Advertisement
manojfdo

Untitled

Mar 4th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.59 KB | None | 0 0
  1. // helpers for JSON Parser
  2. import groovy.json.JsonSlurper;
  3.  
  4. // get the previous stepIndex by deducting 1 from the current step
  5. def previousStepInd = context.currentStepIndex - 1;
  6. // get previous test name
  7. def previousTestStepName = context.testCase.getTestStepAt(previousStepInd).name;
  8. // get previous test step response
  9. def responseBody = testRunner.testCase.testSteps[previousTestStepName].testRequest.response.contentAsString;
  10. def jsonBody = new JsonSlurper().parseText(responseBody)
  11.  
  12. testRunner.testCase.testSuite.setPropertyValue( "orderId", jsonBody.orderPlacementResponse.orderId );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement