Better browsing through global variables

Hello guys,

Is there any way to better store and browse through my global variables?
I mean i have like 5 diffrent profiles, aroun 60 variables in each of them and its getting hard to sometimes find particular thing. At least crtl+f shortcut could help with finding names. It would be cool if i could create folders in profiles.
Also in test cases, when i want to add step using global variable, picking it from list is almost impossible, its in random order. It could be at least alphabetical.

Best regards

3 Likes

I feel your pain. Agreed - all potentially sortable lists should be sortable.

I use external files and read them in. Some of the values overwrite globals. But I don’t know if you would consider that “better”, it’s what I prefer.

Benefits:

  1. The file is under my control.
  2. I could (but don’t) produce it from other systems (database, spreadsheet, whatever).
  3. Ordering/sorting is a non-issue since I control it.

You obviously need to be comfortable in Groovy code to do something like this, though.

1 Like

I believe this is resolved now, we can search trought all available variables now

Alternative solution of mine:


1.5 List GlobalVariables filtered by the GV name and the Profile name with Regex

Problem to solve:

I want my test script to list GlobalVariables while filtering by both of the GlobalVariable name and by the Profile name.

Sample code:

// Test Cases/main/1_listing/4_listGlobalVariable

List<String> gvipList = CustomKeywords.'com.kazurayam.ks.globalvariable.LookOverExecutionProfilesKeyword.listGlobalVariablesInProfiles'(
    'ENV.*|URL.*', 'd.*')

for (String gvip in gvipList) {
    println gvip
}

The listGlobalVariablesInProfiles method takes 2 arguments. The 1st argument is a regex that matches with the name of GlobalVariable. The 2nd argument is a regex that matches with the name of Profile.

Output:

2022-05-08 21:36:22.747 INFO  c.k.katalon.core.main.TestCaseExecutor   - --------------------
2022-05-08 21:36:22.750 INFO  c.k.katalon.core.main.TestCaseExecutor   - START Test Cases/docs/1_looking-over_Profiles/5_listGlobalVariablesInProfiles
2022-05-08 21:36:23.974 INFO  k.k.c.m.CustomKeywordDelegatingMetaClass - com.kazurayam.ks.globalvariable.LookOverExecutionProfilesKeyword.listGlobalVariablesInProfiles is PASSED

ENVIRONMENT default ''
URL1    demoDevelopmentEnvironment  'http://demoaut-mimic.kazurayam.com/'
URL1    demoProductionEnvironment   'http://demoaut.katalon.com/'

2022-05-08 21:36:24.016 INFO  c.k.katalon.core.main.TestCaseExecutor   - END Test Cases/docs/1_looking-over_Profiles/5_lis

My solution is quite similar to @Russ_Thomas. There is only one difference.

Russ wrote:

My Custom keywords use Profiles/*.glbl files and read them in.

*.glbl file is just an XML file. My code can parse XML files, manipulate the contents. That’s all.

@duyluong

I would argue that Katalon Studio should provide such keywords built-in.