Java Reference
In-Depth Information
you to choose which method to run from the selected test case. To select more
than a single test method from a test case without running all of them, you must
create your own test suite, as described in the
JU
nit documentation.
Changing the test's working directory
The
Wo r k in g d ire ct o ry
option in the
Run/Debug Configurations
dialog lets you
change the base directory for all relative file paths. This is useful if your test cases
must read or write data files as part of the testing process. Before executing your
tests, the test runner changes to this directory. By default, this directory is the
same directory your project file is in.
Passing parameters to the VM
The
VM
parameters
field in the
Run/Debug Configurations
dialog is used to
pass system properties or
VM
options such as the maximum heap size. Any argu-
ments specified here are passed to the
JVM
executing your tests, just as they
would be when directly running an application.
Passing parameters to the test runner
IDEA
's test runner application ultimately relies on the test-running application
included with the
JU
nit framework. As such, you can pass parameters to the
underlying test runner by entering them in the appropriate configuration field.
However, since the other configuration options give you an easier avenue of con-
trolling how the tests are run, there's not much benefit to be gained through extra
parameters; but this option is provided in the
Run/Debug Configurations
dialog
for the sake of completeness. Refer to the
JU
nit documentation for a list of cur-
rent options.
Selecting the appropriate module
As you learned in chapter 4,
IDEA
manages most source and Classpath informa-
tion at the module level. In the
Run/Debug Configurations
dialog, you'll there-
fore need to select the module to which the currently selected test case should run
under if it exists in more than one module. This also determines the
JDK
used to
execute the tests. An exception to this rule is when you're running all the tests in a
given package.
Triggering a build automatically
The two checkbox options
Display settings before running/debugging
and
Make module before running/debugging/reloading
in the
Run/Debug Config-
urations
dialog behave exactly as they do for the other types of execution targets