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

**URL:** <https://forum.katalon.com/t/how-to-call-a-custom-test-object-created-at-run-time-in-one-test-case-in-another-test-case/15186>\
**Category:** Miscellaneous\
**Created:** [December 10, 2018, 8:08am UTC](https://forum.katalon.com/t/how-to-call-a-custom-test-object-created-at-run-time-in-one-test-case-in-another-test-case/15186 "2018-12-10T08:08:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandy\_Tupas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/sandy_tupas/32/432_2.png) [@Sandy\_Tupas](https://forum.katalon.com/u/Sandy_Tupas)\
**Post date:** [December 10, 2018, 8:08am UTC](https://forum.katalon.com/t/how-to-call-a-custom-test-object-created-at-run-time-in-one-test-case-in-another-test-case/15186/1 "2018-12-10T08:08:51Z")

</div>

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");
customSignIn.setProperties(properties);
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:  
[https://docs.katalon.com/katalon-studio/docs/creation-of-test-object-in-object-repository-in-runtime.html](https://docs.katalon.com/katalon-studio/docs/creation-of-test-object-in-object-repository-in-runtime.html)

Are there any possible solutions? Thanks! 🙂

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [December 10, 2018, 8:20am UTC](https://forum.katalon.com/t/how-to-call-a-custom-test-object-created-at-run-time-in-one-test-case-in-another-test-case/15186/2 "2018-12-10T08:20:17Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![Sandy\_Tupas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/sandy_tupas/32/432_2.png) [@Sandy\_Tupas](https://forum.katalon.com/u/Sandy_Tupas)\
**Post date:** [December 10, 2018, 8:46am UTC](https://forum.katalon.com/t/how-to-call-a-custom-test-object-created-at-run-time-in-one-test-case-in-another-test-case/15186/3 "2018-12-10T08:46:57Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [December 12, 2018, 6:07am UTC](https://forum.katalon.com/t/how-to-call-a-custom-test-object-created-at-run-time-in-one-test-case-in-another-test-case/15186/4 "2018-12-12T06:07:13Z")

</div>


