-In this example, we're going to start from an informal specification, and the - -2
-specification is the one shown here in file spec.txt. This is the - -3
-specification for the maintenance function in a specific system. So what we're - -4
-doing is that we're taking the description of the functionality of a system, - -5
-and we're building a model, in this case a final state machine - -6
-for it. And there is no need to look at all the details - -7
-for this specification, but I want to point out that if you - -8
-look at the way the specification is written, we can identify specific cases - -9
-that we need to take into account. Like here if something - -10
-happens, something else will follow. Again, if something happens something else - -11
-will follow. So we have multiple choices here. Here will determine - -12
-the next steps and so on. So all we have to - -13
-do is to go through this process, identify these cases and - -14
-then build a machine that represents these cases. For the spec - -15
-that we just consider this is the state machine that will - -16
-result. Again there is no need to go through all the details, - -17
-but what I want to point out is that we have - -18
-a set of states. So for instance, we have state zero, - -19
-which is no maintenance, and if a request comes in, the - -20
-system will move, and the system wait for pickup. Then if - -21
-the pickup actually occurs, the system will move to the repair - -22
-state, and so on and so forth. So this is just - -23
-a more systematic representation of what was in the former specification. - -24
-And I will argue that this is much easier to understand at - -25
-least for somebody who has to develop tests for this system. In - -26
-fact what we're going to see next is how we can go from that - -27
-representation to a set of test cases. And the way which we do - -28
-it is by covering the behaviors represented by defining state machine. And we - -29
-can decide how we want to cover them. For example we might want - -30
-to cover all the states. So we might want to identify paths in - -31
-the state machine that go through all the states in the machine. Like - -32
-the one I just draw or this one, this one and this one. - -33
-So if we consider these four test cases, we can see that all the - -34
-states in my system or at least all the states that I have identified - -35
-are covered. I might want to go a little further, and decide that I - -36
-don't only want to cover all of the states, but I want to cover, all - -37
-of the transitions, because, it makes sense to visit a state, when coming from - -38
-different states. And, if I want to do that, and I look at the - -39
-test cases that I generated so far, I can see that there is one - -40
-transition, the one here, that is not covered. And, the same can be said for - -41
-the two transitions here. So what I can decide to do is - -42
-to generate another test case, that covers those or extend an existing one. - -43
-For instance, I could extend this test case by adding a visit to - -44
-the state, before going back to these two. Alternatively, I could also generate - -45
-new test cases, such as this one. To cover the missing transitions. - -46
-And once I have these test cases, I can express them in a - -47
-clearer way by simply specifying what are the states that they cover. I'm - -48
-just going to give you a couple of examples. Say, if we look - -49
-at the last one that I added, which will be test case - -50
-number five, I just need to specify that it will go through state - -51
-zero, which is this one, five, which is this one, six, and - -52
-then back to zero. And I can do the same for the other - -53
-test cases. So this will be my complete set of test cases. - -54
-So the bottom line here is that it is much harder to build - -55
-a set of test cases that will cover the behavior of an informal - -56
-description. But by going through a model, so by building in this case, - -57
-a finite state machine for that description, we can, in a much easier way, see - -58
-what the behaviors of interest of the system - -59
-are, and try to cover them. And there - -60
-is again in the spirit of breaking - -61
-down a complex problem into smaller steps that - -62
-we can better manage, which in the end, - -63
-results in a more efficient and effective testing. -- cgit 1.4.1