Generating Test Cases using ATG

Generating Test Case automaticaly

We are now ready to generate the desired test case with ATG:

Screen capture a1

After a preparation phase, ATG starts generating testcases. Already during test case generation, you can unfold the tree below TheTestCalc in the browser part of the search dialog in order to view which model elements are covered and which are not in the current state of test case generation.

Screen capture of Search dialog

At the end of test case generation (after 1 minute of generation time), you can see, that all states of TheTestCalc's statechart have been covered. Two transitions and 1 of 11 operations remain uncovered.

We now close the generation dialog again and inspect the covered and uncovered model elements in the browser part of the ATG main dialog.

It turns out, that the uncovered operation is the init operation which is only invoked by the transition reacting to evReset in statechart TheTestCalc::TestBehaviorSpecification. And also, transitions 2 in TheTestCalc::TestBehaviorSpecification as well as 4 in TheTestCalc::TestBehaviorSpecification are not covered.

Note: Double clicking a model element in the browser part of the ATG main window highlights the model element in the respective Rhapsody model diagram.

Screen capture of transition highlights

We conclude, that neither transition 2 nor the init could be covered by ATG using our helper function based interface. Remember, that the helper function doesn't send event evReset to TheTestCalc. Furthermore, we understand, that transition 4 can't be covered by ATG using our helper function, since the helper function always sends evOperand(int No, int Val) with No=1 or No=2, but transition 4 is only taken if No!=1 && No!=2. We will later add some other test cases in order to reach full model element coverage.