Is there a way to access the test classes in AndroidTest and test folders from my code? I can access tests placed in the same folder than my activity but not from these test folders.
Here is a picture to explain what I mean:
I am using Android Studio and Kotlin. Thanks in advance for any help
答案 0 :(得分:0)
is there a way to access the test classes in androidTest and test folders from code?
If by "from code" you mean "from classes in the main/
source set", then no, that is not possible.
I want to do that to run test after an admin clicked a button.
Android tests (androidTest
and test
) are run by the Android SDK tools. Unit tests (test
) are run on a development machine, not the device. Instrumented tests (androidTest
) require special permissions to run and cannot be executed directly by an ordinary Android app.