Forum Discussion

roglesby's avatar
roglesby
Occasional Contributor
11 years ago

Groovy - Get Java Exceptions

I am looking for a way to capture java exceptions such as "Thu Sep 12 15:38:44 CDT 2013:ERROR:java.net.UnknownHostException: badurl.com" Stack track would be great but I am really looking to capture when it happens.

I am aware that the Error Logs show both the error and the stack track but is there anyway to capture the errors from a groovy teardown script.

I am intentionally trying to throw these errors so I want to capture them within the test script insted of the default error logs.

Thanks in advance.

5 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Have you checked another global script log which is meant for groovy?
  • roglesby's avatar
    roglesby
    Occasional Contributor
    not sure I follow.

    We have custom integration with Quality Center and I am looking to force errors for some of our web services, Some security testing of trying to hit our services off network for example. I know and expect the Unknown host error to be thrown and I want to capture the Java error.

    I know there is custom reporting that can be set up through SoapUI but I was really hoping that there would be a way to capture the error directly through my test script.
  • roglesby's avatar
    roglesby
    Occasional Contributor
    What I am looking to do from a little trial and error is capture something like

    def sMessages = testStepResult.getMessages().toString()
    log.info " Step Messages: " + sMessages


    That code works if it is in an event for "TestRunListener.afterStep" but where I am at right now I Would like to get the same data "TestRunListener.afterRun"