Knowledge Base > IntelliJ Plugin > Run configurations
Run configurations
Run configurations allow you to configure the environment variables and system properties that are used when the Diffblue Cover IntelliJ plugin creates tests. It also allows you to manually specify the method, class, package or prefix for writing tests.
Dialog
The run configuration contains the following elements:
- Name - you can give the run configurations unique names to help you identify them
- Method/Class/All in Package/Prefix drop down - corresponding to the scope of items you’re writing tests for
- Text box - to supply the method/class/package and prefixes
- Environment Variables - to supply a list of key/value pairs to set environment variables
To access the system properties setting, click on the Modify options
button, and select Add VM Options from the list. In this text box you can add JVM system properties in the standard format, for example -Dkey=value
.
Creating a Run Configuration
Automatic Creation
When you write tests with the Diffblue Cover IntelliJ plugin a run configuration is created for your selection. For example, suppose we have the sample below:
package com.example;
public class StringUtils {
public static boolean isPalindrome(final String s) {
for (int i = 0; i < s.length() / 2; i++) {
char first = s.charAt(i);
char second = s.charAt(s.length() - 1 - i);
if (first != second) {
return false;
}
}
return true;
}
}
If you write tests for the method the run configuration that is created will look like this:
You will notice there is a split between the class name and the method name, and that the method includes the signature of the method you’ve selected – this is the (Ljava/lang/String;)Z
string after the colon.
Manual Creation
To create a run configuration manually, first select the scope, then use the Browse action on the class/package (and method, if appropriate) to make your selection. If you’ve selected the method scope, the signature will be populated for you.
Template
If you have a particularly large list of system properties or environment variables, that you would like to use every time you use the Diffblue Cover plugin for IntelliJ to write tests, you can specify a template. The values you specify there will be used for any future run configurations.
Prefixes
You can tell the Diffblue Cover plugin for IntelliJ to only write tests for specific packages, classes or methods by specifying one or more prefixes. For example, by specifying a prefix of com.a.
, the Diffblue Cover IntelliJ plugin will produce tests for all accessible methods within package com.a.
and subpackages. For example, tests will be written for class com.a.B
, com.a.b.C
but not for com.x.Y
. Note that com.a
(not com.a.
) will allow tests to be written for class com.apple
, com.apricot
etc.