1

In Android Instrumented test, it needs to read from some moc json files to get the test case's json data.

  1. Find some post suggest to put in the app's asset folder. Would that the moc json file be packaged with the app's resource?

  2. And see the Android studio has menu item for creating a "Sample Data Directory" (“new > Sample Data directory”), could it be used for the json file of the Android Instrumented test? Will the file there be packaged with the app's resource?

  3. Or have to put them into app/src/androidtest/resources (have to create the folder manually), then in gradle do something like:

    sourceSets { test.resources.srcDirs += 'src/androidtest/resources' } and then:

    javaClass.classLoader.getResourceAsStream("mocJson.txt")

What is the suggested way to put the instrument test's json file in some place and read them in the test, and the file should not be packaged with the app build?

lannyf
  • 9,865
  • 12
  • 70
  • 152

0 Answers0