Overview Run Continuous Testing tests in your GitLab pipelines, block deployments, and trigger rollbacks to ensure your code is added in production when your essential business workflows are functioning as expected.
To integrate Continuous Testing tests with a GitLab pipeline , you can use the datadog-ci npm package .
Setup To get started:
Add your Datadog API and application keys as variables in your GitLab project. Ensure your GitLab runner has a version of Node.js >= 10.24.1 installed. For more information, see CI/CD Integrations Configuration .
Simple configuration Run tests using test IDs
Copy
stages :
- test
synthetic-tests :
stage : test
script :
- npm install -g @datadog/datadog-ci
- datadog-ci synthetics run-tests --apiKey "$DATADOG_API_KEY" --appKey "$DATADOG_APP_KEY" --public-id xtf-w5p-z5n --public-id eif-van-tu7
Copy
stages :
- test
synthetic-tests :
stage : test
script :
- npm install -g @datadog/datadog-ci
- datadog-ci synthetics run-tests --apiKey "$DATADOG_API_KEY" --appKey "$DATADOG_APP_KEY" -s 'tag:e2e-tests'
Run tests using variable overrides If you have different test users or data specific to your CI/CD environment, you can override these variables with the -v
command. For more information, see the Synthetics command](https://github.com/DataDog/datadog-ci/tree/master/src/commands/synthetics ) in the datadog-ci
NPM package.
Copy
stages :
- test
synthetic-tests :
stage : test
script :
- npm install -g @datadog/datadog-ci
- datadog-ci synthetics run-tests --apiKey "$DATADOG_API_KEY" --appKey "$DATADOG_APP_KEY" -s 'tag:e2e-tests' -v PASSWORD="$PASSWORD"
Advanced configuration Run tests using a custom configuration file Add a custom config.json
file to your pipeline repository and access it in your pipeline configuration.
Copy
stages :
- test
synthetic-tests :
stage : test
script :
- npm install -g @datadog/datadog-ci
- datadog-ci synthetics run-tests --apiKey "$DATADOG_API_KEY" --appKey "$DATADOG_APP_KEY" --config synthetics_global.json -f synthetic_test.json
Test output This example demonstrates the pipeline has identified the configuration file and is running the test:
A successful test output returns the following in GitLab:
Further reading Additional helpful documentation, links, and articles: