Debugging custom scripts - TestRail

Debugging custom scripts

When implementing custom defect plugins or custom reports, you sometimes need to inspect return values from third-party tools or debug your script’s execution flow. To do this you can use TestRail’s built-in debug logging methods. To benefit from TestRail’s logging capabilities you need to temporarily enable the logging mode.

You can then use the following methods to write debugging information to TestRail’s system log, which is usually stored in a logs directory in TestRail’s installation path.

Method Description
logger::debug(string) This method allows you to send a simple string or message to the system log.
logger::debugr(string,object) Use this method to send a full object, array or variable to the system log. This method is useful to inspect the contents of variables or responses from third-party tools.
logger::debugf(string,..) This method allows you to specify a format string and corresponding arguments. Format arguments can be specified as {0}, {1}, {2}, etc.