Testing

sbt provides an extensive documentation on testing.

ScalaTest

ScalaTest is a popular testing framework and has a tight integration with sbt.

Add scalatest as a dependency in your build.sbt

libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test"

Now write your first test in src/test/scala . Execute all test in sbt via

$ sbt test

Framework options

You can pass parameters to scalatest that configure parallel execution, output format and verbosity.

testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "<parameters here>")

Junit

Jenkins can parse junit xml files. You can configure scalatest via sbt to generate a test-report.xml like this

testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-u", (target in Test).value / "test-reports")

results matching ""

    No results matching ""