API reference

Link to API reference copied to clipboard

Information on the library's public classes and functions.

Not for use with personal data

AxeDevTools

When you set up automated testing, you set the instrumentation registry, allowing axe DevTools for Android to connect to the accessibility node info. Reference the library's public classes and functions below as you build your tests.

Initializing AxeDevTools

Use the following APIs when initializing the AxeDevTools library.

loginWithUsername(params)

Generates an auth token to connect to the dashboard.

Required params:

Name Type Description
username String Deque username
password String Deque password

Optional param:

Name Type Description
serverConfig String Defines the server URL to connect to.

loginWithApiKey(param)

Generates an auth token to connect to the dashboard.

Required param:

Name Type Description
apiKey String Deque API key

Optional param:

Name Type Description
serverUrl String Defines the server URL to connect to.

setInstrumentation(param)

Allows the library to get the view hierarchy of the application under test.

Required param:

Name Type Description
instrumentation android.app.Instrumentation Instrumentation Registry Object providing application context and instrumentation.

isUserAuthenticated()

Returns a boolean to indicate whether the user is authenticated and ready to send scans.

Returns:

Type Description
Boolean Indicates whether a user is authenticated for axe DevTools Mobile.

disconnect()

Clears the current axe DevTools network session to allow a new connection to be made.

Scanning

Once you have imported and initialized the AxeDevTools library, you are ready to scan.

scan()

Scans the information collected by the instrumentation registry object passed into setInstrumentation(param) for issues and returns a ScanResultHandler.

Returns:

Name Type Description
ScanResultHandler Nullable ScanResultHandler provides a way to get more detailed information on the result or further update the scan by providing a name or tags.

getResult(param)

Requests a scan's result from the dashboard matching the provided result key.

Required param:

Name Type Description
axeDevToolsResultKey AxeDevToolsResultKey The identifier of the result you'd like to grab.

Returns:

Type Description
AxeDevToolsResult Nullable AxeDevToolsResult provides access to details of the result.

Handling Results

Use these APIs with the ScanResultHandler object returned from a scan.

uploadToDashboard()

Upload the accessibility scan's result to the dashboard. Returns:

Type Description
AxeDevToolsResult Nullable AxeDevToolsResult provides access to details of the result.

saveResultToLocalStorage(param)

Save the accessibility scan result to a local file on your test device.

Required param:

Name Type Description
prefixFilename String Beginning of the filename to save the result as.

getSerializedResult()

Grabs the result of your scan to use within the test.

Customizing Your Configuration

Name and tag your scans, opt to ignore certain rules, or create your own custom rules.

setScanName(param)

Set a name to the scan before uploading it to the dashboard.

Required param:

Name Type Description
name String Name for the scan.

addCustomRule(param)

Add a rule to run against your application during scans.

Required param:

Name Type Description
customRule Class<AxeDevToolsRule> Rule to add

ignoreRules(param)

Ignores rules completely from being run against any view.

Required param:

Name Type Description
rulesToIgnore List<String> List of rules to ignore.

ignoreByViewId(param)

Ignores all rules provided for a given viewId.

Required param:

Name Type Description
viewId Int ViewId to ignore.
ruleList List<Class<out AxeRule>> List of rules to ignore.

ignoreAllByViewId(param)

Ignores all rules for the provided viewIds.

Required param:

Name Type Description
viewIds List<Int> List of viewIds to ignore all rules on.

ignoreByView(param)

Ignores all rules provided for a given View.

Required param:

Name Type Description
view View An instance of a view to ignore.
ruleList List<Class<out AxeRule>> List of rules to ignore.

ignoreAllByView(param)

Ignores all rules for the provided View's.

Required param:

Name Type Description
viewIds List<View> List of View to ignore all rules for.

ignoreByClassName(param)

Ignores all rules for a given type that extends View.

Required param:

Name Type Description
view Class<out View> Class to ignore.
ruleList List<Class<out AxeRule>> List of rules to ignore.

ignoreAllByClassName(param)

Ignores all rules for the provided types, which extend View.

Required param:

Name Type Description
classNames List<Class<out View>> List of Classes to ignore all rules on.

ignoreExperimental()

Opts out of experimental rules. Results for experimental rule(s) will have the status of AxeStatus.IGNORED.

resetIgnoredRules()

Clear the ignored Rules list set by the ignored rules APIs. Helpful for changing rule configuration between automated tests.

tagScanAs(param)

Tags a scan before uploading it to the dashboard.

Required param:

Name Type Description
tags Set<String> List of tags to add to the scan.

tearDown()

Resets tags and clears test state from prior testing.

deleteResult(param)

Delete a scan's result from the dashboard matching the provided result key.

Required param:

Name Type Description
axeDevToolsResultKey AxeDevToolsResultKey The identifier of the result you'd like to grab.