dimanche 21 décembre 2014

How can I run a server with sbt, as a test?

I'm writing a simple REST API, and as part of it, I'd like to be able to set up a database with mock data, then spin up the REST server using that test database.


This would be easy if all my test code was in /src/main, but it isn't. Instead, I have it all in /src/test, which makes sense (none of the tools I've written to fill the database with data have any place in the main app).


Because it's under /src/test, I'm not sure how I should go about spinning up a test instance. I don't think I want to add it as a test, because then I can't run my test suite without commenting out the server test. I'd need to turn the server test off because it should block forever while it serves requests, but that's not what I'd want mixed in with my other tests.


Aucun commentaire:

Enregistrer un commentaire