Setting up actions for multiple test folders in SBT

Regarding the previous question , I would like to have several test folders for different types of tests and be able to run the tests contained in each folder with a separate SBT action.

For example, the "test block" of the action will run only those tests that are contained in the src / test / scala / unit folder, and the "test-functional" action will only run tests under the src / test / scala / functional commands. How will we write actions for this?

+7
source share
1 answer

If you use xsbt 0.10.0, you can easily create additional test configurations by specifying the complete build configuration in Scala, located in the project folder. The following is an example wiki for integration tests. The default directory layout is slightly different from yours, unit tests go to src / test / scala and integration tests to src / it / scala. Then from the console, you can run test to run unit tests or it:test for integration tests.

 import sbt._ import Keys._ object B extends Build { lazy val root = Project("root", file(".")) .configs( IntegrationTest ) .settings( Defaults.itSettings : _*) .settings( libraryDependencies += specs ) lazy val specs = "org.scala-tools.testing" %% "specs" % "1.6.8" % "it" } 
+3
source

All Articles