Global value for keyword

I am new in Katalon Studio. I did not find any similar topic in Katalon Community so I am writing here

I have created keyword: defaultString and result of it I would like to set as a Global Value
This variable works as a Private variable
x = CustomKeywords.‘input.utilitties.defaultString’(5)
But I do not know how to put this variable into Global…
What kind of Value type I should choose (I have chosen “string”)
I have written something like this:

create default String - 5 letters CustomKeywords.'CustomKeywords.'input.utilitties.defaultString'(5) G_defaultString But after running my tstacase i have receiving followin errror: "Reason: groovy.lang.MissingPropertyException: No such property: G_defaultString for class: Script1554977299023" Could somebody help me in this matter and show where i make mistake?


check this page

I have seen the page from this link… and I do not understand exactly “metaprogramming:” so maybe there is a simpler way… :frowning:

At the end of this text, there is information that [rajamanthiram.r] tried to use this code and received an error and nobody helped him


you have to first define Global Variable with value or null value


then in testcase use it
CustomKeywords.''('localURL', '')
println GlobalVariable.localURL

and Keyword is
import internal.GlobalVariable

public class CreateGlobalVariables {
	void addGlobalVariable(String name, def value) {
	 GroovyShell shell1 = new GroovyShell()
	 MetaClass mc = shell1.evaluate("internal.GlobalVariable").metaClass
	 String getterName = "get" + name.capitalize()
	 mc.'static'."$getterName" = { -> return value }
	 mc.'static'."$name" = value

2019-04-17 16:19:26.877 DEBUG testcase.iniFile                         - 2: println(localURL)