我正在尝试使用下面的代码排除selenium测试(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>
答案 0 :(得分:1)
首先,让我们具体一点。我们不排除Selenium测试 - 我们排除测试框架测试。
找出您正在使用的测试框架...... jUnit
,TestNG
等。
<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>