Skip to main content
Version: 2.0.0

TLS Docker Support

Recording Testcases and Data Mocks

  1. To record test cases and data mocks, follow these steps in the root directory of your application. Ensure that you have the following prerequisites in place:
  • If you're running via docker-compose, ensure to include the <CONTAINER_NAME> under your application service in the docker-compose.yaml file like this.
  • You must run all of the containers on the same network when you're using docker run command (you can add your custom network name using --network flag in docker run command).
  • In your Docker Compose file, every container should run on the same network.
  • Docker_CMD_to_run_user_container refers to the Docker command for launching the application.
  • Add the required commands to your DockerFile as stated below.
  1. Add the following commands to your Dockerfile to download the ca.crt file and the script.
# Download the ca.crt file
RUN curl -o ca.crt
RUN curl -o
# Give execute permission to the script
RUN chmod +x

# Run the CA setup script and then run the application server
CMD ["/bin/bash", "-c", "source ./ && <your app running command>"]

Note: Also add curl installation command if curl is not installed on your image

To capture test cases, Execute the following command within your application's root directory.

keploy record -c "Docker_CMD_to_run_user_container --network <network_name>" --containerName "<container_name>"

Perform API calls using tools like Hoppscotch, Postman, or cURL commands.

Keploy will capture the API calls you've conducted, generating test suites comprising test cases (KTests) and data mocks (KMocks) in YAML format.

Running Testcases

To execute the test cases, follow these steps in the root directory of your application.

When using docker-compose to start the application, it's important to ensure that the --containerName parameter matches the container name in your docker-compose.yaml file.

keploy test -c "Docker_CMD_to_run_user_container --network <network_name>" --containerName "<container_name>" --delay 20

Voilà! 🧑🏻‍💻 We have the tests with data mocks running! 🐰🎉

You'll be able to see the test cases that ran with the results report on the console as well as locally in the testReport directory.