When using Called Test how do I use variable from the test I’m calling to

I am trying to use called tests, however I need to use variables in the called tests that will be defined from the test they are called too.

For example, I have a data file that queries our DB for a random user name. I want to set up a called test to use as a “login module” to reuse in all my tests. However the way I define the type of user I use the variables section of the test I’m trying to call login module to.

I want to use “userName” variable in the called test but have it execute from the variable in the specific tests…

how would I do this?

I have tried to go to window katalon studio preferences but this doesn’t help…

My lead developer came over to take a look at the Katalon Studio program. I’m not sure if this is what you meant but he was able to help me. I wanted to share with anyone else who is running into this issue.

I have login test case

in test case I define variable userName

I call for steps to log user into the system

userName is defined as variable in my login test case (not the called test)

in called test I have to define variable userName. I did this with the following:

userName Map [:]

then when I call the test I set up this:

Call Test Case Login_Module (this is my called test) [userName:userName]

in that call test I have row binding I inserted one row. it has
Key type = String
Key = “userName”
Value Type = Variable
Value = userName

Where would I find the Web UI sample project?

For login_ms I have a variable userName. The user name is pulled as a data file from a DB query. If I run this in the test case I can define the variable in the login case sensitive test. It stores it with user name, and customer name. I define both as their own variable. If I do a called test it requires me to set the variable on the called test. I don’t want this as the variable is then not usable in the test I am calling too. I am try this as a simple intro to katalon.

browse to web page
search db for user name
enter user name
enter password
verify user is logged in
in login page reenter username as all uppercase
enter password
verify user is logged in
close browser

I have other tests I have tried and in other tests I am utilizing userName and customerName.

I want to create a modular system where I can build the modules together without having to rewrite the same code lines in every test

If the value of userName is actually set from calling test case but what is variable using userName value in test case Login_MS. The syntax should be like this:

WebUI.callTestCase('...Login_MS', ['the_name_of_varible_that_uses_userName_value': userName])

Please explore our Web UI sample project and take a look at Call Test Case step of Test case **Test Cases/Main Test Cases/TC2_Verify Successful Appointment.**

Can I not define the variable in the test I am calling too?
Login_MS is the module step I want to use in all my test cases. I want that value of user name defined in the test. So this way if I call the test for a user with X, Y and Z permissions then call it again for another test that user has permissions A, B and C.

If I call and define the variable userName at this level wouldn’t Have to define my query there too?

Hi B L,

1. For Call Test Case keyword, you just ignore the Key Type and focus on Value Type. Value Type is the object type of the variable that you want to bind. Eg:
1.1 If key is ‘userName’ and value is ‘Jone Doe’ then Value Type is String.
1.2 If key is ‘timeout’ and value is **10 **then Value Type is Number.
2. The error logs show that you didn’t define variable ‘userName’ in test case Login_MS. Please navigate to Login_MS, select Variable tab and add new variable that’s names is Login_MS.


It would be the second I have many user types with different permissions. In some test cases I have an admin user login, make changes then sign out. A normal user then logs in and confirm in same test case. So the second sounds most viable. How do I configure this correctly?

If I double click input I get a popup with two options.

First one says “binding” “map” “map” “[:]”

Second one says “flowControl” “FailureHandling” “Property” “STOP_ON_FAILURE”

I assumed the first, when I click value I get a popup for map input, and I can insert. I get key type and value type. Here I see I can use test data value…but I don’t understand the difference between “Key Type” and “Value Type” how do I configure this please?

I have tried Key Type Variable with variable name for key and value type test data value and value the row and column for my test data. I have also tried these in reverse and I keep getting that the variable is undefined in the fail logs.

07-18-2017 07:42:48 AM - [ERROR] - Test Cases/Modules/Login/Login_MS FAILED because (of) Variable ‘userName’ is not defined for test case.
07-18-2017 07:42:48 AM - [FAILED] - Unable to call Test Case with id ‘Test Cases/Modules/Login/Login_iTMS’ (Root cause: Call Test Case ‘Test Cases/Modules/Login/Login_MS’ failed because of error(s))
07-18-2017 07:42:48 AM - [ERROR] - Test Cases/13_Miscellaneous/13.01_Login/Login_case_sensitive FAILED because (of) Variable ‘userName’ is not defined for test case.

Hi, it is simple.
There are a couple options and you can chose either one of them.

If you are using the same set of credentials in all test cases then just create separate test case for Login. Then, provide the variables on the ‘Variables’ tab (under the same ‘Login’ test) and define the values.
Then, each time your other tests call the ‘Login’ test, this set of credentials will be taken and populated.
If using different sets of credentials for different tests, then:

First, create a separate test case for ‘Login’ and define the variables there without giving the values.
After the login test has been created, call it from all your other tests and provide values for variables accordingly.
Click inside the ‘Input’ column twice to change variables or point to a table or other places.
Hope, it helps.