Accessibility Automated Testing


Accessibility is tested in several different places. This page documents some of the most widely-used systems.

Unit testing

This is the most basic accessibility testing. It is designed to test methods of a particular accessibility class. To build the unit testsuite do:

autoninja -C out/Default accessibility_unittests

To run:

out/Default/accessibility_unittests

You can use --gtest_filter option to specify which test to run. For example:

out/Default/accessibility_unittests --gtest_filter="AXInspectScenario*"

Add new tests

The unit test file should be postfixed by _unittest and placed next to a testing file. For example, for ax_inspect_scenario.h file it will be ax_inspect_scenario_unittest.cc. You should also add the test file to under accessibility_unittests block.

Browser testing

If you need a test to run it in a browser, then you should use browser testsuite. It consist of browser_tests to test browser UI and content_browsertests to test a web document accessibility. To build the browser tests you do:

autoninja -C out/Default browser_tests

or

autoninja -C out/Default content_browsertests

To run:

out/Default/browser_tests

or

out/Default/content_browsertests

Use --gtest_filter option to specify which test to run.

Test files shall be postfixed by _browsertest and placed next to a tested file. You can refer to this test as an example. Also the test file should be added into corresponding block in Build.gn, for example, under content_browsertests.

Dump Accessibility Testing

This testsuite is designed to test platform accessibility APIs. It is part of browser_tests and content_browsertests testsuites. Please refer to the docs for details.

Blink Layout Tests

Blink layout tests are another important way accessibility is tested. There are a number of accessibility tests in this directory third_party/blink/web_tests/accessibility/. These tests are critically important for testing Blink implementation of accessibility at a low-level, including parsing html and sending notifications.

Here's a sample command line for running the tests:

ninja -C out/Debug blink_tests
python third_party/blink/tools/run-web-tests.py --no-show-results --no-retry-failures --results-directory=results accessibility/

To run just one test:

out/Release/content_shell --run-layout-test third_party/blink/web_tests/accessibility/test_name.html

To run just one test, on Mac OS X:

out/Release/Content\ Shell.app/Contents/MacOS/Content\ Shell --run-layout-test third_party/blink/web_tests/accessibility/test_name.html

Audit testing

Another testing type is accessibility audit testing aslo known as axe-core.
Comments