Generate Reports within CI/CD

This page is not available in the language you requested. You have been redirected to the English version of the page.
Link to this page copied to clipboard
Not for use with personal data

With axe DevTools Reporter, you can now generate self-contained reports right within your continuous integration / continuous deployment (CI/CD) pipeline.

Follow the basic steps below to integrate the reporter into your Android or iOS pipeline.

Integration into an Android Pipeline

Set up your Automated Tests

  1. Update your automated tests to save results locally, which can then be used to generate the report.

  2. Add the script below to your app's build.gradle file, below the android block, and ensure it's not within another Gradle task. Add your app package name in the packageName variable. This script will move the results generated from your automated run to the build folder's report directory.

def reportsDirectory = "$buildDir/reports/androidTests/connected/axe"
def packageName = "your.app.package.name.here"

def createAndroidFolderDirectoryTask = task('createAndroidFolderDirectoryTask', type: Exec, group: 'reporting') {
    executable "${android.getAdbExecutable().toString()}"
    args 'shell', 'mkdir', '-p', '/storage/emulated/0/Android/data/' + packageName + '/files/AxeTestCases'
}

def clearAndroidDirectoryTask = task('clearAndroidDirectoryTask', type: Exec, group: 'reporting') {
    executable "${android.getAdbExecutable().toString()}"
    args 'shell', 'rm', '-r', '/storage/emulated/0/Android/data/' + packageName + '/files/AxeTestCases'
}

def fetchAndroidFolderAxeReportsTask = task('fetchAndroidFolderAxeReportsTask', type: Exec, group: 'reporting') {
    executable "${android.getAdbExecutable().toString()}"
    args 'pull', '/storage/emulated/0/Android/data/' + packageName + '/files/AxeTestCases', reportsDirectory

    dependsOn {
        createAndroidFolderDirectoryTask
    }

    finalizedBy {
        clearAndroidDirectoryTask
    }

    doFirst {
        new File(reportsDirectory).mkdirs()
    }
}

def createDirectoryTask = task('createDirectoryTask', type: Exec, group: 'reporting') {
    executable "${android.getAdbExecutable().toString()}"
    args 'shell', 'mkdir', '-p', '/storage/emulated/0/Documents/AxeTestCases'
}

def clearDirectoryTask = task('clearDirectoryTask', type: Exec, group: 'reporting') {
    executable "${android.getAdbExecutable().toString()}"
    args 'shell', 'rm', '-r', '/storage/emulated/0/Documents/AxeTestCases'

    finalizedBy {
        fetchAndroidFolderAxeReportsTask
    }
}

def fetchAxeReportsTask = task('fetchAxeReportsTask', type: Exec, group: 'reporting') {
    executable "${android.getAdbExecutable().toString()}"
    args 'pull', '/storage/emulated/0/Documents/AxeTestCases', reportsDirectory

    dependsOn {
        createDirectoryTask
    }

    finalizedBy {
        clearDirectoryTask
    }

    doFirst {
        new File(reportsDirectory).mkdirs()
    }
}

tasks.configureEach { task ->
    if (task.name == 'connectedDebugAndroidTest') {
        task.finalizedBy {
            fetchAxeReportsTask
        }
    }
}

Steps to Generate the Report

  1. Log in to our private artifactory, Agora, with your Deque credentials.
  2. From the "Welcome, <your_email>" drop-down, select 'Edit Profile'.
  3. Click 'Generate an Identity Token'.
  4. A dialog box will open and show the option to copy the Reference Token.
  5. Create a distinctive name for the Identity Token and add that in the description. The example below uses AGORA_IDENTITY_TOKEN as the name
  6. Select 'Next'.
  7. In the next dialog box, please copy your Identity Token for use in the below script. For an automated pipeline, look into having this token available in your environment variables or project secrets for your platform.
note

The Identity Token is accessible from within the dialog only, and you will not be able to view it again after closing the dialog. This token will expire 11 months and 30 days after its creation.

  1. Before running your tests or build, fetch the reporter. Here's a script to get started:
    # Compatible with a Mac runner on GitHub Actions. Make changes to the Reporter download type and location based on your pipeline requirements.
    AGORA_IDENTITY_TOKEN='<YOUR_AGORA_IDENTITY_TOKEN>'
    curl --compressed \
         -H "X-JFrog-Art-Api: ${AGORA_IDENTITY_TOKEN}" \
        "https://agora.dequecloud.com/artifactory/axe-devtools-reporter-cli/prod/4.11.1/pkgs/@axe-devtools/reporter-cli-macos" \
         --output "/Users/runner/reporter"
    chmod +x /Users/runner/reporter
  1. Build your app and run your tests

  2. Once tests have finished, execute the reporter and specify the file path of the result JSON files.

    DEQUE_RESULTS="../ContainingFolder"
    /Users/runner/reporter ${DEQUE_RESULTS} "AxeReport" --format=html
tip

Customize your output format (--format) with html, junit or csv.

Integration into an iOS Pipeline

Setup your Automated Tests

Update your automated tests to save results locally, which can then be used to generate the report.

Steps to Generate the Report

  1. Log in to our private artifactory, Agora, with your Deque credentials.
  2. From the "Welcome, <your_email>" drop-down, select "Edit Profile".
  3. Click 'Generate an Identity Token'.
  4. A dialog box will open and show the option to copy the Reference Token.
  5. Create a distinctive name for the Identity Token and add that in the description. The example below uses AGORA_IDENTITY_TOKEN as the name.
  6. Select 'Next'.
  7. In the next dialog box, please copy your Identity Token for use in the below script. For an automated pipeline, look into having this token available in your environment variables or project secrets for your platform.
note

The Identity Token is accessible from within the dialog only, and you will not be able to view it again after closing the dialog. This token will expire 11 months and 30 days after its creation.

  1. Before running your tests or build, fetch the reporter. Here's a helpful script to get started:
    AGORA_IDENTITY_TOKENY='<YOUR_AGORA_IDENTITY_TOKEN>'
    curl --compressed \
         -H "X-JFrog-Art-Api: ${AGORA_IDENTITY_TOKEN}" \
        "https://agora.dequecloud.com/artifactory/axe-devtools-reporter-cli/prod/4.11.1/pkgs/@axe-devtools/reporter-cli-macos" \
         --output "/Users/runner/reporter"
    chmod +x /Users/runner/reporter
  1. Build your app and run your tests.

  2. Once tests have finished, execute the reporter and specify the file path of the result JSON files.

    DEQUE_RESULTS="../ContainingFolder"
    /Users/runner/reporter ${DEQUE_RESULTS} "AxeReport" --format=html
tip

Customize your output format (--format) with html, junit or csv.