@Usha_J, was your issue resolved. bumping into the same thing and I can’t wrap my head around it. Tried the above with both css and xpath and I’m running into an unresolved variable each time.
If you’re still having issues, could you please restate the problem you’re trying to solve and share what you’ve tried? There was a lot of back and forth previously and it got a bit confusing.
What I am doing now as a workaround is basically overriding the method.
There’s a TestObjectSupport class with static methods. One of them resolves a variable (no nested values, just plain simple) I must admin I did not try it again. I’m working on the project again now, so I’ll get back to it. THanks for the mail follow-up by the way!
As for the code: instead of using the piece above I did:
/**
* (!) Nested varriables / properties are not supported. It may work in some occasions, but it should not be done.
* @param to -- TestObject, the test object to modify
* @param props -- Map<String, String>, set of properties.
* Key is property name, value is the value it will be replaced with.
* --> The properties are replaced when they are marked like "${propertyHere}".
*
* @return TestObject - The modified TestObject object
*/
public static TestObject resolveActivePathForTestObject(TestObject testObject, Map<String, String> props) {
String resolvedSelector = getActiveSelectorString(testObject)
props.each {key, value ->
resolvedSelector = resolvedSelector.replaceAll('\\$\\{' + key + '\\}', value)
}
testObject.setSelectorValue(testObject.getSelectorMethod(), resolvedSelector)
return testObject
}
Using the builltin method would be the way to go of course… But again, did not try it since I just started out with POC-ing Katalon.
In WebUI, trying to use a variable in object properties just as Testernik_Testowy was trying to do in Mobile.
Basically, for WebUI trying to reproduce this Mobile code from Testernik_Testowy on Jun '18 above;
Mobile.selectListItemByLabel(findTestObject(‘TEST1/LIST_SELECTION’), randomNumber, 10)
Here are some Katalon docs on how to parameterize a test object. It’s a mix of the Manual and Script views, but it’s pretty good at walking you through it. Please let me know if you need some additional info:
In your script, could you try changing the AuditDate variable to the text you want to use, 10 - October - 2019? This could help narrow down if it’s a problem getting the variable into the script or whether it’s a problem getting the parameter into the test object.
So it would look like:
Mobile.verifyElementExist(findTestObject('Roles/Role_Audit/Audit_Date', [('text') : '10 - October - 2019']), 0)
@pgonzalez as far as i remember, for the rest-api objects, when you do data binding from the tescase (call the object with parameters) you have to pass all parameters declared in object variable tab with a certain value.
otherwise the ones not binded will be ‘emptied’ even it in the object repository they have a value (which imho should be treated as a default)
i think there is a bug report opened on this matter.
could be the case that web objects behave the same …
Glad it’s working when passing in the value directly.
The next thing to check is if your test script is pulling in the variable correctly. If you’re using Test Case Variables, then you’ll need to wrap the variable in ${} when you use it in your script:
I noticed from your last screenshots that the “Audit_Date” Test Object doesn’t have any of the “Detect object by” checkboxes selected. If you’re running your test that way, can you try selecting the class property as a minimum?