i know how to run Junit test class:
mvn test -Dtest=classname
but when i tried to run a single unit test method as follows:
mvn test -Dtest=classname#methodname
i always get the error: that no test were executed
References:
http://maven.apache.org/plugins/maven-surefire-plugin/examples/single-test.html http://stackoverflow.com/questions/1873995/run-a-single-test-method-with-maven
please advise why my test method is not getting execusted, i am using maven 2 and junit 4.7 .
The syntax above is only supported for Maven Surefire version 2.7.3+
Make sure you're using the correct version of the plugin.
There is an issue with surefire 2.12. This is what happen to me changing maven-surefire-plugin from 2.12 to 2.11:
mvn test -Dtest=DesignRulesTest Result: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project pmd: No tests were executed!
mvn test -Dtest=DesignRulesTest Result: [INFO] --- maven-surefire-plugin:2.11:test (default-test) @ pmd --- ... Running net.sourceforge.pmd.lang.java.rule.design.DesignRulesTest Tests run: 5, Failures: 0, Errors: 0, Skipped: 4, Time elapsed: 4.009 sec
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With