Advanced Automation Examples

Link to Advanced Automation Examples copied to clipboard
Free Trial

With axe DevTools for Mobile, you can have complete accessibility testing at every step of the development lifecycle. Catch accessibility issues with automation before they are added to the codebase.

Automation setup can be found in the getting started pages for XML layouts and Compose layouts.

This section will discuss features available to you to customize your automation experience. You'll also find examples of integrating axe DevTools into your favorite testing frameworks within the left-side navigation.

Scans can be sent to the dashboard and/or saved locally. Save scans locally to generate session reports utilizing the axe DevTools Reporter CLI tool.

Custom Configuration

Utilize some of the available features when initializing the AxeDevTools or AxeDevToolsCompose objects before testing begins.

Update Build Status

As mentioned above, axe DevTools is available throughout your CI/CD pipeline. To fail a build and keep an issue from being merged, you will want to fail a test when accessibility issues are found.

private fun a11yScan() {
    rule.scenario.onActivity { activity ->
        //1. Scan and receive the ScanResultHandler locally
        val scanResultHandler = axe.scan(activity)

        //2. Upload it to the dashboard
        scanResultHandler?.uploadToDashboard()

        //3. Using the results in your test suite
        val result: AxeResult? = scanResultHandler?.getSerializedResult()
        val failureCount = result?.axeRuleResults?.filter { axeRuleResult -> axeRuleResult.status == AxeStatus.FAIL }.size

        //4. Fail the build if failures occurred
        assertEquals(failureCount, 0)
    }
}