Katalon Studio - Script for change profile and value global variable

My custom solution is also available.

This keyword provides a keyword “loadExecutionProfile()”, with which you can load any number of Execution Profiles in a Test Case run. GlobalVariables are dynamically overwritten with the values loaded by this keyword, like this:

import com.kazurayam.ks.globalvariable.ExecutionProfilesLoader

new ExecutionProfilesLoader().loadProfile("ProductionEnv")

println "GlobalVariable.URL=" + GlobalVariable.URL

or this:

CustomKeywords."com.kazurayam.ks.globalvariable.ExecutionProfilesLoader.loadProfile"("ProductionEnv")

println "GlobalVariable.URL=" + GlobalVariable.URL

The goodness of this keyword is that it enables the modularisation of Execution Profiles.

What is “modularisaztion of Execution Profile”?

Say, you have 6 GlobalVariables in a single Execution Profile now.

  • var1=foo1
  • var2=foo2
  • var3=foo3
  • val1=bar1
  • val2=bar2
  • val3=bar3

Now you want to assign new value to valX. You need to create 2nd Execution Profile like this:

  • var1=foo1
  • var2=foo2
  • var3=foo3
  • val1=baz7
  • val2=baz8
  • val3=baz9

This would work, but looks stupid. You need to repeat writing `var1=foo1’ in 2 Execution Profiles.

Why you have to repeat writing var1=foo1 in multiple Execution Profiles?

It is because, Katalon Studio asks you to choose only 1 Execution Profile to run your Test Case/Test Suites. Katalon Studio does not provide a way for you to load 2 or more Execution Profiles.


My “ExecutionProfilesLoader” enables you to load 2 or more Execution Profiles for a single Test Case execution.

With it you can split the above example Global variables into 3 groups.

  1. Execution Profile “GroupA”
  • var1=foo1
  • var2=foo2
  • var3=foo3
  1. Execution Profile “GroupB”
  • val1=bar1
  • val2=bar2
  • val3=bar3
  1. Execution Profile “GroupC”
  • val1=baz7
  • val2=baz8
  • val3=baz9

and your test case will choose 2 groups amongst 3, and load them with the ExecutionProfilesLoader.

You can create as many Execution Profiles as modules as you want. For example, in one of my testing project I created 16 Execution Profiles, and choose 5 out of 16 to apply to a single run of Test Suite. This enabled me significant flexibility of configuring the project.