2.4.1. Sample 1: using the Swing Simple Adder

You can start the Swing SimpleAdder using the configurations for the SimpleAdder AUT. For Windows and Linux, you can choose whether you want to use the JRE installed with the ITE or your system JRE. Mac users can use the Mac configuration to start the SimpleAdder with their default Java version.

2.4.1.1. Sample 1.1: creating a Test Case from Test Steps

This category contains one Test Case. The Test Case contains four Test Steps, which test an addition in the Simple Adder. The parameter values in the Test Steps have been referenced, and a data set has been added.

This is an example of a test written with Test Steps. However, we recommend using the library of Test Cases to write tests, as shown in the next examples.

2.4.1.2. Sample 1.2: creating a Test Case using the library

This category contains one Test Case. The Test Case has referenced another Test Case, with four reused Test Cases, which have been reused from the Project unbound_modules_concrete.

Press »F6« to find where a particular Test Case was originally specified.

The Test Cases carry out the same steps as in the previous example (Section 2.4.1.1, “Sample 1.1: creating a Test Case from Test Steps”). The differences here are:

  • The steps to enter a value both reuse the same Test Case, with different referenced parameters, and a different component name.

  • The components used in the reused Test Cases are abstract components (Section 3.15.9, “Understanding the component hierarchy”). This means that the Test Cases are easier to reuse, making tests more robust and maintainable.

This Test Case is reused in the executable Test Case 1.2_SIMPLE_ADDER_TEST, which is nested in the Test Suite of the same name.

2.4.1.3. Sample 1.3: using Event Handlers

This category has four subcategories. Each subcategory contains a test which reuses a Test Case to execute a calculation in the Simple Adder which will cause an error. After the error, a reset is carried out.

An Event Handler has been specified in the bound_modules_samples Project. The Event Handler has been added to the Test Case, and checks that text in the result field is jackpot.

The four tests are as follows:

Continue
The Event Handler in this test has the reentry property continue. When the error occurs, the Event Handler is activated. Once the check has been carried out, the test continues, and the reset is performed.

Exit
The Event Handler in this test has the reentry property exit. When the error occurs, the Event Handler is activated. Once the check has been carried out, the test finishes. The reset is not performed.

Pause
The Event Handler in this test has the reentry property pause. When the error occurs, the Event Handler is activated. Once the check has been carried out, the test pauses. By un-pausing the Test Suite in the client, the test continues.

Retry
The Event Handler in this test is different to the Event Handler in the other tests. It contains the same steps as the test itself, but the parameter references have been switched. This essentially changes the order in which the numbers are entered into the Simple Adder. The Event Handler has the reentry property retry. When the error occurs, the Event Handler is activated. The calculation is redone with the switched values. The failed Test Step (i.e. the original check) is retried, and there is no error. The test is marked as successful.



Copyright BREDEX GmbH 2015. Made available under the Eclipse Public License v1.0.