Introduction of unit test to management
Upcoming SlideShare
Loading in...5

Introduction of unit test to management



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

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



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Introduction of unit test to management Introduction of unit test to management Presentation Transcript

  • Introduction of Unit Test toManagement and BusinessAugust, 2012Wei Li
  • ”To err is human;to forgive, divine.”Alexander Pope
  •  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
  • 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
  • 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
  • Unit Test Is Not QA test Customer/user test
  • Why? What? Write code to test code? No! I don’t have time for it!
  • 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
  •  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
  • 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
  • Benefits of Unit Test – Good Way to Work with Legacy/Existing Code Write unit test to get started understanding legacy code and system
  • 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
  • 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
  • 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
  • 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
  •  Our old friend JUnit is still our best friend– No new wheel was reinvented– De facto tool– Familiarity to most developersUnit Test Practice
  •  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
  •  Unit test coverage – the thorough the betterUnit Test Practice
  •  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
  • 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
  • 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
  • ”To err is developer;to catch early, unittest.”