WS.verifyElementPropertyValue - Casesensitive

I have been trying to write a test case to verify whether the response contains firstName matching the test data and i see WS. verifyElementPropertyValue is case sensitive. it doesnt allow me to compare with ignore cases on the response.

Service could respond the firstName either upper case or lower case or combination of either. how can i write a test case and feed the data to match this creteria?

WS. verifyElementPropertyValue (response, ‘Response.details.User.Profile.firstName’, firstName)
Response.details.User.Profile.firstName is locator, how can i get this value and compare without any case consideration?

1 Like

Hello,

there is a method str1.equalsIgnoreCase(str2) which may be suitable for you. But you have to change your code a little bit. Look at my POC code:

RequestObject ro = new RestRequestObjectBuilder()
				.withRestUrl("https://jsonplaceholder.typicode.com/users")
				.withRestRequestMethod("GET")
				.build()

ResponseObject resp = WS.sendRequest(ro)
def parsedResp = new JsonSlurper().parseText(resp.getResponseText())

String getProperty = parsedResp.name[0]
String caseInsensitiveProperty = "leAnNE grAHaM"
assert getProperty.equalsIgnoreCase(caseInsensitiveProperty)

Just change your variables and it should work.

1 Like

thank you for the response. However, It would be great if you redirect the documentation on these? i do not see any deep documentation around service API testing.
What is the package for RequestObject, ResponseObject? how do i use variables in RestRequestObjectBuilder to pass parameters if any? how do I append request body if its post?

All API docs regarding Response and RequestObject as well as RequestBuilder are available here - https://api-docs.katalon.com/com/kms/katalon/core/testobject/package-summary.html

You can find also other useful methods there.

1 Like