Forum Discussion

Holly_Greger's avatar
Holly_Greger
Contributor
15 years ago

Add properties to a project using a script?

Hello,

Is there any way to dynamically add properties to a project. I know how to get the value of a property if it already exist but how could i create a new property and assign it a value using a groovy script at a project level?

2 Replies

  • Hello,

    Sure, this can be done. The setPropertyValue method will create the Property first, if it doesn't already exist:


    testRunner.testCase.testSuite.project.setPropertyValue( "MyNewProperty", "value" )


    Regards,
    Dain
    eviware.com
  • Oh wow, i looked at that method call in the API 1000 times and never thought it would create the property if it didn't exist. No documentation. Thank you so much, this is just what i needed.