Need help in groovy script to fetch proper response.
I need help in below issue.
I have 2 attributes in request orderComponentId and orderDataType.
orderDataType can take 2 values (TTTN and PORT) and orderComponentId can take any value.
I have 2 path where response is stored in XML. This response name will be same as orderComponentId value
path1= groovyUtils.projectPath+"/MOCK/CSI/IETN/
path2= groovyUtils.projectPath+"/MOCK/CSI/IETN/PORTEDTN/
Now based on orderDataType value i.e TTTN or PORT, I need to fetch response from path1 or path2 and if not present throw a fault message as No data found
If orderDataType is TTTN, then fetch response from path1 and if orderDataType is PORT, fetch response from path2
I am trying with below script and always i get fault message
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def holder = groovyUtils.getXmlHolder(mockRequest.requestContent)
def soNumber = holder.getNodeValue("//*:InquireEnterpriseTNOrderDataRequest/*:orderComponentId")
def orderType = holder.getNodeValue("//*:InquireEnterpriseTNOrderDataRequest/*:orderDataType")
def file = new File (groovyUtils.projectPath+"/MOCK/CSI/IETN/${soNumber}.xml")
def file1 = new File (groovyUtils.projectPath+"/MOCK/CSI/IETN/PORTEDTN/${soNumber}.xml")
def fileToLoad = 'soapFault'
if (orderType == "TTTN" and file.exists ) {
fileToLoad = soNumber
context.content = groovy.xml.XmlUtil.serialize(new XmlParser().parse(groovyUtils.projectPath+"/MOCK/CSI/IETN/${fileToLoad}.xml"))
}
else if (orderType == "PORT" and file1.exists ) {
fileToLoad = soNumber
context.content = groovy.xml.XmlUtil.serialize(new XmlParser().parse(groovyUtils.projectPath+"/MOCK/CSI/IETN/PORTEDTN/${fileToLoad}.xml"))
}
The link below might help and describes some coverage JQL queries you can run but I *think* it only works on the Server version of Zephyr Scale, and looking at the report you mention in your post I think you're not on the Cloud version. Hope that helps but let me know if not?
Advanced Search With JQL Functions | Zephyr Scale Server/Data Center Documentation (smartbear.com)