Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly learn Android testing? [closed]

What are good ways to learn Android testing? I'm interested in learning Android testing, I don't actually do TDD but write the tests and code together.

I read all the information at http://developer.android.com/tools/testing/index.html and the 'Android Application Testing Guide' book and understand the basic concepts but there is almost no information or examples out there that I can find.

the book and examples are very basic and showing how to test a pretty simple activity with 2 EditText boxes,

I need to test more complicated stuff such as IntentService, AsyncTask, ResultReceiver, etc.. I'm interested in building my apps in a TDD or almost TDD way.

is there any way I can learn those things (books, blogs, examples, ...) or Android testing is something very uncommon ?

like image 723
Gal Ben-Haim Avatar asked Aug 15 '12 16:08

Gal Ben-Haim


People also ask

What is end-to-end testing Android?

End-to-end testing verifies the backend layers and database of an app. It verifies the overall functions of apps with complex architectures - whose workflow works through various tiers. End-to-end testing ensures that apps can provide a UX that works across different browsers, environments, and platforms.

How do you write test cases for Android Apps?

Test cases should be written in such a way that they allow a person to test only one feature at a time. One should not overlap or complicate test cases. Cover all the positive and negative probabilities of the test outcomes. Write in simple language with exact and accurate names of forms, fields, etc.


2 Answers

Question is a bit old and quite few things changed from the time it was asked.

Forget old Robotium, RoboElectric etc..Those were all just temporal and workaround solutions. Android Studio comes now with 1st party testing solution. JUnit Tests doesn't need to run anymore on device but on development host (aka your Mac/Pc machine) JVM. So read a lot, whatever you find (newer books, blog posts, google announcements) and experiment.

Use JUnit with Mockito, Espresso and UiAutomator. There will be more and more explanations on Android Developers pages about those tools. Happy testing ;)

like image 61
Ewoks Avatar answered Sep 24 '22 20:09

Ewoks


You can write JUnit tests for Unit testing. If you want to test the UI, I'd recommend using a framework like Robotium they have lots of examples on their website, and it makes automated UI testing very easy.

I'm not sure about more advanced techniques, but a tool like Robotium coupled with some good unit tests will give you a good start.

like image 37
DiscDev Avatar answered Sep 22 '22 20:09

DiscDev