1 / 34

Test Design Techniques

Test Design Techniques. Software Testing: IN3240 / IN4240. Summary. Specification-based testing Equivalence partitioning [x] Boundary value analysis [x] Decision table State transition Use case testing. Structure-based testing Statement coverage Decision coverage. Decision Table.

mauricen
Download Presentation

Test Design Techniques

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. Test Design Techniques Software Testing: IN3240 / IN4240

  2. Summary • Specification-based testing • Equivalence partitioning [x] • Boundary value analysis [x] • Decision table • State transition • Use case testing • Structure-based testing • Statement coverage • Decision coverage

  3. Decision Table • How do you create a decision table? • What are the conditions? • Anything that can be evaluated using boolean values! • How many rules are there? • where N = number of conditions project title

  4. Decision Table (exercise) An education program at a Norwegian university have the following admission requirements: To obtain a study place, the applicant must have a general academic qualification, the mathematic course R1 from upper secondary school, and GPA above the limit of the year. If the applicant’s GPA are below the limit, the individual is put into the waiting list, assuming that he/she have a general academic qualification and have taken R1. If the applicant has a general qualification, but not taken the mathematics course, the applicant is offered a preparatory course in mathematics, assuming that the GPU are above the limit Draw the decision table which shows all possible combinations Simplify the decision table and reduce the number of rules while retaining the same functionality project title

  5. Decision Table (exercise) Draw the decision table which shows all possible combinations Simplify the decision table and reduce the number of rules while retaining the same functionality project title

  6. Decision Table (exercise) Draw the decision table which shows all possible combinations Simplify the decision table and reduce the number of rules while retaining the same functionality Assumption: Every combinations other than the ones presented will result in ignore / not enrolled project title

  7. State transition testing • “A black box technique in which test cases are designed to execute valid and invalid state transitions” • Describes the aspects of the system • Finite • A finite number of states • State • A stable situation where the process awaits stimuli • State diagrams consist of four parts: • The states that the software/system may occupy • The transitions from one state to another • The events that cause a transitions • The actions that result from a transition project title

  8. State transition testing “A black box technique in which test cases are designed to execute valid and invalid state transitions” State diagrams consist of four parts: The states that the software/system may occupy The transitions from one state to another The events that cause a transitions The actions that result from a transition project title

  9. State transition testing (exercise) A website shopping basket starts out empty. As purchases are selected, they are added to the shopping basket. Items can also be removed from the basket. When the customer decides to check out, a summary of the items and the total cost are shown. Customer states if the information is ok If the contents and the price are OK, then the customer will be redirected to the payment system. Otherwise, you go back to shopping Produce a state diagram Define a sequence to cover all transitions project title

  10. State transition testing (exercise) project title

  11. State table • Maps out states and transitions in tabular form project title

  12. Exercise 2(b): Answer project title

  13. Use Case testing • “Technique to help identify test cases that exercise the whole system from start to finish” • A description of a particular use of the system by an actor (user of the system) • Each use case describes the interaction between the actor and the system to achieve a specific task • A sequence of steps from start to finish • May uncover integration defects • Actors may not only be users, but also other systems! project title

  14. Use Case testing project title

  15. Use Case testing For a vending machine, create a test case for normal usage project title

  16. Use Case testing For a vending machine, create a test case for normal usage project title

  17. Summary • Specification-based testing • Equivalence partitioning [x] • Boundary value analysis [x] • Decision table [x] • State transition [x] • Use case testing [x] • Structure-based testing • Statement coverage • Decision coverage

  18. Test Coverage • Statement and Decision coverage • Questions regarding coverage is usually in conjunction with control flow diagrams project title

  19. Statement Coverage • Example: Statement coverage • Test 1_1: • A = 2, B = 3 • Test 1_2: • A = 0, B = 25 • Test 1_3: • A = 47, B = 1 • Which statements have we covered? project title

  20. Statement Coverage • Example: Statement coverage • Have covered 5 out of 6 statements • Statement coverage = 83 % • Need another test to reach 100 % • Test 1_4: • A = 20, B = 25 project title • In fact, only one test case needed

  21. Decision Coverage • Decision coverage • One test required for 100 % statement coverage • A = 12, B = 10 • // All statements are exercised • Decisioncoverage requires: • Each condition must have True and False project title

  22. Decision Coverage • Which of the following statements about the relationship between statement and decisioncoverage is correct? • Decision coverage • Additional test case • A = 2, B = 4 • // All decisions have been exercised • Have achieved 100 % decision coverage project title

  23. Test Coverage (Exercise) If you are flying with an economyticket, there is a possibility that you may get upgraded to business class, especially if you hold a goldcard in the airline’s frequent flyer program. If you don’t hold a goldcard, there is a possibility that you will get “bumped” off the flight if it is full and you checkinlate. This is shown in the following figure. Note that each box (i.e. statement) has been numbered. project title

  24. Test Coverage (Exercise) Tests run: Test 1 Goldcard holder who gets upgraded to business class Test 2 Non-goldcard holder who stays in economy Test 3 A person who is bumpedoff the flight project title

  25. Test Coverage (Exercise) on 7 What is the statementcoverage of these three tests? 60 % 70 % 80 % 90 % project title

  26. Test Coverage (Exercise 2) A vending machine dispenses either hot or colddrinks. If you choose a hot drink (e.g. tea or coffee), it asks if you want milk (added if required). Then it asks if you want sugar (added if required) Finally, the drink is dispensed. Draw a control flow diagram for this example Hint: Regard the selection of the type of drink as onestatement project title

  27. Test Coverage (Exercise 2) • Draw a controlflowdiagram for this example • 7. Construct the controlflow diagram combining all elements project title

  28. Test Coverage (Exercise 2) Given the following tests, what is the statementcoverage achieved? What is the decisioncoverage achieved? Test 1: Cold drink Test 2: Hot drink with milk and sugar project title

  29. Test Coverage (Exercise 2) • Statement and decision coverage • Test 1: • Cold drink • Test 2: • Hot drink with milk and sugar • What is the statement coverage? • What is the decision coverage? project title

  30. Test Coverage (Exercise 2) • Statement and decision coverage • Statement coverage • 100 % statement coverage • Every statement has been covered • (All boxes have been touched) • What is the decision coverage? • How manydecisionoutcomes exist? • How many decision outcomesexercised? project title

  31. Test Coverage (Exercise 2) • Statement and decision coverage • What is the decision coverage? • How manydecisionoutcomes exist? • Hot / Cold / Yes / No / Yes / No • 6 decision outcomes in total • How many decision outcomesexercised? • Hot / Cold / Yes / No • 4 decision outcomes exercised • Decision coverage • 4 / 6 = 67 % project title

  32. Test Coverage (Exercise 2) What additional tests would be needed to achieve 100% decision and statement coverage? project title

  33. Test Coverage (Exercise 2) • What additionaltests would be needed to achieve 100%decision and statement coverage? • Additional tests • Statement coverage: • No further tests • Decision coverage • Must exercise No / No • Test 3: • Hot drink, no milk, no sugar • All decisions exercised project title

  34. Summary • Specification-based testing • Equivalence partitioning [x] • Boundary value analysis [x] • Decision table [x] • State transition [x] • Use case testing [x] • Structure-based testing • Statement coverage [x] • Decision coverage [x]

More Related