How to programmatically set or get a running profile?

Is there a way to script some code to set the running profile and/or retreive the profile name currently used in a testcase?

setProfile(‘QA’)
String runningProfile = getProfile.name()

Thank you in advance

Please try the following snippet:

import com.kms.katalon.core.configuration.RunConfiguration as RC
def executionProfile = RC.getExecutionProfile()
WebUI.comment("executionProfile=${executionProfile}")
WebUI.verifyEqual('default', executionProfile)
5 Likes

I had a look at the javadoc of RunConfiguration: https://api-docs.katalon.com/com/kms/katalon/core/configuration/RunConfiguration.html

I could find getExectionProfile() method, however there found no public void setExecutionProfile(String name) method.

I believe that a Test Case can not modify the name of Execution Profile; and I think it is not necessary.

Ok. Thanks a lot :wink:

I believe that a Test Case can not modify the name of Execution Profile; and I think it is not necessary.

What happens if you have different Execution profiles for different tests which you wish to run in a suite? I would argue that it is necessary. Can it at least be set at suite level?

In my project I have a Test Suite Collection in which I have 3 entries. Each entry invokes a single Test Suite with 3 different Profiles ---- default, develop and project. See the following screenshot.

16691.png

1 Like