Last updated: March 2, 2011
Description
This document describes how to run Eclipse JUnit plugin tests from the command line using Eclipse SDK JUnit test plug-ins 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:
JUnit Support in Eclipse
Testing Eclipse Plug-ins with JUnit
Requirements
eclipse-Automated-Tests-<buildId>.zip
from an Eclipse build (http://download.eclipse.org/eclipse/downloads/).
This ZIP contains this document, scripts to run the tests, the test framework plug-ins and the JUnit test plug-ins.Setup
eclipse-testing
.test.xml
file with the information described below:
Running Tests
From a command prompt or terminal:
cd
to the eclipse-testing
directoryruntests -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.
Parameter | Description |
-os <operating system> | The OS the tests are being run on. One of: aix, hpux, linux, macosx, solaris, win32. Default win32 |
-ws <windowing system> | The windowing system the tests are being run on. One of: cocoa, 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. |
-properties | 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. |
-vm | 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. |
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, 1.5 and 1.6 JREs required) | Runs all the targets below. Default. |
ant | org.eclipse.ant.tests.core |
antui | org.eclipse.ant.tests.ui |
compare | org.eclipse.compare.tests |
coreexpressions | org.eclipse.core.expressions.tests |
coreresources | org.eclipse.core.tests.resources |
coreruntime | org.eclipse.core.tests.runtime |
coretestsnet | org.eclipse.core.tests.net |
equinoxsecurity | org.eclipse.equinox.security.tests |
filebuffers | org.eclipse.core.filebuffers.tests |
jdtapt (JRE 1.5 required) | org.eclipse.jdt.apt.tests | jdtaptpluggable (JRE 1.6 required) | org.eclipse.jdt.apt.pluggable.tests |
jdtcompilerapt (JRE 1.6 required) | org.eclipse.jdt.compiler.apt.tests |
jdtcompilertool (JRE 1.6 required) | org.eclipse.jdt.compiler.tool.tests |
jdtcorebuilder (JRE 1.5 required) | org.eclipse.jdt.core.tests.builder |
jdtcorecompiler (JRE 1.5 required) | org.eclipse.jdt.core.tests.compiler |
jdtcoremodel (JRE 1.5 required) | org.eclipse.jdt.core.tests.model |
jdtcoreperf | org.eclipse.jdt.core.tests.performance |
jdtdebug | org.eclipse.jdt.debug.tests |
jdttext | org.eclipse.jdt.text.tests |
jdtui | org.eclipse.jdt.ui.tests |
jdtuirefactoring | org.eclipse.jdt.ui.tests.refactoring |
jface | org.eclipse.jface.text.tests |
jfacedatabinding | org.eclipse.jface.tests.databinding |
ltkcorerefactoringtests | org.eclipse.ltk.core.refactoring.tests |
ltkuirefactoringtests | org.eclipse.ltk.ui.refactoring.tests |
osgi | org.eclipse.osgi.tests |
pdeapitooling (JRE 1.5 required) | org.eclipse.pde.api.tools.tests |
pdebuild | org.eclipse.pde.build.tests |
pdeui | org.eclipse.pde.ui.tests |
relEng | org.eclipse.releng.tests |
swt | org.eclipse.swt.tests |
teamcore | org.eclipse.team.tests.core |
teamcvs | org.eclipse.team.tests.cvs.core |
text | org.eclipse.text.tests |
ua | org.eclipse.ua.tests |
ui | org.eclipse.ui.tests |
uieditors | org.eclipse.ui.editors.tests |
uiforms | org.eclipse.ui.tests.forms |
uinavigator | org.eclipse.ui.tests.navigator |
uiperformance | org.eclipse.ui.tests.performance |
uircp | org.eclipse.ui.tests.rcp |
uiviews | org.eclipse.ui.tests.views.properties.tabbed |
uiworkbenchtexteditor | org.eclipse.ui.workbench.texteditor.tests |
update | org.eclipse.update.tests.core |
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) |
hpux | motif | PA_RISC |
linux | gtk | x86 |
linux | gtk | x86_64 |
macosx | carbox | ppc |
macosx | cocoa | x86 |
macosx | cocoa | x86_64 |
solaris | gtk | sparc |
solaris | gtk | x86 |
solaris | motif | sparc |
win32 | win32 | x86 |