Method for retrieving an array-based list of all testIDs within a given folder structure in Katalon Studio?

The keyword callTestCases() enable you to introduce more layers of abstraction where you can implement any data manipulation. For example, you can load values from JSON in the caller test case.

I made a JSON file <projectDir>/config.json

{
	"message1": "Wingardium Leviosa",
	"message2": "Expelliarmus",
	"message3": "Expecto Patronum"
}

I made a Test Case “TestCase6”

import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import groovy.json.JsonSlurper
import internal.GlobalVariable

// load the config file and put it into a variable of type Map
JsonSlurper slurper = new JsonSlurper()
def config = slurper.parse(new File('./config.json'))

WebUI.callTestCase(findTestCase("MyTestsFolder/TestCase1"), ["message1": config.message1, "message2": config.message2, "message3": config.message3])
WebUI.callTestCase(findTestCase("MyTestsFolder/TestCase2"), ["message1": config.message1, "message2": config.message2, "message3": config.message3])
WebUI.callTestCase(findTestCase("MyTestsFolder/TestCase3"), ["message1": config.message1, "message2": config.message2, "message3": config.message3])

I ran the TestCase6, it worked as follows

Please note, the message texts are loaded from the json file, are different from what CallerA and CallerB passed.

The callee Test Cases (TestCase1, TestCase2, TestCase3) are not modified at all, but displayed different messages: a sort of data-bining was performed here.

1 Like