Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/342.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/2/unit-testing/4.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_Unit Testing_Maven_Selenium_Junit - Fatal编程技术网

Java Maven使用关键字“运行所有测试”;测试“;

Java Maven使用关键字“运行所有测试”;测试“;,java,unit-testing,maven,selenium,junit,Java,Unit Testing,Maven,Selenium,Junit,我已经建立了一个带有Junit测试的maven项目,以便在构建服务器上运行Selenium(java)脚本。据我所知,Maven旨在运行文件夹test.java 考虑到这一点,我使用@RunWith和@suitelasses设置了一个TestAll类来专门运行我想要的类和测试 但是,当我运行mvn testmaven时,会运行标题中任何地方都有关键字test的所有方法,即test_A_1423,标题中有“test”的类中的所有测试,以及任何包中有关键字“test”的所有测试。我如何只运行我想要的

我已经建立了一个带有Junit测试的maven项目,以便在构建服务器上运行Selenium(java)脚本。据我所知,Maven旨在运行文件夹
test.java

考虑到这一点,我使用
@RunWith
@suitelasses
设置了一个TestAll类来专门运行我想要的类和测试

但是,当我运行
mvn test
maven时,会运行标题中任何地方都有关键字test的所有方法,即test_A_1423,标题中有“test”的类中的所有测试,以及任何包中有关键字“test”的所有测试。我如何只运行我想要的测试,或者我需要从任何我不想运行的类或方法中删除“Test”。包括我的pom.xml文件

`
 <modelVersion>4.0.0</modelVersion>
<groupId>cyberx.automation</groupId>
<artifactId>tests</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>cyberx.test.automation</name>
<url>http://maven.apache.org</url>
<!--<repositories>-->
    <!--<repository>-->
        <!--<id>central</id>-->
        <!--<name>bintray</name>-->
        <!--<url>http://jcenter.bintray.com</url>-->
    <!--</repository>-->
<!--</repositories>-->
<dependencies>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.12</version>
</dependency>
<dependency>
 <groupId>org.seleniumhq.selenium</groupId>
 <artifactId>selenium-java</artifactId>
 <version>2.45.0</version>
</dependency>
<dependency>
  <groupId>joda-time</groupId>
  <artifactId>joda-time</artifactId>
  <version>2.3</version>
 </dependency>
  <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <version>2.0.1</version>
   </dependency>
   <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
   </dependency>
   <!--<dependency>-->
      <!--<groupId>org.testng</groupId>-->
      <!--<artifactId>testng</artifactId>-->
      <!--<version>6.9.4</version>-->
      <!--<scope>test</scope>-->
   <!--</dependency>-->
   <dependency>
      <groupId>net.sf.opencsv</groupId>
      <artifactId>opencsv</artifactId>
      <version>2.3</version>
   </dependency>
  </dependencies>
  <build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
 </build>
 </project>
`
`
4.0.0
网络自动化
测验
罐子
0.0.1-快照
测试自动化
http://maven.apache.org
朱尼特
朱尼特
4.12
org.seleniumhq.selenium
硒爪哇
2.45.0
乔达时间
乔达时间
2.3
org.apache.logging.log4j
log4japi
2.0.1
log4j
log4j
1.2.17
net.sf.opencsv
opencsv
2.3
maven编译器插件
2.3.2
1.7
1.7
`

您有正则表达式来包含/排除测试。
有关surefire插件的文档,请参阅。

您可以指定使用-Dtest运行哪个测试=