cafe.common.reporting package

cafe.common.reporting.base_report module

class cafe.common.reporting.base_report.BaseReport[source]

Bases: object

generate_report(result_parser, all_results=None, path=None)[source]

cafe.common.reporting.cclogging module

cafe.common.reporting.cclogging.getLogger(log_name=None, log_level=None)[source]

Convenience function to create a logger and set it’s log level at the same time. Log level defaults to logging.DEBUG Note: If the root log is accesed via this method in VERBOSE mode, the root log will be initialized and returned, if it hasn’t been initialized already.

cafe.common.reporting.cclogging.get_object_namespace(obj)[source]

Attempts to return a dotted string name representation of the general form ‘package.module.class.obj’ for an object that has an __mro__ attribute

Designed to let you to name loggers inside objects in such a way that the engine logger organizes them as child loggers to the modules they originate from.

So that logging doesn’t cause exceptions, if the namespace cannot be extracted from the object’s mro attribute, the actual name returned is set to a probably-unique string, the id() of the object passed, and is then further improved by a series of functions until one of them fails. The value of the last successful name-setting method is returned.

cafe.common.reporting.cclogging.init_root_log_handler(override_handler=None)[source]

Setup root log handler if the root logger doesn’t already have one

cafe.common.reporting.cclogging.log_info_block(log, info, separator=None, heading=None, log_level=20, one_line=False)[source]

Expects info to be a list of tuples or an OrderedDict Logs info in blocks surrounded by a separator: ==================================================================== A heading will print here, with another separator below it. ==================================================================== Items are logged in order…………………………..: Info And are separated from their info……………………: Info By at least three dots……………………………..: Info If no second value is given in the tuple, a single line is logged Lower lines will still line up correctly……………..: Info The longest line dictates the dot length for all lines…: Like this ==================================================================== if one_line is true, info block will be logged as a single line, formatted using newlines. Otherwise, each line of the info block will be logged as seperate log lines (with seperate timestamps, etc.)

cafe.common.reporting.cclogging.logsafe_str(data)[source]
cafe.common.reporting.cclogging.parse_class_namespace_string(class_string)[source]

Parses the dotted namespace out of an object’s __mro__. Returns a string

cafe.common.reporting.cclogging.setup_new_cchandler(log_file_name, log_dir=None, encoding=None, msg_format=None)[source]

Creates a log handler named <log_file_name> configured to save the log in <log_dir> or <os environment variable ‘CAFE_TEST_LOG_PATH’>, in that order or precedent. File handler defaults: ‘a+’, encoding=encoding or “UTF-8”, delay=True

cafe.common.reporting.json_report module

class cafe.common.reporting.json_report.JSONReport[source]

Bases: cafe.common.reporting.base_report.BaseReport

generate_report(result_parser, all_results=None, path=None)[source]

Generates a JSON report in the specified directory.

cafe.common.reporting.metrics module

class cafe.common.reporting.metrics.CSVWriter(headers, file_name, log_dir='.', start_clean=False)[source]

Bases: object

writerow(row_list)[source]
class cafe.common.reporting.metrics.PBStatisticsLog(file_name=None, log_dir='.', start_clean=False)[source]

Bases: cafe.common.reporting.metrics.CSVWriter

extends the csv writer

report(test_result=<cafe.common.reporting.metrics.TestRunMetrics object>)[source]
class cafe.common.reporting.metrics.TestResultTypes[source]

Bases: object

Types dictating an individual Test Case result @cvar PASSED: Test has passed @type PASSED: C{str} @cvar FAILED: Test has failed @type FAILED: C{str} @cvar SKIPPED: Test was skipped @type SKIPPED: C{str} @cvar TIMEDOUT: Test exceeded pre-defined execution time limit @type TIMEDOUT: C{str} @cvar ERRORED: Test has errored @type ERRORED: C{str} @note: This is essentially an Enumerated Type

ERRORED = 'ERRORED'
FAILED = 'Failed'
PASSED = 'Passed'
SKIPPED = 'Skipped'
TIMEDOUT = 'Timedout'
UNKNOWN = 'UNKNOWN'
class cafe.common.reporting.metrics.TestRunMetrics[source]

Bases: object

Contains test timing and results metrics for a test.

class cafe.common.reporting.metrics.TestTimer[source]

Bases: object

@summary: Generic Timer used to track any time span @ivar start_time: Timestamp from the start of the timer @type start_time: C{datetime} @ivar stop_time: Timestamp of the end of the timer @type stop_time: C{datetime}

get_elapsed_time()[source]

@summary: Convenience method for total elapsed time @rtype: C{datetime} @return: Elapsed time for this timer. C{None} if timer has not started

start()[source]

@summary: Starts this timer @return: None @rtype: None

stop()[source]

@summary: Stops this timer @return: None @rtype: None

cafe.common.reporting.reporter module

class cafe.common.reporting.reporter.Reporter(result_parser, all_results)[source]
generate_report(result_type, path=None)[source]

Creates a report object based on what type is given and generates the report in the specified directory.

cafe.common.reporting.xml_report module

class cafe.common.reporting.xml_report.XMLReport[source]

Bases: cafe.common.reporting.base_report.BaseReport

generate_report(result_parser, all_results=None, path=None)[source]

Generates an XML report in the specified directory.