Need to pass different data when calling a test case twice

Hi, I have called login test case which has hard coded credentials in it → did some operation → Logged out → In the same test case, I am again calling the Login Test case, but want to supply different credentials. How would I achieve it?

Katalon provoides ‘Profiles’ that allow you to set up this kind of thing:

1.) In your Explorer, right click on Profiles > New > Execution Profile:


2.) Enter a name for the profile:


3.) Add four new rows, two for the different usernames, and two more for the passwords:

4.) All of these fields can be accessed in the scripts using GlobalVariables:

WebUI.setText(findTestObject('path/to/username/field/object'), GlobalVariable.username1);
WebUI.setText(findTestObject('path/to/password/field/object'), GlobalVariable.password1);

// Execute test code, and eventually log out...

WebUI.setText(findTestObject('path/to/username/field/object'), GlobalVariable.username2);
WebUI.setText(findTestObject('path/to/password/field/object'), GlobalVariable.password2);

5.) When it comes time to run your script, just make sure you’ve selected the appropriate profile:

Generally speaking, you should organize profiles on a per-environment (per-server) basis. So a profile would ideally include:

  • URL(s) for application(s) deployed to that environment
  • Login credentials for any number of users
  • Any other environment-specific values that will be used across multiple scripts

Thanks man! But it won’t work, because, I am calling login test case twice within a same test case. I don’t want to write those login steps in the actual test case twice.

Need info on how to pass different data for a called test case within same executing test case.

A is login test case.
B is executing test case.

I started writing B --> called A with hardcoded credentials in it --> logged out --> now, I want to call A again, but how to pass different credentials.

1 Like

Sure, so when you do the WebUI.callTestCase(), just pass the global variable of your choice. See below for how to use callTestCase() with parameters:

Bro, I am still having issues. How can I pass values like [Key:Value] to a called testcase. What should be the input for called test case?

How to create a test case where I can pass key:values to it in a different test case?

Given two Test Cases named “testCase1” and “testCase2”, you can call testCase2 from testCase1 with parameter(s) as follows:


In testCase2, you must create a handle for the variable by going to the Variables tab and adding a new variable of the same name as the intended parameter:

Then in the test code for testCase2, you access the variable using that handle:


1 Like

An alternative to using pofiles would be to use test data.

It basically allows you to create variables for test cases which you can then add multiple different data sets. You create a spreadsheet in excel with the different login credentials, something like this

username password
mackin letmein
green1 letmein
adrp letmein
mellgj letmein

Then import the spreadsheet into data files and so on. If you follow the link i have attatched it will make perfect sense to you.

Then simply when you run a test suite, it will use those variables and run the ‘login test’ multiple times to fulfill the test data you have inputted, so for my example the one login test will run 4 times for each set of login credentials.