> For the complete documentation index, see [llms.txt](https://doc.wearepatchworks.com/product-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/testing-a-process-flow-against-a-virtual-environment.md).

# Testing a process flow against a virtual environment

## Introduction

The `initialise flow (advanced)` option allows you to run a master process flow against any virtual environment that has a `deployed` version. Where applicable, you can also add new/override existing [environment variables](/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/configuring-virtual-environment-replacements/replacement-variables.md).

This runs the flow and replaces any components [configured](/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version.md) and [deployed](/product-documentation/virtual-environments/implementing-virtual-environments/deploying-the-configuration-for-a-virtual-environment.md) for the selected virtual environment.

{% hint style="warning" %}
Keep in mind that replacement connector instances for the selected virtual environment version might be for a live system! If in doubt, double-check the configuration for virtual environments before testing your process flow(s).
{% endhint %}

## Need to know

* The `virtual environment` selector is only displayed if [at least one virtual environment is deployed](/product-documentation/virtual-environments/managing-virtual-environments-versions-and-flows/managing-virtual-environment-configuration-versions/deleting-a-virtual-environment-version.md) for your company profile.
* All virtual environments with a [deployed configuration version](/product-documentation/virtual-environments/implementing-virtual-environments/deploying-the-configuration-for-a-virtual-environment.md) will be available for selection when testing flows with the `initialise flow (advanced)` option.
* If the selected virtual environment is configured with replacement `environment variables`, these are displayed with an override option.
* If `no virtual environment` is selected, you have the option to add new, temporary `environment variables` for this run (this can be useful for prototyping).
* If the current (i.e. displayed) process flow version includes `flow variables`, these are displayed with an override option.
* When a process flow is run against a virtual environment using the `initialise flow (advanced)` option, the [deployed configuration](/product-documentation/virtual-environments/implementing-virtual-environments/deploying-the-configuration-for-a-virtual-environment.md) for the given environment is applied.

## Using the initialise flow (advanced) option

{% stepper %}
{% step %}
**Access the required process flow**

[Access the first process flow version](/product-documentation/process-flows/accessing-your-process-flows.md) that you want to test, so it's displayed on the canvas. If necessary, use the [versions panel in process flow settings](/product-documentation/process-flows/building-process-flows/process-flow-versioning.md#accessing-process-flow-versions) to switch to the required flow version.
{% endstep %}

{% step %}
**Select the initialise flow (advanced)**

Select the `initialise flow (advanced)` option from the actions bar - for example:

<div align="left"><figure><img src="/files/QVVYwImsapIIFRNax9QK" alt=""><figcaption></figcaption></figure></div>

The `initialise flow (advanced)` page is displayed:

<figure><img src="/files/WBpzRIDG8mjdSZcfRGuy" alt=""><figcaption></figcaption></figure>

Here, the left panel can be used to pass in a specific payload, and the right panel shows whether flow and/or environment values are present.

{% hint style="info" %}
Please see the [Need to know](#need-to-know) section above for more information on what causes these variables to be displayed.
{% endhint %}
{% endstep %}

{% step %}
**Review flow variables (if applicable)**

If a `flow variables` section is displayed, click the associated arrow to display any [flow variables](/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables.md) defined for the current version - for example:

<figure><img src="/files/p7mg0jrd5BjL1gGCDQZ7" alt=""><figcaption></figcaption></figure>

If required, you can use the associated toggle option to override the current variable value - for example:

<figure><img src="/files/nun4VjrR1w1Kohne6AzU" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Any value specified here is applied for this run only
{% endhint %}
{% endstep %}

{% step %}
**Review virtual environment variables (if applicable)**

If a `virtual environment variables` section is displayed, it means that at least one virtual environment is deployed for your company profile. Click in the `virtual environment` field and select the environment that the current flow should run against - for example:

<figure><img src="/files/Z8VJrXRpHgw3xMnByqA8" alt=""><figcaption></figcaption></figure>

Any replacement environment variables configured for the selected virtual environment are listed below - for example:

<figure><img src="/files/P55sBM3WHOjdascvTqk8" alt=""><figcaption></figcaption></figure>

If required, you can use the associated toggle option to override the current variable value - for example:

<figure><img src="/files/vdU2gbB0XOcRi3qYZqw7" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Any value specified here is applied for this run only
{% endhint %}
{% endstep %}

{% step %}
**Run the process flow**

Click the `initialise flow` button at the bottom of this page:

<figure><img src="/files/6BIEb4qCdona49yomxMG" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You may need to scroll down to access this option.
{% endhint %}
{% endstep %}

{% step %}
**Check output**

As the process flow runs, the live logs will show where any replacements (swaps) are made for the selected environment - for example:

<figure><img src="/files/7kQ0Sq1RtTKjOwQpwkur" alt=""><figcaption></figcaption></figure>

Check the logs and generated payloads to ensure that results are as expected. When you're satisfied that the process flow is running correctly, you can [deploy it to the virtual environment](/product-documentation/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment.md).
{% endstep %}
{% endstepper %}

## Related pages

* Testing a process flow against a virtual environment
