Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Integrate AgileTest into GitHub CI/CD pipeline

Do you know that now you can import automated tests via pipeline trigger onto AgileTest?

But first, let’s start by learning what GitHub is:

GitHub provides a comprehensive CI/CD tool that enables automated testing and deployment processes for software development projects. With GitHub Actions, developers can create workflows to build, test, and deploy code directly within their repositories.

You can follow the video below for guidance on how to integrate GitHub with AgileTest: 

These are the detailed steps to follow:

Step 1: Generate Client ID & Client Secret

In AgileTest, first, access Jira's admin settings to generate a token for API access, then securely copy the provided Client ID and Secret. These credentials are essential for authenticating your pipeline with AgileTest.

  • Log in to Jira as an admin, then head to Admin settingsAgileTestAPI Integration.

  • Click Generate New Token, select a user, and generate it.

  • Copy the Client ID and Client Secret - keep them secure, as you’ll need them later.

Step 1 Generate Client ID & Client Secret.png

Step 2: Create GitHub Token

Generate a personal access token in GitHub with write:packages permission to allow pipeline actions. This token enables your workflow to interact with GitHub's features securely.

  • On GitHub, go to SettingsDeveloper settingsPersonal access tokens → Token (Classic).

  • Click Generate new token, name it (e.g., "AgileTest Integration"), and enable "write:packages"

  • Generate it, copy the token, and store it safely.

Step 2 Create GitHub Token.png

Step 3: Create Pipeline Configuration YAML file

Create a workflow file in your repository to automate testing, authentication, and result uploads using the provided template. Customize it with your test commands and add your secrets (like the Client ID and Secret) in the repository settings.

  • In your GitHub repository, create a ".github/workflows" folder if it doesn’t exist.

  • Add a file named "sample.yml". You’ll need to customize it with your test commands and secrets. This includes:

    • API to "Authenticate and get the token"

    • API to "Upload the test results"

    • Parameters of AgileTest: "PROJECT_KEY", "TEST_EXECUTION_KEY", "milestoneId", "testEnvironments", "testPlanKeys", "revision", "fixVersions"

Example: Authenticate and Upload Test Results

Here’s a snippet that demonstrates how to authenticate with AgileTest and upload results using a JUnit report:

 

# Authenticate and get the token
export token=$(curl -X POST "$AGILETEST_AUTH_BASE_URL/api/apikeys/authenticate" \
  -H 'Content-Type: application/json' \
  --data '{"clientId":"'"$CLIENT_ID"'","clientSecret":"'"$CLIENT_SECRET"'"}' | tr -d '"')

echo "Token generated: $token"

# Upload the test results
curl -X POST \
  -H "Content-Type: application/xml" \
  -H "Authorization: JWT $token" \
  --data @"./playwright-report/results.xml" \
  "$AGILETEST_BASE_URL/ds/test-executions/junit?projectKey=${{ inputs.PROJECT_KEY }}&testExecutionKey=${{ inputs.TEST_EXECUTION_KEY }}&milestoneId=${{ inputs.milestoneId }}&testEnvironments=${{ inputs.testEnvironments }}&testPlanKeys=${{ inputs.testPlanKeys }}&revision=${{ inputs.revision }}&fixVersions=${{ inputs.fixVersions }}"
  • After pasting, go to your repository’s SettingsSecrets and Actions, and add your Client ID, Client Secret, and other details as secrets. Save and commit the file.

Step 3 Create Pipeline Configuration YAML file.png

Step 4: Create Automation Trigger in AgileTest

To enable AgileTest to initiate your GitHub pipeline remotely, you’ll need to configure an automation trigger. This allows you to run automated tests from AgileTest without switching tools.

Steps to set it up:

  1. In AgileTest, go to
    Settings → Automated Test → GitHub

  2. Click “New Configuration”.

  3. Fill in the following:

    • Repository name: (e.g., "your-username/your-repo")

    • Workflow file name: (e.g., "sample.yml")

    • GitHub token: Use the token generated in Step 2

  4. Click Save, and then toggle the Active switch to enable the configuration.

This setup allows AgileTest to trigger your GitHub Actions workflow directly from the Test Execution ticket.

Step 4 Create Automation Trigger in AgileTest.png

For a detailed step-by-step guide, visit the official documentation:
Trigger build remotely with AgileTest – GitHub

Step 5: Trigger Results from Execution Issue

Trigger the pipeline from AgileTest and monitor its progress in GitHub Actions to ensure successful execution. Once complete, check AgileTest for the imported test results.

  • In the test execution ticket, find AgileTest field, choose your GitHub configuration, and click Trigger pipeline.

  • Monitor progress in your GitHub repository by clicking on each pipeline.

  • Once complete, check AgileTest for the results.

Step 5 Trigger Results from Execution Issue.png

Conclusion

With these steps, you’ve connected AgileTest to your GitHub CI/CD pipeline, making your testing process faster and easier. Give it a try today and see how it improves your workflow. Check the official documentation for more details: https://docs.devsamurai.com/agiletest/github!

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events