How to develop code to generate HTML report in Katalon Studio?

640 Views Asked by At

I want to write a custom method to generate HTML test reports in Katalon Studio whenever a test suite executes. I don't want to use the Basic report plugin available in Katalon store.

Do I need to write the code in Test suite file using the - @SetupTestCase @TearDownTestCase

Test Suite file

1

There are 1 best solutions below

0
On

If you want to use the hooks for the Test Suite you will need to use @SetUp.

Something like this could work:

@SetUp(skipped = false)
def setUp() {
    //create the custom report file using methods linked here: https://www.tutorialspoint.com/groovy/groovy_file_io.htm
}

@SetupTestCase(skipped = false)
def setupTestCase() {
    // write to file whatever you want
}

@TearDownTestCase(skipped = false)
def tearDownTestCase(TestCaseContext testCaseContext){
    // get test case status and write it to file 
    def status = testCaseContext.getTestCaseStatus()
}

You will need to play around with the groovy file methods to learn exactly how to create files and write to files but this is the way to go if you wish to create a custom report.