Perfecto with Espresso Example
Test your Android app for accessibility issues on devices from Perfecto.
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. Checkout our getting started guide if needed.
Example Project
Looking for an example? Our Sample iOS Project has an integration ready to test.
- Finish the prerequisites
- Download the sample project from Github
- Add your axe DevTools for Mobile API key to
app/build.gradle
- Adjust the values for
cloudURL
andsecurityToken
inconfigFile.json
to 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 Terminal, run a test on Perfecto:
./gradlew perfecto-android-inst -PconfigFileLocation=configFile.json -PcloudURL=demo.perfectomobile.com -PsecurityToken=$SECURITY_TOKEN
There are 3 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.gradle
, 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 Perfectos configuration JSON and review the values
cloudURL
,securityToken
,apkPath
andtestApkPath
to match your Perfecto authentication and application.
{
"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 setup, run a test on Perfecto from the terminal:
./gradlew perfecto-android-inst -PconfigFileLocation=configFile.json -PcloudURL=demo.perfectomobile.com -PsecurityToken=$SECURITY_TOKEN
cloudURL
should reflect your Perfecto cloud URL and securityToken
should reflect your Perfecto's security token.