首页 > 解决方案 > 1 个特定测试的 testFailureIgnore

问题描述

我在 maven-surefire-plugin 中寻找类似于 testFailureIgnore 的东西,只有在一个特定测试失败时才适用。有没有办法做到这一点?

基本上它忽略了所有测试失败,我希望它忽略一个特定的失败。

标签: maven-surefire-plugin

解决方案


我在这里找到了答案:https ://rmannibucau.metawerx.net/post/maven-surefire-debugging-execution

他们的例子如下:

<plugin>
 <artifactId>maven-surefire-plugin</artifactId>
 <executions>
   <execution>
     <id>applicationcomposer</id>
     <goals>
       <goal>test</goal>
     </goals>
     <configuration>
       <groups>com.github.rmannibucau.surefire.executions.Group1</groups>
       <skip>${maven.test.skip}</skip>
       <systemPropertyVariables>
         <openejb.jul.forceReload>true</openejb.jul.forceReload>
       </systemPropertyVariables>
     </configuration>
   </execution>
   <execution>
     <id>arquillian</id>
     <goals>
       <goal>test</goal>
     </goals>
     <configuration>
       <excludedGroups>com.github.rmannibucau.surefire.executions.Group1</excludedGroups>
       <skip>${maven.test.skip}</skip>
       <systemPropertyVariables>
         <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
       </systemPropertyVariables>
     </configuration>
   </execution>
 </executions>
 <configuration>
   <skip>true</skip>
   <failIfNoTests>false</failIfNoTests>
   <reuseForks>true</reuseForks>
   <forkCount>1</forkCount>
 </configuration>
</plugin>

推荐阅读