how to handle case sensitive data while automating a service


#1

In my scenario i am getting value from service in different ways like once all text in small once in capital and once partially capital.
Below values come for same element when service is called.
Can some one suggest how to handle?

EX:
sales representative
Sales Representative
SALES REPRESENTATIVE


#2

Hello,

you can convert the response to lower/upper case and compare it this way.

String responseString = "Sales Representative"
String expectedString = "sales representative"

if(responseString.toLowerCase() == expectedString) {
    KeywordUtil.markPassed("Response is correct")
} else {
    KeywordUtil.markFailed("Response is not correct")
}

#3

HI Melocik,
We are not able to get the particular text into the string variable as katalon tool(5.7) which we use does not support getResponseText() method.
As of now we are verifying the element text by.
WS.verifyElementPropertyValue(Response, ‘data.associatedContacts[0].role’, ‘SALES REPRESENTATIVE’,
FailureHandling.CONTINUE_ON_FAILURE)
In this case how can we validate?


#4

Did you try

ResponseObject resp = new ResponseObject('{"blah":"blahblah"}')
println resp.getResponseBodyContent()

By the way, getResponseText() works as well in latest Katalon release (6.1)