Forum Discussion
3 Replies
- nmraoChampion Level 3Can you elaborate your use case?
- InekeBauwOccasional Contributor
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}')
- groovyguyCommunity Hero
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.