robot.reporting package

Implements report, log, output XML, and xUnit file generation.

The public API of this package is the ResultWriter class. It can write result files based on XML output files on the file system, as well as based on the result objects returned by the ExecutionResult() factory method or an executed TestSuite.

It is highly recommended to use the public API via the robot.api package.

This package is considered stable.

Submodules

robot.reporting.expandkeywordmatcher module

class robot.reporting.expandkeywordmatcher.ExpandKeywordMatcher(expand_keywords: str | Sequence[str])[source]

Bases: object

match(kw: Keyword)[source]

robot.reporting.jsbuildingcontext module

class robot.reporting.jsbuildingcontext.JsBuildingContext(log_path=None, split_log=False, expand_keywords=None, prune_input=False)[source]

Bases: object

string(string, escape=True, attr=False)[source]
html(string)[source]
relative_source(source)[source]
timestamp(ts: datetime) int | None[source]
message_level(level)[source]
check_expansion(kw)[source]
property expand_keywords
property strings
start_splitting_if_needed(split=False)[source]
end_splitting(model)[source]
prune_input(*items)[source]

robot.reporting.jsexecutionresult module

class robot.reporting.jsexecutionresult.JsExecutionResult(suite, statistics, errors, strings, basemillis=None, split_results=None, min_level=None, expand_keywords=None)[source]

Bases: object

remove_data_not_needed_in_report()[source]

robot.reporting.jsmodelbuilders module

class robot.reporting.jsmodelbuilders.JsModelBuilder(log_path=None, split_log=False, expand_keywords=None, prune_input_to_save_memory=False)[source]

Bases: object

build_from(result_from_xml)[source]
class robot.reporting.jsmodelbuilders.Builder(context: JsBuildingContext)[source]

Bases: object

robot_note = re.compile('<span class="robot-note">(.*)</span>')
class robot.reporting.jsmodelbuilders.SuiteBuilder(context)[source]

Bases: Builder

build(suite)[source]
class robot.reporting.jsmodelbuilders.TestBuilder(context)[source]

Bases: Builder

build(test)[source]
class robot.reporting.jsmodelbuilders.BodyItemBuilder(context)[source]

Bases: Builder

build(item, split=False)[source]
class robot.reporting.jsmodelbuilders.MessageBuilder(context: JsBuildingContext)[source]

Bases: Builder

build(msg)[source]
class robot.reporting.jsmodelbuilders.StatisticsBuilder[source]

Bases: object

build(statistics)[source]
class robot.reporting.jsmodelbuilders.ErrorsBuilder(context)[source]

Bases: Builder

build(errors)[source]
class robot.reporting.jsmodelbuilders.ErrorMessageBuilder(context: JsBuildingContext)[source]

Bases: MessageBuilder

build(msg)[source]

robot.reporting.jswriter module

class robot.reporting.jswriter.JsResultWriter(output, start_block='<script type="text/javascript">\n', end_block='</script>\n', split_threshold=9500)[source]

Bases: object

write(result, settings)[source]
class robot.reporting.jswriter.SuiteWriter(write_json, split_threshold)[source]

Bases: object

write(suite, variable)[source]
class robot.reporting.jswriter.SplitLogWriter(output)[source]

Bases: object

write(keywords, strings, index, notify)[source]

robot.reporting.logreportwriters module

class robot.reporting.logreportwriters.LogWriter(js_model)[source]

Bases: _LogReportWriter

usage = 'log'
write(path: Path | str, config)[source]
class robot.reporting.logreportwriters.ReportWriter(js_model)[source]

Bases: _LogReportWriter

usage = 'report'
write(path: Path | str, config)[source]
class robot.reporting.logreportwriters.RobotModelWriter(output, model, config)[source]

Bases: ModelWriter

write(line)[source]

robot.reporting.outputwriter module

class robot.reporting.outputwriter.OutputWriter(output, rpa=False, suite_only=False)[source]

Bases: XmlLogger

start_message(msg)[source]

Called when a message starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

close()[source]
end_result(result)[source]
class robot.reporting.outputwriter.LegacyOutputWriter(output, rpa=False)[source]

Bases: LegacyXmlLogger

start_message(msg)[source]

Called when a message starts.

By default, calls start_body_item() which, by default, does nothing.

Can return explicit False to stop visiting.

close()[source]
end_result(result)[source]

robot.reporting.resultwriter module

class robot.reporting.resultwriter.ResultWriter(*sources)[source]

Bases: object

A class to create log, report, output XML and xUnit files.

Parameters:

sources – Either one Result object, or one or more paths to existing output XML files.

By default writes report.html and log.html, but no output XML or xUnit files. Custom file names can be given and results disabled or enabled using settings or options passed to the write_results() method. The latter is typically more convenient:

writer = ResultWriter(result)
writer.write_results(report='custom.html', log=None, xunit='xunit.xml')
write_results(settings=None, **options)[source]

Writes results based on the given settings or options.

Parameters:
  • settingsRebotSettings object to configure result writing.

  • options – Used to construct new RebotSettings object if settings are not given.

class robot.reporting.resultwriter.Results(settings, *sources)[source]

Bases: object

property result
property js_result

robot.reporting.stringcache module

class robot.reporting.stringcache.StringIndex[source]

Bases: int

class robot.reporting.stringcache.StringCache[source]

Bases: object

empty = 0
add(text, html=False)[source]
dump()[source]

robot.reporting.xunitwriter module

class robot.reporting.xunitwriter.XUnitWriter(execution_result)[source]

Bases: object

write(output)[source]
class robot.reporting.xunitwriter.XUnitFileWriter(xml_writer)[source]

Bases: ResultVisitor

Provides an xUnit-compatible result file.

Attempts to adhere to the de facto schema guessed by Peter Reilly, see: http://marc.info/?l=ant-dev&m=123551933508682

start_suite(suite: TestSuite)[source]

Called when a suite starts. Default implementation does nothing.

Can return explicit False to stop visiting.

end_suite(suite: TestSuite)[source]

Called when a suite ends. Default implementation does nothing.

visit_test(test: TestCase)[source]

Implements traversing through tests.

Can be overridden to allow modifying the passed in test without calling start_test() or end_test() nor visiting the body of the test.

visit_keyword(kw)[source]

Implements traversing through keywords.

Can be overridden to allow modifying the passed in kw without calling start_keyword() or end_keyword() nor visiting the body of the keyword

visit_statistics(stats)[source]
visit_errors(errors)[source]
end_result(result)[source]