O'Reilly logo

JUnit Recipes: Practical Methods for Programmer Testing by J B Rainsberger, Scott Stirling

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Organizing and building JUnit tests

This chapter covers

  • Deciding where to place production code and test code
  • Dealing with duplicate test code
  • Organizing special case tests
  • Building tests in various development environments

Once you understand the fundamentals of writing JUnit tests, the next step is to begin writing them. Once you open your favorite Java editor and begin writing test code, you need to decide into which package you should place the test code. Although this decision seems simple enough, there is a considerable difference between placing your test code in the same package as your production code[1] or in a different package. For that reason, we offer a few recipes to help you decide which to do.

1 We will use ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required