Forum Discussion

webserviceAutom's avatar
webserviceAutom
Occasional Contributor
12 years ago

JDBC test step assertion gives NULL output

Hi,

I have a JDBC test step and I created a script assertion to store the response into properties test step.

Everytime I run the script assertion I get an error pop up with "null" message ( see attached screen shot)

Even though I get null message the response is stored into properties test step successfully.

Any idea why I am getting error pop up with "null" message.


Script Assertion below:
If I remove the text in red, then the error pop up with "null" message goes away, is there any other way of storing response into a properties test step?
====================================================================

import com.eviware.soapui.support.XmlHolder

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "RetrieveBatchNumber#ResponseAsXml" )

def myProps = new java.util.Properties();
def testCase = messageExchange.modelItem.testCase
myProps = testCase.getTestStepByName("BatchNumber");



// loop item nodes in response message and store actual record values
for( item in holder.getDomNodes( "//Row" )){

def batchNum= groovy.xml.dom.DOMCategory.xpath(item, "//BATCH.BATCH_NUM")
def rcdDate= groovy.xml.dom.DOMCategory.xpath(item, "//BATCH.RCD_DATE")

myProps.setPropertyValue("expectedBatchNum",batchNum)
myProps.setPropertyValue("expectedDate",rcdDate)

}

4 Replies

  • I believe you have the following defined incorrectly: messageExchange.modelItem.testCase
    try: messageExchange.modelItem.testStep.testCase

    Thanks,
    Michael Giller
    SmartBear Software
  • webserviceAutom's avatar
    webserviceAutom
    Occasional Contributor
    Hi,

    I tried following but still getting null error pop up on running the script assertion :-(

    def myProps = new java.util.Properties();
    def testCase = messageExchange.modelItem.testStep.testCase
    myProps = testCase.getTestStepByName("BatchNum");