Run Espresso tests with Appium
Use the Espresso automation engine to run Android Appium sessions that interact with views inside your app, including Android View Tags. UiAutomator2 remains the default engine when you do not select Espresso.
On this page:
Prerequisites
- Have an Espresso server APK built for your app. Each server APK is specific to one app.
- Sign the app under test and the Espresso server APK with the same signing key.
- Have a valid security token and a device selection.
Start an Espresso session
- Upload the app under test and its Espresso server APK to the repository. For upload steps, see 4 | Upload your app to the Perfecto repository. Use the repository key for each APK in the session capabilities. Both keys can use the
PUBLICorPRIVATErepository. -
Set the session capabilities. Replace the example package, activity, repository keys, device name, and security token with your values.
Copy{
"platformName": "Android",
"appium:automationName": "Espresso",
"appium:app": "PUBLIC:MyApp.apk",
"appium:appPackage": "com.example.myapp",
"appium:appActivity": "com.example.myapp.MainActivity",
"perfecto:espressoServerApp": "PUBLIC:espresso-server-myapp.apk",
"perfecto:options": {
"securityToken": "YOUR_SECURITY_TOKEN",
"deviceName": "YOUR_DEVICE"
}
} - Start the Appium session at
https://<cloud>.perfectomobile.com/nexperience/perfectomobile/wd/hub. - Run your Espresso interactions while the app under test is in the foreground. Espresso can interact with views in that app.
- Quit the driver when the test finishes.
Do not set skipServerInstallation or forceEspressoRebuild. The cloud configures these settings for the session.