Maven2 Surefire test plugin
Usages
Section titled “Usages”This plugin is used when you run mvn test.
There are special command line parameters you can use:
Skipping tests
Section titled “Skipping tests”You should be running a full suite of tests each time, but on occasions where you want to skip
it, add -DskipTests system property to the command line
Running a single test
Section titled “Running a single test”Use the test system property. e.g. add -Dtest=MySingleTest. This is helpful when you want to test a
single test instead of all tests.
Running a test in debug mode
Section titled “Running a test in debug mode”Use the maven.surefire.debug system property to tell mvn to wait for a debugger to remotely attach to
your test JVM.
e.g. To debug a single test, your command might look something like:
mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5008" -Dtest=HardToDiagnoseTest testMaven will pause until you connect your debugger to the maven JVM. I’ve used this when tests are failing in maven but pass in the IDE.