Forum Discussion
Aaronliu
13 years agoFrequent Contributor
Sure. you should use "//" in root node.
if you would like to use groovy script to set an attribute in custom property. that's no problem to do that. here is a simple example:
#1:(need to create a script step. note: the script cannot be run directly, if you define testrunner in test suite or test case level, you should run it in test suite or test case respectively)
Or
#2:
thanks,
Aaron
if you would like to use groovy script to set an attribute in custom property. that's no problem to do that. here is a simple example:
#1:(need to create a script step. note: the script cannot be run directly, if you define testrunner in test suite or test case level, you should run it in test suite or test case respectively)
import com.eviware.soapui.support.XmlHolder
def ts = context.getProperty("#TestSuiteRunner#").currentTestCase.testSuite
def xmlHolder = new XmlHolder(context.expand ('${StepName#Response}')) //populate your test name
xmlHolder.namespaces['ns1'] = 'http://.............................'
def node = xmlHolder.getNodeValue("XPath expression") //just like you used in xpath assertion
ts.setPropertyVaule("node") //set the value in custom properties of test suite level
Or
#2:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def ts = testRunner.testCase.testSuite
def xmlHolder = groovyUtils.getXmlHolder ("StepName#Response") //populate your step name
xmlHolder.namespaces['ns1'] = 'http://.............................'
def node = xmlHolder.getNodeValue("XPath expression") //just like you used in xpath assertion
ts.setPropertyVaule("node") //set the value in custom properties of test suite level
thanks,
Aaron
Related Content
- 5 years ago
- 6 years ago
- 2 years ago
Recent Discussions
- 6 days ago
- 10 days ago