View Mobile Results for XCUI Testing in Developer Hub
Not for use with personal data
Requires:
axeDevToolsXCUI
Framework- axe DevTools Mobile API Key
- Developer Hub Project ID
Developer Hub Projects
When you create a project in axe Developer Hub, you will get a unique Project ID that you'll use to push test results to Developer Hub. In addition to this project ID, you will also need an axe DevTools Mobile API Key to send results. Learn how to Get an axe DevTools Mobile API Key.
Setup
- Install the axeDevToolsXCUI Framework
- Use the example below as a reference to implement axe in your tests.
- Use the
startSession
function - Copy/paste your axe DevTools Mobile key into <DEQUE_APIKEY>.
- Copy/paste the Project ID into <DEVHUB_PROJECT_ID>.
- Use the
axe = try? AxeDevTools.startSession(apiKey: "<DEQUE_APIKEY>",
projectId: "<DEVHUB_PROJECT_ID>")
Note: Your results will be posted to both the axe Devtools Mobile Dashboard and axe Developer Hub. The Mobile Dashboard will eventually be retired in favor of Developer Hub, but during the transition, you can access your results in both places.
Full Example
class SampleUITests: XCTestCase {
var axe: AxeDevTools?
var app = XCUIApplication()
override func setUp() {
axe = try? AxeDevTools.startSession(apiKey: "<DEQUE_APIKEY>",
projectId: "<DEVHUB_PROJECT_ID>")
app.launch()
sleep(1)
}
func testAccessibility() throws {
guard let result = try axe?.run(onElement: app) else {
XCTFail()
return
}
// Send results to the dashboard in case of a failure.
if result.failures.count > 0 {
try axe?.postResult(result)
}
// Fail the build if failures were found
XCTAssertEqual(result.failures.count, 0)
}
}