How to write html test reports while keeping console output for ScalaTest

Recently I decided that I wanted to have html reports of my ScalaTest unit tests.  What I didn’t realize was that it would *remove* my console output!

When I first added html reports, I discovered that the required a dependency I wasn’t aware of: pegdown.


Adding html reports was as easy as setting it in the testOptions:

(testOptions in Test) += Tests.Argument(TestFrameworks.ScalaTest, "-h", "target/report")

As I mentioned above, this caused the following error:

java.lang.NoClassDefFoundError: org/pegdown/PegDownProcessor

So I added the latest version of PegDown to my build.sbt and set its scope to test:

"org.pegdown" % "pegdown" % "1.6.0" % "test"

But then I discovered that I wasn’t getting any console output for my tests!

The answer is to simply add both to your testOptions sequence:

testOptions in Test ++= Seq(Tests.Argument(TestFrameworks.ScalaTest, "-o"), Tests.Argument(TestFrameworks.ScalaTest, "-h", "target/test-reports"))


Leave a Reply

Your email address will not be published. Required fields are marked *