Forum Discussion
resmis19
13 years agoOccasional Contributor
I have a query here.
I'm trying to read from an external xml file.
-<Currencies>
<Currency1>AUD</Currency1>
<Currency2>AWG</Currency2>
</Currencies
I can read the nodes one by one and put it in the properties file.
String s1= new File("${url}").text
def holder = groovyUtils.getXmlHolder(s1);
def C1 = holder.getNodeValue("//Currency1")
propTestStep = context.testCase.getTestStepByName("Pro")
propTestStep.setPropertyValue("Currency1", C1)
def C2 = holder.getNodeValue("//Currency2")
propTestStep = context.testCase.getTestStepByName("Pro")
propTestStep.setPropertyValue("Currency2", C2)
but I instead of this,i want to find the count and then loop using for loop.
I tried like this: def nodeCount = holder.getNodeValues
But did not return anything.
any help is appreciated.
I'm trying to read from an external xml file.
-<Currencies>
<Currency1>AUD</Currency1>
<Currency2>AWG</Currency2>
</Currencies
I can read the nodes one by one and put it in the properties file.
String s1= new File("${url}").text
def holder = groovyUtils.getXmlHolder(s1);
def C1 = holder.getNodeValue("//Currency1")
propTestStep = context.testCase.getTestStepByName("Pro")
propTestStep.setPropertyValue("Currency1", C1)
def C2 = holder.getNodeValue("//Currency2")
propTestStep = context.testCase.getTestStepByName("Pro")
propTestStep.setPropertyValue("Currency2", C2)
but I instead of this,i want to find the count and then loop using for loop.
I tried like this: def nodeCount = holder.getNodeValues
But did not return anything.
any help is appreciated.