Android Test Storage Fraud

My application uses Storage, but for testing, I want to replace it with mock object or smth. Is this possible in Android? If so, could you provide a link with an example of how to do this? Thanks!

+4
source share
1 answer

You can use a mocking structure for this. Check out this question and answers to a list of mocking frameworks that work great with Android. I personally recommend Mockito, which recently got Android support.

Now the question is what is being taunted. You can try to mock data storage mechanisms directly, but I would recommend wrapping data storage at a different level of abstraction. This will give you a clean seam to introduce the layout when testing. This design also gives you great flexibility in general (for example, you can change a specific type of data warehouse without affecting the business logic of your application).

Let me know if this is exactly what you are looking for.

0
source

All Articles