How to detect whether android app is running UI test with Espresso

后端 未结 8 1967
-上瘾入骨i
-上瘾入骨i 2020-12-03 06:56

I am writing some Espresso tests for Android. I am running in the the following problem:

In order for a certain test case to run properly, I need to disable some fea

8条回答
  •  被撕碎了的回忆
    2020-12-03 07:29

    I'll create two files like below

    src/main/.../Injection.java

    src/androidTest/.../Injection.java

    And in Injection.java I'll use different implementation, or just a static variable int it.

    Since androidTest is the source set, not a part of build type, I think what you want to do is hard.

提交回复
热议问题