Espresso – Local Execution

>>>Espresso – Local Execution
Espresso – Local Execution 2018-03-26T12:52:15+00:00

For Android development teams using the Espresso test framework, Perfecto DevTunnel provides the ability to run tests on real devices and under realistic conditions. This enables developers to quickly debug code under test, fix failing tests, and resolve test flakiness issues on multiple real devices and end user environments.


1. Install Android Studio

2. Install Perfecto plugin for Android Studio

3. Download sample app (.apk) –

Download the app as .zip file and extract it.



Run Espresso Test on a Mobile Device

1. Open the android-calculator-master app project.

2. Click the ‘Launch Mobile’ icon in the Perfecto Android Studio plugin toolbar.

3. Select an Android device and click “open”


4. Switch to the Widgets menu and click the ‘DevTunnel’ widget.


5. If you have not done so already, download and install the DevTunnel installer, and wait for the installation to complete.


6. Click the ‘Start Dev Tunnel Session’ step to establish a direct connection to the device.

7. Navigate to ‘SimpleTest’ under ‘app > src > androidTest’ folder in Project navigator.

8. Before executing the test, you can leverage Perfecto Lab capabilities to configure the device environment using the widgets – change the network, location, or install additional applications on the device to validate multiple end user environments.


9. Right-click on ‘SimpleTest’ and select ‘Run SimpleTest

10. Select the Android device you opened from the Perfecto Lab plugin and click ‘OK’ to launch the app on that device.

11. After Gradle build is successful, note that Android Studio utilizes ADB commands against the device to copy the .apk resources to the device, launch the app, and run your Espresso test.

12. When finished, click the ‘Disconnect’ button from the Perfecto plugin Widgets to close your DevTunnel session.

13. Click the ‘X’ on the device window to release the mobile device.

Congratulations! You now know how to connect a real, cloud-based mobile device from the Perfecto Lab into your IDE. Try it out with the next feature you’re building or run some of your own tests on different devices to see if your apps pass with flying colors on other platforms.