Forum Discussion

opaciga's avatar
opaciga
New Contributor
2 years ago
Solved

Get a list of all properties

I have a scenario where a test case loads a DataSource and uses testRunner.testCase.testSuite.setPropertyValue() in a Groovy script to pass values from the data to another test case. The code to do t...
  • groovyguy's avatar
    groovyguy
    2 years ago

    Not a problem, let me see what I can do to help! Give this a shot and let me know if it works. Will need to run the Data Source so it has data, of course.
     

    // This is highly dependent on where your DataSource lives. Assuming within the same Test Case.
    
    // Assuming Data Source name of DataSource.
    def DataSource = context.testCase.testSteps["DataSource"];
    
    DataSource.getProperties().each {
     // testRunner should work, but it might need to be context.testCase.testSuite
     testRunner.testCase.testSuite.setPropertyValue( it.key, context.expand( '${DataSource#'+it.key+'}' ))
    }

     

  • opaciga's avatar
    2 years ago

    Thanks, that worked like a charm! Exactly what I needed.