I have mock data that I want to use for both unit and instrumented test. To avoid repetition, I created a common directory testHelper and placed my mock data there. In app/build.gradle I did:
Код: Выделить всё
sourceSets {
androidTest {
java.srcDirs += 'testHelper'
}
test {
java.srcDirs += 'testHelper'
}
}
basically, I don't want my main code to access the mock data
Код: Выделить всё
import AppMockData // ==> this shouldn't work. currently it does.
@Composable
fun HelloWorld(){}
Источник: https://stackoverflow.com/questions/781 ... ndroidtest
Мобильная версия