Running a JUnit test

This topic describes how to create and run a JUnit test configuration.

Before you can run a JUnit test, you must generate the test suite's Java code and create a test deployment.
To run a JUnit test:
  1. From the menu bar, click Run > Run. The Run dialog box opens.
  2. In the Configurations pane on the left, click Test.

  3. Optionally, in the Perspectives tab, you can associate the three launch modes (Debug, Run, and Profile) with different workbench perspectives by clicking the appropriate arrow and selecting the perspective from the drop-down list.
  4. To create a new configuration, click the New button on the bottom left.

    A new test configuration, initially named New_Configuration, is created. Change the name if you like. Alternatively, expand Test and click a listed configuration that you want to inspect or modify. The Run dialog box opens in the Test tab.

  5. In the Select Test to run pane in the middle listing all projects in the workspace, navigate to the project containing the test to run and click it.
  6. In the Select a deployment pane on the right listing all defined deployments in the workspace, click the one to use for this run.

    To run the test using default values, or using the same values that you set during the previous test run, you can click Run now and stop reading.

  7. Click Execution Results to display that tab, as shown below.

  8. In the Location box navigate to the folder where you want to store the test results file, and enter a name for the file in the Name field. Select Override existing Execution Results resource to overwrite the test results file each time you run the test configuration.
  9. Click Common to display the Common tab, as shown below.

  10. When you run a test configuration, Eclipse creates a file, with a .launch suffix, containing metadata. If you select Local, Eclipse stores this file in your workspace's metadata folder, which is not visible to other users. If you want other users to have access to the file, select Shared, click Browse, and navigate to a folder in your workspace where you want to store the file.
  11. To have the test configuration appear in the Run, Debug, or Profile favorites toolbar menus, select the appropriate boxes.
  12. Select Launch in background to have Eclipse run the test configuration in the background so that you can perform other Eclipse tasks while the test runs.
  13. Click Apply to save the settings for the configuration.
  14. Click Run.

Parent topic: JUnit testing with TPTP

(C) Copyright IBM Corporation 2000, 2004. All Rights Reserved.