Forum Discussion

Rhonda_Ward's avatar
Rhonda_Ward
Occasional Contributor
13 years ago

How can I get Rest Test case log information using a script?

Hi,

How can I get Rest Test case log information using a script?

I have rest test case that returns following error "java.net.ConnectException: Connection refused: connect" in the Test Case Log. I want to capture this information and store into the property for custom reporting.
I am unable to retrieve rest test case log information. Can you please help?



Thx,
Rhonda

1 Reply

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Rhonda,

    I think you would need to access the TestStepResult object associated with the failed TestStep and query either its error property (which returns a Throwable) or its messages property (a String array). The testRunner.results property is a Vector of all TestStepResult objects - so if you want to get the result for the last executed TestStep you would use for example

    def result = testRunner.results[testRunner.results.size()-1]
    log.info result.error
    log.info result.messages

    Does that help?

    regards,

    /Ole
    SmartBear Software