See also: Component Builds
Testing With Tycho + Maven
These instructions are a work in progress and therefore subject to change. Please report problems as a JBIDE Build/Releng JIRA.
In parent/pom.xml, search for maven-osgi-test-plugin and look for the list of valid test class patterns:
These are the classfiles that the Tycho/Maven test runner will find and run - be sure to name your test classes to match the patterns above, and framework classes you do not want to run so they do not.
In your pom.xml files, setting the following packaging type tells Tycho to run tests within this plugin:
NOTE: If you have a plugin used by your tests but which does not contain test classes - just shared framework code - then place that test-related plugin in
tests/, and set its packaging type thus:
In your test plugins' MANIFEST.MF files, be sure to add the dependencies for junit3, junit4, or swtbot, as appropriate. This will ensure Tycho knows what type of test to run.
Ensure that your test plugins are contained within a test feature, and that those features are aggregated into the features/pom.xml file.
To run your tests, you can simply build your component and its included tests will be run, provided they are aggregated into the overall build reactor. Because Maven builds using relative path aggregation, you can simply run:
cd ~/trunk/common/tests; mvn clean install
You will therefore build and run all the test plugins that are contained in that folder's pom.xml.
- Alternatively, you can build a component's plugins, features, tests, and update site all in one step by building from that component's root folder's pom.xml:
cd ~/trunk/common; mvn clean install
- To disable running tests (in this case, when rebuilding only a single plugin):
cd ~/trunk/common/tests/org.jboss.tools.common.model.ui.test; mvn clean install -Dmaven.test.skip=true
If you have classes in your test plugins which look like tests, but are in fact abstract or framework classes and should not be run as tests, you have two options to exclude them:
1. Rename them so they don't match the default pattern of included tests in the parent pom.xml:
2. Or, add special includes/excludes to your test plugin's pom.xml (or its container pom):
To be able to debug / step through your tests, you can attach a debugger to the running Tycho/Maven build. Here's how.
Testing With PDE "uberbuilder" :: Deprecated
When running tests via the PDE "uberbuilder", you must explicitly define which suites and classes to run, as well as the type of test (console, ui, swtbot) to run.