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. After you run a test, you can choose to rerun individual test methods executed during the test and displayed in the JUnit Test Results window.

To run tests for an entire project:

  1. Select any node or file in the project you want to test in the Projects or Files window.
  2. From the main menu, choose Run > Test project_name (Alt-F6).

    The IDE executes all of the project's tests.

To run a test for a single class:

  1. Select the node of the class for which you want to run a test in the Projects or Files window.
  2. From the main menu, choose Run > Run File > Test classname (Ctrl-F6).

To run a single test method:

  1. Run the test class or suite containing the test method.
  2. In the JUnit Test Results window, right-click the test method and choose Run Again.

Working with JUnit Test Output

When you run a test, the IDE shows the test results in two tabs in the JUnit Test Results window:

See Also
Creating a JUnit Test
About Running Java Applications

Legal Notices