无法使用maven运行单一测试方法

Mah*_*leh 5 maven-2 unit-testing junit4

我知道如何运行Junit测试类:

mvn test -Dtest=classname
Run Code Online (Sandbox Code Playgroud)

但是当我试图运行单个单元测试方法时如下:

mvn test -Dtest=classname#methodname
Run Code Online (Sandbox Code Playgroud)

我总是得到错误:没有执行任何测试

参考文献:

http://maven.apache.org/plugins/maven-surefire-plugin/examples/single-test.html http://stackoverflow.com/questions/1873995/run-a-single-test-method-with-maven

请告诉我为什么我的测试方法没有被执行,我使用的是maven 2junit 4.7.

Aar*_*lla 7

只有Maven Surefire版本2.7.3+支持上述语法

确保您使用的是正确版本的插件.