Junit 如何将surefire报告分为2个或更多类别?
我想将测试分为3个不同的类别:Junit 如何将surefire报告分为2个或更多类别?,junit,maven-3,maven-surefire-plugin,maven-site-plugin,maven-failsafe-plugin,Junit,Maven 3,Maven Surefire Plugin,Maven Site Plugin,Maven Failsafe Plugin,我想将测试分为3个不同的类别: 单位 镇静 系统 然后我想在不同的阶段分别运行它们,并将这些测试的执行结果显示在3个不同的surefire报告中,或者可能是一个,但测试结果被分为3个不同的类别 如何用maven实现它 我知道我可以使用failsafe maven插件单独运行测试。所以这不是问题 唯一的问题是我可以将报告分为3个类别。我正在使用maven surefire插件和junit类别 <plugin> <artifactId>ma
- 单位
- 镇静
- 系统
唯一的问题是我可以将报告分为3个类别。我正在使用maven surefire插件和junit类别
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.2</version>
<executions>
<execution>
<id>unit-tests</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<groups>com.mycompany.mavenproject2.UnitTest</groups>
<reportsDirectory> ${project.build.directory}/surefire-reports/unit</reportsDirectory>
<reportNameSuffix>UNIT</reportNameSuffix>
</configuration>
</execution>
<execution>
<id>comp-tests</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<groups>com.mycompany.mavenproject2.ComponentTest</groups>
<reportsDirectory> ${project.build.directory}/surefire-reports/comp</reportsDirectory>
<reportNameSuffix>COMPONENT</reportNameSuffix>
</configuration>
</execution>
<execution>
<id>sys-tests</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<groups>com.mycompany.mavenproject2.SystemTest</groups>
<reportsDirectory> ${project.build.directory}/surefire-reports/sys</reportsDirectory>
<reportNameSuffix>SYSTEM</reportNameSuffix>
</configuration>
</execution>
</executions>
</plugin>
maven surefire插件
2.12.2
单元测试
测试
com.mycompany.mavenproject2.UnitTest
${project.build.directory}/surefire reports/unit
单位
比较试验
测试
com.mycompany.mavenproject2.ComponentTest
${project.build.directory}/surefire reports/comp
组成部分
系统测试
测试
com.mycompany.mavenproject2.SystemTest
${project.build.directory}/surefire reports/sys
系统
它工作正常,只是它首先运行所有测试,而不是将它们划分为类别。
如何消除此类行为?
Build生成了一个输出。
T T S T S
运行com.mycompany.mavenproject2.AppTest
单元测试
成分测试
系统测试
测试运行:3,失败:0,错误:0,跳过:0,所用时间:0.031秒
结果:
测试运行:3,失败:0,错误:0,跳过:0
[surefire:测试]
Surefire报告目录:C:\Users\mz\Documents\NetBeansProjects\mavenproject2\target\Surefire reports\unit
T T S T S 并发配置为parallel='none',PercoretThreadCount=true,threadCount=2,useUnlimitedThreads=false 运行com.mycompany.mavenproject2.AppTest 单元测试 测试运行:1,失败:0,错误:0,跳过:0,所用时间:0.003秒 结果: 测试运行:1,失败:0,错误:0,跳过:0 [surefire:测试] Surefire报告目录:C:\Users\mz\Documents\NetBeansProjects\mavenproject2\target\Surefire reports\comp
T T S T S 并发配置为parallel='none',PercoretThreadCount=true,threadCount=2,useUnlimitedThreads=false 运行com.mycompany.mavenproject2.AppTest 成分测试 测试运行:1,失败:0,错误:0,跳过:0,所用时间:0.003秒 结果: 测试运行:1,失败:0,错误:0,跳过:0 [surefire:测试] Surefire报告目录:C:\Users\mz\Documents\NetBeansProjects\mavenproject2\target\Surefire reports\sys
T T S T S 并发配置为parallel='none',PercoretThreadCount=true,threadCount=2,useUnlimitedThreads=false 运行com.mycompany.mavenproject2.AppTest 系统测试 测试运行:1,失败:0,错误:0,跳过:0,所用时间:0.003秒 结果:
测试运行:1,失败:0,错误:0,跳过:0我正在将maven surefire插件与junit类别一起使用
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.2</version>
<executions>
<execution>
<id>unit-tests</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<groups>com.mycompany.mavenproject2.UnitTest</groups>
<reportsDirectory> ${project.build.directory}/surefire-reports/unit</reportsDirectory>
<reportNameSuffix>UNIT</reportNameSuffix>
</configuration>
</execution>
<execution>
<id>comp-tests</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<groups>com.mycompany.mavenproject2.ComponentTest</groups>
<reportsDirectory> ${project.build.directory}/surefire-reports/comp</reportsDirectory>
<reportNameSuffix>COMPONENT</reportNameSuffix>
</configuration>
</execution>
<execution>
<id>sys-tests</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<groups>com.mycompany.mavenproject2.SystemTest</groups>
<reportsDirectory> ${project.build.directory}/surefire-reports/sys</reportsDirectory>
<reportNameSuffix>SYSTEM</reportNameSuffix>
</configuration>
</execution>
</executions>
</plugin>
maven surefire插件
2.12.2
单元测试
测试
com.mycompany.mavenproject2.UnitTest
${project.build.directory}/surefire reports/unit
单位
比较试验
测试
com.mycompany.mavenproject2.ComponentTest
${project.build.directory}/surefire reports/comp
组成部分
系统测试
测试
com.mycompany.mavenproject2.SystemTest
${project.build.directory}/surefire reports/sys
系统
它工作正常,只是它首先运行所有测试,而不是将它们划分为类别。
如何消除此类行为?
Build生成了一个输出。
T T S T S
运行com.mycompany.mavenproject2.AppTest
单元测试
成分测试
系统测试
测试运行:3,失败:0,错误:0,跳过:0,所用时间:0.031秒
结果:
测试运行:3,失败:0,错误:0,跳过:0
[surefire:测试]
Surefire报告目录:C:\Users\mz\Documents\NetBeansProjects\mavenproject2\target\Surefire reports\unit
T T S T S 并发配置为parallel='none',PercoretThreadCount=true,threadCount=2,useUnlimitedThreads=false 运行com.mycompany.mavenproject2.AppTest 单元测试 测试运行:1,失败:0,错误:0,跳过:0,所用时间:0.003秒 结果: 测试运行:1,失败:0,错误:0,跳过:0 [surefire:测试] Surefire报告目录:C:\Users\mz\Documents\NetBeansProjects\mavenproject2\target\Surefire reports\comp
T T S T S 并发配置为parallel='none',perCoreThreadCount=tr