This week's book giveaway is in the Security forum.
We're giving away four copies of Securing DevOps and have Julien Vehent on-line!
See this thread for details.
Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Testing in Android is hard  RSS feed

Ranch Hand
Posts: 448
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am studying testing since 4 days to understand how it works with Android. Because I have an interview
I have a lot of questions is a really difficult subject to me, and cannot find an organic guide.
Ui tests with espresso, roboeletric and mockito on one side
on the other ones Instrumentation Tests and Junit tests

I simply do not know which one use.
I have a lot of questions.

First of all, what are the best practices? I read instrumentationTestCases is not used too much, so I should use JUnit tests, is that true? It looks like one can acces to dependencies also with Junit4 with Mockito and when instead AndroidTestCase.

I have an app that the main activity calls a fragment with a master/detail view pattern.
this fragment is the "cockpit" of all my app, the class of god.

So this bring to my second question How can i text using the best practices, this Fragment that extends Fragment

I am able to obtain it the fragment in Instrumentation text calling the MainActivity that has attached the fragment( is that a correct approach with instrumentation test?)

but now How can I start to text the various features?
I have a menu linked to a switch case cosntruct inside onOptionsItemSelected, inside there are explicit intents, services, calls to Asynctasks
Then I have a contextMenu, some sharedPreferences and loader classes that query a database( this last one I am able to do it with AndroidTestCase, because I have some code)

All in all how can I learn (1) and understand which of the dozen test choices(2) fits for me? I tried to look in SO, but there are a lot of fragments, more or less appropriate,
where can i find a guide that teach me how to test in Android? thank you

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!