Testing parsers
There are many occasions where your Android application relies on external XML, JSON messages, or documents obtained from web services. These documents are used for data interchange between the local application and the server. There are many use cases where XML or JSON documents are obtained from the server or generated by the local application to be sent to the server. Ideally, methods invoked by these activities have to be tested in isolation to have real unit tests, and to achieve this, we need to include some mock files somewhere in our APK to run the tests.
But the question is where can we include these files?
Let's find out.
Android assets
To begin, a brief review of the assets' definition can be found in the Android SDK documentation: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access