Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
16 years ago

iterating through the items in properties test step

I have a properties test step with variable number of items.
How can I write a for loop that outputs the 'name' and the 'value' for each of the entries in the properties value.

so something like

for ( i = 0; i < num of items in properties step; i ++)
{
    log.info ( item.name)
    log.info (item.value
}

Thanks

Ali

3 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Ali,

    try

    def propertiesStep = ..

    for( prop in propertyNames )
    {
        log.info( prop + " = " + propertiesStep[prop].value )
    }


    regards!

    /Ole
    eviware.com
  • alibaba82's avatar
    alibaba82
    Super Contributor
    I tried
    def propertiesStep  = testRunner.testCase.getTestStepByName("Results");
    for( prop in propertiesStep  )
    {
        log.info( prop + "=" + propertiesStep [prop].value )
    }

    but am getting this error.

    Wed Dec 17 09:05:18 PST 2008:ERROR:An error occured [No signature of method: com.eviware.soapui.impl.wsdl.teststeps.WsdlPropertiesTestStep.plus() is applicable for argument types: (java.lang.String) values: {"="}], see error log for details
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    sorry, please try

    def propertiesStep  = testRunner.testCase.getTestStepByName("Results")
    for( prop in propertiesStep.propertyNames  )
    {
        log.info( prop + "=" + propertiesStep.properties[prop].value )
    }

    instead!

    regards,

    /Ole
    eviware.com