17 years ago
Multiple property values to loop thru for same request
Hey! I'm writing some SoapUI tests and I want to have many property values put into my soap request and tested one after the other, from a file called basic.properties. I'd appreciate any input on how you do this, probably GroovyScript I think.
(I used the little snippet of Groovyscript from the tutorial page, but short of a .getProperties(name) feature, my script obviously won't help- plus how do you store multiple values in the file). Thanks!
def properties = new java.util.Properties();
properties.load( new java.io.FileInputStream("c:/root/SoapUI/trunk/basic.properties"));
def targetStep = testRunner.testCase.getTestStepByName("Basic Properties");
def names = properties.propertyNames();
while (names.hasMoreElements())
{
def name = names.nextElement();
// .getProperty unfortunately only returns one value of course...
targetStep.setPropertyValue(name, properties.getProperty(name));
log.info(properties.getProperty(name));
}
(I used the little snippet of Groovyscript from the tutorial page, but short of a .getProperties(name) feature, my script obviously won't help- plus how do you store multiple values in the file). Thanks!
def properties = new java.util.Properties();
properties.load( new java.io.FileInputStream("c:/root/SoapUI/trunk/basic.properties"));
def targetStep = testRunner.testCase.getTestStepByName("Basic Properties");
def names = properties.propertyNames();
while (names.hasMoreElements())
{
def name = names.nextElement();
// .getProperty unfortunately only returns one value of course...
targetStep.setPropertyValue(name, properties.getProperty(name));
log.info(properties.getProperty(name));
}