Skip to main content

Global Variables and Execution Profile

Execution Profile

Execution Profile helps cover multiple and different environments to execute your automation test scripts with ease. You can configure the testing environment in terms of data and behaviors through Global variables.

Create a profile

Like other test artifacts, you can CRUD the Execution Profile in the Tests Explorer.

You need to define a profile's content by adding Global variables. Do as follows:

  1. Select a profile > click Add.
  2. In the New Variable dialog, specify details for the variable > click OK.

  3. The variable is added to the profile accordingly.

View a profile

Execution profile is provided with Manual view and Script view. In the Script view, an XML editor is available for adding variables via script. Depending on the project needs, you can create as many profiles as you want to.

In the Script view, profiles are in sync once a similar list of Global Variables is required for testing different environment types. To conduct, copy and paste the variables list from one profile to another.

Set default profile at project level


Introduced in v7.4.2, you can set a default profile at the project level.

A default profile is considered as a place to comprise commonly used global variables. Other profiles can either inherit or override the global variables stored in the default one.

You may have multiple profiles for executing your tests, for instance, staging and production profiles. It would be convenient to set a profile as your default one in every execution of a project.

Right-click on your desired execution profile and select Set as default Execution Profile.

This profile becomes a default execution option for Test Case, Test Suite, and Test Suite Collection.

It's also applied for the Command Generator's Executive Platform in case you use Katalon Runtime Engine.

Profile Inheritance

Profile Inheritance reduces your effort spent on modification and recreation of the same global variables in derived profiles. Suppose Katalon Studio does not find variables used in the test within the designated profile (any profiles but default). In that case, it will look into the default profile and use its variables to execute the test.

How to utilize Profile Inheritance

Commonly used global variables should be stored in the default profile and should store other sets of global variables in the derived (custom) profiles to avoid duplicated code and for better management.

Running the examples

The following examples illustrate how the Profile Inheritance feature works.

  • Given the following test case:

  • Execute default profile with the given test case:

    The result is shown as below:

  • Execute stagging and production profile with the given test case:

    When executing the stagging and production profiles, the name, serveURL, and credential variables are overridden (highlighted in red), while the usage and reference variables are inherited (highlighted in blue) from the global variables in the default profile.

    • Stagging profile:

      The result is shown as below:

    • Production profile:

      The result is shown as below:

Use a profile

By default, Katalon Studio uses the default profile for executing tests, as indicated on the screen's top right corner. You can select any available execution profiles in the drop-down menu.

The following section shows you a usage example. There are three profiles based on testing environments: local, staging, and production.

  • For test cases or test suites: Select your desired profile on the top right > all Global Variables within your current project automatically uses these values.

  • For Test Suite Collection: Select your desired profile to be executed with your Test Suite on the Profile column.

  • For Console Mode execution: Select your desired profile on the Profile field.

    The Generated Command has executionProfile parameter so that you can change it manually. For example:

    katalonc -noSplash  -runMode=console -consoleLog -projectPath="C:\Users\Admin\Katalon Studio\yourProject.prj" -retry=0 -testSuitePath="Test Suites/TS_RegressionTest" -executionProfile="local" -browserType="Chrome (headless)

Global Variables

A global variable is a variable defined in the execution profile and can be used in a test case, test object, web service object, and email configuration in a project.

Scope of Global Variables

Global variables are Test Suite scoped. If any Global Variable value is changed during runtime, this change will not be shared among Test Suites. This infers that you can modify Global Variables when executing a particular Test Suite without affecting other Test Suites' Global Variables in the Test Suite Collection.

You can find "Test Suites/New Test Suite (1)" is listed twice in the following screenshot. The first one uses "default," and the second one has "stagging". This association proves that a Profile is Test Suite scoped. Otherwise, the association can not be logically valid.

Use a Global Variable

Any test cases across a project can use global variables - for example, input data for keywords in Manual View (highlighted in blue) or params when binding Data for Test Execution (highlighted in red).

Parameterize a Global Variable

You can directly parameterize Global Variables in WebUI, Mobile, Windows, and API Test Objects. To parameterize a global variable, enter the syntax ${} in each type's supported locations.

Use escaping and special characters

To use a special character like $ or \ as a regular one in any place that calls parameterized global variables, prepend it with a backslash: \ (the so-called escape character).

"productName": ${GlobalVariable.productName},
"unit": "\\bottle\",
"quantity": 50,
"discount": ${ if (productName == "wine") { return 30 } else { return 0}}
"note": "Currency unit of ${GlobalVariable.productName} is \$."

  • Without \: note: Currency unit of ${GlobalVariable.productName} is $.
  • With \: note: Currency unit of wine is $.

Create Global Variables

You can change global variable values in a test suite during runtime without affecting other test suites. Therefore, using a global variable as a parameter in the keyword runFeatureFolderWithTags can save you time when you have many tags to manage.

  1. Go to Tests Explorer -> Profiles to open your desired profiles. Click Add to create a global variable whose values are tags. See Global Variables.

    add global variable

  2. Write a test case with the following keyword:
    runFeatureFolderWithTags(folderRelativePath, tags)
    • folderRelativePath: the folder relative path that starts from the current project location.
    • tags: the global variable defined in step 1.


    CucumberKW.runFeatureFolderWithTags('Include/features/BDD Cucumber Tests', GlobalVariable.username)
  3. Add this test case to a test suite and execute it from Jenkins. With the global variable created, you can choose which feature files folder to run with your desired tags values.

Update Global Variables during runtime

To change the global variable by your desired scenario tags during runtime, use the following command syntax -g_XXX, for example, -g_userName="admin".

Read more about running Cucumber feature files at BDD Testing Framework (Cucumber integration).