You can run component test launch configurations in a "headless"
workbench (with no user interface for the development environment). This can
be useful if you want to include component tests in an Ant script.
Before running component tests in headless mode:
- Your workspace must contain a valid test suite with at least one test
case.
- The component under test must be compilable.
- Agent Controller must be running on your machine in order to retrieve
test results. The Agent Controller is a daemon process that enables client
applications to launch host processes and interact with agents that coexist
within host processes.
- You must have a workspace containing one or more launch configurations
for component tests.
Note: You cannot run several headless workbenches on the same workspace
at the same time, nor can you use a headless workbench while an Eclipse graphical
user interface has locked the workspace.
To create and run an Ant script:
- Select .
- Enter build.xml as the name of the Ant script
and click Finish.
- Double-click the build.xml Ant script to open
the Ant editor.
- Enter the following content in the editor:
<?xml version="1.0" encoding="UTF-8">
<project name="MyTestProject" default="ComponentTestHeadless" >
<target name="ComponentTestHeadless">
<property name="eclipse_dir" value="D:\\eclipse"/>
<property name="workspace_dir" value="D:\\workspace"/>
<property name="options" value=" -onlyClient ComponentTest -reportDirectory ${workspace_dir}\\batch_report -fullreport -timeStampMode"/>
<exec executable="${eclipse_dir}/jre/bin/java" dir="${eclipse_dir}" vmlauncher="false">
<arg line="-Xj9 -Dorg.eclipse.emf.ecore.EPackage.Registry.INSTANCE=org.eclipse.emf.ecore.impl.EPackageRegistryImpl -cp ${eclipse_dir}/startup.jar org.eclipse.core.launcher.Main -application com.ibm.r2a.command.line.mode.CommandLineModeApplication -data ${workspace_dir} ${options}" />
</exec>
</target>
</project>
Note: This is an example Ant script
for Windows. For information on additional platform specific parameters, see
the related reference topic for component test headless mode.
- Replace the property values of eclipse_dir and workspace_dir with
the actual Eclipse installation directory and the workspace directory. Add
any additional options to the options property value. Use double quotes when the path contains spaces and double backslashes
(\\) instead of the backslash character. Here is an example: "C:\\Program
Files\\IBM\\Rational\\".
- Close the Ant editor.
- To run the Ant script, right-click the build.xml script,
select and click Run. This launches a new instance of the Eclipse environment in
headless mode, which will run the component test launch configurations located
in the specified workspace. You can also run the Ant script from a command
line by using the runAnt command.
The results of the test execution are generated in a report directory
located in the workspace.