I have a CSV file that I want to make available for my Android testing suite. I don't want it to be available for the main app, though. I saved it in the assets folder of my test project. Then I try to access it from a test using
context.getAssets().open(DATA_ASSET);
where DATA_ASSET is declared as
DATA_ASSET = "cards.csv"
I set the context to refer to the Activity which I am testing. However, this obviously won't work as I have it since it will look in the assets of the main app. I see two possibilities to fix this:
- Provide the correct path to the asset installed with the test project
- Obtain a
Contextwhich refers to the test project's resources and assets
I haven't found any way to do either of these yet. Perhaps there is a third solution that I haven't thought of. How can I access the assets that are installed with the test project?