On 12/06/2012 11:16 PM, Rizzo, Eric
wrote:
Does Tycho automatically run surefire on any projects that
use the eclipse-test-plugin packaging type? It appears so, as I
have just added the plugin-test projects to my new Tycho build
and I'm getting surefire test failures without having added any
configuration at all for surefire.
Yes, it does automatically run tycho-surefire-plugin on
eclipse-test-plugin
Related question: our product has numerous different
plugin-test projects. Does Tycho require that I configure the
pom of each of them if I need to, for example, specify special
VM parameters? Or is there some way to configure all tests in
one place without duplicating that in many poms?
It depends on the attribute you want to override. Some can be
configured simply by setting a value of a property (that is used
later by tycho-surefire-plugin), some other need to be set in the
tycho-surefire-plugin <configuration/>
System properties don't have a matching Maven property (see
http://www.eclipse.org/tycho/sitedocs/tycho-surefire/tycho-surefire-plugin/test-mojo.html#systemProperties
has no "_expression_"), si you'll need to define the
tycho-surefire-plugin <configuration/> tag.
I advise you put this configuration in the parent pom of your tests,
and use a property such as ${tycho.surefire.systemProperties} to set
the value in the <configuration/>. You can set it to a default
value in this definition, and children pom can override. This will
affect tycho-surefire-plugin without so many lines of configuration.
On a more general note, I'm looking for a comprehensive
example or guide for running JUnit tests for an RCP product
build. The examples I've seen so far don't account for the fact
that a product has special context that needs to be satisfied
for the tests to run. For example, some of our tests require
that Equinox DS plugin be auto-started with a start level to
make sure declared services are available before the test is
executed. There are other requirements for our product, which is
why we have a detailed launch configuration for executing the
tests from within the IDE. I guess what I need is some help
converting that launch configuration (and the custom TestSuite
it uses to collect tests) into an appropriate Tycho
configuration.
Tycho currenly allows testing at test-plugin level. There is an
issue open to request execution of tests with Tycho on a
fully-provisionned RCP application:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=386988 .
If it comes to orchestrating your tests on an RCP app, I think the
best way to achieve it so far is to use the legacy mechanism to run
tests headless (ie install your tests into your product and then run
the uitestapplication).
Here is an example of how to achieve this in the context of SWTBot
http://wiki.eclipse.org/SWTBot/Automate_test_execution#On_an_already_packaged_RCP_application
|