Introduction of unit test to management

508 views
444 views

Published on

An introduction of unit test and its benefits to business and management

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
508
On SlideShare
0
From Embeds
0
Number of Embeds
13
Actions
Shares
0
Downloads
5
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Introduction of unit test to management

  1. 1. Introduction of Unit Test toManagement and BusinessAugust, 2012Wei Li
  2. 2. ”To err is human;to forgive, divine.”Alexander Pope
  3. 3.  Developer Test– Unit Test– Integration Test– Regression Test QA Test– Integration Test– Regression Test– Performance Test– Stress Test Customer/User Test– Acceptability Test– Usability TestMany Tests in the Life Cycle of Software Development
  4. 4. What is Unit Test Self checking or validation to ensure the code work as expected Developer’s test Part of construction cycle Foundation of all other tests
  5. 5. Where Does Unit Test Fit in Life Cycle? Requirement gathering Business Design Technical Design– Architecture Design– Technical Design Construction– Code and Unit Test QA Test Performance Test User Test
  6. 6. Unit Test Is Not QA test Customer/user test
  7. 7. Why? What? Write code to test code? No! I don’t have time for it!
  8. 8. Benefits of Unit Test – Instant Feedback Unit test provides the earliest opportunity to identify and fix a defect The earlier an error is found, the less expensive it is to fix it Performed before components are integrated together
  9. 9.  Force the developer to write clean and testable code – which leadsto less complexity and better design If your code is hard to be tested, how can it be easily used,maintained and extended?Benefits of Unit Test – Write Testable Code
  10. 10. Benefits of Unit Test – Establish Safety Net in the Lifecycle Can be used as part of regression test suite Provide the green light to refactor old code and make changes
  11. 11. Benefits of Unit Test – Good Way to Work with Legacy/Existing Code Write unit test to get started understanding legacy code and system
  12. 12. Benefits of Unit Test – Excellent Way to Learn New Language and API Write unit test cases to learn and try new API The unit test cases can become reusable knowledge base
  13. 13. Benefits of Unit Test – Excellent Way to Report a Defect Write a unit test case to report a defect or a bug in the system Run the same test to verify the defect is fixed
  14. 14. Benefits of Unit Test - Reusability Write once run forever – reusable and repeatable Save time long term in the life cycle Give new team member a good jump start
  15. 15. Unit Test Practice Planning and estimation - account for the construction timefor unit test Code a little and unit test a little - repeat the cycle until theconstruction is done Part of the code review process Run unit test when trouble shooting issues Run unit test whenever a change is made Run unit test whenever is needed Enjoy the results
  16. 16.  Our old friend JUnit is still our best friend– No new wheel was reinvented– De facto tool– Familiarity to most developersUnit Test Practice
  17. 17.  Use a separate unit test project– Only contain unit test related Java code but test code in other projects– Run locally and not deployed to application server Won’t be part of the deployable to application server– Freedom to write more unit tests– Save time in testing (no build and deployment)Unit Test Practice
  18. 18.  Unit test coverage – the thorough the betterUnit Test Practice
  19. 19.  Just do it and it will become a habit You will find out you actually have time to write unit test code You will find out you actually enjoy doing itUnit Test Practice
  20. 20. Test Driven/Test First Methodology Write a test case for a new functionality Run the test and it fails Write just enough code to make the test pass Run the test and it passes Refactor the code to make it better Repeat the test Repeat the cycle
  21. 21. Continuous Integration Get the latest version of the code from source control system Build/compile the code Run all unit test cases Publish the build and test results Notify the development team for any failure Repeat the process periodically, for example, once every hour
  22. 22. ”To err is developer;to catch early, unittest.”

×