How to call a custom test object (created at run-time in one test case) in another test case

Hi there! Anybody has insights on how to call a custom test object (created at run-time in one test case) in another test case?

Here’s the test object I’ve created in a test case:

List <TestObjectProperty> properties = new ArrayList<TestObjectProperty>();
properties.add(new TestObjectProperty('xpath', ConditionType.EQUALS, "(//button[@type='button'])[21]"));
properties.add(new TestObjectProperty('type', ConditionType.EQUALS, 'button'));
properties.add(new TestObjectProperty('text', ConditionType.EQUALS, ' Sign In'));
customSignIn = new TestObject("customSignInButton");
CustomKeywords.'com.nb.utilities.CommonUtilities.clickUsingJS'(customSignIn, 30);

My goal is to call customSignIn object in another Test Case. Is that possible?

The only close solution I found is creating a custom keyword:

Are there any possible solutions? Thanks! :slight_smile:

A few options:

  1. You can create a Custom Keyword which returns the Test Object when called. Any number of Test Cases would be able to use the Keyword.
  2. A caller test case creates a Test Object, the caller test case calls other test case passing the Test Object as a parameter to callTestCase()
  3. Use GlobalVariable of type Null, in which you can store any type of Goovy object. Preceding test case creates a Test Object and save it into a GlobalVariable; following test cases read the GlobalVariable value. Please note that you need to explicitly cast the value to the class com.kms.katalon.core.testobject.TestObject.

Thanks @kazurayam! I’ll probably go with the first option. My real intent here is to parameterize certain test objects and be able to re-use them so as to lessen the number of test objects saved in the Object Repo.
Thanks for your insights!