3.31.4. Observing tests in Java AUTs
Prev | 3.31. Observing Test Cases | Next

### 3.31.4. Observing tests in Java AUTs

| If you have not already done so, we recommend reading the tips section for the observation mode before beginning observing (Section 3.31.2, “Tips and tricks for using the observation mode”).

1. In Java AUTs (Swing and SWT/RCP, but not GEF components in RCP) the observation mode will automatically record your actions in the user interface. Each action is created as a Test Step in the Test Case Editor for this observed Test Case.

   | See the section later on performing check actions in the observation mode (Section 3.31.4.2, “Performing checks in the Java observation mode”).

2. You can also see which actions have been recorded in the console (Figure 3.39, “The observation console”).

   Figure 3.39. The observation console

   | If you are creating tests for SWT and RCP AUTs, check that you have set the keyboard layout correctly in the Project properties (Section 3.8.4.4, “Advanced AUT configuration”) and that you have defined the right toolkit for the Project (Section 3.6.3.2, “Changing the toolkit settings for a Project”).

3. Component names for your components are automatically generated and assigned to the technical names from the AUT when you observe Test Steps. If you have already created and mapped a component name for a technical component, this name will be used instead of creating a new one.

4. Once you have recorded the actions you need, stop the observation mode by clicking on the ”stop observing Test Case” button on the main toolbar.

5. Save the Test Case editor containing the Test Steps you have just observed.

6. Check the Test Steps and their parameter values which have been recorded. You will notice that any text that contains non-alphanumeric characters is enclosed in single quotes. Single quotes are used to cancel any meaning of the characters within the quotes.

   | Run the test that you have just recorded to see if it works as you intended. If not, you may need to make some changes to the parameter values, or you may have to supplement the Test Case with Test Cases from the library (Section 3.12.3.1, “Using the library to create tests”).

#### 3.31.4.1. Actions that cannot be recorded

A few actions cannot be recorded in the current version. These include:

- Key combinations that are used as shortcuts in SWT applications.

- Click counts on trees. The select actions are correctly recorded, but the click count is set to 0 and must be manually adjusted.

- Components that contain texts that are too long (more than 3999 characters).

- Actions on native dialogs e.g. file choosers.

- Actions in the figure canvas for GEF components.

#### 3.31.4.2. Performing checks in the Java observation mode

You can perform checks in the observation mode by taking the following steps:

1. Start the check mode by pressing »CTRL+SHIFT+F11«. This key combination can be changed in the preferences (Section 3.29.9, “Observation mode preferences”).

2. In the observation console, the check mode will be marked as on.

3. In the AUT, components will be highlighted with a red border (Figure 3.40, “Red borders in the check mode”).

   Figure 3.40. Red borders in the check mode

   | While the check mode is active, no other actions will be recorded.

4. Hover over the component you want to execute a check on and press »CTRL+SHIFT+F12«. This key combination can be changed in the preferences (Section 3.29.9, “Observation mode preferences”).

5. A dialog will appear showing the type of component you are performing the check on.

6. From the dialog, select the check action you want to perform and enter any parameters the check action needs. Many check actions have predefined parameters based on the state of the AUT.

7. When you have specified your check action, choose whether you want to close the dialog and continue in the check mode (check on) or whether you want to stop the check mode when the dialog closes (stop checking).

   | You can manually stop the check mode using the same key combination as you used to start the check mode (»CTRL+SHIFT+F11« by default).

8. The check action you specify will be added to the Test Case Editor.