Data Binding is not working when I call the test case from the another test case

I wanted to bring up an issue I’m experiencing with two test cases. Please find the details below:

Test Case 1:

  • Calls Test Case2 . (WebUI.callTestCase())

Test Case 2:

  • Performs data binding.

The issue: When I run the second test case independently, the data binding works successfully. However, when I call the second test case from the first test case, the data binding does not work.

1 Like

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!

It is not a bug.
Katalon Studio is designed as such.

Hi,

Based on the details you provided, it seems that the data binding in Test Case 2 works independently but not when it is called from Test Case 1.

The solution to this problem is to pass the bound data from the first test case to the second test case as arguments.

Here’s how you can do this:

Steps:

  1. Define Variables in Test Case 2:
    • In Katalon Studio, open Test Case 2.
    • Go to the Variables tab.
    • Add the variables that you need (e.g., param1, param2).

Test Case 2 (Variables tab):

Variable Name Default Value Description
param1 First parameter
param2 Second parameter
  1. Use the Variables in Test Case 2:
    • Use the variables in your test steps as if they have values.

Test Case 2 (Script tab):

// Use the parameters in your test case
println("Param 1: " + param1)
println("Param 2: " + param2)

// Continue with your data binding and test steps
WebUI.setText(findTestObject('Object Repository/Input_Field_1'), param1)
WebUI.setText(findTestObject('Object Repository/Input_Field_2'), param2)
  1. Bind Data in Test Case 1:
    • In Test Case 1, bind the data and call Test Case 2, passing the variables.

Test Case 1 (Script tab):

import com.kms.katalon.core.model.FailureHandling
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

// Define the data to bind
def data = [
    'param1': 'test value 1',
    'param2': 'test value 2'
]

// Call Test Case 2 with the data binding
WebUI.callTestCase(findTestCase('Test Case 2'), data, FailureHandling.STOP_ON_FAILURE)

Summary:

  1. Define variables in Test Case 2 and use them in your test steps.
  2. Bind data in Test Case 1 when calling Test Case 2, passing the necessary values using the WebUI.callTestCase method.

By setting up the variables in Test Case 2 and binding them in Test Case 1, you ensure that the data is passed correctly, regardless of how Test Case 2 is executed.

I hope this helps!

If it fits for your need, do not hesitate to advise me of your approval :slight_smile:

Regards,
JM

can you try calling the test case 2 from test case 1 again, using Manual View. Ie add the keyword again. The map binding should be automatically be picked up from the test case and you hopefully won’t see ‘null’. If you use script view you’ll probably need to write it yourself, hence why I said use manual view