Forum Discussion
- M_McDonaldSuper Contributor1) Use the Groovy utilities to get the node values into 2 lists.
2) Sort one of the lists.
3) Assert that the 2 lists are equal. - mlenosgrandeContributorFirst thanks for your reply.
I solved it finally more quickly.
Here my solution without 2 lists. Hope it will help others:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
// create holder for last response
def holder = groovyUtils.getXmlHolder( "yourtest step name HERE#Response" )
String [] tab =holder.getNodeValues( "//*:categorie");
for(int i=0;i<tab.length-1;i++){
//verify that the actual is lower or equal than the next one
assert (tab[i].compareToIgnoreCase(tab[i+1])<=0)
} - M_McDonaldSuper ContributorYes that is more efficient. I preferred not to worry about an index:
def holder = gu.getXmlHolder("yourtest step name HERE#Response")
def orderedValues = holder.getNodeValues("//*:categorie")
if (orderedValues.size() > 1) {
orderedValues.sort()
def unorderedValues = holder.getNodeValues("//*:categorie")
assert unorderedValues == orderedValues
}
Yours is better also if you need to point out exactly where the difference starts.