Given a project using a build.sbt file, I would like to have a common TestUtils.scala file which the integration and unit tests both rely upon.
I have my src folder at src/scala and my integration testing folder at it/scala. My unit testing folder is at test/scala, and contains the common TestsUtils.scala file.
Currently I am running my tests through ScalaTest in Intellij. When I run it this way Intellij is able to determine the dependency from the integration testing folder on the unit testing folder. I am attempting to switch over to using a test, it:test and unit:test set of SBT tasks. When I do so the integration testing folder fails to compile since it can't find the common TestUtils.scala file. If I copy the TestUtils.scala file over to my integration testing folder then it does compile but I don't want to have the same code in 2 locations.
Here are the approaches I see to resolve this:
- Copy the file into both test folders (bad)
- Move the file into the
srcfolder (introducessrcreliance onscalatestwhich I would prefer to avoid) - Find a way for the
integrationfolder to use the file from thetestfolder (don't know how to do this)
Ideally I would like to use the third approach but don't know how to actually implement it. How do you get one folder to use another folder as a dependency in SBT? Is there a better approach I'm unaware of?