Integrate Testsigma with Github


When you want to automate, customize, and, execute your software development workflows right in your github repository, you need to use github actions. In this document, we will discuss how to integrate Github with Testsigma for CI/CD purposes.


Pre-requisites:

You should already know:

  1. The basics of github actions. If not, please refer here: Quickstart with github actions
  2. How to generate an API key from Settings.
  3. How to get Test Plan ID from an existing Test Plan.

For Github CICD Integration:

To start with Github Actions, create a .github/workflows directory in your repository on GitHub if this directory does not already exist.

workflows directory created under folder .github

Once the workflow directory is created, for different pipelines/workflows we can create any number of YML files which cater to different build processes.

In this example, we have created a testsigma-cicd.yml file to trigger the build process whenever there is a commit to the provided git repository.

testsigma cicd yml file created to trigger the build process

In this yml file, we have given a build step to trigger/run a Test Plan created in the Testsigma app.

build step in yml file

As you can see we are invoking the bash script contained in the file runsmoketests.sh. You can get a copy of this runsmoketests.sh file here: runsmoketests.sh

Note:

Refer https://testsigma.com/docs/continuous-integration/shell-script/ for a shell script to run/trigger Test plans in Testsigma.

Similarly, the shell script here can be used to trigger a particular test plan within your Testsigma account. For that, you need to provide the ID of that Test Plan and the API Key along with other parameters. To know how to get the Test Plan ID, refer here and to get the API key, refer here. The key "TESTSIGMAAPIKEY" in the script needs to be provided the API Key value and the key "TESTSIGMATESTPLAN_ID" needs to be provided the test plan ID. Below is how the script looks for our example:

test plan API key and other parameters in Testsigma

Repo used to create this document