What's the purpose of TestObject?

Hello, I’m trying to understand TestObject it seems great to be able to declare and reuse existing elements in different tests. But I cannot get their child elements, I can’t really do anything dynamic with them… So in these cases I drop down to the WebElement… And if so… What’s the point? I could use WebElement all the time, discarding TestObject. After considering that I’m wondering why using Katalon at all. I’m a developer so that is defiantly coloring my view of this. If TestObject could reference an array, and if it’s child elements could be accessed with a filter returning another TestObject that would definitely change my mind on this matter.

Am I missing something? Is that in the works?

Let me ask you a question.

Do you use “Record Web” and “Spy Web”?

Do you find them useful for you?

The following post by Marek Melocik would surprise you.

You can search sub elements using TestObject!

The purpose of TestObject for Marek here? TestObject is just an envelope of a XPath selector string. Let me rewrite his code a bit:

// ".//div[1]/div/div/ng-view/div[4]/div/div[7]/div/div[2]/div"String absolutePathToParent = findTestObject('Page_/parent_node').findPropertyValue('xpath')// "//div[text()='textYouLookFor']"String relativePathToChild  = findTestObject('Page_/relative_to_parent').findPropertyValue('xpath')
TestObject to = new TestObject().addProperty("xpath", ConditionType.EQUALS,    abosolutePathToParent + relativePathToChild)WebUI.verifyElementVisible(to)

Here the selector string could have been generated by “Report Web” or handcrafted; it doesn’t matter.

The heart of this trick is concatinating 2 selectors in XPath (absolute + relative) to form a new TestObject.

Please be aware that “Record Web” and “Spy Web” does not do support this trick.

kazurayam said:

Let me ask you a question.

Do you use “Record Web” and “Spy Web”?

Do you find them useful for you?

The Record Web I find a “neat trick” but not sure it’s going to be useful on it’s own, the ability to edit a recorded script is helpful. Getting down to nut&bolts… here’s the reality: a programmer is going to have to review the script and edit it to get something good and useful. But this provides a promise and a reality that upper management will buy into (the BA’s can do this themselves).

The Spy Web what I think is good about this is the ability to easily define and display. It starts the conversation of here is what I need to test, when widget X changes it will break the following tests. I am unsure if a TestObject’s multiple definitions are OR’ed or AND’ed. It’s an important detail that I’ve been assuming works the way I’d hope (I’ll leave that out of this discussion).

I am hoping to get a proof-of-concept out to my company then use these Record-Web Spy-Web tools to sell the idea of using this tool. I do not believe that these tools can stand on there on in there present form (but it is very close).

Thank you for the code sample, I’ll take a look at it.

User 123 said:

kazurayam said:

Let me ask you a question.

Do you use “Record Web” and “Spy Web”?

Do you find them useful for you?

The Record Web I find a “neat trick” but not sure it’s going to be useful on it’s own, the ability to edit a recorded script is helpful. Getting down to nut&bolts… here’s the reality: a programmer is going to have to review the script and edit it to get something good and useful. But this provides a promise and a reality that upper management will buy into (the BA’s can do this themselves).

The Spy Web what I think is good about this is the ability to easily define and display. It starts the conversation of here is what I need to test, when widget X changes it will break the following tests. I am unsure if a TestObject’s multiple definitions are OR’ed or AND’ed. It’s an important detail that I’ve been assuming works the way I’d hope (I’ll leave that out of this discussion).

I am hoping to get a proof-of-concept out to my company then use these Record-Web Spy-Web tools to sell the idea of using this tool. I do not believe that these tools can stand on there on in there present form (but it is very close).

I agree with you.

I have posted my thought with running example at

if you are seasoned developer, Katalon brings some (quite lot) restrictions for you.
Now try to look al Katalon studio from QA whos is beginner in automation - we have recorder, spy web, objects are stored separately (1 st pattern - separate description of page from code) then you can create custom keywords (2nd pattern - separate business and page logic) - lot of useful stuff.
To usefulness of TO. In team where you expect to hand-over knowledge quite often, it’s good to have tool that contains page descriptions separately. If you put some effort to it, you can sort OR by pages and maintain order and reduce duplicates to minimum. Also have some naming convention in place is good idea so you can easily find and delete duplicates.
Of course all this is work above standard test development, but will pay-off in long-run where maintenance will take it’s toll.
But what i definitely agree with you, work with OR and TO is a bit lousy (still thinking what to do to improve that)
one thing what i’m missing is ability to create TO from WebElement