Skip to content

merikan/testcontainers-demo

Repository files navigation

How to use Testcontainers

Intro

This is a Spring Boot application used as an example in my blogs posts, how to use Testcontainers in a Spring Boot project and its integration tests. It shows you how to migrate from an embedded h2 database to a real Mariadb database running in a docker container. After that, how you can get your tests to start much faster.

Read more in my blog posts

The source code

This project consists of several directories that contain the application both before and after the changes.

The following directories are available

  • the origin directory contains the source code before we migrated our tests from H2 to Testcontainers.
  • the solution directory contains the source code after we migrated our tests from H2 to Testcontainers.
  • the faster directory contains the source code after doing some changes to make our tests run faster

How to run the code

  1. Check out the code
$ git clone https://github.com/merikan/testcontainers-demo.git
  1. cd into the desired directory
$ cd testcontainers-demo/faster
  1. and run the tests
$ ./mvnw clean test verify

License

This project is licensed under the terms of the Apache License, Version 2.0.

About

A Testcontainers demo project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages