> For the complete documentation index, see [llms.txt](https://docs.does.qa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.does.qa/better-coverage/run-across-environments.md).

# Run across environments

Most suites need the same journeys on more than one environment. Keep one Flow, drive URLs and credentials with [Values](/values/value-store.md), then change those Values per Run with a [Run Recipe](/configuration/run-recipes.md). Use tags only when the journey itself differs between environments.

```mermaid
flowchart TD
  values["Assets Values for URL and credentials"] --> flow["Flow uses dollar Values"]
  flow --> recipe["Recipe overwrites per environment"]
  recipe --> run["Schedule or CI starts the Recipe"]
```

Use the **Flow Builder** for this walkthrough.

## Put environment data in Values

Create [Values](/better-coverage/share-data-with-values.md) for anything that changes by environment, such as:

* `BASE_URL`
* `USERNAME` and `PASSWORD`
* Feature flags or region codes your steps read

Keep the Flow free of hard-coded staging or production URLs.

## Use those Values in the Flow

{% stepper %}
{% step %}

## Open with the environment URL

Start with [**Open**](/test-steps/starter/open.md). In the URL field, type `$` and pick `BASE_URL` (or your Value title).
{% endstep %}

{% step %}

## Fill credentials from Values

Add [**Set value**](/test-steps/action/set-value.md) for username and password fields. Use `$USERNAME` and `$PASSWORD` from the [Value Store](/values/value-store.md).
{% endstep %}

{% step %}

## Finish the shared journey

Continue with the same steps you would run on every environment.
{% endstep %}
{% endstepper %}

<figure><img src="/files/P2z2gA5Lbsul1MnIiL86" alt="Open, Set value, and Touch using Values"><figcaption><p>Example Flow driven by environment Values</p></figcaption></figure>

## Overwrite Values per environment

Go to [**Settings → Run Recipes**](/configuration/run-recipes.md). Create one recipe per environment, or one recipe that iterates over several value sets.

In **Value Overwrites**, replace the defaults for that Run:

```json
{
  "BASE_URL": "https://staging.example.com",
  "USERNAME": "staging_user",
  "PASSWORD": "staging_secret"
}
```

For several environments in one recipe, use an array of objects. Add `primaryValue` so results show which set ran:

```json
[
  {
    "primaryValue": "Staging",
    "BASE_URL": "https://staging.example.com",
    "USERNAME": "staging_user"
  },
  {
    "primaryValue": "Production",
    "BASE_URL": "https://www.example.com",
    "USERNAME": "prod_user"
  }
]
```

{% hint style="info" %}
**Pro tip:** Prefer recipe overwrites for environment URLs and accounts. Tags mark which *paths* run. They do not store credentials or URLs.
{% endhint %}

## When the journey differs by environment

Some steps exist only in one environment, such as a cookie-consent banner on production.

1. After shared setup, add a [Flow Branch](/getting-started/terminology.md).
2. On each path, add [**Tag Test**](/test-steps/utility/tag-test.md) with an environment tag, such as `production` or `nonprod`.
3. Put environment-only steps on the matching path.
4. In each recipe, set **Test Case Filters → Include Tags** to that environment tag, and keep the **Value Overwrites** for that environment’s URL and credentials.

For packs that share paths but differ only by data, skip the branch and use overwrites alone. See [Build smoke and regression coverage](/better-coverage/build-smoke-and-regression-coverage.md) for tag and filter detail.

## Related

* [Share data with Values](/better-coverage/share-data-with-values.md)
* [Run Recipes](/configuration/run-recipes.md)
* [Tag Test](/test-steps/utility/tag-test.md)
* [Build smoke and regression coverage](/better-coverage/build-smoke-and-regression-coverage.md)
* [Reuse a login session](/guides/reuse-a-login-session.md)
