specs2中如何将测试输出设置为控制台而不是gradle中的html [英] How do I set the test output to console instead of html in gradle for specs2
问题描述
我使用specs2 / scala进行单元测试并使用gradle来构建。默认情况下,单元测试输出转到html文件。我想输出直接输出到stdout(就像sbt一样)。
感谢
翼
您可以使用
测试{
//在运行测试时使标准流(err和out)在控制台中可见testLogging.showStandardStreams = true
}
但是,这会在信息级别记录标准输出,因此您需要运行gradle -i才能看到它(看起来这将在1.1中修复:http://issues.gradle.org/browse/GRADLE-1966 )
或者,您可以添加一个事件处理程序:
test {
onOutput {descriptor,event - >
logger.lifecycle(Test:+ descriptor +生成标准输出/ err:+ event.message)
}
}
I'm using specs2/scala for unit tests and using gradle to build. By default the unit-test output goes to a html file. I would like to have the output go directly to stdout (just like sbt).
Anyone know the magic incantation?
thanks wing
You can use
test {
//makes the standard streams (err and out) visible at console when running tests
testLogging.showStandardStreams = true
}
But this logs stdout at the info level so you need to run gradle -i to see it (it seems this will be fixed in 1.1: http://issues.gradle.org/browse/GRADLE-1966)
Alternatively, you can add an event handler:
test {
onOutput { descriptor, event ->
logger.lifecycle("Test: " + descriptor + " produced standard out/err: " + event.message )
}
}
这篇关于specs2中如何将测试输出设置为控制台而不是gradle中的html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!