Global Variables

Estimated reading time: 1 minute

Define a Global Variable

A Global Variable can be accessed anywhere inside your project. Global Variables can be managed using the Global Variables view.

Expand the Global Variable view. Then click Add

The New Variable dialog is displayed. Specify details for the variable then click OK.

The variable will be added to the Global Variable list accordingly.

Use a Global Variable

Global Variables can be utilized by any test case across a project. (e.g. input data for keywords in Manual View or params when binding Data for Test Execution).

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import internal.GlobalVariable as GlobalVariable

WebUI.comment('Story: Login to CURA system')

WebUI.comment('Given that the user has the valid login information')


WebUI.setText(findTestObject('Page_Login/txt_UserName'), Username)

WebUI.setText(findTestObject('Page_Login/txt_Password'), Password)

WebUI.comment('When he logins to CURA system')'Page_Login/btn_Login'))

WebUI.comment('Then he should be able to login successfully')

landingPage = WebUI.verifyElementPresent(findTestObject('Page_CuraAppointment/div_Appointment'), GlobalVariable.G_Timeout)


Parameterize a Global Variable

Starting with Katalon Studio version 6.3.0, you can directly parameterize Global Variables in both WebUI and API Test Objects.

Enter the syntax ${} in any supported locations. For example:

in HTTP Body of an API Test Object:

in Selected Locator of a WebUI Test Object:

User Contributed Notes