Forum Discussion

RobWithers's avatar
RobWithers
Occasional Contributor
12 years ago

logging from inside a groovy class

I am calling a groovy class, I wrote, from inside a groovy script test step and I am passing the "log" variable in. When I run the test step alone, I get a log message in the Log Output. When I run as a test case, I get no log message in the TestCase Log. What is going on and how can I ensure I get a log message in both cases?

Thanks!

3 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    The log object writes to the script log tab in the bottom of the main SoapUI window.

    --
    Regards
    Erik, SmartBear Sweden
  • RobWithers's avatar
    RobWithers
    Occasional Contributor
    Ok, thanks. I suppose that works, but is there any way to log to the TestCase log, instead?
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Yes,

    try adding this

    testStepResult.addMessage "My custom message"


    to a TestRunListener.afterStep event handler.

    --
    Regards

    Erik
    SmartBear Sweden