How to pass result from groovy script to Request body Parameter and Request header ?
- 4 years ago
Hello ,
I tried with below option
testRunner.testCase.testSteps['Properties'].setPropertyValue("Date", Date.toString());
testRunner.testCase.testSteps['Properties'].setPropertyValue("Timestamp", Timestamp.toString());
.
Then I tried some exploration on how to setproperty on test cases level and tried below solution
String timestamp=new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC"))
testRunner.testCase.setPropertyValue( "TimeStamp", timestamp )
log.info(timestamp);String date = new Date().format("yyyy-MM-dd")
testRunner.testCase.setPropertyValue( "Date", date )
log.info(date);I retrieve value from test case properties using "Get Data" and used in Request body and request Header Parameter and it worked!
Thank you for your reply. I got lead to search in right direction!
Thanks,
Neha