Skip to content

Test logging functions

Steven Li edited this page Mar 23, 2017 · 5 revisions

test_logger = logging.getLogger("Test")

test_logger is a predefined logger, which can be directly used. And all pass/fail functions will use this logger to log information.
You could add handlers to the logger as you want.
The default log-level of this logger is logging.DEBUG. You could change it as you want.

setlogger(testlogger)

You could use your logger to replace test_logger by invoking this function. This function does nothing else to replace the logger using the one you indicated

log_new_func(name=None, path=None)

This is for pytest or nose plugin use. Do not use this functions in normal cases.

auto_func_detection(auto=True)

To define if allowed to detect function (case name) automatically. By default, it's true, so that the case could be logged before steps/checks logged in the particular case.

This is also used to temporarily disable function/case detection, e.g. when you invoke another function in a case, but you will count all the check in the invoked function into your case, you could disable the function auto-detection in the child function. See lesson6 in the source code test_examples folder.

Init_testbed function

Pre-defined pass/fail functions

Test Step/steps functions

Test Log functions

Functions to add functions

Clone this wiki locally