> For the complete documentation index, see [llms.txt](https://sealights-docs.tricentis.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sealights-docs.tricentis.com/test-optimization/test-optimization-strategy/test-selection-policies/test-project-id/configuring-test-project-id.md).

# Configuring Test Project ID

## Configuration

You can configure Test Project ID using either:

1. **Command-line parameter** (when running your test agent)
2. **Environment variable** (set in your CI/CD pipeline or test environment)

### Option 1: Command-Line Parameter

The exact CLI parameter depends on your test runner technology. Refer to your technology-specific documentation for the correct parameter name and syntax.

**General pattern:**

```bash
<your-test-runner-command> --test-stage=regression --test-project-id="Product A"
```

### Option 2: Environment Variable

Set the following environment variable before running your tests:

```bash
export SL_TEST_PROJECT_ID="Product A"
```

**Example in CI/CD pipeline:**

```yaml
# Jenkins, GitLab CI, etc.
environment:
  SL_TEST_PROJECT_ID: "Product A"
```

***

## Technology-Specific Configuration

### Gradle

Add `testProjectId` to your `sl-config.json` configuration file to distinguish test stages with the same name (e.g., "Component Tests" or "BDD Tests") when triggered by different teams or test sets.

**When to use:**

* Multiple teams run the same test stage name against the same application
* You need separate tracking of test results from different sources
* Different pipelines execute identical test stages concurrently

**Example scenario:** Team A and Team B both run "BDD Tests" against the same application. Using different `testProjectId` values ensures their results are tracked separately in the SeaLights Dashboard.

#### Configuration

**Gradle Plugin 4.0.1013 and later** — add `testProjectId` to `sl-config.json`:

```json
{
  "executionType": "testsonly",
  "tokenFile": "./sltoken.txt",
  "labId": "<lab-id>",
  "runFunctionalTests": true,
  "testStage": "BDD Tests",
  "testProjectId": "<your-test-project-identifier>"
}
```

**Older versions** — you must also pass the value via `sealightsJvmParams`:

```json
{
  "executionType": "testsonly",
  "tokenFile": "./sltoken.txt",
  "labId": "<lab-id>",
  "runFunctionalTests": true,
  "testStage": "BDD Tests",
  "testProjectId": "<your-test-project-identifier>",
  "sealightsJvmParams": {
    "sl.testProjectId": "<your-test-project-identifier>"
  }
}
```

{% hint style="success" %}
**Recommendation:** Use the latest version of the SeaLights Java agent. From Gradle Plugin 4.0.1013+, only the `testProjectId` field in `sl-config.json` is required.
{% endhint %}

#### Integration Steps

1. Integrate with your Gradle project:

```bash
java -jar sl-build-scanner.jar -gradle -configfile sl-config.json -workspacepath .
```

2. Run your tests:

```bash
./gradlew <your-test-task-name>
```

3. Restore build files:

```bash
java -jar sl-build-scanner.jar -restoreGradle -workspacepath .
```
