I have a suite of scalatest tests that test different endpoints of a RESTful API. I really want them separated into different files for best organization.
My problem
Alternatively you can just use an object.
object TestServer {
startServer()
}
When you access the object it will be initialised, starting the server. Just create a common trait in the body of which you access the object. Then mixin that trait into all your tests. Done.
If your server runs in daemon mode (e.g. a Play! application in test mode) it will be automatically shut down after all tests are run.