SBT / Scala and Integration Testing

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

Attaching to these steps, I may have other plugins that can start / stop and launch docker images.

There is also a good way in the plugin with which I can distinguish between UnitTests and IntegrationTests (although both are written in JUNIT).

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

My requirement

  • Record integration tests in SpecFlow.
  • Integration tests are handled differently than unit tests.
  • The first unit tests are performed.
  • Then docker containers are created and run.
  • integration tests are performed.
  • contains dockers.
  • Test results are written to files. (same as surefire / fail-safe plugins).

Is this possible in a Scala / sbt combo?

+6
source share
2 answers

I found the answer to the question. SBT provides integration test tools as well as customization and cleaning methods to do things like create / destroy docker containers.

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

0
source

A simple solution is to run $ sbt "~ it:test" (make sure the integration test is in the package named "it") for the integration test, which will run automatically every time the source code is updated. In addition, $sbt "~ test" for automated unit tests. If you use an IDE such as IntelliJ IDEA, you can make it easier to run in a user configuration from within the IDE. Hope this helps a bit. I work on them all the time.

+1
source

All Articles