Home
Existing User Login
Brochure
Sign up for Risk-Free Trial
About Testcover.com
Frequently Asked Questions
Tutorial with Examples
->Finite State Machine
--->Start Command: 3 States
--->Start Command: 2 States
Performance
WSDL Interface
Background
Partners
Registrations
Contact Information
|
The Start Command Example illustrates pairwise testing using a
finite state machine.
Each partition corresponds to a transition between two states.
The start command test model has three states, and each state may transition to any of the three states.
Thus, there are 3 3 = 9 state transitions to test.
Test cases for these nine transitions are generated in this example.
For comparison, the start command also is modeled with
two states,
one of which is a composite state of a hierarchical state machine
similar to those of
UML.
In the second test model there are 2 2 = 4 transitions, i.e. 4 partitions.
In both models the same blocks are used, and the same pairs are covered.
Tradeoffs between the two models are noted.
Requirements summary.
The start command may be used alternately on either of two networked hosts to invoke an application.
It provides simple prompts to the operator, to offer supported choices and to avoid errors.
A production application may run on either of the hosts, but only one at a time.
When a host is not runnning the production application, it may be running a comparable test application,
or it may be idle.
When the start command runs on this host, it checks the state of this host and the state of the other host.
If the state of this host is test or production, the operator is asked if the current database should be dumped.
If yes, the database is dumped for future use before the transition to the target state.
Next, if the state of the other host is not production,
the operator is asked if the production application should be started on this host.
If yes, the operator is asked if this host's production database should be used,
or if the database should be restored
| from the other production database dump, or |
| from this production database dump. |
The production application is started, and the start command exits.
If the state of the other host is production, or if the operator responded no to the start production prompt,
then the operator is asked if the test application should be started on this host.
If yes, the operator is asked if this host's test database should be used,
or if the database should be restored
| from the other production database dump, |
| from this production database dump, or |
| from the other test database dump. |
The test application is started, and the start command exits.
If the operator responded no to the start test prompt, then this host's state becomes idle, and the start command exits.
Test model.
In the example, the purpose is to test the normal operation of the start command on this host.
That is, to answer the question,
"Does the start command produce the correct transitions among the idle, test and production states?"
It is possible to model and test the start command itself, its states between prompts and responses,
the entry/exit actions it implements, etc.
But this example is concerned with system operation based on previously tested subsystems.
Thus the details of the start command are beyond the present scope.
In this normal operation test,
the state of the other host is assumed not to change during the start command execution.
There are six test factors with values as follows.
| Test Factor | Number of Values | Test Factor Values |
| 1. Other state | 3 |
idle test production |
| 2. This state | 3 |
idle test production |
| 3. Dump this db? | 2 | no yes |
| 4. Start production? | 2 |
no yes |
| 5. Start test? | 2 |
no yes |
| 6. Restore db? | 4 |
no from_other_prod from_this_prod from_other_test |
For test factors 3, 4, 5 and 6, the value no stands for no or not prompted.
The request is composed of nine partitions corresponding to the nine state transitions illustrated below.
The request for this test model is shown below.
Partition prefixes (e.g. 3-II, 3-IT, etc.) are used to distinguish the test cases of different partitions.
Start Command with 3 states
Other state
This state
Dump this db?
Start production?
Start test?
Restore db?
#3-II idle to idle
idle test production
idle
no
no
no
no
#3-IT idle to test
idle test production
idle
no
no
yes
no from_other_prod from_this_prod from_other_test
#3-IP idle to production
idle test
idle
no
yes
no
no from_other_prod from_this_prod
#3-TI test to idle
idle test production
test
no yes
no
no
no
#3-PI production to idle
idle test
production
no yes
no
no
no
#3-TT test to test
idle test production
test
no yes
no
yes
no from_other_prod from_this_prod from_other_test
#3-TP test to production
idle test
test
no yes
yes
no
no from_other_prod from_this_prod
#3-PT production to test
idle test
production
no yes
no
yes
no from_other_prod from_this_prod from_other_test
#3-PP production to production
idle test
production
no yes
yes
no
no from_other_prod from_this_prod |
The nine results tables follow.
#1.
idle to idle
Test Case ID |
Other state |
This state |
Dump this db? |
Start production? |
Start test? |
Restore db? |
Combo Countdown |
| 3 Values | 1 Value | 1 Value | 1 Value | 1 Value | 1 Value | 25 |
| 3-II1 | idle | idle | no | no | no | no | 10 |
| 3-II2 | test | idle | no | no | no | no | 5 |
| 3-II3 | production | idle | no | no | no | no | 0 |
#2.
idle to test
Test Case ID |
Other state |
This state |
Dump this db? |
Start production? |
Start test? |
Restore db? |
Combo Countdown |
| 3 Values | 1 Value | 1 Value | 1 Value | 1 Value | 4 Values | 46 |
| 3-IT1 | test | idle | no | no | yes | from_other_test | 31 |
| 3-IT2 | production | idle | no | no | yes | no | 22 |
| 3-IT3 | idle | idle | no | no | yes | from_other_prod | 13 |
| 3-IT4 | test | idle | no | no | yes | from_this_prod | 8 |
| 3-IT5 | idle | idle | no | no | yes | no | 7 |
| 3-IT6 | production | idle | no | no | yes | from_other_prod | 6 |
| 3-IT7 | production | idle | no | no | yes | from_this_prod | 5 |
| 3-IT8 | idle | idle | no | no | yes | from_other_test | 4 |
| 3-IT9 | test | idle | no | no | yes | from_other_prod | 3 |
| 3-IT10 | test | idle | no | no | yes | no | 2 |
| 3-IT11 | production | idle | no | no | yes | from_other_test | 1 |
| 3-IT12 | idle | idle | no | no | yes | from_this_prod | 0 |
#3.
idle to production
Test Case ID |
Other state |
This state |
Dump this db? |
Start production? |
Start test? |
Restore db? |
Combo Countdown |
| 2 Values | 1 Value | 1 Value | 1 Value | 1 Value | 3 Values | 32 |
| 3-IP1 | idle | idle | no | yes | no | no | 17 |
| 3-IP2 | test | idle | no | yes | no | from_other_prod | 8 |
| 3-IP3 | idle | idle | no | yes | no | from_this_prod | 3 |
| 3-IP4 | idle | idle | no | yes | no | from_other_prod | 2 |
| 3-IP5 | test | idle | no | yes | no | no | 1 |
| 3-IP6 | test | idle | no | yes | no | from_this_prod | 0 |
#4.
test to idle
Test Case ID |
Other state |
This state |
Dump this db? |
Start production? |
Start test? |
Restore db? |
Combo Countdown |
| 3 Values | 1 Value | 2 Values | 1 Value | 1 Value | 1 Value | 32 |
| 3-TI1 | idle | test | no | no | no | no | 17 |
| 3-TI2 | test | test | yes | no | no | no | 8 |
| 3-TI3 | production | test | no | no | no | no | 3 |
| 3-TI4 | test | test | no | no | no | no | 2 |
| 3-TI5 | idle | test | yes | no | no | no | 1 |
| 3-TI6 | production | test | yes | no | no | no | 0 |
#5.
production to idle
Test Case ID |
Other state |
This state |
Dump this db? |
Start production? |
Start test? |
Restore db? |
Combo Countdown |
| 2 Values | 1 Value | 2 Values | 1 Value | 1 Value | 1 Value | 26 |
| 3-PI1 | idle | production | no | no | no | no | 11 |
| 3-PI2 | test | production | yes | no | no | no | 2 |
| 3-PI3 | test | production | no | no | no | no | 1 |
| 3-PI4 | idle | production | yes | no | no | no | 0 |
#6.
test to test
Test Case ID |
Other state |
This state |
Dump this db? |
Start production? |
Start test? |
Restore db? |
Combo Countdown |
| 3 Values | 1 Value | 2 Values | 1 Value | 1 Value | 4 Values | 56 |
| 3-TT1 | test | test | yes | no | yes | from_other_test | 41 |
| 3-TT2 | idle | test | no | no | yes | from_other_prod | 29 |
| 3-TT3 | production | test | yes | no | yes | no | 20 |
| 3-TT4 | test | test | no | no | yes | from_this_prod | 14 |
| 3-TT5 | production | test | no | no | yes | from_other_test | 11 |
| 3-TT6 | idle | test | yes | no | yes | from_this_prod | 8 |
| 3-TT7 | idle | test | no | no | yes | no | 6 |
| 3-TT8 | production | test | yes | no | yes | from_other_prod | 4 |
| 3-TT9 | production | test | yes | no | yes | from_this_prod | 3 |
| 3-TT10 | idle | test | no | no | yes | from_other_test | 2 |
| 3-TT11 | test | test | no | no | yes | from_other_prod | 1 |
| 3-TT12 | test | test | yes | no | yes | no | 0 |
#7.
test to production
Test Case ID |
Other state |
This state |
Dump this db? |
Start production? |
Start test? |
Restore db? |
Combo Countdown |
| 2 Values | 1 Value | 2 Values | 1 Value | 1 Value | 3 Values | 40 |
| 3-TP1 | idle | test | no | yes | no | no | 25 |
| 3-TP2 | test | test | no | yes | no | from_other_prod | 16 |
| 3-TP3 | idle | test | yes | yes | no | from_this_prod | 7 |
| 3-TP4 | test | test | yes | yes | no | no | 4 |
| 3-TP5 | idle | test | yes | yes | no | from_other_prod | 2 |
| 3-TP6 | test | test | no | yes | no | from_this_prod | 0 |
#8.
production to test
Test Case ID |
Other state |
This state |
Dump this db? |
Start production? |
Start test? |
Restore db? |
Combo Countdown |
| 2 Values | 1 Value | 2 Values | 1 Value | 1 Value | 4 Values | 47 |
| 3-PT1 | idle | production | no | no | yes | no | 32 |
| 3-PT2 | test | production | yes | no | yes | from_other_test | 20 |
| 3-PT3 | test | production | no | no | yes | from_other_prod | 14 |
| 3-PT4 | idle | production | yes | no | yes | from_this_prod | 8 |
| 3-PT5 | idle | production | yes | no | yes | from_other_prod | 6 |
| 3-PT6 | test | production | yes | no | yes | no | 4 |
| 3-PT7 | test | production | no | no | yes | from_this_prod | 2 |
| 3-PT8 | idle | production | no | no | yes | from_other_test | 0 |
#9.
production to production
Test Case ID |
Other state |
This state |
Dump this db? |
Start production? |
Start test? |
Restore db? |
Combo Countdown |
| 2 Values | 1 Value | 2 Values | 1 Value | 1 Value | 3 Values | 40 |
| 3-PP1 | idle | production | no | yes | no | no | 25 |
| 3-PP2 | test | production | no | yes | no | from_other_prod | 16 |
| 3-PP3 | idle | production | yes | yes | no | from_this_prod | 7 |
| 3-PP4 | test | production | yes | yes | no | no | 4 |
| 3-PP5 | idle | production | yes | yes | no | from_other_prod | 2 |
| 3-PP6 | test | production | no | yes | no | from_this_prod | 0 |
In each of the nine partitions, all pairs of factor values are covered.
Moreover, the number of test cases is the minimum possible in each of the partitions.
The total number of test cases for this model is 63
(compared with 35 for the 2-state model).
The final illustration for the 3-state model shows how the test cases can be ordered
to create a path through the test model states.
In a successful test run, each transition would set up the initial conditions for the following test case.
In this example, the test cases are sorted by the 3 other state values to create 3 corresponding test runs.
In each run the transitions for this host are ordered
so that the resulting state of each test case sets up the initial state of the next.
Run 1. Other state idle
Test Case ID |
Other state |
This state |
Dump this db? |
Start production? |
Start test? |
Restore db? |
| 3-II1 | idle | idle | no | no | no | no |
| 3-IT3 | idle | idle | no | no | yes | from_other_prod |
| 3-TI1 | idle | test | no | no | no | no |
| 3-IT5 | idle | idle | no | no | yes | no |
| 3-TI5 | idle | test | yes | no | no | no |
| 3-IT8 | idle | idle | no | no | yes | from_other_test |
| 3-TT2 | idle | test | no | no | yes | from_other_prod |
| 3-TT6 | idle | test | yes | no | yes | from_this_prod |
| 3-TT7 | idle | test | no | no | yes | no |
| 3-TT10 | idle | test | no | no | yes | from_other_test |
| 3-TP1 | idle | test | no | yes | no | no |
| 3-PI1 | idle | production | no | no | no | no |
| 3-IT12 | idle | idle | no | no | yes | from_this_prod |
| 3-TP3 | idle | test | yes | yes | no | from_this_prod |
| 3-PI4 | idle | production | yes | no | no | no |
| 3-IP1 | idle | idle | no | yes | no | no |
| 3-PT1 | idle | production | no | no | yes | no |
| 3-TP5 | idle | test | yes | yes | no | from_other_prod |
| 3-PT4 | idle | production | yes | no | yes | from_this_prod |
| 3-TI1 | idle | test | no | no | no | no |
| 3-IP3 | idle | idle | no | yes | no | from_this_prod |
| 3-PT5 | idle | production | yes | no | yes | from_other_prod |
| 3-TI1 | idle | test | no | no | no | no |
| 3-IP4 | idle | idle | no | yes | no | from_other_prod |
| 3-PP1 | idle | production | no | yes | no | no |
| 3-PP3 | idle | production | yes | yes | no | from_this_prod |
| 3-PP5 | idle | production | yes | yes | no | from_other_prod |
| 3-PT8 | idle | production | no | no | yes | from_other_test |
In this run test case 3-TI1 was repeated twice to set up its following test cases.
Run 2. Other state test
Test Case ID |
Other state |
This state |
Dump this db? |
Start production? |
Start test? |
Restore db? |
| 3-II2 | test | idle | no | no | no | no |
| 3-IT1 | test | idle | no | no | yes | from_other_test |
| 3-TI2 | test | test | yes | no | no | no |
| 3-IT4 | test | idle | no | no | yes | from_this_prod |
| 3-TI4 | test | test | no | no | no | no |
| 3-IT9 | test | idle | no | no | yes | from_other_prod |
| 3-TT1 | test | test | yes | no | yes | from_other_test |
| 3-TT4 | test | test | no | no | yes | from_this_prod |
| 3-TT11 | test | test | no | no | yes | from_other_prod |
| 3-TT12 | test | test | yes | no | yes | no |
| 3-TP2 | test | test | no | yes | no | from_other_prod |
| 3-PI2 | test | production | yes | no | no | no |
| 3-IT10 | test | idle | no | no | yes | no |
| 3-TP4 | test | test | yes | yes | no | no |
| 3-PI3 | test | production | no | no | no | no |
| 3-IP5 | test | idle | no | yes | no | no |
| 3-PP2 | test | production | no | yes | no | from_other_prod |
| 3-PP4 | test | production | yes | yes | no | no |
| 3-PP6 | test | production | no | yes | no | from_this_prod |
| 3-PT2 | test | production | yes | no | yes | from_other_test |
| 3-TP6 | test | test | no | yes | no | from_this_prod |
| 3-PT3 | test | production | no | no | yes | from_other_prod |
| 3-TI2 | test | test | yes | no | no | no |
| 3-IP2 | test | idle | no | yes | no | from_other_prod |
| 3-PT6 | test | production | yes | no | yes | no |
| 3-TI2 | test | test | yes | no | no | no |
| 3-IP6 | test | idle | no | yes | no | from_this_prod |
| 3-PT7 | test | production | no | no | yes | from_this_prod |
In this run test case 3-TI2 was repeated twice to set up its following test cases.
Run 3. Other state production
Test Case ID |
Other state |
This state |
Dump this db? |
Start production? |
Start test? |
Restore db? |
| 3-II3 | production | idle | no | no | no | no |
| 3-IT2 | production | idle | no | no | yes | no |
| 3-TI3 | production | test | no | no | no | no |
| 3-IT6 | production | idle | no | no | yes | from_other_prod |
| 3-TI6 | production | test | yes | no | no | no |
| 3-IT7 | production | idle | no | no | yes | from_this_prod |
| 3-TT3 | production | test | yes | no | yes | no |
| 3-TT5 | production | test | no | no | yes | from_other_test |
| 3-TT8 | production | test | yes | no | yes | from_other_prod |
| 3-TT9 | production | test | yes | no | yes | from_this_prod |
| 3-TI3 | production | test | no | no | no | no |
| 3-IT11 | production | idle | no | no | yes | from_other_test |
In this run test case 3-TI3 was repeated once to set up its following test case.
For comparison, the start command also is modeled with
two states.
Reducing the number of partitions from 9 to 4 reduces the number of test cases by 44% in this example.
|