How do you share classes between test configurations using SBT

sbt, scala

Solution

A configuration can extend another configuration to use that configuration's dependencies and classes. For example, the custom test configuration section shows this definition for the custom configuration:

lazy val FunTest = config("fun") extend(Test)

The `extend` part means that the compiled normal test sources will be on the classpath for `fun` sources. In your case, declare the `acceptance` configuration to extend the `it` configuration:

lazy val AcceptanceTest = config("acceptance") extend(IntegrationTest)

Problem

I have followed the instructions on SBT's documentation for setting up test configurations. I have three test configurations Test, IntegrationTest, and AcceptanceTest. So my src directory looks like this: - src/ - acceptance/ - scala/ - it/ - scala/ - test/ - scala/ My question is, how can I configure SBT to allow sharing of classes between these configurations? Example: I have a class in the "it" configuration for simplifying database setup and tear down. One of my acceptance tests in the "acceptance" configuration could make use of this class. How do I make that "it" class available to the test in "acceptance" Many thanks in advance.

Original source