value of unit testing
DESCRIPTION
Unit testing is an essential part of software design and development. But somehow it is considered as testing and its value is not known to majority of the software teams. This presentation tries to show the value of unit testing.TRANSCRIPT
![Page 1: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/1.jpg)
Unit Testing
Ferose Khan J
![Page 2: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/2.jpg)
What is Unit Testing?
User Acceptance Testing
Integration Testing
Unit Testing
![Page 3: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/3.jpg)
Reality Check
![Page 4: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/4.jpg)
Unit testing is HARD
![Page 5: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/5.jpg)
Developers only write production code
![Page 6: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/6.jpg)
Never attempt UT for my code
![Page 7: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/7.jpg)
Why do unit testing?
• Refactor with peace of mind• Know when coding is done• Understand the design• Living documentation of the code• Feel good on seeing those green dots
![Page 8: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/8.jpg)
Steps
• Setup• Create input • Call the method • Verify output• Teardown
![Page 9: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/9.jpg)
Testing Scope
• Test behavior instead of methods• Test one layer at a time
![Page 10: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/10.jpg)
Do’s
• Runs Fast• Fully automated • Can be executed in any order• Produce consistent result • Produce atomic result• Write informative message
![Page 11: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/11.jpg)
Don’ts
• Conditional coding in tests• Catch unexpected exceptions in tests• Loops inside tests• Testing related logic in production
code
![Page 12: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/12.jpg)
Questions?Questions?
![Page 13: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/13.jpg)
Conversation master programmer & pupil:
Pupil: “When can I stop writing tests?” Master:“When you stop writing code.” Pupil:“When do I stop writing code?” Master:“When you become a manager.” (The pupil trembled)Pupil: “When do I become a manager?” Master: “When you stop writing tests.” The pupil rushed to write some tests. He left skid marks.
![Page 14: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/14.jpg)
“Unit testing is part of the design process and not part of testing process”
![Page 15: Value of Unit Testing](https://reader033.vdocuments.us/reader033/viewer/2022060110/5561818ad8b42ade208b5684/html5/thumbnails/15.jpg)
THANKSTHANKS