2. What is “White Box Testing”
Data Processing and Calculation Correctness Tests
Correctness Tests:
Path Coverage
Line Coverage
McCabe’s Cyclomatic complexity Metrics
Software Qualification and Reusability Testing
Advantages and Disadvantages
Contents:
3. IEEE Definition “Testing that takes into account the internal
mechanism of a system component”.
Examines internal Calculation paths in order identify bugs.
Software Quality Assurance tool used to enforce the Quality of
the software.
Enables Performance:
◦ Data Processing
◦ Calculation correctness tests.
◦ Software Qualification Tests
◦ Maintainability Tests
◦ Re-usability Tests
White Box Testing
4. Is a procedure based on checking the data processing for each test case.
An Immediate Issue becomes apparent:
●
Coverage
◦ Number of possible processing paths
◦ Multitude of lines of code
Two possible solutions
“Path Coverage” to plan our test to cover all the possible paths, where coverage is
measured by a percentage of paths covered.
“Line Coverage” to plan our tests to cover all the program code lines, where coverage
is measured by percentage of lines covered
Data Processing
5. Path Testing when used is based upon achieving
“complete” path coverage.
This involves following all of the possible paths in a
module.
Different paths in a software module are created by the
choice in conditional statements.
The main reason for working as a percentage to find
out how much of the testing has been completed.
However when looking at the amount of resources
needed it becomes very “impractical”.
Path Testing
6. Another major problem that is addresses is “the cost” an example of this can
be shown below.
Modules = 5 conditional statements
◦ Each with only 2 options (IF-THEN-ELSE)
EQUALS = 512 different paths (25 – 50 lines of code)
Achieve “Complete Path Coverage”
●
512 test cases should be prepared
Modules = 50 conditional statements
Equals = 51,200 different paths (25 – 50 lines of code)
Achieve “Complete Path Coverage”
●
51,200 test cases should be prepared
Realistic?!?!?
Path Testing Cont.
7. Far fewer tests cases – resulting in a great of paths
untested.
To achieve full line coverage, every line of code is to be
executed at least once during the testing process.
Car Insurance Scenario
In the flow diagram:
◦ Diamonds Represent: a logical condition or predicate.
◦ Rectantgle Represents: a sequence of processing steps that are
executed unconditionally.
◦ Head of Arrow: Indicates the flow of control
◦ Circ le – End of transition.
Line Coverage – Correctness
Tests
10. Measures the complexity of a program or module.
Addition to this it also measures the “maximum
number of independent paths needed to successfully
achieve full line coverage”
Calculates this through a formulae to work out the
independent paths needed.
This type of method works off the characteristics of a
flow graph. Our example will give us a better
understanding of how McCabes theories work!
McCabes Cyclomatic Complexity
Metrics
11. The formulae:
V(G) = R
V (G) = E –N + 2
V(G) = P + 1
R = The number of regions that is involved in the
program flow graph. (Any enclosed area)
E = The number of edges
N = The number of nodes
P = The number of decisions
McCabes Cyclomatic Complexity
Metrics Cont.
13. The formulae:
V(G) = R
V (G) = E –N + 2
V(G) = P + 1
Our Example
V(G) = 6
V(G) = 21 -17 + 2 = 6
V(G) = 5 + 1 = 6
Resulting metrics calculations indicate that the maximum number of independent paths is 6.
Summary
Programs with cyclomatic complexities of less then 5 are simple and easy to understand
20+ The complexity is perceived as high.
50+ the software for practical purposes becomes unpractical.
Conclude McCabes Theory
14. This type of procedure is very crucial and is just important as the rest.
Main objective is to check whether the software program qualifies (coding
and documentation) to the correct standards.
This will lead to a more efficient program when:
Team leaders check the software,
Replacement programmers proceed with existing programmers tasks.
Maintenance programmer to fix and update the system.
Software Qualification tests first takes into account whether the software
development responded positively.
Example:
Does the coding style fulfil coding style procedures.
Does the code fulfil the correct standards and structure of the code.
Is the Documentation to the correct standard.
Software Qualification Testing
15. Main procedure is to determine whether the packaging
and documentation of the programs listed for reuse
confirm to the correct standards.
Reduces the project resources requirements and
improves the quality of the new software systems.
This shortens the development period.
Benefits the whole organisation.
Supporting the of growth of software reuse.
Software Reusability Testing
16. Advantages
Enforces the determination of software correctness as explained in the processing paths.
Allows performance of line coverage, it allows the tester to identify the code that has not
yet been executed and test cases can be applied to these lines of code.
It ensures quality of coding work and apply to coding standards.
Disadvantages
As knowledge of code and internal structure is a prerequisite, a skilled tester is needed to
carry out this type of testing, which increases the cost.
And it is nearly impossible to look into every bit of code to find out hidden errors, which
may create problems, resulting in failure of the application
Adv and Disadv – White Box
Testing
Data Processing Calculation correctness tests. (Requires every computational operation in the sequence of operations by each test case must be examined) This is a type of verification that allows whether the processing operations and sequences have been programmed correctly. Software Qualification Tests Focuses on the examination of the software code including comments – Coding standards, work instructions Maintainability Tests Special features installed for detection of causes of failures, modules structures and support software adaptations and software improvements Re-usability Tests Examine the extent of reused software is incorporated, and adaptations performed in order to make the software reusable.