Integrate Testsigma with AWS DevOps(CodeCommit, CodeBuild, CodeDeploy)

Here we will discuss how we can Integrate AWS DevOps with Testsigma.

AWS Services:

CodeCommit: AWS CodeCommit is a version control service that enables you to privately store and manage Git repositories in the AWS cloud.

CodeBuild: CodeBuild compiles your source code, runs unit tests, and produces artifacts that are ready to deploy.

CodeDeployAWS CodeDeploy is a deployment service that enables developers to automate the deployment of applications to instances and to update the applications as required.

AWS DevOps integration methods:

  • Go to CodeBuild Services, Create a Build Project, and Start a Build using your repository.
  • Create CodePipeline with Source, Build, and Pipeline details.

Go to CodeBuild Services, Create a Build Project, and Start a Build using your repository:

1. Click on the Build projects option under the Build section and Create a new Build Project:

2. Give in the project configuration details and select the Source Provider and Repository Accordingly, here we have selected Github as our repository and give Buildspec name as your .yml file name from GitHub:

3. Once this is done Please update the .yml file in the repository with the below code. In this case, we have taken a sample file aws_codebuild.yml:

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
version: 0.2
      java: corretto11
      - echo Nothing to do in the pre_build phase...
      - bash
      - echo Build completed on `date`

As shown in the above code, the file under commands needs to be updated with Test Plan details and added to the repository. We have taken a sample file.

Add the Test Plan details to the .sh file which you need to trigger:

#********START USER_INPUTS ********

TESTSIGMA_API_KEY= <Give in an API Key Generated in the Configuration-> API Keys tab in Testsigma>

TESTSIGMA_TEST_PLAN_ID= <Test Plan ID for the run which you need to trigger>

#********END USER_INPUTS***********

4. Now in the AWS CodeBuild, click on start build:

5. Once Build has been initiated you can check the progress and build logs as shown in the below screenshot:

Also, go to the Testsigma account, there you can see that your Test Plan (the ID which you have given in your .sh file)has been triggered.

Create CodePipeline with Source, Build, and Pipeline details

Similarly, you can go to the CodePipeline service in AWS and create a pipeline for running the Source, Build and Deploy together. You can use the same project created in the CodeBuild earlier inside your CodePipeline. 

Follow the below steps for creating CodePipeline and triggering the test:

1. Click on create a pipeline:

2. You can give in all the build details(selecting the repository accordingly) and select the project which you want to add in your pipeline. In the below screenshot you can see that the project which we created earlier in CodeBuild "demo123" is visible here and we will be selecting that only.

3. Once you have given the details for the Pipeline settings, Source, Deploy stage then you can review the details and click on Create Pipeline:

As soon as you click on create pipeline the run will be triggered:

That's all we need to automate Test Execution when a successful build is triggered using the AWS DevOps.

 Please click here to know the steps on how to integrate with AWS Lambda.

Welcome to the era of Smart Test Automation!