How do you share classes between test configurations using SBT

后端 未结 4 1862
野的像风
野的像风 2021-01-01 18:05

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

4条回答
  •  暖寄归人
    2021-01-01 18:25

    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.

提交回复
热议问题