Forum Discussion
vijaydi
13 years agoContributor
Thank you tons McDonald. It worked for me :-)
Below is the code. Could you please look into it and provide your suggestions on if it could be written better. (I have also captured attributes searchname and matchscore which are also under the same xpath in different array variable----Question - is thr a way that we could capture it in a multi dimentional array instead of different arrays)
Also, could you suggest how to get the count of the array list.
Below is the code. Could you please look into it and provide your suggestions on if it could be written better. (I have also captured attributes searchname and matchscore which are also under the same xpath in different array variable----Question - is thr a way that we could capture it in a multi dimentional array instead of different arrays)
Also, could you suggest how to get the count of the array list.
def holder = grUtils.getXmlHolder("IDM_Modified#Response")
def indicators = []
holder.getDomNodes('//ns5:search-result').each {
indicators << it.getAttribute('match-indicator')
}
def searchname = []
holder.getDomNodes('//ns5:search-result').each {
searchname << it.getAttribute('search-name')
}
def matchscore = []
holder.getDomNodes('//ns5:search-result').each {
matchscore << it.getAttribute('match-score')
}
for (i in 0..22)
{
def output = "SR" + i
def searchresult = indicators[i] + "_" + searchname[i] + "_" + matchscore [i]
testRunner.testCase.getTestStepByName("DataSink").setPropertyValue(output, searchresult)
}