Pages

Men

rh

7/13/2012

Unit Testing

Unit Testing : 
The testing of individual software components.

Individual testing of separate units - methods and classes.
Write many short tests (in code) that span the extents of the requirements for the module you wish to test. Write tests before you write the code. You are done coding once your code can pass all the tests.
 
Benefits of Unit Testing
Assurance of working components before integration
 
Tests are repeatable - Every time you change something you can rerun your suite of tests to verify that the unit still works.
Tests can be designed to ensure that the code fulfills the requirements.
All debugging is separated from the code.
 
Pre-requisites
Before component testing may begin the component test strategy (2.1.1) and project component
test plan (2.1.2) shall be specified.

Component test strategy
The component test strategy shall specify the techniques to be employed in the design of test
cases and the rationale for their choice. Selection of techniques shall be according to clause 3. If
techniques not described explicitly in this clause are used they shall comply with the 'Other
Testing Techniques' clause (3.13).
 
The component test strategy shall specify criteria for test completion and the rationale for their
choice. These test completion criteria should be test coverage levels whose measurement shall
be achieved by using the test measurement techniques defined in clause 4. If measures not
described explicitly in this clause are used they shall comply with the 'Other Test Measurement
Techniques' clause (4.13).
 
The component test strategy shall document the degree of independence required of personnel
designing test cases from the design process, such as:

a) the test cases are designed by the person(s) who writes the component under test;
b) the test cases are designed by another person(s);
c) the test cases are designed by a person(s) from a different section;
d) the test cases are designed by a person(s) from a different organisation;
e) the test cases are not chosen by a person.

The component test strategy shall document whether the component testing is carried out using
isolation, bottom-up or top-down approaches, or some mixture of these.

The component test strategy shall document the environment in which component tests will be
executed. This shall include a description of the hardware and software environment in which all
component tests will be run.

The component test strategy shall document the test process that shall be used for component
testing.

The test process documentation shall define the testing activities to be performed and the inputs
and outputs of each activity.
 
For any given test case, the test process documentation shall require that the following activities
occur in the following sequence:
 
a) Component Test Planning;
b) Component Test Specification;
c) Component Test Execution;
d) Component Test Recording;
e) Checking for Component Test Completion.


This Figure illustrates the generic test process described in clause 2.1.1.8. Component Test Planning shall begin the test process and Checking for Component Test Completion shall end it; these activities are carried out for the whole component. Component Test Specification, Component Test Execution, and Component Test Recording may however, on any one iteration, be carried out for a subset of the test cases associated with a component. Later activities for one test case may occur before earlier activities for another. Whenever an error is corrected by making a change or changes to test materials or the component under test, the affected activities shall be repeated.