Now that we've had an overview of what TestNG can do, we can add a test to our sample Vacation Planner application. At present, there aren't many components within the application to be tested. However, as we progress throughout the book, we'll keep coming back to the tests, and show how new components that we develop can be tested.
To start testing our application we need to have a TestNG control file. We'll create a file called AllTests.xml
and place it in the src/test/com/davidsalter/vacationplanner/actions/test
folder of our sample application.
Because all of our tests are in the same package, we can specify the tests by using the <package />
element within the AllTests.xml
file. For our sample application, the AllTests.xml
file is as follows.
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="VacationPlanner" verbose="2" parallel="false"> <test name="VacationTest"> <packages> <package name="com.davidsalter.vacationplanner...