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

Reply via email to