Setup for Automated Testing

Link to Setup for Automated Testing copied to clipboard

Add the framework into your UI tests

Not for use with personal data

Automated Testing

XCTest is required to run axeDevToolsXCUI. Other UI testing frameworks are supported that utilize XCTest.

Setup for Testing

In any file used for accessibility testing, import the axeDevToolsXCUI framework.

import axeDevToolsXCUI

Create an object within your testing class to hold onto the axe DevTools instance:

var axe: AxeDevTools?

Initialize the framework within the setUp or setUpWithError methods.

Connect with an API key:

Generate an API key at axe.deque.com.

axe = try? AxeDevTools.login(withAPIKey: "<DEQUE_APIKEY>")

Connect with username and password:

axe = try? AxeDevTools.login(withUsername: "<DEQUE_USERNAME>", andPassword: "<DEQUE_PASSWORD>")
Enable local networking and arbitrary loads within your `Info.plist`


        <key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
            <key>NSAllowsLocalNetworking</key>
            <true/>
        </dict>

Setup Example

import axeDevToolsXCUI
import XCTest

class MyUITests: XCTestCase {
    var axe: AxeDevTools?
    var app = XCUIApplication()

    override func setUpWithError() throws {
        axe = try AxeDevTools.login(withAPIKey: "<DEQUE_APIKEY>")

        app.launch()
    }
}

What's Next?

Now that you have the axeDevToolsXCUI framework, you are all set to scan your mobile app. Optionally, you can customize your configuration before you scan, if you want to name your scans, ignore certain results, create custom rules, or tag scans.