Skip to main content
Skip table of contents

GitHub

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.

In this document, you will learn how to integrate AgileTest with Github CI/CD tool.

Firstly, you need to acquire Client id and Client secret from AgileTest. Please refer to this document for more details Access API documentation.

Make sure your account has permission to create TestCase and TestExecution issues; otherwise, the import will fail.

Setup with Github

Go to your Github repositorySettingsSecrets and variables. On Secrets tab, add 2 secrets named CLIENT_ID and CLIENT_SECRET and assign them with the values of client id and client secret which you have acquired from AgileTest.

Screen Shot 2025-01-13 at 16.11.59.png

Action secrets

Similarly, on Variables tab, add one and name it PROJECT_KEY. This variable would be used to indicate which project AgileTest will create the new Test execution into.

Screen Shot 2025-01-13 at 16.13.01.png

Action variables

Upload test result

Here is a JUnit report example to experiment with.

JUnit report example
XML
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite tests="15" failures="0" name="ut.com.xpandit.raven.service.impl.IssueDataSetTest" time="0.163" errors="0" skipped="0">
  <properties>
    ...
  </properties>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidLimitOverflowOption_returnsExpectedSubset" time="0.114"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withNullOptionsAndValidIssue_throwsIllegalArgumentException" time="0.002"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidEmptyOptions_returnsAllIssues" time="0.002"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidGlobalSearchOptions_returnsExpectedTests" time="0.016"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndInvalidColumnSearchOption_returnsAllTests" time="0.007"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidLimitUnderOption_returnsExpectedSubset" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidGlobalSearchOptionThatMachesIssueKey_returnsExpectedTestWithMatchedKey" time="0.006"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidSummaryColumnAscSortOption_returnsExpectedIssuesInAscOrder" time="0.006"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidSummaryColumnDescSortOption_returnsExpectedIssuesInDescOrder" time="0.002"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidGlobalSearchOptionThatMatchesAllElements_returnsAllTests" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidColumnSearchOptionThatMatchesOneElement_returnsOneTest" time="0.002"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidColumnSearchOptionThatMatchesNoIssue_returnsEmptyList" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidGlobalSearchOptionThatMachesNoIssue_returnsEmptyList" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidKeyColumnDescSortOption_returnsExpectedIssuesInDescOrder" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidKeyColumnAscSortOption_returnsExpectedIssuesInAscOrder" time="0.001"/>
</testsuite>

If you need more thorough examples, please refer to our public repository for more sample projects Agile Test GitHub.

🔥 Since GitHub masks all tokens stored in secret variables, you'll need to use the AgileTest CLI to upload the test results.

You could find the specs of our CLI here https://agiletestapp.github.io/agiletest-cli/ .

Below is a sample yaml file.

YAML
name: Agile Test Demo
# This workflow represents a set of basic End-to-End tests
on:
  push:
    branches: [main, master]
  pull_request:
    branches: [main, master]
  workflow_dispatch:

env:
  CLIENT_ID: ${{ secrets.CLIENT_ID }}
  CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
  PROJECT_KEY: ${{ vars.PROJECT_KEY }}

jobs:
  test:
    name: run test
    runs-on: ubuntu-latest
    container: maven:3.9.9-amazoncorretto-17-al2023
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Run test
        run: mvn test
      - name: Upload reports
        uses: actions/upload-artifact@v4
        with:
          name: testResult
          path: target/surefire-reports/*.xml
  upload-result:
    name: upload report
    needs: test
    runs-on: ubuntu-latest
    container: ghcr.io/agiletestapp/agiletest-cli:latest
    steps:
      - name: Download artifact
        uses: actions/download-artifact@v4
        with:
          name: testResult
      - name: Upload report
        run: |
          agiletest --client-id ${CLIENT_ID} --client-secret ${CLIENT_SECRET} \
              test-execution import \
              --framework-type junit --project-key ${PROJECT_KEY} \
              TEST-calculateTest.xml

In this workflow yaml file, we have 2 jobs named test and upload-result.

In test job, we run the automation test scripts and the process yields the reports. Then the report is uploaded to Github artifact using upload-artifact action.

Next, in upload-result job, we use Agile Test CLI, which is integrated in a docker image, to upload the test result to Agile Test application.

Firstly, Github workflow downloads the files you have uploaded in the previous stage by calling download-artifact action.

Next, we use below command to upload test results and create Test cases along with test statuses and relevant attachments.

BASH
agiletest --client-id ${CLIENT_ID} --client-secret ${CLIENT_SECRET} \
              test-execution import \
              --framework-type junit --project-key ${PROJECT_KEY} \
              TEST-calculateTest.xml

For each test run, a new Test Execution will be created along with linked Test Cases. However, if the Test Cases already exist in your project, Agile Test will only generate a new Test Execution and link the matching Test Cases to it, including the test results


Should you need any assistance or further AgileTest inquiries, contact here!

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.