Forum Discussion
Instead of using ${DataSource#isCompliant}, have you tried using:
testRunner.testCase.getTestStepByName("Name of your datasource").getPropertyValue("isCompliant")
I use this in my Groovy scripts and it works great
Hi Justin,
Thanks a lot for the advice, I gave it a try and I have 2 questions please
Here's my code
----------------------------
import com.eviware.soapui.support.XmlHolder
def holder = new XmlHolder( messageExchange.responseContentAsXml )
holder.namespaces["NDW"] = "http://..."
holder.namespaces["NDS"] = "http://..."
def node = holder.getDomNode( "//NDW:mu14Response[1]/NDW:QualityGuidelineList[1]/NDS:QualityGuideline[1]/NDS:sourceAssertedID[1]" ) // check if eligible
def resp_compliance = holder.getNodeValue( "//NDW:mu14Response[1]/NDW:QualityGuidelineList[1]/NDS:QualityGuideline[1]/NDS:isCompliant[1]" ) // get isCompliant true or false in the response
def datasource_compliance = testRunner.testCase.getTestStepByName("DataSource").getPropertyValue("isCompliant") // get isCompliant true or false from the data source
if (node != null) // if eligible, the node exists
{ if (comp == compliance) // if isCompliant in response is the same as in the data source
{ log.info "pass"}
else (log.info "fail")
}
1) It didn't recognize Porperty "isCompliant" in data source, so for
def datasource_compliance = testRunner.testCase.getTestStepByName("DataSource").getPropertyValue("isCompliant")
do I need to give the project name, test case name or test step name as well please?
2) "if" works, but "if ... else..." doesn't, does it suport if else or is my syntax wrong please?
Thanks again for help and have a wonderful Happy New Year!
Jerry