Java Reference
In-Depth Information
Figure 7.2
You can run temporary JUnit targets
from the editor's context menu.
A Run/Debug configuration created in this manner is considered temporary, as
described in chapter 5. It appears ghosted in the selection menu. To save it, select
the corresponding
Save
option from the list under the
Run/Debug
drop-down.
Even if you don't save it, you'll be able to tweak its behavior by selecting its entry
in the
Run/Debug Configurations
dialog.
IDEA
allows only a single temporary target to exist per project. If you
create a second one, it will replace the first.
WARNING
Debugging test cases
Not only does
IDEA
help you run your test cases, but it also helps you debug
them. If you click the
Debug
icon instead of the
Run
icon in the toolbar in the
Run/Debug Configurations
dialog, your test cases execute in the debugger. This
lets you set breakpoints and step through your code during execution, as
described in chapter 6. You can set breakpoints in the test cases or in the applica-
tion code the test cases call. Either way, this is a great technique to figure out why
a test that ran fine last week suddenly blows up!
7.4 Working with IDEA's JUnit test runner
Each time you activate the
Run
or
Debug
command for your tests,
IDEA
invokes its test runner and opens a devoted tab in the
Run
tool window.
IDEA
's