"Global Variable"-ception

Supposed that i want to register URL & its subdirectories as separated Global Variable. Then i want to call those two global variables with one global variables.

URL_Base : https://mywebsite.com/
SUB_Photo : photo

I wanted to call those two with one global variable, like this :

URL_Photo : URL_Base + SUB_Photo

Which will result in this : https://mywebsite.com/photo

I’m working on multi-tenant project so i need to change ‘URL_Base’ value periodically.
I need to figure out how to do that through XML Script or Groovy Script, as I coincidentally configure it through ‘GlobalVariable.groovy’ located in ‘Libs/internal’ folder.

But as i said it is coincidence, i can’t figure it out again.

One more thing : how to call edit ‘GlobalVariable.groovy’ through Katalon ? Because as of now, i can only edit it externally.

Thanks beforehand~

See Reuse GlobalVariable inside Profile

Thank you for your assistance.

I apologize for not seeking through deeply for previous QA beforehand.


maybe you should create new Global variable where those two are combined

import internal.GlobalVariable

public class HelperUtils {

	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