> For the complete documentation index, see [llms.txt](https://docs.redefine.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.redefine.dev/configuration/parallel-test-execution/redefine-parallel.md).

# Redefine Parallel

Redefine Parallel is Redefine's method of optimizing test distribution across multiple machines. It allows you to run tests as though they are being executed on a single machine while Redefine manages the distribution.

This approach utilizes test duration and failure probability to ensure that the most relevant tests are always running in parallel.

## Install

Follow the instructions in the [Quick Start ⏱️](/welcome-to-redefine/quick-start.md)guide to install Redefine.

## Configure

### Configure a shared session ID

To use Redefine Parallel, it is important to configure a shared session ID between all testing machines. This allows Redefine to connect the prediction and the execution of the tests.

Follow these steps to configure the shared Session ID:

1. It is crucial to generate the session ID once and provide it to all testing machines, to avoid misalignment. &#x20;
2. You can use the CLI command `redefine get session_id` to generate the session ID, which represents the current session.
3. Export the environment variable REDEFINE\_SESSION\_ID with the same value on all test-runners.

## Verify

Make sure that the verify command ends with success on all testing machines -

```bash
redefine verify --<testing-framework>
```

Follow the [Quick Start ⏱️](/welcome-to-redefine/quick-start.md#verify) guide for instructions and troubleshooting.

## Run

When executing the `redefine install` command, you need to pass the number of machines and the index of each machine to the Redefine command in the following format:

{% tabs %}
{% tab title="Pytest" %}

```bash
redefine install --pytest --<selection_mode> --splits <number of machines> --group <machine index>
pytest -n auto tests/
```

{% endtab %}

{% tab title="Cypress" %}

```bash
redefine install --cypress --<selection_mode> --splits <number of machines> --group <machine index>
npx run cypress
```

{% endtab %}

{% tab title="Mocha" %}

```bash
redefine install --mocha --<selection_mode> --splits <number of machines> --group <machine index>
npm run test
```

{% endtab %}
{% endtabs %}


---

# 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 dynamically by asking a question.

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

```
GET https://docs.redefine.dev/configuration/parallel-test-execution/redefine-parallel.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
