6 Test quality

This chapter covers

  • Measuring test coverage
  • Writing testable code
  • Investigating test-driven and behavior-driven development
  • Introducing mutation testing
  • Testing in the development cycle

I don’t think anybody tests enough of anything.

--James Gosling

In the previous chapters, we introduced testing software, began to explore testing with JUnit, and presented different test methodologies. Now that you are writing test cases, it is time to measure how good these tests are by using a test-coverage tool to report what code is executed by the tests and what code is not. This chapter will also discuss how to write code that is easy to test and finish by taking a first look at test-driven development (TDD).

6.1 Measuring test coverage ...

Get JUnit in Action, Third Edition 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.