I’d like to know if it’s possible to use the getText function to then populate a test data object for use in another case as part of a test suite.
For example, Test Case 1 creates a booking for a customer which generates a unique reference. I’d like to get that reference from the booking confirmation page and write it into a Test Data object for use in Test Case 2 to locate that booking via the reference.
I believe you can use a global variable to store the getText value as a string. Then call that variable when assigning input in your other test cases. I’m fairly new to Katalon, but I’ve used this method with other test automation suites.
Variable documentation:
https://docs.katalon.com/display/KD/Variable+Types
Once created you’d use a command like this to store the text:
myURL = WebUI.getText(findTestObject(null))
Yes, very much as Sean described it.
In TestCase1:
GlobalVariable.BOOKING_REF = WebUI.getText(...)
In TestCase2:
DoSomethingWith(GlobalVariable.BOOKING_REF)
I like to create my globals ahead of time (and set them to “” if they don’t have a default value).
1 Like