Gradle TestNG结果输出 [英] Gradle TestNG results output

查看:798
本文介绍了Gradle TestNG结果输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



首先,Gradle选择 $ project_dir / build / reports / tests 默认为HTML报告输出。我如何更改此默认位置?我尝试在 build.gradle 中设置 testReportDir 无济于事。例如

 测试{
if(runTest){
)在调用useTestNG //启用TestNG支持(默认为JUnit)
useTestNG {
outputDirectory = file($ buildDir / test-output)
}
}
}

不起作用。

我尝试使用TestNG的Reporter进行一些额外的日志记录,例如:

  @Test 
public void testMethod(){
parseFile();
Reporter.log(File parsed);
Assert.assertTrue(...);
}

但我似乎无法找到日志!有人可以帮忙吗?

解决方案

testReportDir 属性是只读的。您需要设置 Project.testReportDirName 。你应该能够像这样启用测试日志。

  test {
testLogging.showStandardStreams = true
}


I can't seem to figure out how to configure log output and results folders for Gradle TestNG runs.

First, Gradle picks $project_dir/build/reports/tests by default for HTML report output. How do I change this default location? I tried setting testReportDir in build.gradle to no avail. Specifying a map in call to useTestNG(), e.g.

test {
   if (runTest) {
      // enable TestNG support (default is JUnit)
      useTestNG {
         outputDirectory = file("$buildDir/test-output")
      }
   }
}

does not work as well.

Second, I tried using TestNG's Reporter for some additional logging, e.g:

@Test
public void testMethod() {
   parseFile();
   Reporter.log("File parsed");
   Assert.assertTrue(...);
}

But I can't seem to find the logs! Can someone please help?

解决方案

The testReportDir property is read-only. You'll need to set Project.testReportDirName. You should be able to enable test logging like so.

test {
    testLogging.showStandardStreams = true
}

这篇关于Gradle TestNG结果输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆