How to get a list of my GlobalVariable in Profile during execution?

Hello,

How can I get a list of my GlobalVariable in Profile to iterate in all this GlobalVariable during execution ?

Something like that for the first entry in the Profile…
GlobalVariable.name[0]
GlobalVariable.value[0]
GlobalVariable.description[0]

Thank you !

OL.

Katalon Studio does not support a feature that provides a list of GlobalVariables in Profile during execution.

Here is my custom solution.

com.kazurayam.ks.globalvariable.ExpandoGlobalVariable

The following code is a sample Test Case which uses this helper class.

import internal.GlobalVariable as GlobalVariable
import com.kazurayam.ks.globalvariable.ExpandoGlobalVariable

println "\n--- All name:value pairs as GlobalVariable available in the current context ---"
ExpandoGlobalVariable.keySetOfGlobalVariables().each { name ->
	println "GlobalVariable.${name} : " + GlobalVariable[name]
}

This emits messages in the console, for example:


--- All name:value pairs as GlobalVariable available in the current context ---
GlobalVariable.AVAR1 : null
GlobalVariable.AVAR2 : null
GlobalVariable.AVAR3 : null
GlobalVariable.BVAR1 : null
GlobalVariable.CATEGORY : 0
GlobalVariable.CONFIG : ./Include/fixture/Config.xlsx
GlobalVariable.DEBUG_MODE : false
GlobalVariable.EMPTY_VARIABLE : null
GlobalVariable.ENVIRONMENT : 
GlobalVariable.INCLUDE_SHEETS : []
GlobalVariable.INCLUDE_URLS : []
GlobalVariable.NULL_VARIABLE : null
GlobalVariable.SAVE_HTML : false
GlobalVariable.myList : null
1 Like

Geat job ! thanks !

@olivier

I have made a jar file which includes the com.kazurayam.ks.globalvariable.ExpandoGlobalVariable. Visit the following URL to download the jar.

https://github.com/kazurayam/ExecutionProfilesLoader/releases/tag/1.0.1

You want to save the jar into the Plugins folder of your Katalon project. Stop+restart KS. Then the helper class will be avaiable to your scripts.