Forum Discussion

SoapQA's avatar
SoapQA
New Contributor
9 years ago
Solved

Json response in groovy script returns nothing when using testrunner.bat DOS command.

Using Windows 7 with Soap 5.2.0 freeware (open source). I have a rest project that has one test suite with one test case containing two test steps. The first step is a groovy step that calls the ...
  • SoapQA's avatar
    9 years ago

    I found the solution for this in Stack Overfloe - thanks to RAO. The suggested links weren't related to this problem.

     

    When running through DOS, I did this in the groovy script per RAO's suggestion.

     

    // setup stepName as variable for name of test step to run.
    def stepName = "PingTest"
    // use stepName to get the test step for calling the test step (testCase is a string variable of the test case name).
    def step = context.testCase.getTestStepByName(stepName)
    // call the test step.
    step.run(testRunner, context)
    // show the results.
    def response = new String(step.testRequest.messageExchange.response.responseContent)
    log.info response // this response shows correctly in the DOS window