Published on

blackbox and whitebox testing..

Published in: Technology, Education
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Prepared by : 1.Mohammed Siddig Ahmed. 2.Mohammed Zeinelabdeen. 3.Omer Salih Dawood.
  2. 2. <ul><li>Introduction to Testing. </li></ul><ul><li>Verification and validation. </li></ul><ul><li>Black & White-box testing. </li></ul><ul><li>Types of testing that involve both black & white-box techniques. </li></ul><ul><li>Strategies for writing test cases. </li></ul><ul><li>Using a template for writing repeatable, defined test cases. </li></ul>
  3. 3. <ul><li>Software testing is the process of analyzing a software item to detect the differences between existing and required conditions (that is, bugs) and to evaluate the features of the software item. </li></ul><ul><li>Software testing is an activity that should be done throughout the whole development process . </li></ul><ul><li>Software testing is one of the V&V, software practices. </li></ul>
  4. 4. <ul><li>Verification is the process of evaluating a system or component to determine whether the products of a given development phase satisfy the conditions imposed at the start of that phase. </li></ul><ul><li>Validation is the process of evaluating a system or component during or at the end of the development process to determine whether it satisfies specified requirements. </li></ul><ul><li>Verification: Are we building the product right? </li></ul><ul><li>Validation : Are we building the right product? </li></ul>
  5. 5. <ul><li>Standard or specification to measure or identify correct results from incorrect results must define some terms: </li></ul><ul><ul><ul><li>Mistake . </li></ul></ul></ul><ul><ul><ul><li>Fault [or Defect] . </li></ul></ul></ul><ul><ul><ul><li>Failure . </li></ul></ul></ul><ul><ul><ul><li>Error . </li></ul></ul></ul><ul><ul><ul><li>Specification . </li></ul></ul></ul>
  6. 6. <ul><li>In software development, there are costs associated with testing our programs. </li></ul><ul><li>Quality is much more important for safety- or mission critical software e.g. aviation software. </li></ul><ul><li>Goal of testing covering many defects as possible with a little testing. </li></ul>
  7. 7. <ul><li>There are two basic classes of software testing definitions below: </li></ul><ul><ul><ul><li>Black box testing (also called functional testing) is testing that ignores the internal mechanism of a system or component and focuses solely on the outputs generated in response to selected inputs and execution conditions . </li></ul></ul></ul><ul><ul><ul><li>White box testing (also called structural testing and glass box testing) is testing that takes into account the internal mechanism of a system or component . </li></ul></ul></ul>
  8. 8. <ul><li>1. Unit Testing </li></ul><ul><li>Opacity: White box testing. </li></ul><ul><li>Specification: Low-level design and/or code structure. </li></ul><ul><li>( Unit testing is the testing of individual hardware or software units or groups of related units). </li></ul><ul><li>2. Integration testing </li></ul><ul><li>Opacity: Black- and white-box testing. </li></ul><ul><li>Specification: Low- and high-level design. </li></ul><ul><li>( Integration test is testing in which software components, hardware components, or both are combined and tested to evaluate the interaction between them ). </li></ul>
  9. 9. <ul><li>3 . Functional and system testing </li></ul><ul><li>Opacity: Black-box testing </li></ul><ul><li>Specification: high-level design, requirements specification. </li></ul><ul><li>( Functional testing involves ensuring that the functionality specified in the requirement specification works,& System testing is testing conducted on a complete, integrated system to evaluate the system compliance with its specified requirements). </li></ul><ul><ul><ul><li>Stress testing </li></ul></ul></ul><ul><ul><ul><li>Performance testing </li></ul></ul></ul><ul><ul><ul><li>Usability testing </li></ul></ul></ul>
  10. 10. <ul><li>4. Acceptance testing </li></ul><ul><li>Opacity: Black-box testing </li></ul><ul><li>Specification: requirements specification. </li></ul><ul><li>( Acceptance testing is formal testing conducted to determine whether or not a system satisfies its acceptance criteria (the criteria the system must satisfy to be accepted by a customer) and to enable the customer to determine whether or not to accept the system ). </li></ul>
  11. 11. <ul><li>5. Regression testing </li></ul><ul><li>Opacity: Black- and white-box testing </li></ul><ul><li>Specification: Any changed documentation, high-level design </li></ul><ul><li>( Regression testing is selective retesting of a system or component to verify that modifications have not caused unintended effects and that the system or component still complies with its specified Requirements). </li></ul><ul><ul><li>A subset of the regression test cases can be set aside as smoke tests. </li></ul></ul>
  12. 12. <ul><li>6. Beta testing </li></ul><ul><li>Opacity: Black-box testing. </li></ul><ul><li>Specification: None. </li></ul><ul><li>The advantages of beta test: </li></ul><ul><ul><ul><li>Identification of unexpected errors </li></ul></ul></ul><ul><ul><ul><li>A wider population search for errors </li></ul></ul></ul><ul><ul><ul><li>Low costs </li></ul></ul></ul><ul><li>The disadvantages </li></ul><ul><ul><ul><li>Lack of systematic testing </li></ul></ul></ul><ul><ul><ul><li>Low quality error reports </li></ul></ul></ul><ul><ul><ul><li>Much effort is necessary to examine error reports </li></ul></ul></ul>
  13. 13.
  14. 14. <ul><li>( Document describing the scope, approach, resources, and schedule of intended test activities. It identifies test items, the features to be tested, the testing tasks, who will do each task, and any risks requiring contingency plans). </li></ul><ul><li>Test case ( set of test inputs, execution conditions, and expected results developed for a particular objective, such as to exercise a particular program path or to verify compliance with a specific requirement). </li></ul>
  15. 15. <ul><li>The earlier testing is planned at all levels, the better. </li></ul><ul><li>Very important to consider test planning and test execution as iterative processes. </li></ul><ul><li>It is best to begin to write functional and system test cases. </li></ul><ul><li>When requirements change, revise the test cases. </li></ul><ul><li>When code changes, run the test cases again. </li></ul><ul><li>All in all, testing should be considered an iterative and essential part of the entire development process. </li></ul>
  16. 16.
  17. 17.
  18. 18. Black-Box Testing
  19. 19. <ul><li>Called : </li></ul><ul><ul><li>functional testing </li></ul></ul><ul><ul><li>behavioral testing </li></ul></ul><ul><li>focuses on: </li></ul><ul><ul><li>whether or not a program does what it is supposed to do based on its functional requirements. </li></ul></ul>
  20. 20. <ul><li>incorrect or missing functionality. </li></ul><ul><li>interface errors . </li></ul><ul><li>errors in data structures used by interfaces. </li></ul><ul><li>behavior or performance errors. </li></ul><ul><li>initialization and termination errors. </li></ul><ul><li>But : no amount of testing can demonstrate the absence of errors. </li></ul>
  21. 21. <ul><li>blackbox tester is not the programmer of </li></ul><ul><li>the code (it is best). </li></ul><ul><li>Programmer: </li></ul><ul><ul><li>If the program does what they programmed it to do?. </li></ul></ul><ul><li>Needed: </li></ul><ul><ul><li>If The program does what the customer wants it to do?. </li></ul></ul>
  22. 22. <ul><li>Focus on input and output of the software without regard to the internal code of the program </li></ul>
  23. 23. <ul><li>test case a unique identifier. </li></ul><ul><li>describe the set of steps and/or input for the particular condition. </li></ul><ul><li>the expected results for an input/output oracle. </li></ul><ul><li>the actual results. </li></ul>
  24. 24.
  25. 25. <ul><li>Why test Strategies?:- </li></ul><ul><ul><li>test every possible thing (Cost). </li></ul></ul><ul><ul><li>find many defects in few test cases . </li></ul></ul><ul><ul><li>avoid writing redundant test cases. </li></ul></ul><ul><ul><li>design the simplest test cases . </li></ul></ul>
  26. 26. <ul><li>Tests of Customer Requirements. </li></ul><ul><li>Equivalence Partitioning. </li></ul><ul><li>Boundary Value Analysis. </li></ul><ul><li>Decision Table Testing. </li></ul><ul><li>Failure (“Dirty”) Test Cases. </li></ul>
  27. 27. <ul><li>Black box test cases are based on customer requirements </li></ul><ul><li>Have two paths: </li></ul><ul><ul><li>success path. </li></ul></ul><ul><ul><li>failure path. </li></ul></ul><ul><li>risky requirements should tested first. </li></ul>
  28. 28. <ul><li>don’t want to write several test cases that test the same aspect of our program(cost). </li></ul><ul><li>A good test case uncovers a different class of errors. </li></ul><ul><li>Equivalence partitioning is used to reduce the number of test cases . </li></ul><ul><li>divides the input of a program into classes </li></ul>
  29. 29. <ul><li>For each of these classes :- </li></ul><ul><ul><li>the set of data should be treated the same by the module under test . </li></ul></ul><ul><ul><li>And should produce the same answer. </li></ul></ul>
  30. 30.
  31. 31. <ul><li>When creating BVA test cases, consider the following : </li></ul><ul><ul><li>If input conditions have a range from a to b (such as a=100 to b=300), create test cases: </li></ul></ul><ul><ul><li>immediately below a (99) </li></ul></ul><ul><ul><li>at a (100) </li></ul></ul><ul><ul><li>immediately above a (101) </li></ul></ul><ul><ul><li>immediately below b (299) </li></ul></ul><ul><ul><li>at b (300) </li></ul></ul><ul><ul><li>immediately above b (301) </li></ul></ul>
  32. 32. <ul><li>If input conditions specify a number of values that are allowed, test these limits. </li></ul>
  33. 33. <ul><li>record complex business rules that must be implemented in the program, and therefore tested. </li></ul><ul><li>conditions represent possible input. </li></ul><ul><li>actions are the events that should trigger. </li></ul><ul><li>Each column in the table is a unique combination of input conditions that result in triggering the action(s) associated with the rule. </li></ul>
  34. 34.
  35. 35. <ul><li>every possible thing a user could possibly do with your system to demolish the software. </li></ul>
  36. 36. White-Box Testing
  37. 37. <ul><li>White-box testing is a verification technique software engineers can use to examine if their code works as expected. </li></ul><ul><li>White-box testing is testing that takes into account the internal mechanism of a system or </li></ul><ul><li>component . It also known as structural testing, clear box testing, and glass box testing (Beizer, 1995). </li></ul>
  38. 38. <ul><li>types of testing: </li></ul><ul><li>There are six basic types of testing: </li></ul><ul><ul><li>Unit Testing. </li></ul></ul><ul><ul><li>Integration Testing. </li></ul></ul><ul><ul><li>Regression Testing. </li></ul></ul><ul><ul><li>function/system Testing. </li></ul></ul><ul><ul><li>Acceptance Testing. </li></ul></ul><ul><ul><li>Beta Testing. </li></ul></ul><ul><li>White-box testing is used for 1,2,and 3 respectively. </li></ul>
  39. 39. <ul><li>white-box testing techniques : </li></ul><ul><ul><li>White-Box Testing by Stubs and Drivers. </li></ul></ul><ul><ul><li>Deriving Test Cases. </li></ul></ul><ul><ul><li>Control-flow/Coverage Testing. </li></ul></ul><ul><ul><li>Data Flow Testing. </li></ul></ul><ul><ul><li>Failure (“Dirty”) Test Cases. </li></ul></ul><ul><ul><li>Flow Graphs Revisited. </li></ul></ul>
  40. 40. <ul><li>With white-box testing, you must run the code with predetermined input and check to make </li></ul><ul><li>sure that the code produces predetermined outputs. Often programmers write stubs and </li></ul><ul><li>drivers for white-box testing. </li></ul><ul><li>A driver: is a software module used to invoke a module under test and, often, provide test inputs, control and monitor execution, and report test results </li></ul><ul><li>A stub: is a computer program statement substituting for the body of a software module that is or will be defined elsewhere. </li></ul>
  41. 41. <ul><li>A driver: </li></ul><ul><li>movePlayer(Player1, 2); </li></ul><ul><li>A stub: </li></ul><ul><li>public void movePlayer(Player player, int diceValue) </li></ul><ul><li>{ </li></ul><ul><li>player.setPosition(1); </li></ul><ul><li>} </li></ul>
  42. 42. <ul><li>statistics show that the act of careful, complete, systematic test design will catch as many bugs as the act of testing . </li></ul><ul><li>The test design process, at all levels, is at least as effective at catching bugs as is running the test case designed by that process. </li></ul>
  43. 43. <ul><li>Basis Path Testing : </li></ul><ul><li>A testing mechanism proposed by McCabe. </li></ul><ul><li>is a means for ensuring that all independent paths through a code module have been tested. </li></ul><ul><li>An independent path is any path through the code that introduces at least one new set of processing statements or a new condition . </li></ul>
  44. 45. <ul><li>cyclomatic number : </li></ul><ul><li>Number of conditions (diamonds) and add 1. </li></ul><ul><ul><li>1-2-3-4-5-10 (property owned by others, no money for rent) </li></ul></ul><ul><ul><li>1-2-3-4-6-10 (property owned by others, pay rent) </li></ul></ul><ul><ul><li>1-2-3-10 (property owned by the player) </li></ul></ul><ul><ul><li>1-2-7-10 (property available, don’t have enough money) </li></ul></ul><ul><ul><li>1-2-7-8-10 (property available, have money, don’t want to buy it) </li></ul></ul><ul><ul><li>1-2-7-8-9-10 (property available, have money, and buy it) </li></ul></ul>
  45. 46. <ul><li>Equivalence Partitioning/Boundary Value Analysis : </li></ul><ul><li>Equivalence partitioning (EP) and boundary value analysis (BVA) provide a strategy for writing white-box test cases. Undoubtedly, whenever you encounter any kind of number or limit in a requirement, you should be alert for EP/BVA issues. </li></ul><ul><li>then we will check the object by giving boundary values as :min,min-1,min+1,max,max-1,max+1 </li></ul>
  46. 47. <ul><li>Equivalence Partitioning/Boundary Value Analysis : </li></ul><ul><li>1. property costs $100, have $200 (equivalence class “have enough money”). </li></ul><ul><li>2. property costs $100, have $50 (equivalence class, “don’t have enough money”). </li></ul><ul><li>3. property costs $100, have $100 (boundary value). </li></ul><ul><li>4. property costs $100, have $99 (boundary value). </li></ul><ul><li>5. property costs $100, have $101 (boundary value). </li></ul>
  47. 48. <ul><li>Coverage: is a measure of the completeness of the set of test cases </li></ul>
  48. 49. <ul><li>Statement Coverage </li></ul><ul><li>Decision/Branch Coverage </li></ul><ul><li>Condition Coverage </li></ul><ul><li>Decision/Condition Coverage </li></ul><ul><li>Path Coverage </li></ul>
  49. 50. <ul><li>If ((A>1) & (B=0)) then Do; </li></ul><ul><li>X=X/A; </li></ul><ul><li>END; </li></ul><ul><li>If ((A==2) | (X>1)) then Do; </li></ul><ul><li>X=X+1; </li></ul><ul><li>END; </li></ul><ul><li>END; </li></ul>Source: The Art of Software Testing – Glenford Myers
  50. 51. Statement Coverage <ul><li>Exercise all statements at least once </li></ul><ul><li>How many test cases? </li></ul><ul><ul><li>A=2 and B=0 (ace) </li></ul></ul>Source: The Art of Software Testing – Glenford Myers
  51. 52. Decision/Branch Coverage <ul><li>Each decision has a true and a false outcome at least once </li></ul><ul><li>How many test cases? </li></ul><ul><ul><li>A=2 and B=0 (ace) </li></ul></ul><ul><ul><li>A=1 and X=1 (abd) </li></ul></ul>Source: The Art of Software Testing – Glenford Myers
  52. 53. Condition Coverage <ul><li>Each condition in a decision takes on all possible outcomes at least once </li></ul><ul><li>Conditions: A>1, B=0, A=2, X>1 </li></ul><ul><li>How many test cases? </li></ul><ul><ul><li>A=2, B=0, and X=4 (ace) </li></ul></ul><ul><ul><li>A=1, B=1, and X=1 (abd) </li></ul></ul>Source: The Art of Software Testing – Glenford Myers
  53. 54. Decision/Condition Coverage <ul><li>Each condition in a decision takes on all possible outcomes at least once, and each decision takes on all possible outcomes at least once </li></ul><ul><li>How many test cases? </li></ul><ul><ul><li>A=2, B=0, and X=4 (ace) </li></ul></ul><ul><ul><li>A=1, B=1, and X=1 (abd) </li></ul></ul><ul><li>What about these? </li></ul><ul><ul><li>A=1, B=0, and X=3 </li></ul></ul><ul><ul><li>A=2, B=1, and X=1 </li></ul></ul>(abe) (abe)
  54. 55. Multiple Condition Coverage <ul><li>Exercise all possible combinations of condition outcomes in each decision </li></ul><ul><li>Conditions: </li></ul>Source: The Art of Software Testing – Glenford Myers A>1, B=0 A>1, B<>0 A<=1, B=0 A<=1, B<>0 A=2, X>1 A=2, X<=1 A<>2, X>1 A<>2, X<=1
  55. 56. Multiple Condition Coverage <ul><li>How many test cases? </li></ul><ul><ul><li>A=2, B=0, X=4 </li></ul></ul><ul><ul><li>A=2, B=1, X=1 </li></ul></ul><ul><ul><li>A=1, B=0, X=2 </li></ul></ul><ul><ul><li>A=1, B=1, X=1 </li></ul></ul>Source: The Art of Software Testing – Glenford Myers (ace) (abe) (abe) (abd)
  56. 57. Path Coverage <ul><li>Every unique path through the program is executed at least once </li></ul><ul><li>How many test cases? </li></ul><ul><ul><li>A=2, B=0, X=4 (ace) </li></ul></ul><ul><ul><li>A=2, B=1, X=1 (abe) </li></ul></ul><ul><ul><li>A=3, B=0, X=1 (acd) </li></ul></ul><ul><ul><li>A=1, B=1, X=1 (abd) </li></ul></ul>Source: The Art of Software Testing – Glenford Myers
  57. 58. <ul><li>the control flowgraph is annotated with information about how the program variables are defined and used . </li></ul>
  58. 60. <ul><li>Look at the structure of your code and think about every possible way a user might break it . </li></ul><ul><li>Some suggestions follow: </li></ul><ul><li>Look at every input into the code you are testing. </li></ul><ul><li>Look at every calculation </li></ul>
  59. 61. <ul><li>When you encounter a compound predicate, such as in, you must break the expression up so that each Boolean sub-expression is evaluated on its own . </li></ul>
  60. 62. Why Do Both? <ul><li>Black-box </li></ul><ul><li>Impossible to write a test case for every possible set of inputs and outputs </li></ul><ul><li>Some of the code may not be reachable without extraordinary measures </li></ul><ul><li>Specifications are not always complete </li></ul><ul><li>White-box </li></ul><ul><li>Does not address the question of whether or not the program matches the specification </li></ul><ul><li>Does not tell you if all of the functionality has been implemented </li></ul><ul><li>Does not discover missing program logic </li></ul>
  61. 63. <ul><li>References : </li></ul><ul><li>Cem Kaner, Testing Computer Software. </li></ul><ul><li>http://www.win.tue.nl/~mousavi/testing/7.pdf . </li></ul><ul><li>www.sisqa.com/Training/ White_Box_Testing - 200709 . ppt </li></ul>
  62. 64. <ul><li>Questions ? </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.