How should I handle Exception raised by my Groovy code within Test Suite/Test Cases

Last week I made another post to Katalon Q&A:

There I showed my Test Suite code snippet. The code goes like this:

def setUp() {
    ...
    try {
        Files.createDirectories(outputDir)
    ...
    {
        System.err.println(e)
    }
}

In the catch block I called “System.err.println(e)”. I think it would not be an appropriate way of handling Exceptions in Test Suite/TestCases. At least I do not know how to make the System.output.println() result visible on the Katalon Studio.

What is the best practice of dealing with Exception raised by custom groovy codes. Any example?

1 Like