Unit Testing: Unit is testable piece of s/w that can be build and executed under the control a test driver or Testing individual s/w component.
Unit Testing focuses on the smallest unit of software design or module.
# Unit Test Environment:-
1. Driver: It is just like main program that accepts case, data and prints the relevant results
A test driver simulates a calling component or external environment.
2. Stubs: - It is just like a dummy subprogram that returns control to the module undergoing testing.
A test stub simulates a called component.
The unit test heavily uses white box testing and the testing can be conducted in parallel for multiple components.
3. It is usually done by the developer.
# Activities in Unit Testing:-
1. Develop unit test plan
2. Design unit test case
3. Develop unit test case
4. Execute unit test case
# Unit test conditions:
-Interface
-Local data structure
-Boundary conditions
-Basis path
-Error handling paths.
# Unit Test Techniques: -
# White box Testing:-
-Basis path testing
-Loop Testing
-Condition Testing
-Data definition and use testing
-Internal boundary value testing
# Black box Testing:-
-Specification derived tests
-Equivalence portioning
-State transition testing
# Common errors uncovered during unit testing.
-Incorrect arithmetic precedence
-Incorrect precision
-Incorrect symbolic representation etc.
# Major benefits of unit testing:
-Be able to detect and remove defects at a much less cost compared to other later stages of testing.
-Simplifies debugging.
-Able to achieve a high level of structural coverage of code.
# Why unit Test:-
-Nobody is perfect.
-Bug in development tools.
-Certain bugs easier to find in unit testing.
-To localize defects
What is a unit?
In conventional structured programming language like C, Pascal
Unit:- Function, Procedure or subroutine.
In Object oriented language like JAVA and C++
Unit: Class
In ADA Unit could be Package or Procedures.
In 4GLS, Unit could be a display window, menu etc.
# Misconceptions of Unit Testing:-
-It is waste of time.
-Only proves that code does what the code does
-I am too good a programmer to need unit tests.
-Integration tests will catch all bugs any way.
-It is not cost effective.
# Develop unit Test Plan:-
-Entry criteria:-
An approved detailed design (Program specs) is available
-Validation:-
Unit test Plan (UTP) is reviewed
-Exit Criteria:-
UTP is reviewed and approved.
# Design Unit Test Cases:-
-Entry Criteria: -
-UTP is available
-An approved detailed design is available
Validation:-
-Design of unit test cases is reviewed.
Exit Criteria
-Unit Test cases design is reviewed and approved.
# Develop unit test cases
-Entry Criteria: Design of unit test cases is available
-Validation: - unit test cases are reviewed
-Exit Criteria:- Unit test cases are reviewed and approved.
# Execute unit test cases:-
Entry criteria :- Approved unit test cases are available and Inspected code is available
Validation: Defect report reviewed.
Exit Criteria: - Test items passed the unit testing as per pass/fail criteria in the UTP
Unit testing summary details are available in the defect report
# Test Design
-Test strategy
-Test Planning
-Test Specification
-Test Procedure
# Test Specification:
-Test objective
-Initial stage of the unit
-Input
-Expected output
# UNIT Test Steps:-
-Make it run
-Positive Testing
-Negative Testing
-Special consideration
-Coverage Tests.
Unit Test Plan Template
Unit id: Prepared by
Unit Name Prepared on
Testing By Testing on
Tuesday, April 5, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment