Forum Discussion

roryLIT's avatar
roryLIT
Contributor
12 years ago

[Resolved] Loop through custom properties at testsuite level

Instead of accessing an external text file and reading through the values line by line is it possible to do this for custom property values at the testsuite level using groovy?? I would import the text file into the properties and then I want to read the values and output each one

2 Replies

  • PaulDonny's avatar
    PaulDonny
    Regular Contributor
    Hi Rory,

    I made an example script that will show some of the different things you can do with the properties and how you can implement this. My script is essentially useless for anything other than demonstration purposes as it just replaces the property value with the previous one.


    def testSuiteProperties = testRunner.testCase.testSuite.getPropertyList() ;
    def newPropValue = "Testing";
    for(tsProperty in testSuiteProperties ) {
    log.info "Showing the Name: "+tsProperty.getName();
    log.info "Showing the Value: "+tsProperty.getValue();
    tempPropValue = tsProperty.getValue();
    tsProperty.setValue(newPropValue);
    newPropValue = tempPropValue;
    }
  • Hi Paul,

    That's perfect for what I'm looking to do! Thanks