Testobjects inside custom keywords are logged as ' ' in test reports

Hi,

Im using testobjects for performing any actions inside my custom keywords plugins and in test reports it is getting logged as:
object ’ ’ is visible like this:

image

Could you please help here?

Regards
Soumya

@devalex88 @kazurayam Please check this.

Is it object from Object repository or manually created TestObject’s instance?

Manual…I have used it inside groovy file only.
as the custom keyword is used as a plugin, as we can create plugin for object repository so I had to create objects in groovy file only.

And did you set its name in constructor? Otherwise, object name is null (blank).

TestObject to = new TestObject("myObjectName")

1 Like

I have done it like this:

  def getTestObject(String locators, String attribute) {
	TestObject to = new TestObject()
	to.addProperty ( attribute, ConditionType.EQUALS, locators,  true)
	return to;
}

and created objects like this:
String close_btn_xpath = “//button[(normalize-space(text()) = ‘Close’)]”
TestObject close_btn = getTestObject (close_btn_xpath , ‘xpath’)

Should I change it to this?

def getTestObject(String locators, String attribute) {
TestObject to = new TestObject(locators)
to.addProperty ( attribute, ConditionType.EQUALS, locators, true)
return to;
}

Yes, this way it should work.

Thank you @Marek_Melocik. It worked like that.

Another issue that Im facing here is, if I use takeScreenshot keyword inside my custom keyword, it is logged in my JUnit_Report.xml like this:

where as if I use takeScreenshot keyword in my test case, it will be logged in JUnit_Report.xml like this:

While using inside custom keyword, ‘takeScreenshot(): Taking screenshot successfully’ this is not logged.

Is there any way I can fix this?