Running component tests from a command line

You can run component test launch configurations in a "headless" workbench (with no user interface for the development environment) from a command line interface.

Before running component tests in headless mode: The development environment does not need to be running.
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 run component test in a headless workbench, you launch the command line mode application using the command <eclipse_dir>/jre/bin/java <virtual machine options> -cp <eclipse_dir>/startup.jar org.eclipse.core.launcher.Main <command line mode options> <eclipse options>, along with your product configuration.

You might need to append additional parameters to the commands, depending on your operating system configuration. The parameters for launching the workbench in your environment are located in the system configuration details under System properties in Help > About > Configuration Details, where:
  • <virtual machine options> are located under the eclipse.vmargs property.
  • The main Eclipse options are located under the eclipse.commands property, to which you add the workspace path using the Eclipse token -data.
  • <command line mode options> refers to command-line mode options. See the reference section for more information.
To run component tests in a headless workbench:
  1. Open a command line window or shell
  2. Enter the correct command line for your environment. For example:
    • For Windows: <eclipse_dir>/jre/bin/java -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 -onlyClient ComponentTest -data <workspace_dir> -reportDirectory <workspace_dir>/report
    • For Linux: <eclipse_dir>/jre/bin/java -Xj9 -Dorg.eclipse.swt.browser.internal.flash -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 -os linux -ws gtk -plugincustomization <pluginCustomizationPath> -data <workspace_dir> -reportDirectory <workspace_dir>/report -onlyClient ComponentTest

    In these examples:
    • -Xj9 -Dorg.eclipse.swt.browser.internal.flash -Dorg.eclipse.emf.ecore.EPackage.Registry.INSTANCE=org.eclipse.emf.ecore.impl.EPackageRegistryImpl corresponds to the virtual machine arguments that are required by the workbench.
    • -data <workspace_dir> -plugincustomization <pluginCustomizationPath> corresponds to the required Eclipse arguments.
    • The other arguments are related to the application for command-line mode.
  3. Replace <eclipse_dir> with the path to the Eclipse directory. This Eclipse directory must be the Eclipse directory located in the project root directory. 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\\".
  4. Replace <workspace_dir> with the path to the workspace directory.
  5. Add any additional options to the end of the command line. For information on optional parameters, see the related reference topic for component test headless mode.
  6. Press Enter.
The results of the test execution are generated in a report directory located in the workspace.
Note: In some environments the length of a command line might be limited. If you encounter errors due to a truncated command line, try replacing parts of the command with variables.
Related concepts
Headless execution of component tests
Related reference
Component test headless mode reference
Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.