cancel
Showing results for 
Search instead for 
Did you mean: 

Automated methods to compare responses from 2 endpoints

Highlighted
New Contributor

Automated methods to compare responses from 2 endpoints

I am performing data driven testing using groovy scripts by retrieving xml files stored in local drive and triggering requests to 2 end points. The responses from both the end points are collected and saved in local drive in xml formats.
Please help in writing a groovy script for file comparison - the existence of first node from xml1 has to be validated in Xml2. Likewise it has to pick all the nodes from xml1 and validate its existence in xml2. Since i am performing this for bulk data, want to get this done through automated methods.
4 REPLIES 4
Highlighted
New Contributor

Re: Automated methods to compare responses from 2 endpoints

Hi,

Can you share the project for what ever you have achieved till now ? even i am in search of a solution for this requirement.

Thanks
Sri - srirajms@gmail.com
Highlighted
New Contributor

Re: Automated methods to compare responses from 2 endpoints

Hi,

 

You can use below script to fetch files from a folder.

 

import java.io.File;
import java.util.Date;
import jxl.*;
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
import groovy.sql.Sql
def fileList = []
new File("path where u hv stored the files").eachFile{ f ->
if (f.isFile()&& f.name.contains('.xml'))
{
 def filename = f.name[0..-1]
 fileList.add(filename)
 log.info filename
}
}
if (fileList.size() <1)
{
testRunner.fail("No request files found")
}
context.put('fileList',fileList)

Highlighted
Community Hero

Re: Automated methods to compare responses from 2 endpoints

This is not the requirement of the original author of this topic.


Regards,
Rao.
Highlighted
Community Hero

Re: Automated methods to compare responses from 2 endpoints

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors