In this post, we will learn how to create a package using the NetBeans IDE. A java package consists of related java classes. Test automation of large sophisticated projects would consists of many Java test classes. Management of these automation test classes would be easy if you organize them into packages.
Advantages of packages
Packages would reduce the test class name conflicts in the project.
Organizing test classes into groups in packages would make test automation management easier.
You can protect the automation code using the access modifier ‘protected’. protected variables and methods can only accessible by the classes of the same package. Any class outside the package may need to subclass to access the protected members.
Creating a Package in NetBeans
Right click on the Source Packages and choose New >> Java Package…
In the Name and Location screen, specify the package name and click on the Finish button.
A new empty java package would be created under the Source Packages in the explorer. NetBeans also allows you to create java package with a new java class wizard.