Testing Fundamental
Testing Fundamental
1.2. Test Information Flow Two classes of input are provided to the test process: - a software configuration: Software Requirements Specification, Design Specification, and Source code - a test configuration: Test Plan, Test Procedure and Testing tools
- white box testing - knowing the internal workings of a software product, determine whether the internal operations implementing the functions perform according to the specification, and all internal components have been adequately exercised ; White box testing of software is predicated on a close examination of procedural detail. Logical paths through the software are tested by providing test cases. The status of the program is examined at various points to determine if the expected status corresponds to the actual status.
3. White-Box Testing
White box testing is a test case design method that uses the control structure to derive test cases. Using this method the software engineer can derive test cases that: - guarantee that all independent paths in a module have been exercised at least once - exercise all logical decisions after true and false sides ; - execute all loops at their boundaries and within their operational bounds ; - exercise internal data structures to ensure their validity.
3.1. Basis Paths Basis path testing is a white box testing technique that enable the test designer to derive a logical complexity measure and use it as a guide for defining a basis set of execution paths. Test cases derived to exercise the basis are guaranteed to execute every statement in the program at least one time during testing. The Cyclomatic Complexity metric- McCabe et. al. The cyclomatic complexity is a software metric that provides a quantitative measure of the logical complexity of a program. The value computed for cyclomatic complexity defines the number of independent paths in the basis set of a program and provides the upper bound for the number of tests that must be conducted in order to guarantee that all statements have been executed at least once.
An independent path is any path through the program that introduces at least one new statement or a new condition. In terms of a flow graph, an independent path must move along at least one edge that has not been traversed before. Cyclomatic complexity is computed in one of three ways: - the number of regions of the flow graph correspond to the cyclomatic complexity. - cyclomatic complexity, V( G ), for a flow graph G is defined as: V( G ) = E - N + 2 where E is the number of flow graph edges and N is the number of flow graph nodes.
where P is the number of predicate nodes contained in the flow graph G. The value for V( G ) provides an upper bound on the number of tests that must be designed and executed to guarantee coverage of all program statements. 3.2. Applying Basis Path Testing The basis path testing method can be applied in the following way: - using the source code draw a corresponding flow graph - determine the cyclomatic complexity of the resultant flow graph - determine a basis set of independent paths - prepare test cases that will force execution of each path in the basis set