Testing is a fundamental component of the success of our apps. As professionals in charge of developing Android apps, we are well aware of that and do our best to add unit tests to our apps. But having a good test coverage is not an easy task. More so, when activities or fragments get in the middle.
In this talk, I will give a brief introduction about how architecture helps us to increase code coverage and will provide some practical hints and use some examples with and without Google's architecture components.
Finally, I will do live coding to show how to use the latest version of Robolectric (4.0) and implement some view tests using ActivityScenario and the, still in alpha, FragmentScenario. All the code will be written in Kotlin, but I will be happy to answer questions on how to do the same in Java.
This is a "Code or it didn't happen" (TM) talk.
People attending the talk will:
- Get some ideas about how to improve their code coverage and the quality of their tests.
- Learn how to use Dagger 2 for dependency injection and still be able to unit test the views.
- Learn the basics of the new Robolectric version and how it helps to keep the tests within the JVM realm.
- See some examples of how to write unit tests of activities and fragments using ActivityScenario and FragmentScenario.
Jorge is a freelance dedicated to mobile development, security, and systems architecture. As a developer he started to work for the M.I.T. in 1993 and since he has collaborated in many software projects. Most of them were internally for HP where he worked for more than 15 years. Since 2008 he has been working in different aspects of mobile development. After playing with PalmOS, he learned Android programming for the first Google App contest and immediately started to play with the first iPhone SDK. He often participates as instructor in the best iOS and Android Bootcamps in U.S.A. and Europe. He has recently founded Canonical Examples to help other developers to take a step forward and become senior developers in a very demanding market.