gabriele lana: testing web applications

132
Testing Web Applications Gabriele Lana www.gabrielelana.it [email protected]

Upload: francesco-fullone

Post on 14-Jan-2015

3.869 views

Category:

Technology


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Gabriele Lana: Testing Web Applications

Testing Web ApplicationsGabriele Lana

[email protected]

Page 2: Gabriele Lana: Testing Web Applications

Debug Sucks

Test Rocks

Page 3: Gabriele Lana: Testing Web Applications

Why Test Automation?

Page 4: Gabriele Lana: Testing Web Applications

Prevent Change

Page 5: Gabriele Lana: Testing Web Applications

Hard To ChangeC

osto

Tempo

Costo x Modifica nel Tempo

Page 6: Gabriele Lana: Testing Web Applications

Always Change

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

Page 7: Gabriele Lana: Testing Web Applications

Reject ChangeC

osto

Tempo

Costo x Modifica Insostenibile

E' impossibile lavorarci!

Rifacciamolo!

Page 8: Gabriele Lana: Testing Web Applications

Automatic Test

What = Test

How = Code

Page 9: Gabriele Lana: Testing Web Applications

Embrace ChangeC

osto

Tempo

Page 10: Gabriele Lana: Testing Web Applications

Embrace Change=

Sostenibilità

Page 11: Gabriele Lana: Testing Web Applications

Bug Fixing

Page 12: Gabriele Lana: Testing Web Applications
Page 13: Gabriele Lana: Testing Web Applications

Bug FixC

osto

#Bugs

Page 14: Gabriele Lana: Testing Web Applications

#Bugs?C

osto

#Bugs

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

Page 15: Gabriele Lana: Testing Web Applications

How Hard To Fix?

Page 16: Gabriele Lana: Testing Web Applications

How Hard To Fix?C

osto

#Bugs

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

Page 17: Gabriele Lana: Testing Web Applications

Bug Repellent

Page 18: Gabriele Lana: Testing Web Applications

Automatic TestC

osto

Lines Of Code

Page 19: Gabriele Lana: Testing Web Applications

Automatic TestC

osto

Lines Of Code

Page 20: Gabriele Lana: Testing Web Applications

Defect Prevention=

Prevedibilità

Page 21: Gabriele Lana: Testing Web Applications

Defect != Bug

Page 22: Gabriele Lana: Testing Web Applications

Planning

Page 23: Gabriele Lana: Testing Web Applications
Page 24: Gabriele Lana: Testing Web Applications

Feedback

Page 25: Gabriele Lana: Testing Web Applications

Sensing Code(Unit Tests)

Page 26: Gabriele Lana: Testing Web Applications

Sensing Architecture(Functional Tests)

Page 27: Gabriele Lana: Testing Web Applications

Sensing Product(Acceptance Tests)

Page 28: Gabriele Lana: Testing Web Applications

Do

SenseLearn

Page 29: Gabriele Lana: Testing Web Applications

Feedback=

Governabilità

Page 30: Gabriele Lana: Testing Web Applications

Automatic Tests=>

SostenibilitàPrevedibilitàGovernabilità

Page 31: Gabriele Lana: Testing Web Applications

Test AutomationLifecycle

Page 32: Gabriele Lana: Testing Web Applications

FixtureAll the things we need

to have in place inorder to run a test

and expect a particularoutcome

Page 33: Gabriele Lana: Testing Web Applications

1: Fixture SetUp

Fixture SetUpFixture

Page 34: Gabriele Lana: Testing Web Applications

SUTThe “System Under Test”,

whatever thing we aretesting

Page 35: Gabriele Lana: Testing Web Applications

2: Exercise SUT

Fixture SetUp

Exercise SUT

Fixture

SUT

Page 36: Gabriele Lana: Testing Web Applications

3: Verify Result

Fixture SetUp

Exercise SUT

Verify Result

Fixture

SUT

Page 37: Gabriele Lana: Testing Web Applications
Page 38: Gabriele Lana: Testing Web Applications

4: Fixture TearDown

Fixture SetUp

Exercise SUT

Verify Result

Fixture TearDown

Fixture

SUT

Page 39: Gabriele Lana: Testing Web Applications

Test AutomationIdentity

Page 40: Gabriele Lana: Testing Web Applications

Tools

Page 41: Gabriele Lana: Testing Web Applications

Who?

What?

Why?

Page 42: Gabriele Lana: Testing Web Applications

Who?

A chi da valore?

Chi lo scrive?

Chi lo legge?

Page 43: Gabriele Lana: Testing Web Applications

What?

Quali sono le condizioni?Qual'è il SUT?

Page 44: Gabriele Lana: Testing Web Applications

Why?

Cosa voglio verificare?

Qual'è lo scopo?

Quali informazioni

voglio avere?

Page 45: Gabriele Lana: Testing Web Applications

Unit Tests

Page 46: Gabriele Lana: Testing Web Applications

Who?

Developers

Page 47: Gabriele Lana: Testing Web Applications

What?

Unit Of Code

Page 48: Gabriele Lana: Testing Web Applications

Why?

Verify Code Behaviour,Code Documentation

Page 49: Gabriele Lana: Testing Web Applications

Unit Test

Unit

Test

•Function•Method•Procedure•...

Page 50: Gabriele Lana: Testing Web Applications

Unit Test

Unit

Test

X

•Database•File System•Configuration•OS

Page 51: Gabriele Lana: Testing Web Applications

Unit Test

Unit

Test

XXNetwork

Page 52: Gabriele Lana: Testing Web Applications

Unit Test

Unit

Test

Unit

XXX

Page 53: Gabriele Lana: Testing Web Applications

Tools

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

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

Page 54: Gabriele Lana: Testing Web Applications
Page 55: Gabriele Lana: Testing Web Applications

1: Fixture SetUp

Page 56: Gabriele Lana: Testing Web Applications

2: Exercise SUT

Page 57: Gabriele Lana: Testing Web Applications

3: Verify Result

Page 58: Gabriele Lana: Testing Web Applications

4: Fixture TearDown

Page 59: Gabriele Lana: Testing Web Applications
Page 60: Gabriele Lana: Testing Web Applications

If total() < 100 then no discount

If daysUntilLastSelling() > 30then no discount

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

then discount

Page 61: Gabriele Lana: Testing Web Applications

New Requirement

Page 62: Gabriele Lana: Testing Web Applications

If total() < 100 then no discount

If daysUntilLastSelling() > 30then no discount

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

then discount

Page 63: Gabriele Lana: Testing Web Applications

Embrace Change?

Page 64: Gabriele Lana: Testing Web Applications

Test BehaviourNot Code

Page 65: Gabriele Lana: Testing Web Applications

If total() < 100 then no discount

If daysUntilLastSelling() > 30then no discount

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

then discount

Page 66: Gabriele Lana: Testing Web Applications
Page 67: Gabriele Lana: Testing Web Applications

If total() < 100 then no discount

If daysUntilLastSelling() > 30then no discount

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

then discount

Page 68: Gabriele Lana: Testing Web Applications
Page 69: Gabriele Lana: Testing Web Applications

If total() < 100 then no discount

If daysUntilLastSelling() > 30then no discount

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

then discount

Page 70: Gabriele Lana: Testing Web Applications

Why?

Test Driven Development =

Code Design

Page 71: Gabriele Lana: Testing Web Applications

Code Coverage

Page 72: Gabriele Lana: Testing Web Applications

IntegrationTests

Page 73: Gabriele Lana: Testing Web Applications

Who?

Developers

Page 74: Gabriele Lana: Testing Web Applications

What?

Units Of Code

Page 75: Gabriele Lana: Testing Web Applications

Why?

Verify Code Behaviour,Code Documentation,

Code Design

Page 76: Gabriele Lana: Testing Web Applications

DatabaseTests

Page 77: Gabriele Lana: Testing Web Applications

Who?

Developers, DBA

Page 78: Gabriele Lana: Testing Web Applications

What?

Stored Procedure,Complex Query,Data Migration

Page 79: Gabriele Lana: Testing Web Applications

Why?

Wrong data issource of bugs!

Page 80: Gabriele Lana: Testing Web Applications

FunctionalTests

Page 81: Gabriele Lana: Testing Web Applications

Who?

Developers,Customer

Page 82: Gabriele Lana: Testing Web Applications

What?

Application

Page 83: Gabriele Lana: Testing Web Applications

Why?

Verify Application Behaviour,

Application Design

Page 84: Gabriele Lana: Testing Web Applications

What?

HTTPHTTP

Page 85: Gabriele Lana: Testing Web Applications

Tools

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

Page 86: Gabriele Lana: Testing Web Applications
Page 87: Gabriele Lana: Testing Web Applications
Page 88: Gabriele Lana: Testing Web Applications
Page 89: Gabriele Lana: Testing Web Applications
Page 90: Gabriele Lana: Testing Web Applications
Page 91: Gabriele Lana: Testing Web Applications
Page 92: Gabriele Lana: Testing Web Applications
Page 93: Gabriele Lana: Testing Web Applications
Page 94: Gabriele Lana: Testing Web Applications

What?

HTTPHTTP

Page 95: Gabriele Lana: Testing Web Applications

What?

PresentationVs

Business Logic

Page 96: Gabriele Lana: Testing Web Applications

AcceptanceTests

Page 97: Gabriele Lana: Testing Web Applications

Who?

Customer

Page 98: Gabriele Lana: Testing Web Applications

What?

Application

Page 99: Gabriele Lana: Testing Web Applications

Why?

Product Design,Product Specification

Page 100: Gabriele Lana: Testing Web Applications

Tools

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

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

Page 101: Gabriele Lana: Testing Web Applications
Page 102: Gabriele Lana: Testing Web Applications
Page 103: Gabriele Lana: Testing Web Applications
Page 104: Gabriele Lana: Testing Web Applications
Page 105: Gabriele Lana: Testing Web Applications
Page 106: Gabriele Lana: Testing Web Applications
Page 107: Gabriele Lana: Testing Web Applications

ContinuousIntegration

Page 108: Gabriele Lana: Testing Web Applications

Where?When?

RunAutomatic Tests

Page 109: Gabriele Lana: Testing Web Applications
Page 110: Gabriele Lana: Testing Web Applications

Unit Tests, Integration Tests,Database Tests, Acceptance Tests

When?/Where?

Page 111: Gabriele Lana: Testing Web Applications
Page 112: Gabriele Lana: Testing Web Applications
Page 113: Gabriele Lana: Testing Web Applications

When?/Where?

(All Previous) + Smoke Tests

Page 114: Gabriele Lana: Testing Web Applications
Page 115: Gabriele Lana: Testing Web Applications

When?/Where?

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

Page 116: Gabriele Lana: Testing Web Applications

Test AutomationGenesis

Page 117: Gabriele Lana: Testing Web Applications

Risk Analysis

Page 118: Gabriele Lana: Testing Web Applications

Business Facing

Technology FacingSupp

ort P

rogr

amm

ing

Supp

ort P

rodu

ct

Brian Marick Cathegories

Page 119: Gabriele Lana: Testing Web Applications

Business Facing

Technology FacingSupp

ort P

rogr

amm

ing

Supp

ort P

rodu

ct

Brian Marick Cathegories

UnitTests

Page 120: Gabriele Lana: Testing Web Applications

Business Facing

Technology FacingSupp

ort P

rogr

amm

ing

Supp

ort P

rodu

ct

Brian Marick Cathegories

UnitTests

AcceptanceTests

Page 121: Gabriele Lana: Testing Web Applications

Business Facing

Technology FacingSupp

ort P

rogr

amm

ing

Supp

ort P

rodu

ct

Brian Marick Cathegories

UnitTests

AcceptanceTests

Load/Security

Tests

Page 122: Gabriele Lana: Testing Web Applications

Business Facing

Technology FacingSupp

ort P

rogr

amm

ing

Supp

ort P

rodu

ct

Automatic

UnitTests

AcceptanceTests

Load/Security/

Tests

Usability/Exploratory

Tests

Page 123: Gabriele Lana: Testing Web Applications

All Tests shouldbe Automatic?

Page 124: Gabriele Lana: Testing Web Applications

Business Facing

Technology FacingSupp

ort P

rogr

amm

ing

Supp

ort P

rodu

ct

Manual

UnitTests

AcceptanceTests

Load/Security/

Tests

Usability/Exploratory

Tests

Page 125: Gabriele Lana: Testing Web Applications

Manual TestsDrive

Automatic Tests

Page 126: Gabriele Lana: Testing Web Applications

Test Automation

Page 127: Gabriele Lana: Testing Web Applications

Pay Attention

toTest

Automation

Page 128: Gabriele Lana: Testing Web Applications

“An imperfecttest today

is better thana perfect

test someday”

Page 129: Gabriele Lana: Testing Web Applications

Test Automation =Process Improvement

Page 130: Gabriele Lana: Testing Web Applications

Debug Sucks

Test Rocks

Page 131: Gabriele Lana: Testing Web Applications
Page 132: Gabriele Lana: Testing Web Applications

Testing Web ApplicationsGabriele Lana

[email protected]