get teststep name/label
Hi.
Im pretty new to this, so i need to ask. Have googled alot, but no answer.
Problem:
"Save/export request and response as file into folder"
I have a groove script i found via google search, that provide me with the correct setup. But it saves the files with the testCase name, and not the testStep name.
I was wondering if there are some way to get testStep name.
------------ My current script ---------------
String tcName = testRunner.testCase.getName()
File req = new File("filePath" + tcName + "_request.xml")
File res = new File("filePath" + tcName + "_response.xml")
req.write context.expand('${"RequestName"#Request}')
res.write context.expand('${"ResponseName"#Response}')
------------------------------
This saves files in folder as "tcName_request.xml" and "tcName_response.xml" , but would like to have them as "testStepName_request.xml" and "testStepName_response.xml"
Hi Kimdongart1 ,
See my reply in recent topic https://community.smartbear.com/t5/ReadyAPI-Questions/Get-test-step-name-via-property-expansion-in-groovy-step/m-p/244399#M57574
To get a test step name you could just type "testRunner.testCase.getTestStep" followed by a "Ctrl+space" to see the autocomplete options:
So:
String testStepNameStep1 = testRunner.testCase.getTestStepAt(0).getName()
File req = new File("filePath" + testStepNameStep1 + "_request.xml")
File res = new File("filePath" + testStepNameStep1 + "_response.xml")