Reputation: 15066
I try to skip one test with my maven command (doc: https://blog.jdriven.com/2017/10/run-one-or-exclude-one-test-with-maven/):
mvn -B clean install -T2C -pl sub-tests -Dtest=!com.xx.xx.test.xx.xx.canMakeCall*
But I get some error (it seems it tries to skip all tests? I don't know):
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ sub-tests ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project sub-tests: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
What am I doing wrong?
Upvotes: 2
Views: 983
Reputation: 4558
According to Maven Surefire Plugin - Running a Single Test :
Running a Set of Methods in a Single Test Class
As of Surefire 2.7.3, you can also run only a subset of the tests in a test class.
NOTE : This feature is supported only for Junit 4.x and TestNG. Use syntax e.g. "foo/MyTest.java", "/MyTest.java", "MyTest" for "test" parameter (see includes/excludes).**
You should use the following syntax:
mvn -Dtest=TestCircle#mytest test
So I think your command should be:
mvn -B clean install -T2C -pl sub-tests -Dtest=!com.xx.xx.test.xx.xx#canMakeCall*
It will ignore all tests methods starting with canMakeCall
of test com.xx.xx.test.xx.xx
.
Upvotes: 3