> 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="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F4Jtyu5vFuyzfWrlpJxzH%2Ftest%20flow%20with%20ve%201.png?alt=media&amp;token=0dd5c9fa-b3eb-4940-a832-571eacc82170" alt=""><figcaption></figcaption></figure></div>

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

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FtC3vXP0L0z86AywvEWE1%2Fadvanced%20run%201.png?alt=media&amp;token=35489161-0b76-4423-9cb9-04bbf912ae86" 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="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F2KpLqqVE3UymqgaJa1fK%2Fadvanced%20run%203.png?alt=media&amp;token=4d376449-5831-41ed-a612-bc7669347ac8" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FTc7eip0ICCyyoizC61S0%2Fadvanced%20run%203a.png?alt=media&amp;token=22d80922-2c09-4aa1-a210-30ee70271d05" 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="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FIsxNN6qHvxVoEW45tHsD%2Fadvanced%20run%203b.png?alt=media&amp;token=110289fb-0975-4946-899a-1313c0617923" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F2MXcz2f6RpUvU6jOhAuo%2Fadvanced%20run%203c.png?alt=media&amp;token=0ebf4939-0858-4c78-b2bd-ed7c38a94cce" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F33nMyauwJcog7FSHZhNy%2Fadvanced%20run%203d.png?alt=media&amp;token=eb818ab6-ca49-4e09-a208-0c1da4ec8446" 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="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FmkvYf1iHmEZO8YWGkbAc%2Fadvanced%20run%205.png?alt=media&amp;token=58b53dc1-ce75-423b-aa12-6f374bb30617" 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="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FwSQ3kRZpEK4W6v2g1Ahe%2Ftest%20flow%20with%20ve%205a.png?alt=media&amp;token=475bdecc-a6b8-41f6-9d76-62e7cf12cc54" 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
