How do I set the test output to console instead of html in gradle for specs2

霸气de小男生 提交于 2019-12-06 19:31:33

问题


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


回答1:


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 )
  }
}



回答2:


This is not really an answer but more of a suggestion since I'm not using Gradle. Can you pass arguments to the test action and did you try passing the "console" argument?



来源:https://stackoverflow.com/questions/10900506/how-do-i-set-the-test-output-to-console-instead-of-html-in-gradle-for-specs2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!