Testing the ATM package content

The purpose of the tests is to validate the scenario wherein someone deposits some money on his account from an ATM. This requires to identify his credit card and to initiate communication with the bank network. In this scenario, the system under test (SUT) is the BankATM component. Other required components are emulated thanks to test components.

To specify tests involving elements of the ATM package, you only have to:

  1. right click on the ATM package and select the Create a Test Package command. The ATMTest package and diagram are created;

  2. right click on the ATMTest package and create two test components that will appear in the ATMTest Diagram:

  3. Name the former HWEmulator. From the diagram, add it a port named hwCom and attach the IHardware provided interface and the IATM required interface,

  4. Name the latter BankEmulator. From the diagram, add it a port named bankCom and attach the IBank provided interface; After this step, you should have something like on the Content of the ATMTest package .Figure 20. Next,

Figure 20: Content of the ATMTest package.

  1. right click on the ATMTest package to create a test context. Name it ATMSuite. Open the related TestContext diagram. It shows the generated internal parts of the test context. You can connect these parts with links to refine the internal structure (cf. Figure 21) but it is not mandatory for the following;

Figure 21: Internal parts of ATMSuite.

  1. right click on ATMSuite to create a test case. The wizard will be opened;

  2. name the test case invalidPIN and describe the test case objective, e.g. “Verify that if a valid card is inserted, and an invalid pin-code is entered, the user is prompted to re-enter the pin-code.”;

  3. click OK to validate the wizard content;

  4. specify the sequence of synchronous and asynchronous messages of the test case by filling the sequence diagram the same way as on the Figure 22;

Figure 22: Specification of the invalidPIN test case.

  1. To specify the start and stop timer actions as well as the validation action, first add a state invariant on the diagram; then apply the related stereotype:

  2. select the state invariant,

  3. select the “Annotations” tab,

  4. click “Add stereotype”,

  5. select the stereotype you want to apply and validate (cf. Figure 23);

Figure 23: Menu for adding a stereotype.

  1. To show the stereotype icon, right-click on the state invariant and proceed to the option like on the Figure 24;

  2. To specify the duration constraint {0..3}, select the constraint icon from the diagram palette and attach it to the isPinCorrect synchronous message. To do so, you click first on the ‘Synchronous message’ arrow, secondly on the ‘Reply message’ arrow and finally somewhere on the diagram where the constraint should appear.

Figure 24: Menu for showing the stereotype icon.

image026.png (5.22 KB) admin admin, 10 October 2014 16:40

image025.png (7.7 KB) admin admin, 10 October 2014 16:40

image028.jpg (42 KB) admin admin, 10 October 2014 16:40

image027.jpg (28.2 KB) admin admin, 10 October 2014 16:40

image029.jpg (38.3 KB) admin admin, 10 October 2014 16:40