Run tests by using an Ant task
You can execute tests by using the IBM® Rational® Integration Tester Ant
tasks.
You can create the task in one of two ways:
- You can create a custom script.
- You can automatically generate a script. See Generating Ant scripts to run tests.
To create a custom script, open a text file and define the Ant
task, as in the following example:
<taskdef classname="com.ghc.ghTester.ant.GHTester" name="IntegrationTester" classpathref="rittasklib">
Here is an example of the syntax:
<IntegrationTester environment="MyEnvironment" haltOnFailure="true" project="${basedir}\MyProject.ghp" resultsServerLogging="absolute">
<Tests>
<filelist dir="${basedir}">
<file name="MyProject/MakeBooking/MakeBooking"/>
<file name="MyProject/MakeBooking/Empty Test"/>
</filelist>
</Tests>
<AppProperties>
<property name="greenhat.net.defaultnetworkdevice" value="\Device\NPF_{49ACBD55-A866-47E4-AD87-ECF3A7FE49AB}"/>
</AppProperties>
<AdditionalOptions>
<option name="-overrideSlowFail" value="ON" />
</AdditionalOptions>
</IntegrationTester>
Table 1 lists the attributes and
child elements that can you can use to define an Ant task for running
a test. Attribute/Child element | Description | Required |
---|---|---|
Tests | The full path (within the project) of the test resources <res_1>...<res_n> to be executed. | Yes |
AppProperties | A collection of system properties to use during test execution. | No |
environment | The name of the Rational Integration Tester environment to use when the test items are executed. | Yes |
project | The full path to the Rational Integration Tester project file that contains the specified environment and test resources. | Yes |
resultsServerLogging | The option for how the Results Server URL for
executed items is written to the console. The following options are
available:
|
No, default is absolute |
junitDir | Indicates that JUnit reports should be generated for all suites being executed and that the reports should be placed in the specified folder. A full path to the folder is required. The path can include the ${basedir} variable to refer to the directory in which the ant script is running. For more information on the format of the output file, see JUnit style output. | No, default is not to generate JUnit reports. |
securityToken | The value of the security token to use for authentication with IBM Rational Test Control Panel when domain security is enabled. For more information, see Domain level security. | No, default is to send no token. |
haltOnFailure | If the IntegrationTester Ant task fails, the
Ant script will also fail when this flag is set to true. Note: If
you are executing Ant with -verbose or -debug and
the flag is set to true, a failure will result in a Java exception
stack being output.
|
No, default is false. |
failureProperty | The name of a property that is set in the event of a failure. | No |
AdditionalOptions | A collection of options that are supported by the RunTests executable but are not defined as attributes of the IntegrationTester Ant task. | No |
option | A child element within the AdditionalOptions element.
Each option element includes the following attributes:
|
No |