Search code examples
juniteclipse-pluginmavenheadlesstycho

Headless integration tests of an eclipse plugin with maven tycho


I wrote some Junit tests for my eclipse plugin. If I start my test suite as a "JUnit Plug-in Test" from Eclipse, everything is working fine. Now I want to run them from Maven Tycho.

So I put the following packaging : "eclipse-test-plugin", in the pom.xml and the integration tests start with a "mvn clean integration-test". So I think my maven configuration is quite OK.

But some tests are failing, and I suspect the headless build can't detect the IMarkers my tests are trying to detect, since IMarkers are UI components.

Am I right? Any idea to get my tests based on IMarkers running with Tycho?


Solution

  • You need to tell test plugin that you want to run the test with a UI, by default it will run with the headless runner.

    <plugin>
      <groupId>org.eclipse.tycho</groupId>
      <artifactId>tycho-surefire-plugin</artifactId>
      <configuration>
        <useUIHarness>true</useUIHarness>
        <useUIThread>true</useUIThread>
      </configuration>
    </plugin>