# Run configurations

Run configurations allow you to configure the environment variables and system properties that are used when Cover Plugin creates tests. It also allows you to manually specify the method, class, package, or prefix for writing tests.

## Dialog

The IntelliJ run configuration dialog for Diffblue Cover contains the following elements:

* **Name** - Provide a useful name for the run configuration.
* **Store as project file** - If selected, the run configuration will be stored as a project file.
* **Test creation target** - Select All in package, Class, Method, or Prefixes from the drop down to set the scope of items you're writing tests for. Enter the target details as appropriate.
* **Write skeleton tests** - If selected, Cover Plugin will write skeleton tests instead of creating complete tests. See [Creating skeleton tests](/features/cover-plugin/writing-tests/skeleton-tests.md) for more information.
* **Environment Variables** - Provide a list of key/value pairs to set environment variables.

{% hint style="info" %}
To display the dialog box, go to `Run > Edit Configurations`. If needed, click `Add New Configuration` (the **+** button) and select `Diffblue Cover`.
{% endhint %}

<div align="left" data-full-width="false"><figure><img src="/files/piVxNNGDWtzHgVE6U7PP" alt="" width="563"><figcaption></figcaption></figure></div>

To access the system properties setting, click the `Modify options` button, and select `Add VM Options`. The `VM option` text box is added to the Run Configuration options - use this to add JVM system properties in the standard format, for example `-Dkey1=value1`.

<div align="left"><figure><img src="/files/3SdRvi77lY3zzgcgT2CC" alt="" width="563"><figcaption></figcaption></figure></div>

## Creating a run configuration

### Automatic creation

When you write tests with Cover Plugin a run configuration is created for your selection. For example, suppose we have the sample below:

```java
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 the following (to display the dialog box, go to `Run > Edit Configurations` and select the appropriate configuration from the list):

<div align="left"><figure><img src="/files/ZAf7h50LN4u3Axtq3J4X" alt="" width="563"><figcaption></figcaption></figure></div>

You will notice there's 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", go to `Run > Edit Configurations`, click `Add New Configuration` (the **+** button) and select `Diffblue Cover`.

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.

<div align="left"><figure><img src="/files/xdD5S0vzGF4sWyYduClB" alt="" width="563"><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="/files/IJnkw9bJy0YpjQ49OPVr" alt="" width="563"><figcaption></figcaption></figure></div>

## Template

If you have a particularly large list of system properties or environment variables that you would like to use every time you use Cover Plugin to write tests, you can specify a *template*. (`File > New Projects Setup > Run Configuration Templates > Diffblue Cover`). The values you specify will be used for any future run configurations.

## Prefixes

If required, you can specify what packages, classes, or methods you want to restrict these operations to, by specifying one or more prefixes in the run configuration.

**Example:** `io.corebanking.Account`

***

### Package example

Specify a package entry point using the standard Java naming convention, plus an optional trailing dot.

**Syntax:** `<path>[.]`

***

**Trailing dot:** `<path>.`

**Example:** `com.a.`

**Description:** Write tests for all accessible methods within package `<path>` (in our example, `com.a`) and any sub-packages. For example, tests could be written for sub-packages `com.a.B` and `com.a.b.C`

***

**No trailing dot:** `<path>`

**Example:** `com.a`

**Description:** Write tests for all accessible methods within any package that begins with `<path>` (in our example, `com.a`) and any sub-packages. For example, tests could be written for `com.a`, `com.apple`, `com.apricot`, `com.apricot.pip`, etc.

***

### Class example

Specify a class entry point using the standard Java naming convention, plus an optional trailing dot.

**Syntax:** `<path>[.]`

***

**Trailing dot:** `<path>.`

**Example:** `io.diffblue.corebanking.account.Account.`

**Description:** Write tests for all accessible methods within class `<path>` only - in our example, `io.diffblue.corebanking.account.Account`.

***

**No trailing dot:** `<path>`

**Example:** `io.diffblue.corebanking.account.Account`

**Description:** Write tests for all accessible methods within any class that begins with `<path>` - in our example, this could include `...Account` and `...AccountException`.

***

### Method example

Specify a method entry point using the standard Java naming convention, plus an optional method descriptor.

**Syntax:** `<path>:[<methodDescriptor>]`

**Example:** `io.diffblue.corebanking.account.Account.addToBalance:`

**Description:** Write tests for the specified method. If the optional method descriptor is omitted, all parameter and return types will be included.

A method descriptor is a list of type descriptors that describe the parameter types and the return type of a method, in a single string. For more information on method descriptors, see section 2.1.4 of the [ASM 4.0 A Java bytecode engineering library](https://asm.ow2.io/asm4-guide.pdf).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cover-docs-preview.diffblue.com/features/cover-plugin/writing-tests/run-configurations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
