Book Image

NetBeans IDE 8 Cookbook

By : David Salter, Rhawi Dantas
Book Image

NetBeans IDE 8 Cookbook

By: David Salter, Rhawi Dantas

Overview of this book

<p>From the start to the end of a Java project's lifecycle, this book will show you how to perform many key tasks with the NetBeans IDE, uncovering more about mobile, desktop, and enterprise Java along the way.</p> <p>You will start by creating Java projects and learning how to refactor and use NetBeans tools to increase developer efficiency. You will then get a walkthrough of how to create a desktop application before covering JavaFX and mobile applications and how to use external services within them. Having seen how to create many different types of applications, you will then be shown how to test and profile them before storing them in revision control systems such as Git or Subversion. Finally, you will learn how to extend NetBeans itself by adding new features to the IDE.</p>
Table of Contents (19 chapters)
NetBeans IDE 8 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a TestNG unit test


TestNG is another popular Java testing framework that was inspired by early versions of JUnit that did not use annotations. TestNG is described as more powerful and easier to use than JUnit. For more details about this, check out the project's home page at http://testng.org.

Getting ready

To complete this recipe, you'll need the sample project we created in the earlier recipe, Creating a JUnit test suite. If you have not completed that recipe, the project is available as part of the code download bundle for the book.

How to do it…

Ensure the Calculator project is open within NetBeans. Perform the following steps to complete this recipe:

  1. Right-click on the Test Packages node within the Projects explorer and select New and then Other….

  2. In the New File dialog, select Unit Tests from the list of Categories and TestNG Test Case from the list of File Types.

  3. Click on Next.

  4. Enter the Class Name field as CalculatorTestNGTest. Ensure the Location field is set to Test Packages and...