Java Reference
In-Depth Information
A further difference is apparent in the menu that appears when we right-click the test class
(Figure 7.3). There are three new sections in the menu instead of a list of constructors.
Figure 7.3
The pop-up menu
for a test class
Using test classes, we can automate regression testing. The test class contains code to perform
a number of prepared tests and check their results. This makes repeating the same tests many
times much easier.
A test class is usually associated with an ordinary project class. In this case, SalesItemTest
is associated with the SalesItem class, and we say that SalesItem is the reference class for
SalesItemTest .
In our project, the test class has already been created, and it already contains some tests. We can
now execute these tests by clicking the Run Tests button.
Exercise 7.12 Run the tests in your project, using the Run Tests button. You should see a
window similar to Figure 7.4, summarizing the results of the tests.
Figure 7.4
The Test Results
window
 
Search WWH ::




Custom Search