1.
6CCS3SMT/7CCSMASE
Tutorial 9 (Week 10) Solution
Figure 1- Sate machine 1
Figure 2- Symbolic State Table
1. a) 100% state coverage: { 0–5–10–15 } (one test).
b) 100% transition coverage: { 0-5-10-15, 0-10-15, 0-5-15 }. Note that all tests cover the reset transition.
c) Boundary loop coverage: the test suite above covers the minimal number of iterations in the loops. To check an intermediate value, we need to traverse the loops, for example, twice. So the test suite will contain the tests from b), and in addition one repetition of each
test from b). To check a very large number of traversals, we need to add test cases that execute the loops many times – for example, 1000. This will be achieved by just re-running the existing tests 1000 times without stopping and models the functionality of the system if there is a long queue of people who would like to purchase a chocolate bar (for example, during a break in a university cafeteria).
Figure 3- State machine 2
2. a) 100% state coverage: { 0-5-10-select-Mars, 0-5-10-return money, 0-5-10-select-Snickers } b) 100% transition coverage: in addition to the tests above, we should have tests { 0-5- select-Mars, 0-10-select-Mars }.
c) As before, for boundary loop coverage we need to add to the existing test suite tests that execute each loop once more (that is, modelling two students who purchase chocolate bars one after another), and tests that execute each loop a large number of times (modelling a queue during break times).