1 / 17

White Box Testing

White Box Testing. David Woo (dxw07u). Contents :. 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

chace
Download Presentation

White Box Testing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. White Box Testing David Woo (dxw07u)

  2. Contents: • 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

  3. White Box Testing • 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

  4. Data Processing • 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

  5. Path Testing • 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”.

  6. Path Testing Cont. • 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?!?!?

  7. Line Coverage – Correctness Tests • 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.

  8. Line Coverage – Correctness Tests Cont.

  9. 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

  10. McCabesCyclomatic Complexity Metrics • 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!

  11. McCabesCyclomatic Complexity Metrics Cont. • 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

  12. Flow Graph

  13. Conclude McCabes Theory • 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.

  14. Software Qualification Testing 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.

  15. Software Reusability 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.

  16. Adv and Disadv – White Box 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

  17. Question Time?

More Related