Setup for Automated Testing
Get set up for accessibility testing in iOS and Android with axe DevTools Mobile in Appium.
After you have installed the axe DevTools Mobile Appium drivers, you can configure your tests to check for accessibility issues.
Automated Testing
Start the Appium server as normal:
appiumConfigure Your Tests
From your Appium automation scripts, add the capabilities required for axe DevTools Mobile for the platform under test:
Required Android Capability:
| Name | Type | Description |
|---|---|---|
| automationName | String |
Set to 'AxeUiAutomator2' to utilize the driver with axe DevTools Mobile embedded to run accessibility scans. |
| appPackage | String |
The application package of the app under test. Note that appPackage is a part of the UiAutomator2 driver; you may already have it set. |
Required iOS Capability:
| Name | Type | Description |
|---|---|---|
| automationName | String |
Set to 'AxeXCUITest' to utilize the driver with axe DevTools Mobile embedded to run accessibility scans. |
| bundleId | String |
The bundle identifier of the app under test. Note that bundleId is a part of the XCUITest driver; you may already have it set. |
Initialize the Library
In the test class initialization, connect to the driver with one of the following:
Start a Testing Session with a Deque API Key
Generate an Axe DevTools Mobile API key at axe.deque.com. To post results to Axe Developer Hub, you will also need a Project ID. Call the Execute Script API, passing in axeStartSession along with the API Key and Project ID to initiate the testing session.
beforeAll(async () => {
...
const axeAuthSettings = {
apiKey: "<DEQUE_APIKEY>",
projectId: "<DEQUE_PROJECTID>"
};
await driver.execute('mobile: axeStartSession', axeAuthSettings);
...
})If you only want to save results locally, you do not need to include the Project ID.
beforeAll(async () => {
...
await driver.execute('mobile: axeStartSession', { apiKey: "<DEQUE_APIKEY>" });
...
})Start a Testing Session with Offline License Key
Offline automation is available for the Appium drivers, but will require an offline license key for authentication purposes. Please reach out to your Deque representative or contact support to coordinate the delivery of your license key. Then use the snippet below to connect to the Appium driver. Learn more about using our offline Appium drivers to run accessibility scans without making network requests in Frequently Asked Questions.
beforeAll(async () => {
...
await driver.execute('mobile: axeStartSession', { licenseKey: "<DEQUE_OFFLINE_LICENSE_KEY>" });
...
}What's Next?
Now that you have your Appium tests set up, you are ready to scan your mobile app. Optionally, you can customize your configuration before you scan, using our APIs to name your scans, ignore certain results, tag scans and more.
