Environments

Environments help you create variables that you can reuse in requests and scripts.

An environment allows you to group together a set of variable data. You can reference the variable data you define in an environment throughout PruTAN when sending requests or using scripts. Environments are also useful when you need to manage shared variables with a team. You can create environments and share them with your workspace members.

Click on the "Environments" icon on the sidebar to create environments.

Adding Environment Variables

You can create a new environment by clicking the environments icon in the submenu options and clicking the new button. Let's label the environment as E-Comm_Env.

Now, let's create an environment variable called baseUrl where baseUrl = https://app.prutan.com/prutan/core/router, pointing to /HB/d6f7f864-3556-45dc-bdb6-c31664b02898.

Similarly, you can create multiple environments and environment variables.

Accessing Environment Variables

If you have more than one environments, select the environment whose variables you want to access. You can access the variables in the request section by referencing the variable in the following format {{variable_name}}, in our case the variable will be {{baseUrl}} and the complete URL will be {{baseUrl}}/HB/d6f7f864-3556-45dc-bdb6-c31664b02898.

ISO requests can use the values of a saved test card in the same way, with the card. prefix, for example {{card.pan}}. See Card Engine.

An environment can also choose the card. Add a variable. Its value is the name of a card. Then, in the request's Settings → Card, pick From environment. See Use a different card in each environment.

Types of Environments

  1. Global Environment – The global environment is workspace-specific and accessible to all members within that workspace. Variables defined in the global environment are always available for use without requiring manual selection, providing a consistent and shared configuration across the workspace.
  2. Personal Environment – The personal environment is private to the workspace and can be shared only with its members. It can be created for specialized or temporary use cases within the same workspace. A personal environment must be explicitly selected from the dropdown to be active, and when selected, its variables take precedence over the global environment variables for that execution.

PRUTAN Environment Preference Rules

When both Global and Selected environments define the same key:

PRUTAN prefers Selected Environment over Global.

Priority Order:

  1. Selected Environment (highest priority)
  2. Global Environment

Example:

Global: { baseUrl: "https://prod.prutan.com" }
Selected: { baseUrl: "https://dev.prutan.com" }

Result: Uses "https://dev.prutan.com" (selected overrides global)

This ensures environment-specific overrides for testing different setups without modifying shared global configs.

Using Scripts

You can also create and fetch environment variables using scripts in the Rules tab.

// To create environment variable for currently selected environment else global environment
env.set('key', 'value');

// To get environment variable
env.get('key');

Where env.set is saved

env.set always works within the current run — a value you set is available later in the same execution. Whether it is saved for the next request depends on the module:

ModuleRESTISORealtime
SandboxSavedSaved—
InterceptorSavedSaved—
APINot savedNot savedNot saved
In the API module, env.set runs during that request but the value is not persisted for the next request. If you need a value to carry over, set it from Sandbox or Interceptor instead.

Passing values between steps in a Suite

Inside a Suite, env.set is not saved — neither from a pre-request script nor from a validation script. To carry a value from one suite step to another, use the preReq. / preRes. helpers instead of env.set. See Pre-request script for the full method reference and examples.

Environments Import/Export

PruTAN also provides environment import/export functionality. If you want to share a created environment with members who are not part of the team or use this environment collection in another team, you can export the specific environment or all environments simultaneously as a JSON file. After that, the file can be imported into PruTAN environments.

Image 1: Export Single Environment Collection

Steps to export a single environment collection:

  1. Go to the Environment sidebar and hover on the environment you want to export.
  2. On hover, you will see three vertical dots; click on them.
  3. On click, a dropdown will show the export button.
  4. Click on it and the environment will be exported.

Image 2: Import & Export All Environments Simultaneously

A. Steps to export all environment collections:

  1. Go to the environment sidebar section.
  2. Click on the Import/Export button icon.
  3. A dialog box will open with the option to export.
  4. Click on the export button and all the environments will be exported.

B. Steps to import environment collections:

  1. Go to the environment sidebar section.
  2. Click on the Import/Export button icon.
  3. A dialog box will open with the option to import.
  4. Click on the import button, select an env JSON file exported from PruTAN, and import it.

Duplicating an Environment

Create a copy of an existing environment to modify or test different configurations without affecting the original:

  1. Click the "Environments" icon in the sidebar to view all existing environments.
  2. Hover over the environment you want to duplicate; a three-dot icon will appear. Click on the three-dot icon.
  3. From the dropdown menu, select "Duplicate". A new environment with the suffix "- Duplicate" will be created.