tdd let the tests be your guide.pptx
DESCRIPTION
How TDD is doneTRANSCRIPT
![Page 1: Tdd let the tests be your guide.pptx](https://reader034.vdocument.in/reader034/viewer/2022042713/545ad987af79594f558b5e50/html5/thumbnails/1.jpg)
Test-Driven Development Let the tests be your guide
![Page 2: Tdd let the tests be your guide.pptx](https://reader034.vdocument.in/reader034/viewer/2022042713/545ad987af79594f558b5e50/html5/thumbnails/2.jpg)
It starts with the test
![Page 3: Tdd let the tests be your guide.pptx](https://reader034.vdocument.in/reader034/viewer/2022042713/545ad987af79594f558b5e50/html5/thumbnails/3.jpg)
Benefits of TDD ¡ All the benefits of unit testing plus … ¡ It becomes hard to create errors in the first place ¡ You almost have to try to create errors
¡ Better matches the business requirements ¡ It does what it is supposed to do ¡ It must because we only write tests that satisfy
requirements ¡ Encourages communication with the business ¡ It eliminates gold plating
![Page 4: Tdd let the tests be your guide.pptx](https://reader034.vdocument.in/reader034/viewer/2022042713/545ad987af79594f558b5e50/html5/thumbnails/4.jpg)
Red, green,
refactor ¡ asdf
![Page 5: Tdd let the tests be your guide.pptx](https://reader034.vdocument.in/reader034/viewer/2022042713/545ad987af79594f558b5e50/html5/thumbnails/5.jpg)
The red phase
![Page 6: Tdd let the tests be your guide.pptx](https://reader034.vdocument.in/reader034/viewer/2022042713/545ad987af79594f558b5e50/html5/thumbnails/6.jpg)
You want to write positive tests and negative tests ¡ Negative tests involve values that are outside
acceptable ranges. ¡ They should fail ¡ You're testing to make sure that they do
¡ Positive tests are ones that should pass
![Page 7: Tdd let the tests be your guide.pptx](https://reader034.vdocument.in/reader034/viewer/2022042713/545ad987af79594f558b5e50/html5/thumbnails/7.jpg)
The green phase
![Page 8: Tdd let the tests be your guide.pptx](https://reader034.vdocument.in/reader034/viewer/2022042713/545ad987af79594f558b5e50/html5/thumbnails/8.jpg)
The refactoring phase
![Page 9: Tdd let the tests be your guide.pptx](https://reader034.vdocument.in/reader034/viewer/2022042713/545ad987af79594f558b5e50/html5/thumbnails/9.jpg)
Once finished you pick up a user story and start again writing a new failing test
![Page 10: Tdd let the tests be your guide.pptx](https://reader034.vdocument.in/reader034/viewer/2022042713/545ad987af79594f558b5e50/html5/thumbnails/10.jpg)
Refactoring example
![Page 11: Tdd let the tests be your guide.pptx](https://reader034.vdocument.in/reader034/viewer/2022042713/545ad987af79594f558b5e50/html5/thumbnails/11.jpg)
Summary ¡ Unit testing is the cornerstone of TDD ¡ TDD = Red, green, refactor ¡ Red = write a failing unit test ¡ Green = make the unit test pass using a naïve
implementation ¡ Refactor = improve the code quality ¡ TDD results in huge benefits like better quality
code that better matches the business requirements, encourages communication and eliminates gold plating