nkuno
8 years agoNew Contributor
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 this.
I tried online every article says on set and get property in groovy,but i need to create a property in groovy.
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")
- If you need a property available across all test steps in a test case, store it at that test case level.