Atualize o Status da Sua Build

This page is not available in the language you requested. You have been redirected to the English version of the page.
Link to this page copied to clipboard
Not for use with personal data

executando uma varredura e lidando com os resultados running a scan and handling the results. Falhe nos testes quando problemas forem encontrados e interrompa as builds para impedir que esses problemas sejam mesclados no seu código de produção. O trecho de código abaixo mostra um exemplo de como você falharia uma build quando problemas de acessibilidade fossem encontrados nos resultados da sua varredura.

private fun a11yScan() {
    rule.scenario.onActivity { activity ->
        //1. Scan and receive the ScanResultHandler locally
        val scanResultHandler = axe.scan(activity)

        //2. Upload it to the dashboard
        scanResultHandler?.uploadToDashboard()

        //3. Use the results in your test suite
        val result: AxeResult? = scanResultHandler?.getSerializedResult()
        val failureCount = result?.axeRuleResults?.filter { axeRuleResult -> axeRuleResult.status == AxeStatus.FAIL }.size

        //4. Fail the build if failures occurred
        assertEquals(failureCount, 0)
    }
}