Forum Discussion

SanthoshShetty's avatar
SanthoshShetty
Occasional Contributor
7 years ago

How to Read Project Properties from Groovy script?

Hi,

 

We have a requirement to read the Project level properties in a Groovy script configured in BeforeTestCaseEvent handler. Can some one please help me on reading it.

 

Am able to read the custom properties with the below command 

 

testCase.testSuite.project.getPropertyValue("property") 

 

but not able to read the Project properties using it.

 

Thanks.

  • Luffy's avatar
    Luffy
    Occasional Contributor

    This might work:

     

    testRunner.testCase.testSuite.project.setPropertyValue( "MyProp", "test" )
    def projectProperty = testRunner.testCase.testSuite.project.getPropertyValue( "MyProp" )
    log.info projectProperty