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

  • Write Integration tests in SpecFlow.
  • Integration tests are treated differently than unit tests.
  • First Unit Tests are run.
  • Then docker containers are created and run
  • then integration tests are run.
  • docker contains are shut-down.
  • test results are captured in files. (just like surefire/failsafe plugins).
  • Is this possible in Scala/sbt combo?


    A simple solution is to run $ sbt "~ it:test" (make sure integration test are in a package named 'it') for integration test which will automatically run every time source code is updated. Furthermore, $sbt "~ test" for automated unit testing. If you are using a IDE such as IntelliJ IDEA, you can make it easier to run this in a custom configuration from the IDE. Hope this helps a little bit. I run these all the time when working.


    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

    链接地址: http://www.djcxy.com/p/42580.html

    上一篇: Google Maps API v2

    下一篇: SBT / Scala和集成测试