This repository contains the code used in the Running Docker-Based Integration Tests in Scala: A Case Study talk at ScalaDays Madrid 2023.
In particular, it defines three SBT projects:
- The main project contains the code of a simple HTTP application. Such an application simply opens a socket on the
8080port, waiting for incoming connections. The webpage it returns is quite simple and only shows the message "Hello, Madrid"; - The
sbt-docker-composesubproject contains the integration tests written using SBT-docker-compose; - The
test-containerssubproject contains the integration tests written using TestContainers-scala.
To run the tests in the sbt-docker-compose subproject, open an SBT shell and use the following commands:
project sbtDockerCompose
dockerComposeTest
SBT will build a new Docker image named scala-days-2023 and tagged with latest. It will then use it to run the tests implemented in SampleSbtDockerComposeSpec.
To run the tests in the test-containers subproject, open an SBT shell and use the following command:
testContainers / test
SBT will build a new Docker image named scala-days-2023 and tagged with 1.0.0. It will then use it to run the tests implemented in SampleTestContainersSpec.