Issue
I know it is a tedious topic for all android developers. But what exactly is the correct approach to Android Testing?
This is what I can picture.
70% Unit testing (JUnit to test all business logic, network layer, database layer etc...)
20% Integration test (Perhaps testing against mock server? mainly testing API results?)
10% UI testing(mock anything else other than the UI interactions, most likely Mockito+Espresso)
Is this what everyone else is following or there is another pattern?
Thanks in advance!
Solution
This question and my answer, doesn't have anything to do with Android specifically but that is a good thing.
I've slightly modified your assumptions, but the principle is the same.
70% Unit testing (JUnit to test all business logic.)
20% Integration test (network layer, database layer etc, real server)
10% UI testing(UI workflow + manual testing)
Should it be 70%? 80%? 85%? It doesn't matter. The key is the ratio. You want the majority of your tests to be fast, isolated in memory tests. If you do interact with a database you simply want to know your queries work. Does the update query actually update the correct entity? Finally you check your UI works as expected. It doesn't matter at this level what you display. As long as the login screen is displayed when the user isn't logged in your fine.
This is often referred to as the Test Pyramid and is what you have described, just minus the explict ratios.
Answered By - Finglas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.