Previous Chapter | Table of Contents | Next Chapter

Chapter 3 - Exercising the Simple ATM Example

Creating a Test Scenario

In the previous section, you created a simple ATM protocol comprising two Processing Entities (Customer and ATM). These PEs are able to communicate with each other via two possible Messages (cardInserted and keypressCancel). The structure of the communication is represented via Rules (insertCard, acceptCard, pressCancel, and cancelOperation) contained by the PEs and the connections among them formed by Messages.

The design captured on the ATM Protocol Edit Sheet is a specification of the Simple ATM Protocol; i.e., it represents what is possible with the protocol, not any particular usage of the protocol.

In this section, we will cover the creation of a Test Scenario for a protocol specification. A Test Scenario represents a specific set of messages sent in a particular order. It is through Test Scenarios that a protocol specification can be exercised.

In terms of the Simple ATM Example, the Protocol Specification given on the Edit Sheet represents all possible interactions between a customer and an ATM while the Test Scenario on a Test Sheet represents a particular instance of a particular customer interacting with a particular ATM.

Before starting the operations detailed below, ensure that you have loaded the design information captured and saved in the previous section.

Adding a Test Sheet

A Test Sheet can be added to the ProtoCollum binder by means of the Edit>New Sheet menu item. Left-clicking on New Sheet brings up the submenu as shown in Figure ???.

Adding a Test Sheet
Figure ?. Adding a Test Sheet

Left-click on For Testing to add the Test Sheet. Once the Test Sheet is added, right-click on the sheet name tab along the bottom edge of the sheet to get the Sheet Tab Menu pop-up. Select the Rename... menu item and rename the sheet to ATM Test. At this point, your sheet should look like Figure ???.

ATM Test Sheet
Figure ?. ATM Test Sheet

What's on the Test Sheet?

A ProtoCollum Test Sheet is an instance of a particular Edit Sheet. In the current example, the edit sheet ATM Protocol contains two Processing Entities, so when a Test Sheet is constructed for it, that Test Sheet has instances of those two PEs. See Figure ? and the following notes for an explanation of everything on the Test Sheet.

Figure ?. ATM Test Sheet Excerpt
1 Customer PE Instance
A Processing Entity instance. The underlying PE type, Customer, is shown in the upper left corner of the box. The middle bottom of the box shows the instance name Cus0, used to distinguish this instance from any other instances of the Customer PE.
2 ATM PE Instance
An instance of the ATM PE, having the instance name ATM0.
3 PE Instance Stem
On a Test Sheet the stem beneath a PE instance is represented as a column of "+" signs. Messages that enter a PE instance are connected at one of the "+" signs. Messages that are generated by a PE instance will come from a Node positioned at one of the "+" signs. Nodes are described in more detail below when the message connection mechanism is explained.
4 White Hole
A White Hole is an independent (that is, non-PE) source for messages on a Test Sheet. On the Edit Sheet, all messages are sourced by one PE and transmitted to one or more destination PEs. On a Test Sheet, a White Hole is used to insert a message into the system of PEs so that its response may be observed.

Moving the White Hole

Before adding the first instance of a Message to this Test Sheet, we will move the White Hole that the Message will originate from into a more convenient position.

The White Hole is initially in the position shown in the image to the right.

Start by clicking on the Select Mode button on the toolbar. The mouse cursor will be .

As the mouse pointer is moved, it will change to to indicate that it is over an object may be selected.

Select the White Hole by left-clicking on it while the mouse cursor is .

As shown in the image to the right, a handle will appear in the White Hole to indicate that it has been selected.

The selected White Hole may be repositioned by moving the mouse pointer over its handle and left-dragging it to its new position.

The mouse cursor will change to the movement cursor when the mouse pointer is in the correct position to start a move of the object.

While a move is in progress, the mouse pointer will change to a crosshair .

Drag the White Hole 2 cm lower and release the left mouse button. Your sheet should now appear as shown to the right.

Adding the First Message Instance

Now that the White Hole is in its more convenient position, we can add an instance of a Message to the ATM Test sheet.

Click on the Message Mode button on the toolbar. The mouse pointer will change to the Message cursor to show that you are about to create a message.

Move the cursor over the white hole and the mouse pointer will change to to indicate that you can click there.

Left-click and the "Choose a Message" dialog box will appear (as shown in the image to the right). Select the message Init_Msg and click "OK".

Selecting the Message Type

Now that you have selected which message is emerge from the white hole, you have to indicate where that message is to go.

The mouse pointer will have changed back to the Message cursor . Move the cursor over to the stem beneath the Customer Cus0 PE instance. When the cursor is over one of the "+" signs in the stem, the mouse pointer will change to to indicate that you can click there (as shown in the image to the right).

Indicating a Message Destination

When you left-click on the "+" sign, a Node will be added to the stem and the "Rule List" dialog box will appear (as shown in the image to the right). Select the rule insertCard and click "OK".

(Note: It's necessary to select a rule to activate since the Customer Cus0 PE has two different rules, either one of which can receive the Init_Msg message.)

Selecting a Destination Rule

After the insertCard rule has been selected, the sheet will update to appear as the image to the right.

The small white circle that has appeared to the lower right of the node where the Init_Msg message entered the Customer Cus0 PE represents the evaluation of the Action event of the insertCard rule.

This marker is displayed in white to indicate that a message was generated by the evaluation of the Action event.

The mouse pointer should be since we are still in Message Mode.

Move the mouse cursor over the Action event marker and the mouse pointer will change to to indicate that a message is available here. The name of the message (cardInserted) will also appear.

Left-click on the Action marker and move the cursor over to the stem under the ATM ATM0 PE. When the cursor is over one of the "+" signs in the stem, the mouse pointer will change to to indicate that you can click there (as shown in the image to the right).

When you left-click on the "+" sign, a Node will be added to the stem and the name of the receiving rule acceptCard appears.

Since in this case there is only one rule that is suitable for a cardInserted message, ProtoCollum selects it automatically and does not require you to pick it from a Rule List dialog box.

At this point, the Test Sheet should look like Figure ???. Save your work using the File>Save (or File>Save As...) menu item before we move on to adding the next message.

After Adding the First Message
Figure ?. After Adding the First Message

Adding the Second Message Instance

The insertion of the bank card was represented by a insertCard message moving from the Customer Cus0 PE to the ATM ATM0 PE. Similarly, the pressing of a "Cancel" button on our Simple ATM will be represented by sending of a pressCancel message in the same direction.

To add the second message instance, we need another White Hole for the message to originate from. Adding a new White Hole is very simple.

Click on the Whitehole Mode button on the tool bar. The mouse pointer will change to . Position the mouse pointer 2 cm below the first White Hole and left-click.

Your Test Sheet should look like the image to the right.

Since you already have experience in adding a message instance to a Test Sheet, we will summarize the steps for adding the second message instance in the following list. The process exactly parallels that used above to add the first message instance.

  1. Click on the Message Mode button on the toolbar.
  2. Left-click on the second white hole and the "Choose a Message" dialog box will appear.
  3. Select the message Init_Msg and click "OK".
  4. Left-click on one of the "+" signs of the stem beneath the Customer Cus0 PE instance. The "Rule List" dialog box will appear.
  5. Select the rule pressCancel and click "OK".
  6. Left-click on the Action marker that appears to the lower right of the node (which has the label pressCancel) and move the cursor over to the stem under the ATM ATM0 PE instance.
  7. Left-click on one of the "+" signs of the stem beneath the ATM ATM0 PE instance. A node with the label cancelOperation will appear.

At this point, the Test Sheet should look like Figure ???. Save your work using the File>Save (or File>Save As...) menu item before we move on.

After Adding the Second Message
Figure ?. After Adding the Second Message

Where to Go Next

???

Previous Chapter | Table of Contents | Next Chapter

Copyright © 2003-2005 by Bellum Software™
last updated on 10 August 2005