Integration Tests

If your service is part of a micro-service type of application, Codefresh enables you to run your image as part of a composition, and then run your integration tests against it. There are two prerequisites for this step:


Define a Composition
You must define a composition in the Codefresh composition module. This composition dictates how to spin up your micro-services application before running the integration tests. For more information about compositions, see Create a Composition.

Create composition

Create a Composition test image, which is a Docker image with the integration test’s execution engine and scripts
You can create a service, with the GIT repo that contains your integration tests scripts, in Codefresh that automatically builds a Docker image with your testing framework’s execution engine. You can add the integration test scripts as commands in the Dockerfile. Alternatively, you can create the image locally, and make it available to Codefresh in your Docker registry.

Run the Integration Tests

Follow these steps to run the the integration test

  1. Select the RUN TEST WITH COMPOSITION check box.

Create composition

  1. Select a composition to run.

Create composition

  1. Add a Composition test image, which will be added as a new service to your composition

Create composition

This is our test image, which contains the integration test code
  1. Specify the command that will run on the candidate service.

Create composition

Important Notes

  • the Composition test image will be added to your existing composition as a new service.
  • at the moment it is not possible to control other docker-compose fields for the test image service.

If you have a more complicated scenario, you can use the Codefresh YAML to define your pipeline