Hi All,
I have been trying to find different ways to verify the values, text in an application. I came up with the belong method that I use frequently to verify whatever I want. I want to know if there is a better way in verify values using two lists.
Code:
Basically I am passing two lists as arguments and verifying if the lists are same. Sometimes using contains if all the values should contain a single text
@Keyword
def static verifyValuesAreMatchingWithExpected(eleText,textValues,xpath) {
try {
KeywordUtil.markPassed(assertEquals(eleText, textValues))
}catch(AssertionError e) {
try {
for(vl in textValues) {
KeywordUtil.markPassed(assertTrue(eleText.contains(vl)))
}
}catch(AssertionError x) {
TestObject to = new TestObject("objectName")
to.addProperty("xpath", ConditionType.EQUALS, xpath)
def text=WebUI.getText(to)
try {
KeywordUtil.markPassed(assertTrue(text.contains(textValues)))
}
catch(Exception y) {
for(vl in textValues) {
KeywordUtil.markPassed(assertTrue(text.contains(vl)))
}
}
}
}
}
@kazurayam @Katalon_team @Brandon_Hein @Marek_Melocik @Russ_Thomas
Please I need your help guys with suggestions to improve my code