Jtest can collect coverage information for JUnit tests executed in IntelliJ IDEA. The following workflows are available:

Customizing a Default JUnit Test Configuration

You can customize the default JUnit test configuration in IntelliJ to collect coverage with the Jtest coverage runner.

  1. Choose Run> Edit Configurations... from the main IDE menu and choose the JUnit configuration you want to modify.
  2. Open the Code Coverage tab.
  3. Select Jtest form the Choose coverage runner drop-down menu.
  4. Define other options available in the Code Coverage tab, such as customizing coverage scope, or collecting coverage data for folders with tests. These default IntelliJ options will be applied when the configuration is run.
  5. Click Apply.

When the test configuration is run, coverage will be collected with the Jtest coverage runner and displayed in the Jtest Coverage view (see Viewing Coverage for details).

To configure collecting coverage with Jtest coverage runner for all JUnit run configurations, go to Run> Edit Configurations...> Defaults> JUnit and select the Jtest coverage runner from the drop-down menu.

Running a Dedicated Test Configuration

You can collect coverage information for JUnit tests by running a dedicated Jtest run configuration. 

  1. Select and right-click a scope in the Project tool window.
  2. Choose Jtest 'Tests in [scope]' from the context menu.

To customize the Jtest run configuration, open the Startup/Connection tab of your run JUnit configuration and select Jtest.

The following options are available:

  • Enable Unit Test Assistant -  If enabled, your tests will be run with Unit Test Assistant, which can help you improve the test quality. See Working with Unit Test Assistant for more information.
  • Enforce coverage with Jtest coverage runner - If enabled, coverage will be collected with the Jtest coverage runner - even if another runner is selected in the Code Coverage tab.
  • Activate Parasoft Coverage view - If enabled, the Parasoft Coverage view will automatically open when the tests are run.
  • No labels