Handling static and dynamic Test Objects


This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/handling_static_dynamic_test_objects.html

Hi Team,

I would like to know one thing on Objects identification side.

I have added one object to repository once and after few days, developer changed DOM structure(lets assume) then, will katalon studio repository will automatically create new xpath and continue my test or it will fail due to object issue.

What I would like to know is , will Katalon create multiple xpaths for one HTML clode and store in repository or only one

I think Katalon may not to change your object repository with new xpath.
You should choose a permanent object or take it with their IDs

I usually use chropath as my tool for take object

Such automatism has never been there. I believe it will never be.

Most probably your test will fail.

If your test fails, it means you could detect that the DOM structure has been changed while you are not informed of. It will help you improve your tests.

Im gettinga typecast error when I have a method in the class that returns TestObject.

Error: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘common.AppObjects$__clinit__closure1@3d49fd31’ with class ‘common.AppObjects$__clinit__closure1’ to class ‘com.kms.katalon.core.testobject.TestObject’

My keyword looks like this

public class AppObjects {

@Keyword
def static TestObject GetBookAppointmentCheckBox = {
	TestObject to = new TestObject()
	to.addProperty("id", ConditionType.EQUALS, "chk_hospotal_readmission")
	return to
}

}

I call the object from test script like this : WebUI.click(AppObjects.GetBookAppointmentCheckBox())

wrong:

right:

GetBookAppointmentCheckBox() {

even better:

getBookAppointmentCheckBox() {