last updated: May 18, 2006
This document describes how to run Eclipse JUnit plugin tests from the command line using Eclipse SDK JUnit test plugins and a testing framework. This method of running tests is intended for anyone who wishes to automate their testing process or reproduce the testing mechanism used in Eclipse builds by the Eclipse Platform Release Engineering team.
Click here for a description of the testing framework, and how it can be used outside of the setup described here.
If you simply wish to write and run JUnit tests interactively from an Eclipse workbench, try one of the links below:
Support in Eclipse
1. All test machines will require 1.4 and 1.5 java runtime environments installed to run all tests. See test targets
for details on which tests require a 1.5 level jre. All other tests can be executed with either jre levels.
2. A properties file containing the following key-value pair: J2SE-5.0=<path to 1.5 java executable>. On Windows, the path must be enclosed with double quotes if it contains any space characters,
i.e. J2SE-5.0="c:/program files/jdk1.5.0/jre/bin/java"
3. Info-ZIP UnZip version 5.41 or later installed and added to the path.
4. The Automated Test feature from an Eclipse build (http://www.eclipse.org/downloads/index.php). This contains scripts to run the tests, the test framework plugins and the JUnit test plugins.
5. An Eclipse SDK distribution (http://www.eclipse.org/downloads/index.php) to test. Usually you will want to test a particular Eclipse build using a matching Automated Tests feature.
To run the Team CVS tests you will need extssh access to a CVS repository. The tests create a lot of junk modules and tags so you will want to keep the test repository seperate from your development repository. While it is not necessary to clean up the repository between each Team test run you will probably want to clean it up periodically.
1. Extract the eclipse-Automated-Tests-<buildid>.zip or tar.gz. On Window, extract
this file close to the root of the drive to prevent some path names from exceeding
the 255 character limit. This will create a top-level directory "eclipse-testing".
2. Place the Eclipse SDK distribution to test in the eclipse-testing directory. Do not extract this file as the test scripts will take care of this.
3. To run the Team CVS tests, edit the test.xml script to provide connection information.
Replace the following strings in the "teamcvs" target of the test.xml file with the information described below:
These values are used at test time to automatically replace strings in org.eclipse.team.tests.cvs.core/repository.properties. For more information on how this file is used in the team CVS tests, click here.
From a command prompt or terminal:
1. cd to the eclipse-testing directory
2. Execute the following script:
runtests -properties <path to properties file> [-os <operating system>] [-ws <windowing system>] [-arch <architecture>] [-noclean] [-vm <path to java executable>][-Dtest.target=performance][targetname1 targetname2 targetname3 etc...]
All parameters and targets are optional on windows systems with the exception of "-properties". On *nix systems, the os, ws and arch parameters must be specified in addition to the -properties parameter.
The JUnit test results are produced in individual xml files for each test plug-in with a test.xml. These results are copied to the eclipse-testing\results\xml directory. These results can be converted into html by running the "genHtml" target as described in the table below. Please be aware that "Build Successful" printed to the console is NOT indicative of tests passing.
|-os <operating system>||The OS the tests are being run on. One of: aix, hpux, linux, macosx, qnx, solaris, win32. Default win32|
|-ws <windowing system>||The windowing system the tests are being run on. One of: carbon, motif, gtk, photon, win32. Default win32|
|-arch <architecture>||The architecture the tests are being run on. One of: ppc, PA_RISC, x86, sparc. Default x86|
|-noclean||Run tests without installing a clean Eclipse (in "test-eclipse") between test targets. Default is to delete an existing test-eclipse directory and re-extract the Eclipse distribution between test targets.|
As per requirements noted above, this is used to reference a properties file containing additional Ant properties
used in running tests.Can be used to pass additional vm arguments to the
Java virtual machine running the tests by adding the entry "extraVMargs=<the
args to pass to the vm>" to the specified properties file.
The path must be enclosed in double quotes if it contains spaces. This key-value pair is required to run JUnit plug-in tests that require a 1.5 level jvm.
When runtests is executed, two instances of eclipse are started: one to invoke the org.eclipse.ant.core.antRunner application to run a test.xml script in a test plug-in (outer instance) and another in which the JUnit tests are being executed (inner). By default, both will use the java executable on the system path. The -vm property is used to specify an alternate java executable.
For example, "-vm c:\jdk142\jre\bin\java".
|-Dtest.target=performance||Runs the performance target only in each test plug-in's test.xml. When running tests on Windows, enclose this parameter in double quotes, ie. runtests "-Dtest.target=performance".|
|targetname1 targetname2 targetname3 etc..|
Replace with a list of test targets to execute (space delineated). Each corresponds to an Ant target in the eclipse-testing/test.xml script.
Appendix A - Test Targets
Ant targets in the main test.xml which execute tests. Typically each corresponds
to the execution of a test plug-in's test.xml.
|Target name (special jvm requirements)||Description / test plug-in|
|all (1.4 and 1.5 JREs required)||Runs all the targets below. Default.|
|jdtapt (1.5 JRE required)||org.eclipse.jdt.apt.tests|
|jdtcorebuilder (1.5 JRE required)||org.eclipse.jdt.core.tests.builder|
|jdtcorecompiler (1.5 JRE required)||org.eclipse.jdt.core.tests.compiler|
|jdtcoremodel (1.5 JRE required)||org.eclipse.jdt.core.tests.model|
Appendix B- Supported os, ws, and arch value combinations
The following table contains the values that can be used with the -os, -ws, and -arch switches.
|Operating System (os)||Windowing System (ws)||Architecture (arch)|