I wrote some tests that use XML files. I have two project one with code, the second with tests. I would like to store this XML files (they contain some data used during the tests) in the test project. But it is not possible because it seems that only files from src project are loaded to a device. Does anyone know the way to solve this problem ?
Suppose you got assets folder in both android project and test project, and you put the XML file in the assets folder. in your test code under test project, this will load xml from the android project assets folder:
This will load xml from the test project assets folder:
Make sure your TestCase class extends
android.test.InstrumentationTestCase instead of
android.test.AndroidTestCase to access
Answered By – yorkw