Java Mailing List Archive

http://www.java2.5341.com/

Home » Maven Users List »

Surefire plugin - Activate properties/profiles based on test results?

Matt Steele

2008-10-04

Replies: Find Java Web Hosting

Author LoginPost Reply
I'm currently migrating an Ant script to Maven. In Ant, we have a phased
JUnit build set up:

First, run environment checks. If those pass, run system/integration and
unit tests. Otherwise, run only unit tests.

We're accomplishing this using a junit task which toggles a flag on tests
failure using "failureproperty":
<!-- environment checks -->
 <junit dir="${basedir}"
      printsummary="no"
      fork="true"
      forkmode="once"
      failureproperty="environmentchecks.failed"
      errorproperty="environmentchecks.failed">

Inside the second junit task, particular filesets only are tested if the
environmentchecks.failed property is absent:
  <batchtest todir="${junit.xml.dir}"
unless="environmentchecks.failed">
    <fileset refid="system.tests" />
  </batchtest>

I'd like to do the same with Maven. I think activating a profile with
surefire plugins specifically configured for system/integration tests will
work, but I need a way to activate the profile, based on the Surefire
plugin's result. A "failureproperty" which either toggles a property, or
activates a profile, would do the trick, but I don't see anything similar
to this in the Surefire docs.

Is there any way to accomplish this task using Surefire?

Thanks,
Matt Steele
©2008 java2.5341.com - Jax Systems, LLC, U.S.A.