Save Results Locally
Supported within:
Save results locally to utilize the axe DevTools Reporter CLI to build an executive report off a set of scans within your CI/CD pipeline.
A scan's result will be saved as a .json file. Saving results locally is only supported within automated testing.
Optional Parameters
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. Scan name will default to the title of the view controller if available.
try axe?.saveResult(result, toPath: "", withFileName: "", withScanName: "")
axeDevToolsUIKit Example
func testHomeScreen() throws {
let view = HomeViewController()
guard let result = try axe?.run(onViewController: view) 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)
}
axeDevToolsXCUI 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)
}