Tagging Results
Supported within:
Tagging is a helpful feature to organize, share and search for scans within the axe DevTools Mobile Dashboard. Some helpful tags for your team may be the team name, build number, simulator version, etc.
Tagging is supported within manual or automated testing.
Option 1: Setup When Initialized
To tag a scan during manual testing, or to have a tag that will remain the same for the current test run (think build number), you can add the tag when initializing the AxeDevTools
or AxeDevToolsCompose
object.
val axe = AxeDevTools() //or AxeDevToolsCompose()
axe.tagScanAs(setOf("my_tag", "my_tag_2"))
Option 2: Tag After Scanning
The other option supported in automated testing is to call the tag
function from the DashboardService
object after uploading to the dashboard.
XML
protected fun tagYourScanForXml() {
rule.scenario.onActivity { activity ->
val axeResult = axe.scan(activity)?.uploadToDashboard()
runBlocking {
tagResult(axeResult, tags)
}
}
}
private suspend fun tagResult(
axeResult: AxeDevToolsResult?,
tags: List<String>
) {
withContext(Dispatchers.IO) {
axeResult?.axeDevToolsResultKey?.let { key ->
DashboardService.tag(key, tags)
}
}
}
Compose
protected fun tagYourScanForCompose() {
val axeResult = axeCompose.scan()?.uploadToDashboard()
runBlocking {
tagResult(axeResult, tags)
}
}
private suspend fun tagResult(
axeResult: AxeDevToolsResult?,
tags: List<String>
) {
withContext(Dispatchers.IO) {
axeResult?.axeDevToolsResultKey?.let { key ->
DashboardService.tag(key, tags)
}
}
}