Reputation: 13801
I'm working on Guava project, it uses mvn
. It has plenty of test cases, I want to run only one of the test cases from a test class. Googling around I found the solution to be:
mvn -Dtest=TestClass#method test
but running this on guava project says:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
There are no tests to run.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
(note that I passed real testclass and corresponding method, while running the above command)
Where I'm making the mistake? I'm new to maven build tool, couldn't able to figure out where I'm making mistake.
Upvotes: 2
Views: 289
Reputation: 5255
The problem is, that Guava is currently using an old version (2.7.2) of the maven-surefire-plugin which does not yet support the -Dtest=TestClass#method
syntax. This feature was introduced starting with version 2.7.3:
Since 2.7.3, you can execute a limited number of methods in the test by adding #myMethod or #my*ethod. For example, "-Dtest=MyTest#myMethod". This is supported for junit 4.x and testNg.
Upvotes: 3