Copyright © 1999 Sita Ramakrishnan, Monash University All rights reserved

Light Views

HomeCase StudiesOO TheoryHelp

TicTacToe Game

Using concurrent state chart to test Player object

We commence testing Player object's interactions. State based testing of Player object involves exercising the states, transitions and methods associated with this one object. State based test cases are selected based on the coverage required from the model. The coverage objective may include visiting all states, exercising all transitions and/or exercising all methods in a state chart.
With concurrent state chart such as the one shown for a Player object, we should not only want to exercise the orthogonal states separately, but also use interleaving semantics and generate longer test sequences to exercise the AND-chart. These long test sequences for an object can locate errors lurking in interactions.

For example: follow the states - Connected to MyTurn to Playing to Tied or follow the event (transitions) from initialize to setYourTurn(true) to setGameStatus. Automation of the event flow between concurrent states with interleaving semantics is useful to exercise the concurrency and communication aspects of the system.

Test Case Scenario

Our Test case selection strategy is to exercise the state transitions as shown in the concurrent state chart.

Demonstration: State chart visiting all Player states

 

Expected Results: When the system is run using the test cases as shown in the animation that follows, it should be enter and exit these states as shown.

Coverage check: It is necessary to revisit the design diagram and check if any of the methods specified there have been accidentally missed from the player state model.

Sanity check: No errors or exceptions have been modeled in the state chart. Execution may reveal some surprises.

Drilling down from the deployment diagram to the state chart and testing the various paths through the transitions of a Player object.

Demonstration of the Player object and discussion of the steps

Generating the test sequences for the Player's concurrent state chart using interleaving semantics. Left to the reader as an exercise.


Funded by Committee of University Teaching And Staff Development (CUTSD) through DEETYA, 1998