Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

gradle

specs2

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

like image 716
wing Avatar asked Jun 05 '12 15:06

wing


1 Answers

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 )
  }
}
like image 140
Jeppe Nejsum Madsen Avatar answered Oct 13 '22 04:10

Jeppe Nejsum Madsen