3.8.4. Starting Java AUTs (Swing, SWT/RCP/GEF)
Prev | 3.8. Starting and configuring AUTs | Next

### 3.8.4. Starting Java AUTs (Swing, SWT/RCP/GEF)

#### 3.8.4.1. Two options to start Java AUTs

There are two options to start your Java AUT for testing:

Via an AUT configuration:

  This option means that you create an AUT configuration in your Project, and the AUT is started from the ITE (Section 3.8.4.2, “Configuring a Java AUT to be started from the ITE”).

Using the autrun command:

  This option lets you start an AUT without creating a configuration. Certain start parameters are required for the AUT so that it can be located (Section 3.8.4.6, “Starting Java AUTs with the autrun command”).

#### 3.8.4.2. Configuring a Java AUT to be started from the ITE

The AUT configuration dialog for Java has three different levels of detail: basic, advanced and expert.

See the sections below for information on the different levels.

#### 3.8.4.3. Basic Java AUT configuration

You can use the basic setting (Figure 3.13, “AUTconfiguration window: basic”) to configure your AUT if it can be started by an executable file (e.g. .bat, .exe, .cmd, .sh etc.) and if it is written in Java 1.5 or above, and you are using a Java Standard Edition JRE.

| If you are testing RCP or GEF AUTs, there are certain specific steps you need to take to configure them. See the sections on RCP testing (Section 4.3, “Testing RCP AUTs”), GEF testing (Section 4.4, “Testing GEF AUTs”) for details.

Figure 3.13. AUTconfiguration window: basic

1. Enter the basic configuration details as described earlier (Section 3.8.2, “Basic information required for every AUT configuration”).

2. Enter the executable file name in the Executable File Name field. This path can be relative if you define a working directory (Section 3.8.4.4, “Advanced AUT configuration”).

For information on the advanced properties for the AUT configuration, see the next section (Section 3.8.4.4, “Advanced AUT configuration”).

#### 3.8.4.4. Advanced AUT configuration

You can use the advanced dialog (Figure 3.14, “AUTconfiguration window: advanced”) to create a working directory for your AUT, and add command-line arguments needed to start the AUT. You can select a JRE executable and, for SWT/RCP AUTs, a keyboard layout.

Figure 3.14. AUTconfiguration window: advanced

1. Enter the JAR path (directory and file name) into the Executable JAR File Name field.

   This path can be relative (if you define a working directory (Section 3.8.3, “Using a working directory in an AUT configuration”)), or absolute. This JAR file must contain a manifest file which contains the main class and the classpath.

2. Enter any necessary command-line arguments for the AUT in the AUT Arguments field.

3. Browse to a JRE executable or add a new one by clicking ”New”. The Java version used must be 1.5 or later.

   Java is installed with the ITE. You can find the Java file in: Jubula-->jre-->bin. Use java.exe if you want to use a console, use javaw.exe if you do not want a console.

4. For SWT and RCP AUTs, select which keyboard layout is used on the machine on which the AUT will run.

   | The keyboard layout is not the actual keyboard attached to the computer, but is based on the regional language settings for the operating system.

   English (US) and German (DE) keyboard layouts are supported out-of-the box. If you want to use a different keyboard layout, see the Developer Manual for information on creating keyboard layouts.

For information on the expert properties for the AUT configuration, see the next Section 3.8.4.5, “Expert AUT configuration”.

#### 3.8.4.5. Expert AUT configuration

You can use the expert dialog (Figure 3.15, “AUTconfiguration window: expert”) to configure more detailed information about how the AUT should be started.

Figure 3.15. AUTconfiguration window: expert

1. Add any additional desired JRE Arguments.

2. Enter any required System Environment Variables, in the format ”<VARNAME>=<value>”, i.e. ”PATH=C:\”. Separate each variable with a new line by pressing »ENTER«.

   | Please be advised that ''embedding'' the contents of one variable into another is not supported at this time. That is, if you have a variable named FOO whose value is ”abc”, and set the value of a second variable BAR to ”%FOO%def”, the second variable will not contain ”abcdef”, but rather the exact text ”%FOO%def”, without evaluating it.

3. Select an activation method for your AUT. More information on AUT activation is available in the previous Section 3.8.1.1, “AUT activation”.

4. If you want to perform monitoring (code coverage (Section 3.28, “Working with code coverage with Java tests”) then select this from the combo box.

5. If you want the component at which an error occurs to get highlighted in the screenshot that is being taken, select the checkbox Component highlighting. (Not available for HTML AUTs)

#### 3.8.4.6. Starting Java AUTs with the autrun command

The autrun command can be used as an alternative to starting your AUT from the ITE. (i.e. with an AUT configuration (Section 3.8.1, “Configuring AUTs to be started from the ITE”)). It can only be used if your AUT is written in Java 1.5 or above, and you are using a Java Standard Edition JRE.

| The autrun command cannot be used for HTML or pure SWT AUTs.

The command allows you to start your AUT independently, on a machine where the AUT Agent is running. The ITE, when connected to this AUT Agent will then recognize the running AUT as a testable application.

To use the autrun command:

1. Ensure that the AUT Agent is installed on the machine where you will be starting the AUT.

2. Navigate to the server directory in the installation via the command line.

3. Start your AUT via the command line by entering autrun.exe under Windows or autrun under Linux then the following parameters:

   Detail | Parameter
   --- | ---
   -h | -h Gives parameter help
   -w, `--`workingdir | -w <directory> Enter the working directory for the AUT
   -a, `--`autagenthost | -a <hostname> Enter the hostname for the AUT Agent
   -p, `--`autagentport | -p <port number> Enter the port number for the AUT Agent
   -swing | If the AUT is a Swing AUT
   -rcp | If the AUT is an RCP AUT
   -swt | If the AUT is an SWT AUT
   -javafx | If the AUT is a JavaFX AUT
   -k, `--`kblayout | -k <en_US> Enter the keyboard layout for SWT/RCP AUTs
   -i, `--`autid | -i <ID> Enter the ID to give to this AUT
   -e, `--`exec | -e <AUT.exe> Enter the executable file for the AUT This must be the last parameter in the command line
   -g, `--`generatenames (optional) | -g <true/false> For RCP AUTs, enter whether to generate technical names. (Section 3.7, “Defining applications under test (AUTs)”)

   Table 3.1. Parameters for autrun command

| If your AUT is an RCP AUT, use -data'<WORKSPACE>' after the executable file to specify the workspace the AUT should use.

#### 3.8.4.7. Creating an AUT definition from a running AUT

Once you have started an AUT using the autrun command, you can automatically generate an AUT definition (Section 3.7, “Defining applications under test (AUTs)”) for this AUT:

- In the Running AUTs View, select the AUT you want to define (it will be marked as an unknown AUT ID).

- Select:

  Create AUT Definition

  from the context menu.

- The AUT definition window will appear. Complete the dialog (Section 3.7, “Defining applications under test (AUTs)”) and click ”OK”.