2  Guidance

 

“Guidance” means “a suggestion telling us the next step to be achieved and/or aid to achieve the next step to be achieved”. The demo “Guidance” shows how to make a part of aircon model by using guidance. Following testcase is used in the example.

 

begin

setCurrent(aircon^PowerOff);

callEvent aircon.power;

isCurrent(aircon^PowerOn)

end

 

 

2.1 Guidance by compilation errors

 

First, we compile the testcase. Then some compilation errors are reported since no model has been defined (Figure 2-1). MEError means Missing Element Error. SMART tells us there are no objects called aircon, no state called PowerOff, PowerOn, and no event called power.

 

Figure 2 -1

We select one of the MEErrors named “Can’t find object aircon” and push guidance button. Then, SMART asks if an object aircon shall be created (Figure 2-2). If we accept the suggestion, then SMART prompts us to choose one of the existing classes or enter a new class name. Since no class has been defined yet, we enter a new class name, say, Air-Conditioner. Then, SMART declares a new class with the name. Similarly, we are guided to declare other model elements.

 

Figure 22

 

We will be guided and so declare a class, an object, an event and two states. When all compilation errors are gone, we get the green bar.

 

 

2.2 Guidance by behavioral errors

 

Then we run the testcase created from the testsuite table. We have a red bar again, but this time the error is a failure. The assertion isCurrent(aircon~PowerOn) of the testcase failed (Figure2-3).

Failure is behavioral errors. The guidance mechanism of SMART fixes even behavioral errors. SMART recognizes that the execution of the testcase took three steps:

 

1.        setup: set the current state to PowerOff,

2.        execution: trigger the event power,

3.        verification: verify if the current state is PowerOn.

 

Since all the three steps happen with the statemachine of aircon, SMART infers that we would intend a transition from PowerOff to PowerOn triggered by power. Thus it asks us if we would like to make such a transition. Answering to this guidance “yes” to create a transition, the failure of the testcase is gone. What we have input from the keyboard is only the name of the class Air-Conditioner, although we have accepted many guidance.

 

Figure 2 -3