Run/Debug Configuration: TestNG
The TestNG run/debug configuration is used to launch the tests that comply with the TestNG framework. The dialog consists of several tabs.
Common options
Name | Specify a name for the run configuration to quickly identify it among others when editing or running. |
Allow multiple instances | Allow running multiple instances of this run configuration in parallel. By default, it is disabled, and when you start this configuration while another instance is still running, IntelliJ IDEA suggests stopping the running instance and starting another one. This is helpful when a run configuration consumes a lot of resources and there is no good reason to run multiple instances. |
Store as project file | Save the file with the run configuration settings to share it with other team members. The default location is .idea/runConfigurations. However, if you do not want to share the .idea directory, you can save the configuration to any other directory within the project. By default, it is disabled, and IntelliJ IDEA stores run configuration settings in .idea/workspace.xml. |
Configuration tab
The composition of this tab depends on the selected testing scope: package, project, and so on.
Item | Description |
---|---|
Test kind |
|
Output directory | The directory in which test reports will be generated. |
JDK Settings
Item | Description |
---|---|
Test runner parameters | Arguments to be passed to the test runner. Use the same rules as for specifying the VM options. |
Working directory | Specify the working directory to be used for running the application. This directory is the starting point for all relative input and output paths. By default, the working directory is the project root. |
Environment variables | Click to open the Environment Variables dialog where you can create variables and specify their values. |
Use module path | This checkbox is available for projects with JPMS modules (Java 9 and later). It allows you to select how to run your tests: on a class or on a module path. |
JRE | The JRE to be used. |
Shorten command line | Select a method that will be used to shorten the command line if the classpath gets too long, or you have many VM arguments that exceed your OS command line length limitation. The choice of option depends on the class loader implementation. Note that some frameworks do not support JAR manifest, while other frameworks with custom class loaders will not work well with the classpath.file option.
|
Parameters
Item | Description |
---|---|
Parameters | |
Properties file | Specify the .properties file to be passed to TestNG. |
Name - Value | Additional parameters as key - value pairs. |
Listeners | |
| Use these icons to make up a list of listeners. |
Code Coverage tab
Use this tab to configure code coverage monitoring options.
Item | Description |
---|---|
Packages and classes to record code coverage data | Click and select Add Class or Add Package to specify classes and packages to be measured. You can also remove classes and packages from the list by selecting them in the list and clicking the button. |
Logs
The following options are related to logging the execution of this configuration. For more information, refer to View logs.
Item | Description |
---|---|
Specify logs to be shown in console | Specify which log files to display while running the application. Click to add a new log. In the Edit Log Files Aliases dialog, configure the following:
For logs in the table, you can configure the following options:
|
Save console output to file | Save the console output to the specified location. Type the path manually or click the browse button and point to the desired location in the dialog that opens. |
Show console when a message is printed to stdout | Activate the console when the application writes to the standard output stream. |
Show console when a message is printed to stderr | Activate the console when the application writes to the standard error stream. |
Before Launch
In this area, you can specify tasks to be performed before starting the selected run/debug configuration. The tasks are performed in the order they appear in the list.
Item | Description |
---|---|
Add before launch task | Enable this option to add one of the following available tasks:
|
Open run/debug tool window when started | Depending on the type of configuration, open the Run, Debug, or Services tool window when you start this run configuration. If this option is disabled, you can open the tool window manually:
|
Focus run/debug tool window when started | Focus on the run configuration tool window when the tests are running. |
Show the run/debug configuration settings before start | Show the run configuration settings before actually starting it. |