Knows Not Much Knows Not Much - 1 month ago 19
Scala Question

SBT/Scala and Integration testing

While researching on the subject of automating my integration tests, I found out a nice plugin in the maven world called FailSafe. it gives me phases like pre-integration-test, post-integration-test and integration-test.

By tying into these phases, I can have other plugins which can start/stop and run docker images.

The plugin also has a nice way in which I can differentiate between UnitTests and IntegrationTests (even though both are written in JUNIT).

Well now the question is how can I do the same thing with Scala / SBT combination?

my requirement is


  1. Write Integration tests in SpecFlow.

  2. Integration tests are treated differently than unit tests.

  3. First Unit Tests are run.

  4. Then docker containers are created and run

  5. then integration tests are run.

  6. docker contains are shut-down.

  7. test results are captured in files. (just like surefire/failsafe plugins).



Is this possible in Scala/sbt combo?

Answer

I found the answer to the question. SBT provides means to do integration test and also setup and cleanup methods to do things like creation / destruction of docker containers

http://www.scala-sbt.org/0.13/docs/Testing.html