GitLab Integration With Testsigma


This article explains how to integrate GitLab with Testsigma for CI/CD purposes.

Pre-requisites:

To integrate GitLab with Testsigma, you need the following information:

  1. You should have a GitLab account.
  2. Testsigma API key.
  3. Testsigma Testplan ID, for more information on test plan ID, refer to get test plan ID.

Steps to integrate GitLab with Testsigma

  1. Login to your GitLab account.
  2. Create a blank project or create a CI/CD project as per your preference by clicking on New project. New Project
  3. On create project page, enter all the details and click on Create project. Create project
  4. Navigate to CI/CD and click on Jobs. Navigate to CI/CD
  5. Click on Create CI/CD Configuration file to create a YML file. Alternatively, you can also use the below YML sample to create the job.
stages:
 - build
build-code-job:
 stage: build
 script:
 - echo "Calling Shell Script of testsigma"
 - pwd
 - ls -la
 - chmod a+x gitlabcicd.sh
 - ./gitlabcicd.sh 
NOTE:
  1. Refer to the Shell Script to get the sh script, which contains the command that triggers the test plan and fetches the run result. We call this sh script, gitlabcicd.sh, in the above YML file.
  2. You can place the sh script in the same project, call the file inside the YML file, or obtain it from any external sources by providing the appropriate path.
  3. Any bash runner can work with the provided YML file. For instance, if you are using the Docker runner, you can use the YML file as it is. However, if you have a different runner like Powershell, you must modify the YML file to make it executable in the Powershell runner. Additionally, ensure that Powershell is version seven or above.
  1. Once you have access to the shell script, you need to provide the ID of that Test Plan and the API Key along with other parameters.

NOTE:

The keys TESTSIGMAAPIKEY and TESTSIGMATESTPLAN_ID in the script should be replaced with API Key and Test Plan ID, respectively. Refer to the example below.

Example

  1. Click on Commit changes once you have created the YML script, and the job will start to run. Commit changes
  2. From the screenshot below, you can see the job running. You can also notice that the test plan configured inside the shell script would start running. Job running

Once the job is completed you can see the execution report as an XML report based on the path you have shared on the shell script.

  1. Post completion of the job, you can see the details below: Post Run