Can you refer in groovy to the last executed teststep?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you refer in groovy to the last executed teststep?
Is it possible to just refer to the last executed teststep in groovy script?
Now I save the response of an jdbc request by calling it by naming in groovy script. But I want my script just to save the result of the last executed test step.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a testcase with 2 teststeps.
First teststep is a SOAP requests that gives an XML response.
Second teststep is groovy script that will save the XML response.
Groovy script:
def date = new Date()
def dts = date.format("yyyy-MM-dd-HH-mm-ss")
//Write Request to XML File
def myXmlRequest = "C:/Data/Request"+dts+".xml"
def request = context.expand('${SOAP Request}')
def req = new File(myXmlRequest)
req.write(request, "UTF-8")
Is there anyway that you can say in groovy just save the result for the last executed teststep instead of now using context.expand('${SOAP Request}')
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not without tapping into the ReadyAPI and somehow figuring out with your own logic what test was last executed. If ReadyAPI even presents that information. I would probably just hard code the test names or figure out a way for each test step to store it's name in a property.
That way, any time a test runs, it overwrites that property with its own name. That might work.
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
