Write integration tests for Ballerina Service using TestContainers.
Ballerina container support  allows one to package Ballerina main programs or services into docker images that can be run inside containers.
Before moving into Ballerina docker stuff, make sure you have properly installed in docker engine in your machine as per given instructions  in official website.
Here  provides the complete guide on how you can create Ballerina program docker images. It’s very easy and to summarize the steps,
- Install docker environment in your machine as per. 
- Clone  and build source using mvn clean install.
- Add ballerina-container-support-0.xx.x-SNAPSHOT.jar to bre/lib/ directory of Ballerina runtime you downloaded from. 
- ‘docker’ command allows you to created images from from Ballerina source bal extension files or compiled balx extension files executed from the Ballerina runtime bin directory.
- Follow prompt instructions in order to run main/service programs inside docker containers.
ballerina-0.95.6/bin$ ./ballerina docker myTestProgram.bal
Then one may want to create set of Integration tests for Ballerina service that runs inside a Docker container / dockerized environment.
I found TestContainers  library to be pretty useful here, it provides the lightweight framework to automate the test environment locally, which is, spin up docker container which run the service need to be tested, synchronize with the service in order to determine exactly when to start the tests, ( This is required since we may need to know the exact time which service is up and running inside the container in order to start the test suits, otherwise tests may fail ) execute tests and once done we may need to stop execution of container. There are number of advantages automating tests using dockerized environment. Please see  and  blogs and official samples under  what this framework allows you to do.
Let’s move on Integration test sample  written to test Hello World Ballerina service. When writing integration tests for the service, it is required to synchronize the tests with Ballerina service startup, basically we need to wait until the Ballerina service is started inside the container, before start executing integration test suit. TestContainers allows us to write custom waiting strategy to do this.
Please see custom waiting strategy which waits on Ballerina service startup.
The code is very simple. Code basically read container logs and wait until Ballerina service startup log to be appeared within a timeout interval. These waiting strategy / timeouts allows us to write robust tests.
Please see the sample integration test for Hello World sample. 
Here we basically do is,
- Create docker image which packages Hello World service to Ballerina 0.95.6 runtime base image. We use container support dependency to create new child images from base Ballerina runtime images released on public docker hub. 
- Spin up container from created docker image in previous step.
- Wait on the Service to be started on the container.
- Send HTTP Get request to the service.
- Make assertions on the payload received.