ビルドステータスを更新する

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

axe DevTools MobileをCI/CDパイプラインに統合することで、ソフトウェア開発ライフサイクルの早期にアクセシビリティの問題を検出して解決しましょう。アクセシビリティの問題を検出するには、 スキャンを実行し、結果に対応することで行います。問題が見つかった場合はテストを失敗させ、ビルドを失敗させてこれらの問題がプロダクションコードにマージされるのを防ぎます。以下のコードスニペットは、スキャン結果でアクセシビリティの問題が見つかった場合にビルドを失敗させる方法の例を示しています。

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)
    }
}