I have followed the instructions on SBT\'s documentation for setting up test configurations. I have three test configurations Test, IntegrationTest, and AcceptanceTest. So m
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)
SBT uses the Maven default directory layout.
It will recognize folders unders src/test/scala
to compile along with src/main/scala
.
So, if you move the other folders under src/test/scala
SBT will compile them and you can share code between them. e.g.:
└── scala
├── acceptance
│ └── scala
│ └── Acceptance.scala
├── it
│ └── scala
│ └── IT.scala
└── Test.scala
Running sbt test
will compile all three files in the directory. So, with this Acceptance refer to and can create a new IT class for example.
In case you want to stick with predefined configurations instead of defining new ones, and since both Test
and IntegrationTest
extend Runtime
(one would expect IntegrationTest
to extend Test
…), you could use the following:
dependencyClasspath in IntegrationTest := (dependencyClasspath in IntegrationTest).value ++ (exportedProducts in Test).value
This should put all the classes you define in Test
on the IntegrationTest
classpth.
##EDIT:
I was just became aware to amuch better solution thanks to @mjhoy:
lazy val DeepIntegrationTest = IntegrationTest.extend(Test)
An approach is documented here: http://www.scala-sbt.org/release/docs/Detailed-Topics/Testing#additional-test-configurations-with-shared-sources