I have the same situation with next below case: How to switch/change testInstrumentationRunner dynamically with gradle
Threre are 2 groups of espresso tests, 2 packages are in one module (project), to be exact.
First one is in online package and they is executed in online way, using real server requests.
The second group is executed as offline with mocking server requests.
If i need online tests then i activate 51-th line in build.gradle If i need offline tests then i activate the 54-th line
I need to start running both groups of tests in one build at the same time and in accordance with answer mentioned above i could write something like that :
if (project.extensions.has("com.tadamproject.v4.offline.tests")) {
testInstrumentationRunner 'com.tadamproject.TestRunner'
} else {
testInstrumentationRunner 'com.tadamproject.OnlineTestRunner'
}
But it doesn't work.
Can anybody help me please. Thank you very much!