GitLab CI/CD
Integrating GitLab with Arcus by Testsigma uploads your JUnit test results to a test run at the end of a pipeline, so test case statuses update automatically.
Prerequisites
Store the Testsigma values in GitLab
Section titled “Store the Testsigma values in GitLab”The GitLab pipeline reads the project and run IDs from variables rather than from the script itself.
-
Open your project in GitLab.
-
Go to Settings > CI/CD > Variables and click Expand.
-
Add these 3 variables:
TESTSIGMA_API_TOKEN: your Arcus by Testsigma API token.TESTSIGMA_PROJECT_ID: your project ID, which appears in your project URL:https://test-management.testsigma.com/ui/projects/<Project_ID>/.TESTSIGMA_RUN_ID: the run ID, which appears in the URL when you view a test run:https://test-management.testsigma.com/ui/test_runs/<Run_ID>/.
-
Click Save changes.
Configure the pipeline
Section titled “Configure the pipeline”In your repository, create or update .gitlab-ci.yml in the root directory:
stages: - upload
upload_testsigma: stage: upload image: curlimages/curl:8.10.1 only: - main script: - 'set -eu' - 'echo "Looking for reports/junit.xml ..."' - 'test -f reports/junit.xml || { echo "File not found: reports/junit.xml"; exit 1; }' - 'echo "Uploading JUnit XML to Testsigma..."' - 'curl --fail --show-error --location --header "Authorization: Bearer ${TESTSIGMA_API_TOKEN}" --form "junit_xml=@reports/junit.xml" "https://arcus.testsigma.com/api/v1/projects/${TESTSIGMA_PROJECT_ID}/junit-import/test-run/${TESTSIGMA_RUN_ID}"' - 'echo "Upload complete."'The pipeline does 3 things:
- Runs when you push to
main. - Checks that the JUnit XML file exists, and fails the job if it doesn’t.
- Uploads the results to the project and test run named in your variables.
Change reports/junit.xml everywhere it appears if your build writes its report somewhere else.
Trigger a build
Section titled “Trigger a build”Commit and push to the repository connected to GitLab. GitLab runs the pipeline, and when it finishes the test run in Arcus by Testsigma updates with the execution results.
Was this page helpful?
Thanks for the feedback.