callTestCase Not Passing Parameters

I have been able to call and execute TC2 (Test Case 2) from TC1 without parameters successfully.
However, when I try to pass any parameters, they always end up blank in TC2, causing it to fail.

I tried modeling my calls based on the formats in the following locations:


TC1 CODE:

import ...

String sEmail = 'DeleteME@mailinator.com'
String sSubject = 'Subject Data'
String sScrnShtPrefix = 'Test - '
String sTmStmp = 'May 5, 2005 '
String sHOUR = '7'
String sMIN = '11'

// WebUI.callTestCase(findTestCase('MailCatcher-GetEmailBodyText'), ["sEmailAddress": sNonISUEmail, "sSubject": sSubject, "sScrnShtPrefix": sScrnShtPrefix, "sTmStmp": sTmStmp, "sHOUR": sHOUR, "sMIN": sMIN], FailureHandling.CONTINUE_ON_FAILURE)
WebUI.callTestCase(findTestCase('MailCatcher-GetEmailBodyText'), ['sEmailAddress': sNonISUEmail, 'sSubject': sSubject, 'sScrnShtPrefix': sScrnShtPrefix, 'sTmStmp': sTmStmp, 'sHOUR': sHOUR, 'sMIN': sMIN], FailureHandling.CONTINUE_ON_FAILURE)
// WebUI.callTestCase(findTestCase('MailCatcher-GetEmailBodyText'), ['sSubject': sSubject], FailureHandling.CONTINUE_ON_FAILURE)


TC2 CODE:

import ...

String sEmailAddress		// Will receive value from test case that calls this
String sSubject			// Will receive value from test case that calls this
String sScrnShtPrefix		// Will receive value from test case that calls this
String sTmStmp			// Will receive value from test case that calls this
String sHOUR			// Will receive value from test case that calls this
String sMIN			// Will receive value from test case that calls this
int iHour
int iMinute

WebUI.comment(sEmailAddress)
WebUI.comment(sSubject)
WebUI.comment(sScrnShtPrefix)
WebUI.comment(sTmStmp)
WebUI.comment(sHOUR)
WebUI.comment(sMIN)

iHour = sHOUR.toInteger()
iMinute = sMIN.toInteger()

The commented out lines in TC1 were other attempts that also failed.

Every single one of the comments in TC2 displayed in the Log Viewer shows a blank line.

How do I get TC1 to properly pass the values from TC1 to the variables in TC2?

Don’t REDECLARE your variables in TC2:

/* 
String sEmailAddress		// Will receive value from test case that calls this
String sSubject			// Will receive value from test case that calls this
String sScrnShtPrefix		// Will receive value from test case that calls this
String sTmStmp			// Will receive value from test case that calls this
String sHOUR			// Will receive value from test case that calls this
String sMIN			// Will receive value from test case that calls this
*/

WebUI.comment(sEmailAddress)
WebUI.comment(sSubject)
WebUI.comment(sScrnShtPrefix)
WebUI.comment(sTmStmp)


Thank you very much again, @Russ_Thomas!!!

I was wondering if that was the case.

It was the following from the Description of the Parameters Binding in the “Call Test Case” page above that was throwing me off:

Key(s): The public variables defined within the called test case.

I was assuming that the “defined” part meant that they needed to be declared in TC2.

1 Like

The documentation around variables is “weak”, to say the least.

@ThanhTo Is @Liam_B still doing the docs? In addition to the above foot-gun, is the following:

This page https://docs.katalon.com/katalon-studio/docs/call-test-case.html contains this:

That link to “Public variables” contains an anchor “#VariableTypes-Publicvariables” but there is no such anchor on the target page. Worse, there is no mention of the word “public” on that page. That’s confusing and a showstopper for newbies.

(Moved to documentation feedback)

1 Like

Hello everyone

I have updated the document in accordance with your feedback. Thanks a lot!

Have a nice day

Jass

1 Like