{
    "componentChunkName": "component---src-templates-page-jsx",
    "path": "/docs/test-management/ci-cd-integrations/gitlab/",
    "result": {"data":{"markdownRemark":{"html":"<br>\n<p><strong>Integrate GitLab with Test Management by Testsigma and automate your test runs and generate test reports.</strong></p>\n<hr>\n<p>Integrate GitLab with Test Management by Testsigma to automate test executions and generate test reports through CI/CD pipelines. This article discusses integrating GitLab with Test Management by Testsigma.</p>\n<hr>\n<blockquote>\n<h2 id=\"prerequisites\" style=\"position:relative;\"><a href=\"#prerequisites\" aria-label=\"prerequisites permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Prerequisites</strong></h2>\n<p>Before you begin, ensure the following:</p>\n<ul>\n<li>You have a <strong>GitLab</strong> account and a connected project repository.</li>\n<li>A project and at least one test run exist in Test Management by Testsigma.</li>\n<li>You have an API token from Test Management by Testsigma.</li>\n<li>Your test results are generated in JUnit XML format (for example, reports/junit.xml)</li>\n</ul>\n</blockquote>\n<hr>\n<h2 id=\"set-testsigma-secrets-in-gitlab\" style=\"position:relative;\"><a href=\"#set-testsigma-secrets-in-gitlab\" aria-label=\"set testsigma secrets in gitlab permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Set Testsigma Secrets in GitLab</strong></h2>\n<p>To allow GitLab to communicate securely with Testsigma:</p>\n<ol>\n<li>Go to your project in GitLab</li>\n<li>Navigate to <strong>Settings > CI/CD > Variables</strong> and click <strong>Expand</strong>.</li>\n<li>\n<p>Add the following environment variables:</p>\n<ul>\n<li><strong>TESTSIGMA_API_TOKEN</strong></li>\n<li><strong>TESTSIGMA_PROJECT_ID</strong></li>\n<li><strong>TESTSIGMA_RUN_ID</strong></li>\n</ul>\n</li>\n<li>Click <strong>Save</strong> changes.</li>\n</ol>\n<hr>\n<h2 id=\"configure-the-gitlab-pipeline\" style=\"position:relative;\"><a href=\"#configure-the-gitlab-pipeline\" aria-label=\"configure the gitlab pipeline permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Configure the GitLab Pipeline</strong></h2>\n<p>In your project repository, create or update the <strong>.gitlab-ci.yml</strong> file in the root directory with the following configuration:</p>\n<div class=\"gatsby-highlight\" data-language=\"yml\"><pre class=\"language-yml\"><code class=\"language-yml\"><span class=\"token key atrule\">stages</span><span class=\"token punctuation\">:</span>\n  <span class=\"token punctuation\">-</span> upload\n\n<span class=\"token key atrule\">upload_testsigma</span><span class=\"token punctuation\">:</span>\n  <span class=\"token key atrule\">stage</span><span class=\"token punctuation\">:</span> upload\n  <span class=\"token key atrule\">image</span><span class=\"token punctuation\">:</span> curlimages/curl<span class=\"token punctuation\">:</span>8.10.1\n  <span class=\"token key atrule\">only</span><span class=\"token punctuation\">:</span>\n    <span class=\"token punctuation\">-</span> main\n  <span class=\"token key atrule\">script</span><span class=\"token punctuation\">:</span>\n    <span class=\"token punctuation\">-</span> <span class=\"token string\">'set -eu'</span>\n    <span class=\"token punctuation\">-</span> <span class=\"token string\">'echo \"Looking for reports/junit.xml ...\"'</span>\n    <span class=\"token punctuation\">-</span> <span class=\"token string\">'test -f reports/junit.xml || { echo \"File not found: reports/junit.xml\"; exit 1; }'</span>\n    <span class=\"token punctuation\">-</span> <span class=\"token string\">'echo \"Uploading JUnit XML to Testsigma...\"'</span>\n    <span class=\"token punctuation\">-</span> 'curl <span class=\"token punctuation\">-</span><span class=\"token punctuation\">-</span>fail <span class=\"token punctuation\">-</span><span class=\"token punctuation\">-</span>show<span class=\"token punctuation\">-</span>error <span class=\"token punctuation\">-</span><span class=\"token punctuation\">-</span>location \\\n        <span class=\"token key atrule\">--header \"Authorization</span><span class=\"token punctuation\">:</span> Bearer $<span class=\"token punctuation\">{</span>TESTSIGMA_API_TOKEN<span class=\"token punctuation\">}</span>\" \\\n        <span class=\"token punctuation\">-</span><span class=\"token punctuation\">-</span>form \"junit_xml=@reports/junit.xml\" \\\n        \"https<span class=\"token punctuation\">:</span>//test<span class=\"token punctuation\">-</span>management.testsigma.com/api/v1/projects/$<span class=\"token punctuation\">{</span>TESTSIGMA_PROJECT_ID<span class=\"token punctuation\">}</span>/junit<span class=\"token punctuation\">-</span>import/test<span class=\"token punctuation\">-</span>run/$<span class=\"token punctuation\">{</span>TESTSIGMA_RUN_ID<span class=\"token punctuation\">}</span>\"'\n    <span class=\"token punctuation\">-</span> <span class=\"token string\">'echo \"Upload complete.\"'</span></code></pre></div>\n<p>This configuration performs the following actions:</p>\n<ul>\n<li>Runs when you push to the main branch.</li>\n<li>Verifies that the JUnit XML file exists.</li>\n<li>Upload the test results to your specified Testsigma project and test run.</li>\n</ul>\n<div class=\"custom-block alert alert-info\"><div class=\"custom-block-heading\"><strong>NOTE</strong>:</div><div class=\"custom-block-body\"><ul>\n<li>Replace <strong>TESTSIGMA_PROJECT_ID</strong> in the curl command with your Project ID. You can find it in your project URL: <a href=\"https://test-management.testsigma.com/ui/projects/%7BProject_ID%7D/\">https://test-management.testsigma.com/ui/projects/{Project_ID}/</a></li>\n<li>Replace <strong>TESTSIGMA_RUN_ID</strong> in the curl command with your <strong>Test Run ID</strong>, available in the <strong>Test Run URL</strong>: <a href=\"https://test-management.testsigma.com/ui/test_runs/%7BRun_ID%7D/\">https://test-management.testsigma.com/ui/test_runs/{Run_ID}/</a></li>\n<li>Replace <strong>TESTSIGMA_API_TOKEN</strong> with your Testsigma API token stored in GitLab CI/CD variables.</li>\n<li>Ensure the JUnit report path (reports/junit.xml) matches your actual test report file location.</li>\n</ul></div></div>\n<hr>\n<h2 id=\"triggering-the-pipeline\" style=\"position:relative;\"><a href=\"#triggering-the-pipeline\" aria-label=\"triggering the pipeline permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Triggering the Pipeline</strong></h2>\n<ol>\n<li>Commit and push your changes to the repository connected to GitLab.</li>\n<li>GitLab will run the workflow.</li>\n<li>After completion, the corresponding test run in Test Management by Testsigma will be automatically updated with the test execution results.</li>\n</ol>\n<hr>","frontmatter":{"title":"GitLab Integration with Test Management by Testsigma","page_title":"GitLab Integration with Test Management by Testsigma","metadesc":"Integrate GitLab with Test Management by Testsigma to automate test executions & generate test reports through CI/CD pipelines | GitLab Integration with TMS by Testsigma","noindex":false,"contextual_links":[{"type":"section","name":"Contents","url":null},{"type":"link","name":"Prerequisites","url":"#prerequisites"},{"type":"link","name":"Set Testsigma Secrets in GitLab","url":"#set-testsigma-secrets-in-gitlab"},{"type":"link","name":"Configure the GitLab Pipeline","url":"#configure-the-gitlab-pipeline"},{"type":"link","name":"Triggering the Pipeline","url":"#triggering-the-pipeline"}]},"fields":{"slug":"/docs/test-management/ci-cd-integrations/gitlab/"}}},"pageContext":{"slug":"/docs/test-management/ci-cd-integrations/gitlab/","prev":{"fields":{"slug":"/docs/test-management/ci-cd-integrations/circleci/"},"frontmatter":{"title":"CircleCI Integration with Test Management by Testsigma","metadesc":"Integrate CircleCI with TMS by Testsigma to automate test executions & generate test reports through CI/CD pipelines | CircleCI Integration with TMS by Testsigma","canonical":null,"keywords":null,"social_share_summary":null,"social_share_desc":null,"social_share_image":null,"noindex":false}},"next":null}},
    "staticQueryHashes": ["2855385900","63159454"]}