1 / 17

WHY BOTHER TO UNIT TEST

WHY BOTHER TO UNIT TEST. Suprinder Pujji. OVERVIEW. What is Unit testing Emphasis of Unit testing Benefits of Unit Testing Popular Misconceptions Prevailing Who Should Unit Test A Case Study Conclusion. WHAT IS UNIT TESTING. Lowest level of testing performed -

yelena
Download Presentation

WHY BOTHER TO UNIT TEST

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WHY BOTHER TO UNIT TEST Suprinder Pujji

  2. OVERVIEW • What is Unit testing • Emphasis of Unit testing • Benefits of Unit Testing • Popular Misconceptions Prevailing • Who Should Unit Test • A Case Study • Conclusion

  3. 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

  4. EMPHASIS OF UNIT TESTING • Have to be repeated - • All tests have to be maintained –

  5. 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

  6. 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

  7. 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

  8. WORK FLOW USING TEST CASES

  9. 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.

  10. 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.

  11. CASE STUDY • Logical errors contributed to only 8 %. • Found that % of logical defects caught in the static analysis phase increased to about 13 %.

  12. CASE STUDYWithout Using Unit Test Cases

  13. CASE STUDYWith Unit Test Cases

  14. 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

  15. 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

  16. 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.

More Related