Global Variables

Estimated reading time: 1 minute

Starting from Katalon Studio version 6.3.0, Move up and Move down functions for Global Variables are available.

Define a Global Variable

A Global Variable can be accessed anywhere inside your project. Global Variables can be managed in the Default Profile view.

Starting from Katalon Studio version 5.4, the Global Variable view is no longer available.

Expand the default profile view, then click Add.

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

The variable will be added to the default profile 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.openBrowser(GlobalVariable.G_SiteURL)

WebUI.click(findTestObject('Page_CuraHomepage/btn_MakeAppointment'))

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

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

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

WebUI.click(findTestObject('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)

WebUI.closeBrowser()

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 ${GlobalVariable.name} 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