Cover by Gary Gregory, Vincent Massol, Felipe Leme, Petar Tahchiev

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Chapter 1. JUnit jump-start

Never in the field of software development was so much owed by so many to so few lines of code.

Martin Fowler

This chapter covers

  • Exploring JUnit
  • Installing JUnit
  • Writing our first test
  • Running tests

All code is tested.

During development, the first thing we do is run our own programmer’s “acceptance test.” We code, compile, and run. When we run, we test. The test may just be clicking a button to see if it brings up the expected menu. Nevertheless, every day, we code, we compile, we run, and we test.

When we test, we often find issues—especially on the first run. Therefore, we code, compile, run, and test again.

Most of us quickly develop a pattern for our informal tests: we add a record, view a record, edit ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required