maiflai / gradle-scalatest

A plugin to enable the use of scalatest in a gradle Scala project.
The Unlicense
73 stars 35 forks source link

How to provide scalatest options in gradle-scalatest #70

Open h-ngo opened 5 years ago

h-ngo commented 5 years ago

We want to experiment with some flag options to configure scalatest reporter (http://www.scalatest.org/user_guide/using_the_runner, "Configuring reporters").

How do we provide these options to gradle-scalatest?

maiflai commented 5 years ago

The plugin tries to respect the gradle test logging configuration by manipulating the reporters, so this is not really something that is publicly exposed.

What sort of configuration are you thinking of?

h-ngo commented 5 years ago

Right now we are trying to reduce the noise in console output while running the test by only display failed tests.

e.g.

We just want the third failed test to be displayed. We want to pass in -oC options to see if it helps. We have tried, testLogging { events = ['FAILED'] }, but it doesn't work

maiflai commented 5 years ago

That's odd - https://github.com/maiflai/gradle-scalatest/issues/66 suggests that it should work.

What does the rest of the build file look like? Which version of the plugin are you using?

maiflai commented 5 years ago

You might try applying this to all test tasks?

tasks.withType(Test) {
  testLogging { 
    events = ['FAILED'] 
  }
}
h-ngo commented 5 years ago

Yeah. that's exactly what we applied. our test setup is a bit complicated cuz we used scalatest to test both Java and Scala codes. that block only works for tests against Java, not Scala. Perhaps, the setting is not correct. Will try again and update here.

We are using gradle-scalatest 0.16

maiflai commented 5 years ago

Ok - I don't think there's anything in later releases of the plugin that would specifically affect this.

The block above should work for both; although I'm not certain about the details of testScoverage when handling a Java-only project.

If you could share a simple reproduction project that would help enormously.