White Box Testing
David Woo (dxw07u)
 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:
 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
 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
 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
 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.
 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
Line Coverage – Correctness
Tests Cont.
 Complete Full Path Coverage
 1= 1-2-3-5-6-8-9-11-12-17
 2= 1-2-3-5-6-8-9-13-14-15-17
 3= 1-2-3-5-6-8-9-11-13-14-16
 4= 1-2-3-5-6-8-10-11-17
 …
 13= 1-2-4-5-6-8-9-11-12-17
 14= 1-2-4-5-6-8-9-13-14-15-17
 …
 23= 1-2-4-5-7-8-10-11-13-14-15-17
 24= 1-2-4-5-7-8-10-11-13-14-16-17
Line Coverage – Correctness
Tests Cont.
 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
 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.
Flow Graph
 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
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
 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
 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
Question Time?

Qat09 presentations dxw07u

  • 1.
  • 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 aprocedure 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 Testingwhen 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 majorproblem 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 fewertests 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
  • 8.
    Line Coverage –Correctness Tests Cont.
  • 9.
     Complete FullPath Coverage  1= 1-2-3-5-6-8-9-11-12-17  2= 1-2-3-5-6-8-9-13-14-15-17  3= 1-2-3-5-6-8-9-11-13-14-16  4= 1-2-3-5-6-8-10-11-17  …  13= 1-2-4-5-6-8-9-11-12-17  14= 1-2-4-5-6-8-9-13-14-15-17  …  23= 1-2-4-5-7-8-10-11-13-14-15-17  24= 1-2-4-5-7-8-10-11-13-14-16-17 Line Coverage – Correctness Tests Cont.
  • 10.
     Measures thecomplexity 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.
  • 12.
  • 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 ofprocedure 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 procedureis 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  Enforcesthe 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
  • 17.

Editor's Notes

  • #4 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.