0

我正在尝试使用下面的代码(pom.xml - 通过添加配置文件)排除硒测试,但它不起作用,我的问题是我做错了什么?:

我正在运行 mvn clean install

<profiles>
    <profile>
        <id>local</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <includes>
                            <!-- Inclure les tests unitaires ici ... -->
                        </includes>
                        <excludes>
                            <exclude>**/selenium/**/*Test.java</exclude>  <!-- Exclure les tests Selenium ici ... -->
                        </excludes>
                    </configuration>
                    <executions>
                        <execution>
                            <id>surefire-integration-test</id>
                            <phase>integration-test</phase>
                            <goals>
                                <goal>test</goal> <!-- La phase integration-test va lancer les tests... -->
                            </goals>
                            <configuration>
                                <skip>false</skip>
                                <includes>
                                    <include>**/selenium/**/*Test.java</include> <!-- ... Inclure les tests Selenium ici -->
                                </includes>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>


            </plugins>
        </build>
    </profile>


</profiles>
4

1 回答 1

1

首先,让我们具体一点。我们不排除 Selenium 测试——我们排除了测试框架测试。

找出您正在使用的测试框架... jUnitTestNG等等。

按文件/包排除测试(需要 maven surefire 插件)

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.16</version>
        <configuration>
          <includes>
            <include>Sample.java</include>
          </includes>
        </configuration>
      </plugin>
    </plugins>
  </build>
  [...]
</project>
于 2013-09-27T15:44:28.413 回答