Great article as always. There are three features that you didn't mention though:
- wait strategies. Testcontainers implements some strategies to wait that your container is fully initialized, like waiting for a specific message in the logs.
- automatic shutdowns. The difference with docker compose is that once you are done with your functional tests, the test containers are automatically shutdown. You don't have to do anything else.
- parallel runs. You can run multiple instances of your test containers in different ports in the same code to parallise functional tests and avoid collisions. As long as you have enough memory on your machine
I found the first feature game changing. In the past (without testcontainers) I had to measure the start time of my containers and add a sleep time before running the functional tests. This make them brittle and error prone.
Great article as always. There are three features that you didn't mention though:
- wait strategies. Testcontainers implements some strategies to wait that your container is fully initialized, like waiting for a specific message in the logs.
- automatic shutdowns. The difference with docker compose is that once you are done with your functional tests, the test containers are automatically shutdown. You don't have to do anything else.
- parallel runs. You can run multiple instances of your test containers in different ports in the same code to parallise functional tests and avoid collisions. As long as you have enough memory on your machine
I found the first feature game changing. In the past (without testcontainers) I had to measure the start time of my containers and add a sleep time before running the functional tests. This make them brittle and error prone.