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)[source]

Bases: object

match(kw)[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(time)[source]
message_level(level)[source]
check_expansion(kw)[source]
expand_keywords
strings
start_splitting_if_needed(split=False)[source]
end_splitting(model)[source]
prune_input(**kwds)[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.SuiteBuilder(context)[source]

Bases: robot.reporting.jsmodelbuilders._Builder

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

Bases: robot.reporting.jsmodelbuilders._Builder

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

Bases: robot.reporting.jsmodelbuilders._Builder

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

Bases: robot.reporting.jsmodelbuilders._Builder

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

Bases: object

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

Bases: robot.reporting.jsmodelbuilders._Builder

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

Bases: robot.reporting.jsmodelbuilders.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: robot.reporting.logreportwriters._LogReportWriter

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

Bases: robot.reporting.logreportwriters._LogReportWriter

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

Bases: robot.htmldata.htmlfilewriter.ModelWriter

write(line)[source]
handles(line)

robot.reporting.outputwriter module

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

Bases: robot.output.xmllogger.XmlLogger

start_message(msg)[source]

Called when message starts. Default implementation does nothing.

Can return explicit False to stop visiting.

close()[source]
end_result(result)[source]
end_errors(errors=None)
end_for(for_)

Called when FOR loop ends. Default implementation does nothing.

end_for_iteration(iteration)

Called when FOR loop iteration ends. Default implementation does nothing.

end_if(if_)

Called when IF/ELSE structure ends. Default implementation does nothing.

end_if_branch(branch)

Called when IF/ELSE branch ends. Default implementation does nothing.

end_keyword(kw)

Called when keyword ends. Default implementation does nothing.

end_message(msg)

Called when message ends. Default implementation does nothing.

end_stat(stat)
end_statistics(stats)
end_suite(suite)

Called when suite ends. Default implementation does nothing.

end_suite_statistics(tag_stats)
end_tag_statistics(tag_stats)
end_test(test)

Called when test ends. Default implementation does nothing.

end_total_statistics(total_stats)
log_message(msg)
message(msg)
set_log_level(level)
start_errors(errors=None)
start_for(for_)

Called when FOR loop starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_for_iteration(iteration)

Called when FOR loop iteration starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_if(if_)

Called when IF/ELSE structure starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_if_branch(branch)

Called when IF/ELSE branch starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_keyword(kw)

Called when keyword starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_result(result)
start_stat(stat)
start_statistics(stats)
start_suite(suite)

Called when suite starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_suite_statistics(tag_stats)
start_tag_statistics(tag_stats)
start_test(test)

Called when test starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_total_statistics(total_stats)
visit_errors(errors)
visit_for(for_)

Implements traversing through FOR loops.

Can be overridden to allow modifying the passed in for_ without calling start_for() or end_for() nor visiting body.

visit_for_iteration(iteration)

Implements traversing through single FOR loop iteration.

This is only used with the result side model because on the running side there are no iterations.

Can be overridden to allow modifying the passed in iteration without calling start_for_iteration() or end_for_iteration() nor visiting body.

visit_if(if_)

Implements traversing through IF/ELSE structures.

Notice that if_ does not have any data directly. Actual IF/ELSE branches are in its body and visited using visit_if_branch().

Can be overridden to allow modifying the passed in if_ without calling start_if() or end_if() nor visiting branches.

visit_if_branch(branch)

Implements traversing through single IF/ELSE branch.

Can be overridden to allow modifying the passed in branch without calling start_if_branch() or end_if_branch() nor visiting body.

visit_keyword(kw)

Implements traversing through keywords.

Can be overridden to allow modifying the passed in kw without calling start_keyword() or end_keyword() nor visiting child keywords.

visit_message(msg)

Implements visiting messages.

Can be overridden to allow modifying the passed in msg without calling start_message() or end_message().

visit_result(result)
visit_stat(stat)
visit_statistics(stats)
visit_suite(suite)

Implements traversing through suites.

Can be overridden to allow modifying the passed in suite without calling start_suite() or end_suite() nor visiting child suites, tests or keywords (setup and teardown) at all.

visit_suite_statistics(stats)
visit_tag_statistics(stats)
visit_test(test)

Implements traversing through tests.

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

visit_total_statistics(stats)

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

result
js_result

robot.reporting.stringcache module

class robot.reporting.stringcache.StringIndex[source]

Bases: int

bit_length() → int

Number of bits necessary to represent self in binary. >>> bin(37) ‘0b100101’ >>> (37).bit_length() 6

conjugate()

Returns self, the complex conjugate of any int.

denominator

the denominator of a rational number in lowest terms

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

class robot.reporting.stringcache.StringCache[source]

Bases: object

add(text)[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: robot.result.visitor.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)[source]

Called when suite starts. Default implementation does nothing.

Can return explicit False to stop visiting.

end_suite(suite)[source]

Called when suite ends. Default implementation does nothing.

visit_test(test)[source]

Implements traversing through tests.

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

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 child keywords.

visit_statistics(stats)[source]
visit_errors(errors)[source]
end_result(result)[source]
end_errors(errors)
end_for(for_)

Called when FOR loop ends. Default implementation does nothing.

end_for_iteration(iteration)

Called when FOR loop iteration ends. Default implementation does nothing.

end_if(if_)

Called when IF/ELSE structure ends. Default implementation does nothing.

end_if_branch(branch)

Called when IF/ELSE branch ends. Default implementation does nothing.

end_keyword(keyword)

Called when keyword ends. Default implementation does nothing.

end_message(msg)

Called when message ends. Default implementation does nothing.

end_stat(stat)
end_statistics(stats)
end_suite_statistics(suite_stats)
end_tag_statistics(stats)
end_test(test)

Called when test ends. Default implementation does nothing.

end_total_statistics(stats)
start_errors(errors)
start_for(for_)

Called when FOR loop starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_for_iteration(iteration)

Called when FOR loop iteration starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_if(if_)

Called when IF/ELSE structure starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_if_branch(branch)

Called when IF/ELSE branch starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_keyword(keyword)

Called when keyword starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_message(msg)

Called when message starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_result(result)
start_stat(stat)
start_statistics(stats)
start_suite_statistics(stats)
start_tag_statistics(stats)
start_test(test)

Called when test starts. Default implementation does nothing.

Can return explicit False to stop visiting.

start_total_statistics(stats)
visit_for(for_)

Implements traversing through FOR loops.

Can be overridden to allow modifying the passed in for_ without calling start_for() or end_for() nor visiting body.

visit_for_iteration(iteration)

Implements traversing through single FOR loop iteration.

This is only used with the result side model because on the running side there are no iterations.

Can be overridden to allow modifying the passed in iteration without calling start_for_iteration() or end_for_iteration() nor visiting body.

visit_if(if_)

Implements traversing through IF/ELSE structures.

Notice that if_ does not have any data directly. Actual IF/ELSE branches are in its body and visited using visit_if_branch().

Can be overridden to allow modifying the passed in if_ without calling start_if() or end_if() nor visiting branches.

visit_if_branch(branch)

Implements traversing through single IF/ELSE branch.

Can be overridden to allow modifying the passed in branch without calling start_if_branch() or end_if_branch() nor visiting body.

visit_message(msg)

Implements visiting messages.

Can be overridden to allow modifying the passed in msg without calling start_message() or end_message().

visit_result(result)
visit_stat(stat)
visit_suite(suite)

Implements traversing through suites.

Can be overridden to allow modifying the passed in suite without calling start_suite() or end_suite() nor visiting child suites, tests or keywords (setup and teardown) at all.

visit_suite_statistics(stats)
visit_tag_statistics(stats)
visit_total_statistics(stats)