Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define...
Transcript of Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define...
![Page 1: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/1.jpg)
State transition testingA practical workshop in the use of a
software testing technique
Peter Quentin - QBIT
BCS OxfordshireThursday 6th October
![Page 2: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/2.jpg)
contents
• Introduction
• State transition testing
• Example
• Exercises
• Conclusion
![Page 3: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/3.jpg)
the problem...
very large or infinitenumber of test scenarios
+
finite amount of time
=
impossible to test everything
![Page 4: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/4.jpg)
the solution...
Software test techniques exist to reduce the number of tests to be run whilst still providing sufficient coverage of the system under test
![Page 5: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/5.jpg)
state transition testing
• Models each state a system can exist in
• Models each state transition
• Defines for each state transition‣ start state‣ input‣ output‣ finish state
![Page 6: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/6.jpg)
OFF
![Page 7: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/7.jpg)
ON
OFF Input: switch onOutput:light on
![Page 8: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/8.jpg)
ON
OFF
Input: switch offOutput:light off
![Page 9: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/9.jpg)
ON
OFFstart state:
offstart state:
on
input:switch on
input:switch off
output:light on
output:light off
finish state:on
finish state:off
TEST 1 TEST 2
![Page 10: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/10.jpg)
FAULT
ON
OFF
![Page 11: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/11.jpg)
FAULT
ON
OFF
OFF
ON
OFF
ON
FAULT
![Page 12: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/12.jpg)
STEP 1 STEP 2 STEP 3
STARTSTATE
OFF ON OFF
INPUT SWITCH ON SWITCH OFF SWITCH ON
OUTPUT LIGHT ON LIGHT OFF LIGHT ON
FINISHSTATE
ON OFF ON
TEST
![Page 13: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/13.jpg)
electronic clock example
• A simple electronic clock has four modes, display time, change time, display date and change date
• The change mode button switches between display time and display date
• The reset button switches from display time to adjust time or display date to adjust date
• The set button returns from adjust time to display time or adjust date to display date
![Page 14: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/14.jpg)
DISPLAY TIME
DISPLAY DATE
ADJUST TIME
ADJUST DATE
chan
ge m
od
e
chan
ge m
od
e
reset
reset
set
set
![Page 15: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/15.jpg)
DISPLAY TIME
ADJUST TIME
DISPLAY TIME
DISPLAY DATE
DISPLAY DATE
DISPLAY TIME
ADJUST DATE
0-switch orbranch coverage
![Page 16: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/16.jpg)
STEP 1 STEP 2
START STATE DISPLAY TIME DISPLAY DATE
INPUT CHANGE MODE CHANGE MODE
OUTPUT DISPLAY DATE DISPLAY TIME
FINISH STATE DISPLAY DATE DISPLAY TIME
STEP 1 STEP 2 STEP 3
START STATE DISPLAY TIME DISPLAY DATE ADJUST DATE
INPUT CHANGE MODE RESET SET
OUTPUT DISPLAY DATE ADJUST DATE DISPLAY DATE
FINISH STATE DISPLAY DATE ADJUST DATE DISPLAY DATE
STEP 1 STEP 2
START STATE DISPLAY TIME ADJUST TIME
INPUT RESET SET
OUTPUT ADJUST TIME DISPLAY TIME
FINISH STATE ADJUST TIME DISPLAY TIME
TEST 1
TEST 2
TEST 3
![Page 17: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/17.jpg)
DISPLAY TIME
ADJUST TIME
DISPLAY TIME
DISPLAY DATE
DISPLAY DATE
DISPLAY TIME
ADJUST DATE
ADJUST DATE
DISPLAY TIME
DISPLAY DATE
ADJUST TIME
DISPLAY DATE
ADJUST TIME
1-switch orswitch coverage
![Page 18: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/18.jpg)
STEP 1 STEP 2 STEP 3
START STATE DISPLAY TIME DISPLAY DATE DISPLAY TIME
INPUT CHANGE MODE CHANGE MODE CHANGE MODE
OUTPUT DISPLAY DATE DISPLAY TIME DISPLAY DATE
FINISH STATE DISPLAY DATE DISPLAY TIME DISPLAY DATE
STEP 1 STEP 2 STEP 3
START STATE DISPLAY TIME DISPLAY DATE DISPLAY TIME
INPUT CHANGE MODE CHANGE MODE RESET
OUTPUT DISPLAY DATE DISPLAY TIME ADJUST TIME
FINISH STATE DISPLAY DATE DISPLAY TIME ADJUST TIME
STEP 1 STEP 2 STEP 3 STEP 4
START STATE DISPLAY TIME DISPLAY DATE ADJUST DATE DISPLAY DATE
INPUT CHANGE MODE RESET SET CHANGE MODE
OUTPUT DISPLAY DATE ADJUST DATE DISPLAY DATE DISPLAY TIME
FINISH STATE DISPLAY DATE ADJUST DATE DISPLAY DATE DISPLAY TIME
STEP 1 STEP 2 STEP 3 STEP 4
START STATE DISPLAY TIME DISPLAY DATE ADJUST DATE DISPLAY DATE
INPUT CHANGE MODE RESET SET RESET
OUTPUT DISPLAY DATE ADJUST DATE DISPLAY DATE ADJUST DATE
FINISH STATE DISPLAY DATE ADJUST DATE DISPLAY DATE ADJUST DATE
STEP 1 STEP 2 STEP 3
START STATE DISPLAY TIME ADJUST TIME DISPLAY TIME
INPUT RESET SET CHANGE MODE
OUTPUT ADJUST TIME DISPLAY TIME DISPLAY DATE
FINISH STATE ADJUST TIME DISPLAY TIME DISPLAY DATE
STEP 1 STEP 2 STEP 3
START STATE DISPLAY TIME ADJUST TIME DISPLAY TIME
INPUT RESET SET RESET
OUTPUT ADJUST TIME DISPLAY TIME ADJUST TIME
FINISH STATE ADJUST TIME DISPLAY TIME ADJUST TIME
TEST 1
TEST 2
TEST 3
TEST 4
TEST 5
TEST 6
![Page 19: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/19.jpg)
n-switch orboundary interior
n-switch or boundary interior‣ execute each loop n times
‣ at least twice
‣ tests each loop irrespective of the start/end point
‣ 6 loops to be tested in this case
![Page 20: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/20.jpg)
for each exercise...
• Draw a state transition diagram‣ draw the states‣ mark the state transitions‣ define input and output for each state transition
• Determine the level of coverage‣ 1-switch/switch coverage for these exercises
• Draw a testing tree
• Define the tests
![Page 21: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/21.jpg)
electric toothbrush
A two-speed electric toothbrush is operated by pressing its one button. The first press of the button turns the toothbrush from off to speed one, the second press of the button turns it to speed two
When the button is pressed for a third time the electric toothbrush is turned off
![Page 22: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/22.jpg)
SPEED 1
SPEED 2
OFF
OFF
S1
S2
OFF
S1
![Page 23: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/23.jpg)
tape cassette player
A tape player has three operations: play, fast forward and fast play. Play and fast forward are activated using the play and fast forward button respectively. These operations can be cancelled using the stop button. When in play mode, the fast forward can be used to fast play. When in fast play mode, the fast forward button can be pressed again to enter fast forward or the stop button can be used to return to play. When in fast forward the play button can be pressed to enter play mode directly.
![Page 24: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/24.jpg)
OFF
PLAYFAST FOR-
WARD
FAST PLAY
play
fast forward fa
st fo
rwar
d
play
stop
stop
fast forward
stop
![Page 25: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/25.jpg)
0-switch orbranch coverage
![Page 26: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/26.jpg)
1-switch orswitch coverage
![Page 27: Thursday 6th October · • Draw a state transition diagram ... • Draw a testing tree • Define the tests. electric toothbrush A two-speed electric toothbrush is operated by pressing](https://reader030.fdocuments.in/reader030/viewer/2022040910/5e846c2905b1cf0f2b78a542/html5/thumbnails/27.jpg)
conclusions...
• There are many useful techniques available‣ state transition testing is only one of the many
• A finite number of tests can be defined from an infinite number of test scenarios and a level of coverage can still be achieved
• The process for state transition testing:‣ draw state transition diagram‣ determine start state, input, output and finish state‣ determine coverage level to be achieved‣ draw testing tree‣ define tests