Appium Testing with Digital.ai
Add accessiblity scans to your Appium tests with Digital.ai!
Deque has partnered with Digital.ai to bring accessibility testing to your existing automation test workflows. Add accessibility scans to your Appium tests with axe DevTools Mobile, run your tests on Digital.ai devices, then review the results in our online axe DevTools Mobile Dashboard.
Prerequisites:
- Access to Digital.ai Continuous Testing
- Your application uploaded to the Digital.ai Application Manager
- API Key for axe DevTools Mobile
- Your tests running against Appium version 2.11.3 or above
- Your tests using the AxeUIAutomator or AxeXCUITest Appium drivers (pre-installed by Digital.ai)
How to Take Accessibility Scans
Digital.ai has pre-installed the axe Appium drivers on their Appium servers. These drivers enable you to run accessibility scans from your Appium tests. Deque's AxeUiAutomator2
and AxeXCUITest
drivers are forked from the UiAutomator2
and XCUITest
drivers. We fork but do not change the core functionality of these drivers. Your tests will run as expected, and you'll have the added capability to take accessibility scans!
The key steps to configure your Appium tests for accessibility testing are:
- Set the Automation Name to
AxeUiAutomator2
for Android orAxeXCUITest
for iOS. (Note the Axe prefix.) - Provide your Deque API key for authentication.
- Execute the script
mobile: axeScan
each place in your tests you'd like to take an accessibility scan. - After running your tests on Digital.ai devices, review your results on the axe DevTools Mobile dashboard.
Refer to our setup guide for Appium to learn how to customize your configuration and leverage results of accessibility scans to best serve your team, and see a full list of Appium sample tests. The setup guide and examples are general and do not contain everything you need for the Digital.ai integration.
Examples
The examples below show how to configure your Appium tests for accessibility testing with the Digital.ai platform. These examples are written in Java; however, Appium supports multiple programming languages.
Android
@BeforeMethod
public void setUp() throws MalformedURLException {
desiredCapabilities.setCapability("accessKey", ACCESS_KEY); // Digital.ai's Access Key
desiredCapabilities.setCapability("deviceQuery", "@os='android'");
desiredCapabilities.setCapability("appium:automationName", "AxeUiAutomator2");
desiredCapabilities.setCapability("app", "cloud:com.experitest.ExperiBank/.LoginActivity");
desiredCapabilities.setCapability("appPackage", "com.experitest.ExperiBank");
desiredCapabilities.setCapability("appActivity", ".LoginActivity");
desiredCapabilities.setCapability("appiumVersion", "2.16.2");
driver = new AndroidDriver(new URL("https://<your_cloud_url>/wd/hub"), desiredCapabilities);
Map<String, Object> settings = new HashMap<>();
List<String> tags = new ArrayList<>();
settings.put("apiKey", API_KEY); // axe DevTools API Key
settings.put("scanName", "Axe driver"); // a customized scan name to better identify scans within the dashboard.
settings.put("tags", tags); // an array of strings to apply to scans as tags.
driver.executeScript("mobile: axeScan", settings);
}
iOS
@BeforeMethod
public void setUp() throws MalformedURLException {
desiredCapabilities.setCapability("accessKey", ACCESS_KEY); // Digital.ai's Access Key
desiredCapabilities.setCapability("deviceQuery", "@os='ios'");
desiredCapabilities.setCapability("appium:automationName", "AxeXCUITest");
desiredCapabilities.setCapability("app", "cloud:com.experitest.ExperiBank");
desiredCapabilities.setCapability("bundleId", "com.experitest.ExperiBank");
desiredCapabilities.setCapability("appiumVersion", "2.16.2");
driver = new IOSDriver<>(new URL("https://<your_cloud_url>/wd/hub"), desiredCapabilities);
Map<String, Object> settings = new HashMap<>();
List<String> tags = new ArrayList<>();
settings.put("apiKey", API_KEY); // axe DevTools API Key
settings.put("scanName", "Axe driver"); // a customized scan name to better identify scans within the dashboard.
settings.put("tags", tags); // an array of strings to apply to scans as tags.
driver.executeScript("mobile: axeScan", settings);
}