Running a JUnit Test
See Also
Once you have created a test or test suite, you can use the Run Test command
to initiate execution of the test. Run Test commands are available on source
nodes only.
To run tests for an entire project:
- Select any node or file in the project you want to test in the Projects
or Files window.
- From the main menu, choose Run > Test project_name (Alt-F6).
The IDE executes each of the project's tests.
- Alternatively, you can run tests for an entire project by right-clicking the
node of the project you wish to test in the Projects window and choosing Test
Project (Alt-F6) from the popup menu.
To run a test for a single class:
- Select the node of the class for which you want to run a test in the Projects
or Files window.
- From the main menu, choose Run > Run File > Test classname
(Ctrl-F6).
The IDE executes the test using.
- You can also run a class's test by selecting the test class node itself
and choosing Run > Run File > Run testclassname (Shift-F6).
Working with JUnit Test Output
When you run a test, the IDE shows output into two tabs:
- A summary of the passed and failed tests and the description of failed tests
are displayed in the JUnit Test Results window.
- The output from the JUnit tests themselves is displayed in the Output window.
To work with the JUnit test window:
- Double-click any error to jump to the line in the code where the error occurred.
- Click the Output button to view the textual JUnit output.
- Click the
button to filter switch between viewing all test results and viewing only
failures.
- See Also
- Creating a JUnit Test
- About Running Java Applications
Legal Notices