Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java maven在使用时没有运行我要求它运行的所有测试子集_Java_Maven_Junit_Automation_Selenium Webdriver - Fatal编程技术网

Java maven在使用时没有运行我要求它运行的所有测试子集

Java maven在使用时没有运行我要求它运行的所有测试子集,java,maven,junit,automation,selenium-webdriver,Java,Maven,Junit,Automation,Selenium Webdriver,我正在尝试从不同的类运行两个测试,我的命令行是: mvn-Dtest=com.mycop.Selenium.SelTests.SomeTests1XTest,com.mycop.Selenium.SelTests.SomeTests1YTest,com.mycop.Selenium.SelTests.SomeTests2ZTest 当我运行它时,我希望它从类SomeTests1运行XTest和YTest,从类SomeTests2运行ZTest,但它只是运行XTest和ZTest并跳过YTest

我正在尝试从不同的类运行两个测试,我的命令行是:

mvn-Dtest=com.mycop.Selenium.SelTests.SomeTests1XTest,com.mycop.Selenium.SelTests.SomeTests1YTest,com.mycop.Selenium.SelTests.SomeTests2ZTest

当我运行它时,我希望它从类SomeTests1运行XTest和YTest,从类SomeTests2运行ZTest,但它只是运行XTest和ZTest并跳过YTest

如果我只是告诉它运行YTest,或者如果我告诉它运行某些测试中的所有测试,那么它就会工作。有人能看出我做错了什么吗


我不想在每个类中运行所有测试,我只想要一个子集。

如果您使用的是Junit 4.x和surefire 2.12.1或更高版本,那么您可以使用以下语法在一个类中运行多个测试

mvn -Dtest=com.MyComp.Selenium.SelTests.SomeTests1#XTest+#YTest...
请注意+符号。这是你的电话号码