O'Reilly logo

NetBeans IDE 8 Cookbook by Rhawi Dantas, David Salter

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

Creating a JUnit test

For some types of development, for example, TDD, the best practice for testing is to write the test before writing the functionality for the application. This allows the developer to think carefully about the architecture of the application, and helps to ensure better test coverage.

NetBeans helps in this area by allowing developers to create test classes that are not based upon existing application code (this is the opposite of what we saw in the previous recipe, Creating a JUnit test for an existing class, where the application code already existed).

In this recipe, we'll see how to create a basic JUnit test class.

Getting ready

To complete this recipe, you need to ensure that you have installed the JUnit support into NetBeans ...

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