I see many tutorials on Espresso on the internet. All tutorials rely on the app source code. I have recently switched from Appium to Espresso and want to start fresh with Kotlin. How do I launch an activity in Kotlin provided I don't have the App source code ?
Asked
Active
Viewed 249 times
1 Answers
0
If you plan to use Espresso directly as a library, not an Espresso driver by Appium, there is no way to use it without a source code:
Espresso is a grey-box testing tool and can only run as part of an instrumentation test.
If you don't have an access to source code, you can use only black-box testing tools like Appium and Espresso driver is using Espresso API under the hood.

dmle
- 3,498
- 1
- 14
- 22
-
Ok, but in this question, it is mentioned that it's possible. But I am not able to make it work for Kotlin and latest Espresso with AndroidX. https://stackoverflow.com/questions/35217282/android-automation-using-espresso-without-the-app-source-code – Mohamed Wasiq Feb 25 '21 at 12:31
-
The key point is that you need to modify source code with instrumentation libraries and re-build APK file. The code you reference is 4 years old, AndroidX came in late 2018, I only tried using it with source code. Just try the old Espresso library, but you anyway won't we able to use most of Espresso features. So whats the point? https://github.com/cmoaciopm/AndroidTestWithoutSource/blob/master/src/main/java/net/cmoaciopm/androidtest/TestWithoutSourceCode.java – dmle Feb 25 '21 at 13:13
-
Yes. I want to know whether it’s possible with the latest Espresso and Kotlin. Otherwise I will switch to Appium. – Mohamed Wasiq Feb 25 '21 at 16:03
-
Also, this link somewhat directs to my use case. But still I am not able to make it work. https://source.android.com/compatibility/tests/development/instr-app-e2e – Mohamed Wasiq Feb 25 '21 at 17:03