11

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

wing
  • 171
  • 1
  • 5

2 Answers2

11

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

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?

Eric
  • 15,494
  • 38
  • 61
  • I think there is a way to set the 'console' argument for the runner in gradle... but that is my question since googling didn't get me the answer :) – wing Jun 06 '12 at 13:27