How to create a property using groovy script???
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Anyways you can use set to create new properties
def testCaseProperty = testRunner.testCase.setPropertyValue("myTest", "blah")
You like the reply. How to give a Kudos / Accept as solution?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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")
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
https://stackoverflow.com/questions/45840933/how-to-create-a-property-using-groovy-script
Here is the appeal to the author. Please be patient while posting the questions with sample reproducible data, context and clear details so that external people can understand what exact the issue being faced. The time spent explain this not only helps you, but also to the people who willing to help others. Better the question, better the answer.
Not sure where you searched online for the same, please refer below link which has more frequently used code snippets and I believe that is helpful to get started.
https://www.soapui.org/scripting-properties/tips-tricks.html
Thank you for the understanding and your cooperation.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's the person's first post I would cut him some slack and just give the answer
