> For the complete documentation index, see [llms.txt](https://docs.sealights.io/knowledgebase/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sealights.io/knowledgebase/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 .
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sealights.io/knowledgebase/test-optimization/test-optimization-strategy/test-selection-policies/test-project-id/configuring-test-project-id.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
