在我的gradle构建脚本中,我添加了doLast方法来测试任务以运行ant.junit任务以从几个jar文件执行测试。
test << {
//run ant junit task with reports stored in $buildDir/test-results
//after ant junit completion and "test" task completion,
//how can I get the gradle generated html report include the above test-results?
}
我如何增强此任务以获得gradle html报告的好处?我看到在$ buildDir / test-results中正确创建了ant junit测试xml报告以及其他“渐变测试”创建的xml。但是$ buildDir / reports / tests”仅包含。我希望gradle也会拾取由ant junit创建的测试结果xml文件,并将其包含在其html报告中。但是这没有发生。如何获得这种行为?
我试图创建另一个TestReport类型的任务。但这也没有帮助。
task runTestsFromJar( type: TestReport ) {
destinationDir=file("$buildDir/reports/tests")
reportOn tasks.test, files("$buildDir/test-results/binary/test")
}
我正在使用Gradle 1.8。
最佳答案
我建议创建另一个task of type Test来替换您的doAfter闭包。
task antTests(type: Test){
//configuration here
}
我相信到那时,您可以使用与之前尝试类似的方式来使用TestReport任务
task runTestsFromJar( type: TestReport ) {
destinationDir=file("$buildDir/reports/tests")
reportOn test, antTests
}
我尝试基于现有xml结果文件的目录以及
binary
子文件夹生成报告的尝试也未成功
关于gradle - 在gradle html报告中集成ant junit生成的测试结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21488476/