Showing results for 
Search instead for 
Did you mean: 

SOAP UI 5.0-groovy Automation

Occasional Contributor

Re: SOAP UI 5.0-groovy Automation

We have a separate mapping document an excel sheet.. we will see that compare
Community Hero

Re: SOAP UI 5.0-groovy Automation

You can create that mapping from excel sheet into groovy if needed.

Community Hero

Re: SOAP UI 5.0-groovy Automation

First I request you to try the script with fixed data, then with your responses.

Occasional Contributor

Re: SOAP UI 5.0-groovy Automation

@nmrao  your code is Perfect 200%


I wanted to know this how to fetch nodeNames and parentNodeName if you are given with the nodeValue..

for eg.






Now I have only number 123 and hifiCity (values) with this can I fetch back nodeName and ParentNodeName?


Frequent Contributor

Re: SOAP UI 5.0-groovy Automation

It seems you are well on the way to completing this but missing the final step, which should not be dissimilar to the regular approach to data driven testing.  However instead of loading expected values I would load a set a of mappings/bindings.  I would define a properties file that maps one set of names to the other, so taking your table, its contents would something like:  PrimarySourceName = SecondarySourceName.  Then Get the values from each source and use the mapping to get the values for comparison. file

Placed in the same directory as your project.


Load the Properties



// location of mapping properties is relative to SOAPUI project file.
def groovyUtils = new GroovyUtils( context )
String mappingFile = groovyUtils.projectPath + "/"

// load the properties
Properties properties = new Properties()
File propertiesFile = new File(mappingFile)
propertiesFile.withInputStream {


Assuming REST requests are made in previous steps, the responses are retrived

def sourceOneResponse = new XmlSlurper().parseText(requestOne.response)
def sourceTwoResponse = new XmlSlurper().parseText(requestTwo.response)


Then loop through the entries and compare values of each


for (property in properties) {
	sourceOneName =	
	sourceOneValue = sourceOneResponse.getNodeValue(sourceOneName)
	sourceTwoName = property.value
	sourceTwoValue = sourceTwoResponse.getNodeValue(sourceTwoName)
	assert sourceOneValue == sourceTwoValue : "${sourceOneName} : ${sourceOneValue} is not equal to ${sourceTwoName} : ${sourceTwoValue}"