WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing...
-
Upload
doreen-griffith -
Category
Documents
-
view
215 -
download
2
Transcript of WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing...
![Page 1: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/1.jpg)
WHY BOTHER TO UNIT TEST
Suprinder Pujji
![Page 2: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/2.jpg)
OVERVIEW
What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing Who Should Unit Test A Case Study Conclusion
![Page 3: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/3.jpg)
WHAT IS UNIT TESTING
Lowest level of testing performed - Individual units of software are tested – Example -
– Function or subroutine in structured Programming Language
– Class in an object oriented language– Menu or display in a 4GL
![Page 4: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/4.jpg)
EMPHASIS OF UNIT TESTING
Have to be repeated -
All tests have to be maintained –
![Page 5: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/5.jpg)
BENEFITS OF UNIT TESTING
Test parts of a project without waiting for the other parts to be available,
Achieve parallelism in testing Able to detect and remove defects at a much less
cost compared to other later stages of testing, Simplifies debugging Tests internal conditions that are not easily
reached by external inputs
![Page 6: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/6.jpg)
Popular Misconceptions Prevailing
It consumes too much time Integration Tests will catch all the Bugs
Anyway I’m too good a Programmer to Need Unit
tests It only proves that the code does what the
code does It is not Cost Effective
![Page 7: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/7.jpg)
![Page 8: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/8.jpg)
Who Should do it
Unit Testing focuses on implementation Should be done by Test designers Test Designers should know the System requirements and
design thoroughly. Test Designer should be more experienced Should be independent
![Page 9: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/9.jpg)
WORK FLOW USING TEST CASES
![Page 10: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/10.jpg)
CASE STUDY
Analysis of the Integration Testing and System Testing bugs was done
Found that about 30 % of bugs caught in the final stages could have been caught in the early stages it self.
![Page 11: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/11.jpg)
CASE STUDY
Adopted concept of Static Analysis on unit test cases
15 % reduction in the number of bugs escaping to the final stages of software development.
![Page 12: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/12.jpg)
CASE STUDY
Logical errors contributed to only 8 %.
Found that % of logical defects caught in the static analysis phase increased to about 13 %.
![Page 13: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/13.jpg)
CASE STUDYWithout Using Unit Test Cases
![Page 14: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/14.jpg)
CASE STUDYWith Unit Test Cases
![Page 15: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/15.jpg)
QUESTIONS FOR EVALUATING THE UNIT TESTING FOR ADEQUACY
Have all the statements been exercised by at least one test
Has each conditional statement been exercised at least once each way by the tests
Have all boundary cases been exercised
![Page 16: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/16.jpg)
QUESTIONS FOR EVALUATING THE UNIT TESTING FOR ADEQUACY
Were any design assumptions made about the operation of this unit? Have the tests demonstrated these assumptions
Have the tests exercised the unit over the full range of operational conditions it is expected to address
![Page 17: WHY BOTHER TO UNIT TEST Suprinder Pujji. OVERVIEW What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing.](https://reader036.fdocuments.in/reader036/viewer/2022082816/56649d015503460f949d463a/html5/thumbnails/17.jpg)
CONCLUSION
Unit testing can be very effective and affordable. It will result in reduction of total efforts while simultaneously increasing the quality of the product significantly also reducing in the long-term maintenance cost and the total life cycle cost.