Presentation is loading. Please wait.

Presentation is loading. Please wait.

Test Design Techniques Software Testing: IN3240 / IN4240

Similar presentations


Presentation on theme: "Test Design Techniques Software Testing: IN3240 / IN4240"— Presentation transcript:

1 Test Design Techniques Software Testing: IN3240 / IN4240

2 Summary Specification-based testing Structure-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? 2 𝑁 where N = number of conditions project title Rule 1 Rule 2 Rule 3 Rule 4 Conditions X? T F Y? Result Do stuff Do other stuff Transfer things Ignore

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 Conditions R1 R2 R3 R4 R5 R6 R7 R8 Gen. Ac. Qualification T F Math. Course GPA above Actions Enroll Waiting list Prep. Course Ignore

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 Conditions R1 R2 R3 Gen. Ac. Qualification T Math. Course F GPA above Actions Enroll Waiting list Prep. Course

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
State table also shows what’s not legal transitions from a state. 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 Step Description Main Success Scenario A: Actor
S: System 1 A: Inserts card 2 S: Validates card and asks for pin 3 A: Enters pin 4 S: Validates pin 5 S: Allows access to account Extensions 2a Card not valid S: Display message and reject card 4a Pin not valid S: Display error, go back to step 3 4b Pin invalid 3 times S: Eat card and exit project title

15 Use Case testing Step Description Main Success Scenario A: Actor
S: System 1 A: Inserts card 2 S: Validates card and asks for pin 3 A: Enters pin 4 S: Validates pin 5 S: Allows access to account Extensions 2a Card not valid S: Display message and reject card 4a Pin not valid S: Display error, go back to step 3 4b Pin invalid 3 times S: Eat card and exit 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 Structure-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
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 Decision coverage requires: Each condition must have True and False project title

22 Decision Coverage Which of the following statements about the relationship between statement and decision coverage 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 economy ticket, there is a possibility that you may get upgraded to business class, especially if you hold a gold card in the airline’s frequent flyer program. If you don’t hold a gold card, there is a possibility that you will get “bumped” off the flight if it is full and you check in late. 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 Gold card holder who gets upgraded to business class Test 2 Non-gold card holder who stays in economy Test 3 A person who is bumped off the flight project title

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

26 Test Coverage (Exercise 2)
A vending machine dispenses either hot or cold drinks. 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 one statement project title

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

28 Test Coverage (Exercise 2)
Given the following tests, what is the statement coverage achieved? What is the decision coverage 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 many decision outcomes exist? How many decision outcomes exercised? project title

31 Test Coverage (Exercise 2)
Statement and decision coverage What is the decision coverage? How many decision outcomes exist? Hot / Cold / Yes / No / Yes / No 6 decision outcomes in total How many decision outcomes exercised? 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 additional tests 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 Structure-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]


Download ppt "Test Design Techniques Software Testing: IN3240 / IN4240"

Similar presentations


Ads by Google