20
For Testers Sarah & Dewald Usher Viljoen

TDD for Testers

Embed Size (px)

Citation preview

For Testers

Sarah & DewaldUsher Viljoen

’ ?

Input Process

ActualOutput

ExpectedOutput

2

2

3

Write Test

Refactor

Write code

3

2

3

Write Test

Refactor

Write code

4

Write Test

Refactor

See test fail

See test pass

2

3

Write code

5

6

7

58

APIExternalAPI

ExternalAPIPrivate int CreditRatingAlgorithm (double AmountOwned, double PaymentHistoryScore, double CreditHistoryScore){return (AmountOwed + PaymentHistoryScore + CreditHistoryScore) / 3 * 100} 8

58

APIExternalAPI

ExternalAPIPrivate int CreditRatingAlgorithm (double AmountOwned, double PaymentHistoryScore, double CreditHistoryScore){return (AmountOwed + PaymentHistoryScore + CreditHistoryScore) / 3 * 100}

U

I I

I

I

9

58

APIExternalAPI

ExternalAPIPrivate int CreditRatingAlgorithm …U

I I

I

I

Acceptance Test - Scenario10

Source Control

Production Build

Unit Tests

Integration Tests

Acceptance Tests

Check out and Build

Run Tests

11

SC PB U I

A

Passes Tests

-12

Test-Driven-/

DesignInterface designs are

13

’ ?

- Write the test code with a specific intent- Write the production code

14

15

’- Help decide on the intent- Think edge cases which could affect the

design- Pairing with the developer

- Understand what the program is trying to do

- Spot any cases missed by the developer- Understand how a design change may

affect tests 16

- Test, Code, Refactor- Testing is the QA and Dev collaboration point.- QAs can help design better intentions, spot

flaws and edge cases that have been missed.- QAs can better understand how design

changes can affect tests down the (pipe)line.

TDD is a DESIGN tool. Is does not replace the testing work that is required in a project.

17

18

*http://programmers.stackexchange.com/questions/258311/if-we-have-tdd-and-bdd-why-do-we-need-qa-for

http://agiledata.org/essays/tdd.html

http://www.ministryoftesting.com/2014/08/tdd-testers/

http://blog.drorhelper.com/2010/05/why-tdd-is-good-for-testers.html 19

Code sample.

20