【发布时间】:2009-01-05 10:11:31
【问题描述】:
我想将 testng 与 Maven 的 Surefire plug-in 一起使用。这个想法是用integrationTest 组标记一些测试并运行插件两次:目标test 不包括integrationTest 组和目标integration-test 仅包括integrationTest 组。
我找到了一些 material 用于为两个目标运行插件并且有效,但第二次运行的组不起作用(不执行任何测试)。
这里是我pom.xml的build元素中的插件配置:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludedGroups>integrationTest</excludedGroups>
<reportFormat>brief</reportFormat>
<trimStackTrace>true</trimStackTrace>
<useFile>false</useFile>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<groups>integrationTest</groups>
<excludedGroups/>
<reportsDirectory>${project.build.directory}/surefire-reports/integration</reportsDirectory>
</configuration>
</execution>
</executions>
</plugin>
有什么想法吗? mvn integration-test 按预期运行所有单元测试(不包括integrationTest 组),但第二次测试运行时只写:
运行测试套件
测试运行:0,失败:0,错误:0,跳过:0,经过时间:0.562 秒
mvn test 的结果符合预期,测试运行,integrationTest 组被忽略。
【问题讨论】:
标签: maven-2 maven-plugin testng surefire