Need help passing variables between test cases in Katalon Studio

Hi everyone,

I’ve tried numerous things in the Katalon interface and searched the internet and this forum. I’ve found some answers, but I must be too dumb to understand what to do. ¯ \ _ (ツ) _ / ¯

I’m currently evaluating Katalon Studio for potential integration into our production environment. I’ve been running a lot of small tests to figure things out.

Here’s my situation:
The test case TC0503 has two variables: usernameTC and passwordTC. These variables are mapped to a Data File TC0503 which contains two corresponding columns: username and password.

Login is another test case. It also has its variables and dataset with a specific Data File. Login includes several Custom Keywords methods, one of which is used to input login credentials into the application:

loginProcedure(String username, String password) {}

TC0503 starts by calling the Login test case. I’m trying to figure out how to specify to Login that I want to send it the contents of the TC0503 variables usernameTC and passwordTC.

I’m not running this as part of a test suite.

Thanks for your attention. I really appreciate any help you can provide!

2 Likes

Hi @coucou ,

Welcome to our community. Everyone here is willing to help you

You could possibly return the username and password:

  1. in a Map (or Global Variable Map) that is created in your TC (see the Input reference of the last image you have above),
  2. as two String Global Variables containing username and another for password,
  3. as a List<String> that contains username and password…
1 Like

Thank you for taking the time to answer me, grylion54.

I’m especially interested in your first solution. I want to avoid Global Variables.

From TC_05_03_03 I want to target these custom keywords in TCLogin:

CustomKeywords.'loginLogout.Login.loginProcedure'(TCLogin_username, TCLogin_password)
CustomKeywords.'actuBU.modals.remplirModalPrincipal'(TCLogin_titre, TCLogin_description)

In TCLogin I’ve renamed the variables:
image

In TC_05_03_03 I followed your advice:

AFAIK this code is valid (another example):

WebUI.callTestCase(findTestCase('LogInOut/Login'), [(TCLogin_username) : TC050303_username, (TCLogin_description) : TC050303_description,
	 (TCLogin_titre) : TC050303_title, (TCLogin_password) : TC050303_password], FailureHandling.STOP_ON_FAILURE)

I checked if my TC_05_03_03 variables have any values and they do.

I get this error which makes no sense to me as I do have TCLogin variables listed as in use, as shown above:

2024-04-25 15:24:23.> 443 ERROR c.k.katalon.core.main.TestCaseExecutor - :x: Test Cases/ActuBu/TC_05_03_03 FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: TCLogin_username for class: Script1713517697054

Many thanks,

Hi there,

Thank you very much for your topic. Please note that it may take a little while before a member of our community or from Katalon team responds to you.

Thanks!

The above error is indicating something is incorrect with “TCLogin_username”. Perhaps a spelling error? You can use CTRL + C to copy the reference in one location and then CTRL + V (paste) on all the other same references to ensure they are all spelled the same.

Or your TC has come upon “TCLogin_username” with no initialization of what data type the variable is.

Hi Mike,

Many thanks for your answer. I followed your advice and met another wall. Then I decided to recreate the same situation with two new test cases: anoLogin and anoTC05.

image

My goal: to pass TC05’s variables values to anoLogin’s variables. Both tests have variables mapped to different test data sets.

anoLogin script:

WebUI.openBrowser('')
CustomKeywords.'browserLaunch.startProcedure.goToApp'(GlobalVariable.testUrl)
CustomKeywords.'loginLogout.Login.accueilLesObjetsSontPresents'()
CustomKeywords.'loginLogout.Login.notificationPopup'()
print("Local anoLogin test variables print :\n")
print("anoTCLogin_username: " + anoTCLogin_username + "\n")
print("anoTCLogin_password: " + anoTCLogin_password + "\n")
CustomKeywords.'loginLogout.Login.loginProcedure'(anoTCLogin_username, anoTCLogin_password)

If I run this test it works and prints are ok.

anoLogin variables:
image

anoLogin data bindings:

anoTC05:

print("Local anoTC05 test variables print :\n")
print("anoTC05_username: " + anoTC05_username + "\n")
print("anoTC05_password: " + anoTC05_password + "\n")
WebUI.callTestCase(findTestCase('anoLogin/anoLogin'), [(anoTCLogin_username) : anoTC05_username, (anoTCLogin_password) : anoTC05_password], FailureHandling.STOP_ON_FAILURE)

The print works with local variables. callTestCase seems to be OK to me, but not for Katalon.

anoTC05 variables:
image

anoTC05 test data:

Running anoTC05 leads to:

DEBUG testcase.anoTC05                         - 4: callTestCase(findTestCase("anoLogin/anoLogin"), [anoTCLogin_username:anoTC05_username, anoTCLogin_password:anoTC05_password], STOP_ON_FAILURE)
2024-04-29 17:44:19.884 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/anoActubu/anoTC05 FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: anoTCLogin_username for class: Script1714124675762
	at anoTC05.run(anoTC05:24)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	at com.kms.katalon.core.common.CommonExecutor.accessTestCaseMainPhase(CommonExecutor.java:65)
	at com.kms.katalon.core.main.TestCaseBindingExecutor.accessTestCaseBindingMainPhase(TestCaseBindingExecutor.java:67)
	at com.kms.katalon.core.main.TestCaseBindingExecutor.execute(TestCaseBindingExecutor.java:44)
	at com.kms.katalon.core.main.TestCaseMain.startTestCaseBinding(TestCaseMain.java:185)
	at TempTestCaseBinding1714405450835.run(TempTestCaseBinding1714405450835.groovy:25)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

This is the same problem as above.

Katalon 9.4.0

Do you happen to have an idea?

Huge thanks,

Now is the time to use Google to search on your issue:

Based on the reason above, I see you have your “missing property” in your parameter list:

Perhaps the reference “(anoTCLogin_username)” does not have a difinition or initiation yet?

1 Like