Perfecto with Espresso Example
Test your Android app for accessibility issues on devices from Perfecto.
Not for use with personal data
Run your UI Tests on Perfecto to get a comprehensive understanding of your app's accessibility health across devices.
Requires:
- Perfecto Enterprise Private Cloud
Prerequisites
Your UI Tests are integrated with axe DevTools Mobile for Android. Check out our getting started guide if needed.
Example Project
Looking for an example? Our Sample Android Project has an integration ready to test.
- Verify that you have the prerequisites.
- Download the sample project from Github.
- Add your axe DevTools for Mobile API key to
app/build.gradle. - Adjust the values for
cloudURLandsecurityTokeninconfigFile.jsonto match your Perfecto cloud:
{
"cloudURL": "<<perfecto-cloud-name>>",
"securityToken": "<<security-token>>",
...
}- Add your security token as an environment variable (
SECURITY_TOKEN) (or attach to end of the next command). - In the terminal, run a test on Perfecto:
./gradlew perfecto-android-inst -PconfigFileLocation=configFile.json -PcloudURL=demo.perfectomobile.com -PsecurityToken=$SECURITY_TOKEN
There are three files in the sample project used for Perfecto integration: app/build.gradle, configFile.json, and build.gradle.
Add Perfecto to Your Espresso Test
Setup
- In your project's
build.gradlefile, add:
repositories {
...
maven { url "https://repo1.perfectomobile.com/public/repositories/maven" }
...
}
dependencies {
...
classpath 'com.perfectomobile.instrumentedtest.gradleplugin:plugin:+'
...
}
- In
app/build.gradle, add:
plugins {
...
id 'com.perfectomobile.instrumentedtest.gradleplugin'
...
}
- Add Perfecto's configuration JSON and review the following values to match your Perfecto authentication and application:
cloudURLsecurityTokenapkPathtestApkPath
{
"cloudURL": "<<cloud name>>",
"securityToken": "<<security-token>>",
"numOfDevices": 2,
"jobName": "Espresso_Axe_Sample",
"jobNumber": 1,
"branch": "some_branch",
"projectName": "My_Espresso_project",
"projectVersion": "v1.0",
"tags": [
"espresso",
"plugin"
],
"apkPath": "app/build/outputs/apk/debug/app-debug.apk",
"testApkPath": "app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk",
"installationDetails": {
"preCleanUp": "true"
},
"postExecution": {
"uninstall": "false"
},
"debug": false,
"failBuildOnFailure": true,
"takeScreenshotOnTestFailure": true,
"shard": true,
"testTimeout": 60000
}Run
Once your project is set up, run a test on Perfecto from the terminal:
./gradlew perfecto-android-inst -PconfigFileLocation=configFile.json -PcloudURL=demo.perfectomobile.com -PsecurityToken=$SECURITY_TOKEN note
The cloudURL value should reflect your Perfecto cloud URL, and securityToken should reflect your Perfecto security token.
