A sample application built solely to showcase axe DevTools Android automated espresso test implementation. It is non-functional and made inaccessibly by design.
- Library documentation and more information on automated or manual testing can be found at docs.deque.com.
- Learn more about Deque and axe DevTools Mobile here.
- Clone the repository
- Set up a new project on axe Developer Hub to set up a Project ID and API Key.
- Or Grab an API key from the settings page
- In
app/build.gradle, add your API Key in theAXE_DEVTOOLS_APIKEYvariable - If you set up a project add your Project ID in the
app/build.gradleunder theAXE_DEVTOOLS_PROJECT_IDvariable
android {
def AXE_DEVTOOLS_APIKEY = "YOUR_API_KEY_HERE"
def AXE_DEVTOOLS_PROJECT_ID = "AXE_PROJECT_ID_HERE"
}Once you add your variables you are ready to start scanning the application using the espresso tests.
You can see accessibility testing in action through the ExampleEndToEndAccessibilityTest Espresso test or any other test in the androidTest folder.
The androidTest folder contains examples of Jeptpack Compose, XML and UiAutomator.
You can kick it off from Android Studio, or through an automated service such as Perfecto, Sauce Labs, etc.
Note:
- This project is set to use the Android Gradle plugin version 8.11.2. Running the project with newer, or older, JDK versions may require you to update the Gradle plugin version accordingly. Please refer to Android's Updating the Gradle Plugin documentation for more.
If you have an account with Perfecto, you can run the automated tests of this application by using our prewritten Perfecto configuration file configFile.json that shards the tests across any two available devices. Follow the steps below to get started:
-
Project's build.gradle: Add to repositories section. Add
classpath 'com.perfectomobile.instrumentedtest.gradleplugin:plugin:+'to dependencies section. See Configure the project for Perfecto section -
app/build.gradle: Add
id 'com.perfectomobile.instrumentedtest.gradleplugin'to plugins section. -
Update the prewritten
configFile.jsonif needed. See Android configuration parameters -
Run a test on Perfecto from the terminal:
./gradlew perfecto-android-inst -PconfigFileLocation=configFile.json -PcloudURL=demo.perfectomobile.com -PsecurityToken=$SECURITY_TOKENwhere cloudURL should reflect your Perfecto cloud URL and securityToken should reflect your Perfecto's security token.
Reach out to Perfecto Support for any assistance.
If you have an account with Sauce Labs, you can run the automated tests of this application by using our prewritten Sauce Labs configuration file .sauce/config.yml. Follow the steps below to get started:
-
Install the
saucectlcommand line interface. See Using the saucectl CLI -
Add your Sauce Labs credentials to your
.bash_profileor.zshenv. Be sure to load the changes by runningsource .filename. See Associate your Credentials -
Update the prewritten
.sauce/config.ymlSee Configuring Your Espresso Tests -
Run a test on Sauce Labs from the terminal:
./gradlew app:assembleDebug && ./gradlew app:assembleAndroidTest && ./saucectl run
Reach out to us, we'd love to help!