【发布时间】:2016-12-22 11:41:55
【问题描述】:
gradle中有没有办法可以将junit xml报告合并到一个单独的测试报告文件中。
当我们在 ant 中使用 cp-suite 执行我们的 IntegrationTestSuite.java 时,会得到一个 junit 报告。在 gradle 上创建了多个 junit 报告。
IntegrationTestSuite.java
@RunWith(Categories.class)
@Categories.IncludeCategory(IntegrationTests.class)
@Categories.ExcludeCategory(DebugJenkinsTests.class)
@Suite.SuiteClasses(AllTestSuite.class)
public class IntegrationTestSuite { /* nop */
}
截自build.xml
<junit>
<formatter type="xml" />
<batchtest todir="${testreport.dir}">
<fileset dir="${test-src.dir}">
<include name="**/IntegrationTestSuite.java" />
</fileset>
</batchtest>
</junit>
截自build.gradle
task integrationTestSandro(type: Test) {
reports.html.enabled = false
include '**/IntegrationTestSuite*'
reports.junitXml.destination = "$buildDir/test-results/integration"
maxHeapSize = testTaskMaxHeapSize
jvmArgs testTaskJVMArgs
}
【问题讨论】: