Forum Discussion
VLiljeb_ck
12 years agoOccasional Contributor
I still can't get part of a node response through xpath assertion. I use the xpath assertion method for my othere testcases where I want to assert the whole node and it works perfectly! But in this case I do not want to assert the whole node but only part of the node... I still do not get how this can be solved by xpath...
But I have created a groovy script that solves the issue, the groovy script below collects the JDBC response and then split the response to collect only the number of interest from the response. The number is then transferred into a property. And then I use the property in a contains assertion for the SOAP response. Maybe not the best solution but it works
But I have created a groovy script that solves the issue, the groovy script below collects the JDBC response and then split the response to collect only the number of interest from the response. The number is then transferred into a property. And then I use the property in a contains assertion for the SOAP response. Maybe not the best solution but it works

def responseAsXml = context.expand( '${GetJDBCresponse#ResponseAsXml#//Results[1]/ResultSet[1]/Row[1]/STATUSTEXT[1]}' )
def onlynumber = responseAsXml.split(" ")
testRunner.testCase.getTestStepByName("Properties").setPropertyValue("value", onlynumber[20])