Chapter    3

Third-Party Tools

JUnit on its own may be all you need, but there are a number of excellent third-party tools that you can bolt onto JUnit that really make your Android testing shine.

In this chapter we’ll take a look at the following tools:

  • Hamcrest for better assertions
  • JaCoCo so we can measure our JUnit code coverage
  • Mockito so we can keep our unit tests focused on the code
  • Robolectric so we can test our Android activities
  • Jenkins for automating our testing

Hamcrest Assertions

Anything more than a simple Hello, World-type application is probably going to need better assertions than those that come with JUnit 4.x. Hamcrest is one option that offers a lot more matchers. It also provides a lot more flexibility by allowing you to ...

Get Agile Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.