Save Results Locally
Supported within:
Save results locally to utilize the axe DevTools Reporter CLI to build an executive report from 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.
For XML layouts, be sure to pass in the activity to scan. axe
refers to the object you initialized in your test class setup.
axe.scan(activity)?.saveResultToLocalStorage("prefix")
For Compose layouts, axeCompose
refers to the object you initialized in your test class setup.
axeCompose.scan()?.saveResultToLocalStorage("prefix")
Note: You can change the scan's name prior to saving the result.
Accessing the Result Locally
The scan's JSON file will be saved to the Android emulator or device in use. Use the following shell script to ask Android Debug Bridge (ADB) to download the file to your local machine from the scan's current location.
#!/usr/bin/env sh
A=($(adb logcat -d -v raw -e "AxeResult saved at:"))
DIR=${A[${#A[@]}-1]%/*}/
adb pull $DIR
If you see a Permission denied
error, usually with Android API 30 and above, then run adb root
before adb pull
.