I know you can run all the tests in a certain class using:
mvn test -Dtest=classname
But I want to run an individual method and -Dtest=classname.methodname doesn't seem to work.
Thanks -Bill
I know you can run all the tests in a certain class using:
mvn test -Dtest=classname
But I want to run an individual method and -Dtest=classname.methodname doesn't seem to work.
Thanks -Bill
To my knowledge, the surefire plugin doesn't provide any way to do this. But feel free to open an issue :)
You can run a single test class, but not a single method within a test class. You use the simple name of the class not the fully-qualified name of the class. So, if you have a test in "org.sonatype.test.MyTest" and that is the only test you want to run, your command line would look like this:
mvn test -Dtest=MyTest
What I do with my TestNG, (sorry, JUnit doesn't support this) test cases is I can assign a group to the test I want to run
@Test(groups="broken")
And then simply run 'mvn -Dgroups=broken'.
New versions of JUnit contains the Categories runner: http://kentbeck.github.com/junit/doc/ReleaseNotes4.8.html
But releasing procedure of JUnit is not maven based, so maven users have to put it manually to their repositories.