wing
wing

Reputation: 181

How do I set the test output to console instead of html in gradle for 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

Upvotes: 11

Views: 4264

Answers (2)

Jeppe Nejsum Madsen
Jeppe Nejsum Madsen

Reputation: 371

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

Upvotes: 11

Eric
Eric

Reputation: 15557

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?

Upvotes: 0

Related Questions