Forum Discussion

nkuno's avatar
nkuno
New Contributor
7 years ago
Solved

How to create a property using groovy script???

Hi Team,   In my automation script i am in need to create a property and store the value dynamically ,so that the value stored is used in upcoming steps for further process,Could anyone help in thi...
  • groovyguy's avatar
    groovyguy
    7 years ago

    Building on sanj's reply, depending on how you need to access the property there may be a few considerations you need to make.

     

    • If you need a property available across all test steps in a test case, store it at that test case level.
      • def testCaseProperty = testRunner.testCase.setPropertyValue("myTest", "blah")
      • (as provided by sanj)
    • If you need a property available across all test cases in a test suite, store it at the test suite level.
      • def testSuiteProperty = testRunner.testCase.testSuite.setPropertyValue("myTest", "blah")
    • If you need a property available across all test suites in a project, store it at the project level.
      • def projectProperty = testRunner.testCase.testSuite.project.setPropertyValue("myTest", "blah")