Save Results Locally
When you save scan results locally, you can use the JSON result to integrate accessibility metrics into different reporting tools. You can also create an HTML report to share via email or chat, to notify your team of the accessibility health of your test run.
Saving results locally is only supported within automated testing.
Save and Share Results
Use the following code to save test results as a .json
file. If the path and file name are not specified, the results will be named "(APPID)-(CURRENT_SCREEN_TITLE).json"
and will be saved in a folder called "AxeDevToolsResults"
within your User folder. The scan name will default to the title of the view controller if available.
try axe?.saveResult(result, toPath: "", withFileName: "", withScanName: "")
Use Results for Reporting
Utilize the axe DevTools Reporter CLI to build an HTML report from a set of scans. Alternatively, you can access the result files programmatically to integrate accessibility metrics with internal reporting tools.
Full Example
func testAccessibility() throws {
guard let result = try axe?.run(onElement: XCUIApplication()) else { XCTFail(); return }
//Save Result Locally
let path = try axe?.saveResult(result)
print("Result saved to location: \(path)")
//Any assertions
XCTAssertEqual(result?.failures.count, 0)
}
Support on Cloud Testing Platforms
Saving a result locally will not work as expected on Cloud Testing Platforms. If you need support for Cloud Testing Platforms, please send a request to helpdesk@deque.com or at support.deque.com.