Integrate Testsigma with Google Cloud Build


You can integrate Google Cloud Build with your version control system to automate test execution using a shell script that triggers Testsigma tests via CI/CD. This article discusses configuring Google Cloud Build with a repository and executing test automation workflows using a cloudbuild.yaml file.


Prerequisites

Before you begin, ensure you have:

  • A GitHub repository with your project code.
  • A Google Cloud project with billing enabled.
  • Admin permissions in both GitHub and Google Cloud.

Create or Select a Google Cloud Project

  1. Navigate to Google Cloud Console.
  2. On the Google Cloud home page, click Select a Project. select a project
  3. In the Select a project dialog, click New Project if you don’t already have one. New Project
  4. If you already have a project, select it from the list.

  1. Click the navigation menu. navigation menu
  2. In the navigation menu, click View all products. view all products
  3. In the left panel, under Categories, click CI/CD. ci/cd
  4. Click Cloud Build under the CI/CD section. cloud build

Create a Repository Connection

  1. In the Cloud Build navigation pane, click Repositories and then click Connect repository to connect your source code. connect repository
NOTE:
  1. On the Connect repository overlay, select your source code management provider from the list (we’re selecting GitHub), then click Continue.
NOTE:
  • Google Cloud Build will redirect you to GitHub.
  1. Return to Google Cloud Build, and it authenticates automatically.
  2. Once authentication is done, expand the drop-down in the Select repository step and select the required one.

Create a Trigger

  1. Go to Triggers in the Cloud Build menu and click on + Create trigger. create trigger
  2. Enter a name for your trigger in the Name field. Name
  3. In the Create trigger page, under the Source section, expand the drop-down in the Repository and Branch fields and select the required ones.
  4. Under the Configuration section, select the Cloud Build configuration file (yaml or json) radio button.
  5. Under the Location section, select the Repository radio button to automatically fetch the pipeline file details from your GitHub repository.
  6. If you select the Inline radio button and click Open editor to manually add your YAML configuration.
  7. Add the following in the Edit Inline Configuration overlay and click Done:
steps:
  - name: 'ubuntu:20.04'
    args:
      - '-c'
      - |
        apt-get update && apt-get install -y curl bash coreutils
        chmod +x tstrigger.sh
        ./tstrigger.sh
    entrypoint: bash
options:
  logging: CLOUD_LOGGING_ONLY
  1. Under the Advanced section, expand the drop-down in the Service account field, select the required account, and click Create.

Run the Configuration

  1. Click Run on the newly created trigger. run
  2. You can view the build results under History in the Cloud Build menu. history