Forum Discussion
Hi AAB ,
I think in this case, Property Transfer can't handle the thing but you can handle this by writing bit of groovy code.
Check whether this(//ns3:cbeEntityReply[1]/ns3:ReplyData[1]/ns3:Entity[1]/ns4:Enterprise[1]/ns4:Type[1]) exists or not see below code:
tag1 = "//ns3:cbeEntityReply[1]/ns3:ReplyData[1]/ns3:Entity[1]/ns4:Enterprise[1]/ns4:Type[1]" if(tag1 == null){ //write your code where you want } else{ //write your code to store tag2 where you want }
Let me know if you need more help :)
Hello Himanshu,
Thanks for your response. I'm newbee in Groovy and junior in ReadyAPI (well advanced junior already :-) ) so yes, a little more help would be welcome!
I've set up comparision testcases in ReadyAPI to compare 2 responses from 2 different environments. The response will be stashed in a textfile for each, so the comparision code is more 'easy'.
Apparently you understood my setup correctly, but I've read in another question that Rao said that property transfer step would be obsolete by using groovy.
As my set up works perfectly except for this one thing, I would like to hold it. so can I add this groovyscript just for this one item? All the other properties are written correctly in the textfile. It's just for BusinessUnit that it doesn't work.
Some questions:
1) is my groovyscript on the right place for this?
2) don't I need to import some packages?
3) The codesnippets that I tried to merge doesn't work. Not abnormal as I'm just trying but I don't know the groovy language yet.... could you help me please?
import groovy.json.JsonSlurper
tag1 = "//ns3:cbeEntityReply[1]/ns3:ReplyData[1]/ns3:Entity[1]/ns4:Enterprise" if(tag1 == null){ //get propertyTransfer value def tsProperty = messageExchange.modelItem.testStep.testCase.getTestStepByName("Property Transfer - SOAPresponse to DSink1").getPropertyValue("TypeEnterprise") // get response message def responseMessage = messageExchange.response.responseContent // get source property Type def jsonSlurper = new JsonSlurper().parseText(responseMessage) enterpriseType = jsonSlurper.TypeEnterprise def targetProperty = testRunner.testCase.testStep.setPropertyValue(enterpriseType, "N/A") } else{ testRunner.testCase.testStep.setPropertyValue("Type") }
Thanks in advance,
Kind regards,
AboveAndBeyond