gabriele lana: testing web applications

Post on 14-Jan-2015

3.869 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Testing Web ApplicationsGabriele Lana

www.gabrielelana.itinfo@gabrielelana.it

Debug Sucks

Test Rocks

Why Test Automation?

Prevent Change

Hard To ChangeC

osto

Tempo

Costo x Modifica nel Tempo

Always Change

60%-80% of all softwareis developed after firstrelease to production

Reject ChangeC

osto

Tempo

Costo x Modifica Insostenibile

E' impossibile lavorarci!

Rifacciamolo!

Automatic Test

What = Test

How = Code

Embrace ChangeC

osto

Tempo

Embrace Change=

Sostenibilità

Bug Fixing

Bug FixC

osto

#Bugs

#Bugs?C

osto

#Bugs

Costo Totale =(Numero Bugs)? X(Costo del singolo Bug)

How Hard To Fix?

How Hard To Fix?C

osto

#Bugs

Costo Totale =(Numero Bugs)? X(Costo del singolo Bug)?

Bug Repellent

Automatic TestC

osto

Lines Of Code

Automatic TestC

osto

Lines Of Code

Defect Prevention=

Prevedibilità

Defect != Bug

Planning

Feedback

Sensing Code(Unit Tests)

Sensing Architecture(Functional Tests)

Sensing Product(Acceptance Tests)

Do

SenseLearn

Feedback=

Governabilità

Automatic Tests=>

SostenibilitàPrevedibilitàGovernabilità

Test AutomationLifecycle

FixtureAll the things we need

to have in place inorder to run a test

and expect a particularoutcome

1: Fixture SetUp

Fixture SetUpFixture

SUTThe “System Under Test”,

whatever thing we aretesting

2: Exercise SUT

Fixture SetUp

Exercise SUT

Fixture

SUT

3: Verify Result

Fixture SetUp

Exercise SUT

Verify Result

Fixture

SUT

4: Fixture TearDown

Fixture SetUp

Exercise SUT

Verify Result

Fixture TearDown

Fixture

SUT

Test AutomationIdentity

Tools

Who?

What?

Why?

Who?

A chi da valore?

Chi lo scrive?

Chi lo legge?

What?

Quali sono le condizioni?Qual'è il SUT?

Why?

Cosa voglio verificare?

Qual'è lo scopo?

Quali informazioni

voglio avere?

Unit Tests

Who?

Developers

What?

Unit Of Code

Why?

Verify Code Behaviour,Code Documentation

Unit Test

Unit

Test

•Function•Method•Procedure•...

Unit Test

Unit

Test

X

•Database•File System•Configuration•OS

Unit Test

Unit

Test

XXNetwork

Unit Test

Unit

Test

Unit

XXX

Tools

Simple Test(http://www.lastcraft.com/simple_test.php)

PHPUnit(http://www.phpunit.de)

1: Fixture SetUp

2: Exercise SUT

3: Verify Result

4: Fixture TearDown

If total() < 100 then no discount

If daysUntilLastSelling() > 30then no discount

If daysUntilLastSelling() < 30and total() > 100

then discount

New Requirement

If total() < 100 then no discount

If daysUntilLastSelling() > 30then no discount

If daysUntilLastSelling() < 30and total() > 100

then discount

Embrace Change?

Test BehaviourNot Code

If total() < 100 then no discount

If daysUntilLastSelling() > 30then no discount

If daysUntilLastSelling() < 30and total() > 100

then discount

If total() < 100 then no discount

If daysUntilLastSelling() > 30then no discount

If daysUntilLastSelling() < 30and total() > 100

then discount

If total() < 100 then no discount

If daysUntilLastSelling() > 30then no discount

If daysUntilLastSelling() < 30and total() > 100

then discount

Why?

Test Driven Development =

Code Design

Code Coverage

IntegrationTests

Who?

Developers

What?

Units Of Code

Why?

Verify Code Behaviour,Code Documentation,

Code Design

DatabaseTests

Who?

Developers, DBA

What?

Stored Procedure,Complex Query,Data Migration

Why?

Wrong data issource of bugs!

FunctionalTests

Who?

Developers,Customer

What?

Application

Why?

Verify Application Behaviour,

Application Design

What?

HTTPHTTP

Tools

Selenium(http://www.openqa.org/selenium)

What?

HTTPHTTP

What?

PresentationVs

Business Logic

AcceptanceTests

Who?

Customer

What?

Application

Why?

Product Design,Product Specification

Tools

Fit/Fitness/PHPFit(http://fit.c2.com/)

(http://fitnesse.org/)(http://phpfit.berlios.de/)

ContinuousIntegration

Where?When?

RunAutomatic Tests

Unit Tests, Integration Tests,Database Tests, Acceptance Tests

When?/Where?

When?/Where?

(All Previous) + Smoke Tests

When?/Where?

(All Previous) + Load/Performance/Security Tests +Migration/Installation/Configuration Tests

Test AutomationGenesis

Risk Analysis

Business Facing

Technology FacingSupp

ort P

rogr

amm

ing

Supp

ort P

rodu

ct

Brian Marick Cathegories

Business Facing

Technology FacingSupp

ort P

rogr

amm

ing

Supp

ort P

rodu

ct

Brian Marick Cathegories

UnitTests

Business Facing

Technology FacingSupp

ort P

rogr

amm

ing

Supp

ort P

rodu

ct

Brian Marick Cathegories

UnitTests

AcceptanceTests

Business Facing

Technology FacingSupp

ort P

rogr

amm

ing

Supp

ort P

rodu

ct

Brian Marick Cathegories

UnitTests

AcceptanceTests

Load/Security

Tests

Business Facing

Technology FacingSupp

ort P

rogr

amm

ing

Supp

ort P

rodu

ct

Automatic

UnitTests

AcceptanceTests

Load/Security/

Tests

Usability/Exploratory

Tests

All Tests shouldbe Automatic?

Business Facing

Technology FacingSupp

ort P

rogr

amm

ing

Supp

ort P

rodu

ct

Manual

UnitTests

AcceptanceTests

Load/Security/

Tests

Usability/Exploratory

Tests

Manual TestsDrive

Automatic Tests

Test Automation

Pay Attention

toTest

Automation

“An imperfecttest today

is better thana perfect

test someday”

Test Automation =Process Improvement

Debug Sucks

Test Rocks

Testing Web ApplicationsGabriele Lana

www.gabrielelana.itinfo@gabrielelana.it

top related