Is it possible to configure tycho-surefire to run in the test phase?
Asked Answered
E

1

7

I haven't done a lot with Maven, but I understand the basics. We're using Tycho to build RCP plugins and I'm wondering why Tycho uses the integration-test phase to execute the tests in a bundle.

Is it possible to bind some types of tests to the test phase of Maven for Tycho instead of the integration-test phase?

If so, how?

Estelleesten answered 25/2, 2015 at 14:43 Comment(2)
It should be possible, can you show the relevant parts of your pom.xml?Strap
@Behe: For Tycho users, it is pretty obvious that this question is about Tycho's eclipse-test-plugin packaging type.Mudcat
M
11

Tycho executes tests in an OSGi container, and this requires that the compiled classes are already packed as OSGi bundles. Packing only happens in the package phase, so the tests need to be executed later. Therefore, the tycho-surefire-plugin by default executes tests in the integration-test phase.

If you can run your tests as "JUnit Test" in Eclipse (instead of as "JUnit Plug-in Test"), then your code and none of your dependencies require an OSGi container. In this case, you may also be able to run the tests with the maven-surefire-plugin. This plugin by default runs in the test phase. I've found this blog that describes the configuration which is necessary to do this.

Mudcat answered 26/2, 2015 at 9:9 Comment(2)
Thank you, this makes sense. This leaves me with another question however. Does it matter whether you run unittests as plugin unittests (by that I mean let tycho execute them) or as regular unittests(let them be executed in the test phase without OSGi packaging)? As in. Could I run unittests used to test code in a certain plugin, in the test phase, without that causing any trouble (in terms of not covering certain functionality or otherwise)? I'll mark this as the answer. Though I would like to know if this can be done without side-effects.Estelleesten
This really depends on your code - but you can just try it out. If your tests still pass, then probably don't need OSGi.Mudcat

© 2022 - 2024 — McMap. All rights reserved.