How to rename the default profile?

Is there a way to easily rename the ‘default’ profile? We wanted to use a different name but the ‘rename’ option is disabled in the UI. So we went ahead and deleted the default.glbl file from the project, but that started throwing this error: Could not evaluate variable of profile: default
and this is because of this line in %\Libs\internal\GlobalVariable.groovy
def selectedVariables = TestCaseMain.getGlobalVariables("default")

If I comment this line then the tests execute without any problem, but the change is lost on restarting Katalon Studio or re-opening the project.
Another workaround I found was to execute this in TestListener inside @BeforeTestSuite
import com.kms.katalon.core.configuration.RunConfiguration as RC
def executionProfile = RC. getExecutionProfile()

That’s because (as you discovered) the default profile is required. That’s how KS works right now. Maybe that might change in the future, but right now, it needs to be there.

Exactly. Because it needs to be there.

If it’s an issue that you don’t accidentally use it, write some script that lives in a test case listener, that detects the profile name and if it’s “default”, aborts the test.

  @BeforeTestCase
  def beforeTestCase(TestCaseContext testCaseContext) {
    checkProfile()
    comment("beforeTestCase completed.")
    comment("Control transferring to Test Case...")
  }
  
  void checkProfile() {
    String profileName = RunConfiguration.getExecutionProfile()
    if(profileName == "default") {
      FORCESTOP("The default profile is not supported!")
    }
  }

FORCESTOP is merely a throw – you can change it to any throw message you prefer.

Thank you very much, this makes things clear and I can work around it for now.

1 Like

Probably the Katalon devs hard coding stuff such as a profile file name

1 Like