UIAutomator
Not for use with personal data
A continuación se muestra un ejemplo completo de cómo comenzar a realizar pruebas en axe DevTools con UIAutomator. Asegúrate de consultar la sección Características del SDK de Android para conocer todo lo que puedes personalizar en tus pruebas de accesibilidad con axe DevTools Mobile.
class ExampleInstrumentedTestWithAccessibility : Utils {
val axe = AxeDevtools()
@Before
fun setup() {
...
// Authenticate and initiate your axe object for testing.
axe.loginWithApiKey("api_key")
axe.setInstrumenation(InstrumentationRegistry.getInstrumentation())
...
}
@Test
fun allyScan() {
...
// At any point within your automated tests, initiate a scan.
// You may check the results locally, or push to the dashboard for further collaboration and analysis.
val scanResultHandler = axe.scan()
//Option 1. Upload it to the dashboard
scanResultHandler?.uploadToDashboard()
//Option 2. Using the results in your test suite
val result: AxeResult? = scanResultHandler?.getSerializedResult()
result?.axeRuleResults?.forEach { result ->
if(result.status == AxeStatus.FAIL) {
}
}
//Option 3. Save the result JSON to a local file for later use
scanResultHandler?.saveResultToLocalStorage("your_file_prefix")
...
}
}