patternjavaCritical
Run a single test method with maven
Viewed 0 times
runmavenwithmethodsingletest
Problem
I know you can run all the tests in a certain class using:
But I want to run an individual method and -Dtest=classname.methodname doesn't seem to work.
mvn test -Dtest=classnameBut I want to run an individual method and -Dtest=classname.methodname doesn't seem to work.
Solution
To run a single test method in Maven, you need to provide the command as:
where
Wild card characters also work; both in the method name and class name.
If you're testing in a multi-module project, specify the module that the test is in with
For integration tests use
mvn test -Dtest=TestCircle#xyzwhere
TestCircle is the test class name and xyz is the test method.Wild card characters also work; both in the method name and class name.
If you're testing in a multi-module project, specify the module that the test is in with
-pl .For integration tests use
it.test=... option instead of test=...:mvn -pl -Dit.test=TestCircle#xyz integration-testCode Snippets
mvn test -Dtest=TestCircle#xyzmvn -pl <module-name> -Dit.test=TestCircle#xyz integration-testContext
Stack Overflow Q#1873995, score: 1020
Revisions (0)
No revisions yet.