Is there a way to truncate the test results to only show result text for unit tests only when the unit test has failed? I\'m working on a Scala project that has 850 unit tests,
Updated answer for Scalatest 3.
Here's the new syntax for your build.sbt
file to reprint all the failures at the bottom of the test suite run:
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oI")
You might also want to suppress the info notifications, so it's easier to see the failures.
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oNCXELOPQRM")
Here's what all the options represent:
"-oI"
prints the error notifications again at the end of the test suite run whereas "-oNCXELOPQRM"
only shows the tests that fail.
See the configuring reporters section on the ScalaTest website for more detail.
After adding the following to build.sbt, scalaTest will show a fail summary after the standart report:
testOptions in Test += Tests.Argument("-oI")
I - show reminder of failed and canceled tests without stack traces
T - show reminder of failed and canceled tests with short stack traces
G - show reminder of failed and canceled tests with full stack traces
There is also a "drop TestSucceeded events" flag, but I have failed to use it: http://www.scalatest.org/user_guide/using_the_runner
For those using maven with the scalatest-maven-plugin, you can add this configuration:
<configuration>
<stdout>I</stdout>
</configuration>
You could try the sbt command
last-grep error test
This should show you the errors/failures only.