3

I want to know what the best practice is for logging since I have a common test case from which I call other specific test cases, I don't like having a KeywordLogger or KeywordUtil object in each class. Should I just use KeywordUtil.LOGGER instead of making a reference object?

I am new to Katalon Studio, so it would be great if someone could give their perspective on this. Is there a conventional way of doing this?

Mate Mrše
  • 7,997
  • 10
  • 40
  • 77
street_jesus
  • 373
  • 5
  • 17

1 Answers1

2

I don't think there is a best practice for logging. It would heavily depend on your use cases.

Katalon Studio by default generates logs for individual test cases, and test reports (in .csv, .html, .log and .xml formats) for test suites.

As you have already said, you can integrate the logger, as discussed here and here on Katalon forums, and add it into a .properties file:

# Root logger option
log4j.rootLogger=INFO, file
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.Append=false
log4j.appender.file.File=C:\\log\\logging.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:(%F:%L) - %m%n

and then after setting path of config file to

PropertyConfigurator.configure("path of .properties file")

And, of course, the most custom way is to create your own logging and reporting framework.

Mate Mrše
  • 7,997
  • 10
  • 40
  • 77