You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matthew Adams <ma...@matthewadams.me> on 2012/03/11 19:18:21 UTC

How do you specify that only a given execution id of the surefire plugin should run?

Hi all,

Familiar problem:  I've got TestNG & JUnit4 tests in the same project,
and I'm employing the strategy described at

http://blog.matthewadams.me/2012/03/running-testng-junit-4-tests-in-same.html

which appears to be common around these here parts.  Bear with me as I
lead up to my problem.

If I want to run a single test, easy enough:
mvn clean test -Dtest=BlahTest

Problem is, if "BlahTest" isn't defined among the tests in all
executions, I get an error stating that there were no tests and I
should use -DfailIfNoTests=false.  Ok, fair enough:
mvn clean test -Dtest=BlahTest -DfailIfNoTests=false

A little extra typing, but I can live with that when running a test.
Now, I want to **debug** BlahTest and only want the debugger to launch
for the execution that includes BlahTest.  Seems straightforward, but,
problem is, surefire pauses waiting for the debugger to attach on
**every** execution.

Question:  how to I specify that only a given surefire execution id is
to be run?  Please don't tell me to use profiles; I'm hoping for a
more lightweight solution than that...  ;)

Thanks,
Matthew

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How do you specify that only a given execution id of the surefire plugin should run?

Posted by Kristian Rosenvold <kr...@gmail.com>.
This is undocumented, un-intentional and mostly un-nice.

Run with forkMode=always, and surefire will only fork when there are
tests to run.

Kristian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org