Groovy test step result as testSuite level property
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2017
02:13 PM
07-24-2017
02:13 PM
Groovy test step result as testSuite level property
I want my groovy test step result to be passed in all other test cases and do not want to add this step in all other test cases, can i make it as testSuite level property and pass it in all other test cases?
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2017
02:19 PM
07-24-2017
02:19 PM
You can use the following property expansion to set a Project level property:
def result = "Whatever your groovy script result is."; context.testCase.testSuite.project.setPropertyValue("PropertyName", result);
---
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
07-24-2017
02:47 PM
07-24-2017
02:47 PM
It did not pass the groovy step result . following is my groovy script and attached is the how i am making it as testSuite custom property. i am doing wrong anywhere?
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) def today = new Date() def laterDate = today + 2 def dda = laterDate.format("yyyy-MM-dd") log.info dda def result = dda context.testCase.testSuite.project.setPropertyValue("PropertyName", result);
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2017
05:13 PM
07-24-2017
05:13 PM
I apologize, I misread your post and thought you wanted it at the project level, not the test suite level. Here's a better version for the script you provided.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) def today = new Date() def laterDate = today + 2 def dda = laterDate.format("yyyy-MM-dd") log.info dda def result = dda context.testCase.testSuite.setPropertyValue("PropertyName", result);
There's a lot of documentation on Property Expansion here.
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
