Adjust your test case using conversion script to convert XML to JSON. Below is sample script where ‘xmlJSONObj.toString(textIndent)’ is the final result after conversion.
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.json.JSONObject as JSONObject
import org.json.XML as XML
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
But when I tried to verify Converted response with database, I am getting following Error.Please give me some suggestion on this problem.
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords.verifyElementPropertyValue() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.String) values.
In the above method converted response is storing in ‘’ xmlJSONObj.toString(textIndent)’. and I am assigning that into a variable of the type Object called response and using it for verification as below.
This is the code snippet i am using for verification.
where response will contain the response in xml format.****** will be the value fetched from database.and the ‘datalist.data[0].id’ is the xml path of a id from the response.
Error message is:
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to verify element property value (Root cause: com.kms.katalon.core.exception.StepFailedException: Expected element property value ‘*****’ is not equal with actual property value ’ ')
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:36)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:56)
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords.verifyElementPropertyValue() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.String) values.
There is no real benefit to convert the XML response in Json.
Just extract whatever you need from it using XMLSlurper (or Parser), see: http://groovy-lang.org/processing-xml.html