View screenshots taken during an Espresso test in Android Studio

1 day ago 6
ARTICLE AD BOX

I have a few Espresso UI tests for my Android app. During the tests, there are some moments where I take screenshots, which will be evaluated after the test, qualitatively.

I found the androidx.test.espresso.screenshot.captureToBitmap method, as well as the SemanticsNodeInteraction.captureToImage() method for use with Jetpack Compose.

However, both of these return the captured screenshot as their return value, so it is my job to save the screenshot so I can view it later.

I have successfully used this answer to save the screenshots to the phone's storage, but the "Files" app on my phone is a bit inconvenient to use.

I would much prefer having the screenshots sent to the computer that is running Android Studio, or even have them show up in Android Studio itself, if that is possible.

How can I do this?

Read Entire Article