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¶
robot.reporting.jsbuildingcontext module¶
robot.reporting.jsexecutionresult module¶
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
-
class
robot.reporting.jsmodelbuilders.
SuiteBuilder
(context)[source]¶ Bases:
robot.reporting.jsmodelbuilders._Builder
-
class
robot.reporting.jsmodelbuilders.
TestBuilder
(context)[source]¶ Bases:
robot.reporting.jsmodelbuilders._Builder
-
class
robot.reporting.jsmodelbuilders.
KeywordBuilder
(context)[source]¶ Bases:
robot.reporting.jsmodelbuilders._Builder
-
class
robot.reporting.jsmodelbuilders.
MessageBuilder
(context)[source]¶ Bases:
robot.reporting.jsmodelbuilders._Builder
-
class
robot.reporting.jsmodelbuilders.
ErrorsBuilder
(context)[source]¶ Bases:
robot.reporting.jsmodelbuilders._Builder
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
robot.reporting.logreportwriters module¶
-
class
robot.reporting.logreportwriters.
LogWriter
(js_model)[source]¶ Bases:
robot.reporting.logreportwriters._LogReportWriter
-
usage
= 'log'¶
-
robot.reporting.outputwriter module¶
-
class
robot.reporting.outputwriter.
OutputWriter
(output, rpa=False)[source]¶ Bases:
robot.output.xmllogger.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.
-
end_body_item
(item: BodyItem)¶ Called, by default, when keywords, messages or control structures end.
More specific
end_keyword()
,end_message()
, :meth:`end_for, etc. can be implemented to visit only keywords, messages or specific control structures.Default implementation does nothing.
-
end_break
(break_)¶ Called when a BREAK element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_continue
(continue_)¶ Called when a CONTINUE element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_error
(error)¶ Called when a ERROR element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_errors
(errors=None)¶
-
end_for
(for_)¶ Called when a FOR loop ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_for_iteration
(iteration)¶ Called when a FOR loop iteration ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_if
(if_)¶ Called when an IF/ELSE structure ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_if_branch
(branch)¶ Called when an IF/ELSE branch ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_keyword
(kw)¶ Called when a keyword ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_message
(message: Message)¶ Called when a message ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_return
(return_)¶ Called when a RETURN element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_stat
(stat)¶
-
end_statistics
(stats)¶
-
end_suite
(suite)¶ Called when a suite ends. Default implementation does nothing.
-
end_suite_statistics
(tag_stats)¶
-
end_tag_statistics
(tag_stats)¶
-
end_test
(test)¶ Called when a test ends. Default implementation does nothing.
-
end_total_statistics
(total_stats)¶
-
end_try
(root)¶ Called when a TRY/EXCEPT structure ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_try_branch
(branch)¶ Called when TRY, EXCEPT, ELSE and FINALLY branches end.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_while
(while_)¶ Called when a WHILE loop ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_while_iteration
(iteration)¶ Called when a WHILE loop iteration ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
log_message
(msg)¶
-
message
(msg)¶
-
set_log_level
(level)¶
-
start_body_item
(item: BodyItem) → bool|None¶ Called, by default, when keywords, messages or control structures start.
More specific
start_keyword()
,start_message()
, :meth:`start_for, etc. can be implemented to visit only keywords, messages or specific control structures.Can return explicit
False
to stop visiting. Default implementation does nothing.
-
start_break
(break_)¶ Called when a BREAK element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_continue
(continue_)¶ Called when a CONTINUE element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_error
(error)¶ Called when a ERROR element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_errors
(errors=None)¶
-
start_for
(for_)¶ Called when a FOR loop starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_for_iteration
(iteration)¶ Called when a FOR loop iteration starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_if
(if_)¶ Called when an IF/ELSE structure starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_if_branch
(branch)¶ Called when an IF/ELSE branch starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_keyword
(kw)¶ Called when a keyword starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_result
(result)¶
-
start_return
(return_)¶ Called when a RETURN element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_stat
(stat)¶
-
start_statistics
(stats)¶
-
start_suite
(suite)¶ Called when a 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 a test starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
start_total_statistics
(total_stats)¶
-
start_try
(root)¶ Called when a TRY/EXCEPT structure starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_try_branch
(branch)¶ Called when TRY, EXCEPT, ELSE or FINALLY branches start.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_while
(while_)¶ Called when a WHILE loop starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_while_iteration
(iteration)¶ Called when a WHILE loop iteration starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
visit_break
(break_: Break)¶ Visits BREAK elements.
-
visit_continue
(continue_: Continue)¶ Visits CONTINUE elements.
-
visit_error
(error: Error)¶ Visits body items resulting from invalid syntax.
Examples include syntax like
END
orELSE
in wrong place and invalid setting like[Invalid]
.
-
visit_errors
(errors)¶
-
visit_for
(for_: For)¶ Implements traversing through FOR loops.
Can be overridden to allow modifying the passed in
for_
without callingstart_for()
orend_for()
nor visiting body.
-
visit_for_iteration
(iteration: ForIteration)¶ 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 callingstart_for_iteration()
orend_for_iteration()
nor visiting body.
-
visit_if
(if_: If)¶ Implements traversing through IF/ELSE structures.
Notice that
if_
does not have any data directly. Actual IF/ELSE branches are in itsbody
and they are visited separately usingvisit_if_branch()
.Can be overridden to allow modifying the passed in
if_
without callingstart_if()
orend_if()
nor visiting branches.
-
visit_if_branch
(branch: IfBranch)¶ Implements traversing through single IF/ELSE branch.
Can be overridden to allow modifying the passed in
branch
without callingstart_if_branch()
orend_if_branch()
nor visiting body.
-
visit_keyword
(keyword: Keyword)¶ Implements traversing through keywords.
Can be overridden to allow modifying the passed in
kw
without callingstart_keyword()
orend_keyword()
nor visiting the body of the keyword
-
visit_message
(message: Message)¶ Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_message()
.
-
visit_result
(result)¶
-
visit_return
(return_: Return)¶ Visits a RETURN elements.
-
visit_stat
(stat)¶
-
visit_statistics
(stats)¶
-
visit_suite
(suite: TestSuite)¶ Implements traversing through suites.
Can be overridden to allow modifying the passed in
suite
without callingstart_suite()
orend_suite()
nor visiting child suites, tests or setup and teardown at all.
-
visit_suite_statistics
(stats)¶
-
visit_tag_statistics
(stats)¶
-
visit_test
(test: TestCase)¶ Implements traversing through tests.
Can be overridden to allow modifying the passed in
test
without callingstart_test()
orend_test()
nor visiting the body of the test.
-
visit_total_statistics
(stats)¶
-
visit_try
(try_: Try)¶ Implements traversing through TRY/EXCEPT structures.
This method is used with the TRY/EXCEPT root element. Actual TRY, EXCEPT, ELSE and FINALLY branches are visited separately using
visit_try_branch()
.
-
visit_try_branch
(branch: TryBranch)¶ Visits individual TRY, EXCEPT, ELSE and FINALLY branches.
-
visit_while
(while_: While)¶ Implements traversing through WHILE loops.
Can be overridden to allow modifying the passed in
while_
without callingstart_while()
orend_while()
nor visiting body.
-
visit_while_iteration
(iteration: WhileIteration)¶ Implements traversing through single WHILE 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 callingstart_while_iteration()
orend_while_iteration()
nor visiting body.
-
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
andlog.html
, but no output XML or xUnit files. Custom file names can be given and results disabled or enabled usingsettings
oroptions
passed to thewrite_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
oroptions
.Parameters: - settings –
RebotSettings
object to configure result writing. - options – Used to construct new
RebotSettings
object ifsettings
are not given.
- settings –
-
robot.reporting.stringcache module¶
-
class
robot.reporting.stringcache.
StringIndex
[source]¶ Bases:
int
-
as_integer_ratio
()¶ Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
-
bit_count
()¶ Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
-
bit_length
()¶ 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
-
from_bytes
()¶ Return the integer represented by the given array of bytes.
- bytes
- Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
- The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
- Indicates whether two’s complement is used to represent the integer.
-
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
-
to_bytes
()¶ Return an array of bytes representing an integer.
- length
- Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
- The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
- Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
-
robot.reporting.xunitwriter module¶
-
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 a suite starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
visit_test
(test)[source]¶ Implements traversing through tests.
Can be overridden to allow modifying the passed in
test
without callingstart_test()
orend_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 callingstart_keyword()
orend_keyword()
nor visiting the body of the keyword
-
end_body_item
(item: BodyItem)¶ Called, by default, when keywords, messages or control structures end.
More specific
end_keyword()
,end_message()
, :meth:`end_for, etc. can be implemented to visit only keywords, messages or specific control structures.Default implementation does nothing.
-
end_break
(break_: Break)¶ Called when a BREAK element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_continue
(continue_: Continue)¶ Called when a CONTINUE element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_error
(error: Error)¶ Called when a ERROR element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_errors
(errors)¶
-
end_for
(for_: For)¶ Called when a FOR loop ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_for_iteration
(iteration: ForIteration)¶ Called when a FOR loop iteration ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_if
(if_: If)¶ Called when an IF/ELSE structure ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_if_branch
(branch: IfBranch)¶ Called when an IF/ELSE branch ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_keyword
(keyword: Keyword)¶ Called when a keyword ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_message
(message: Message)¶ Called when a message ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_return
(return_: Return)¶ Called when a RETURN element ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_stat
(stat)¶
-
end_statistics
(stats)¶
-
end_suite_statistics
(suite_stats)¶
-
end_tag_statistics
(stats)¶
-
end_test
(test: TestCase)¶ Called when a test ends. Default implementation does nothing.
-
end_total_statistics
(stats)¶
-
end_try
(try_: Try)¶ Called when a TRY/EXCEPT structure ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_try_branch
(branch: TryBranch)¶ Called when TRY, EXCEPT, ELSE and FINALLY branches end.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_while
(while_: While)¶ Called when a WHILE loop ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
end_while_iteration
(iteration: WhileIteration)¶ Called when a WHILE loop iteration ends.
By default, calls
end_body_item()
which, by default, does nothing.
-
start_body_item
(item: BodyItem) → bool|None¶ Called, by default, when keywords, messages or control structures start.
More specific
start_keyword()
,start_message()
, :meth:`start_for, etc. can be implemented to visit only keywords, messages or specific control structures.Can return explicit
False
to stop visiting. Default implementation does nothing.
-
start_break
(break_: Break) → bool|None¶ Called when a BREAK element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_continue
(continue_: Continue) → bool|None¶ Called when a CONTINUE element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_error
(error: Error) → bool|None¶ Called when a ERROR element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_errors
(errors)¶
-
start_for
(for_: For) → bool|None¶ Called when a FOR loop starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_for_iteration
(iteration: ForIteration) → bool|None¶ Called when a FOR loop iteration starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_if
(if_: If) → bool|None¶ Called when an IF/ELSE structure starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_if_branch
(branch: IfBranch) → bool|None¶ Called when an IF/ELSE branch starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_keyword
(keyword: Keyword) → bool|None¶ Called when a keyword starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_message
(message: Message) → bool|None¶ Called when a message starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_result
(result)¶
-
start_return
(return_: Return) → bool|None¶ Called when a RETURN element starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_stat
(stat)¶
-
start_statistics
(stats)¶
-
start_suite_statistics
(stats)¶
-
start_tag_statistics
(stats)¶
-
start_test
(test: TestCase) → bool|None¶ Called when a test starts. Default implementation does nothing.
Can return explicit
False
to stop visiting.
-
start_total_statistics
(stats)¶
-
start_try
(try_: Try) → bool|None¶ Called when a TRY/EXCEPT structure starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_try_branch
(branch: TryBranch) → bool|None¶ Called when TRY, EXCEPT, ELSE or FINALLY branches start.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_while
(while_: While) → bool|None¶ Called when a WHILE loop starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
start_while_iteration
(iteration: WhileIteration) → bool|None¶ Called when a WHILE loop iteration starts.
By default, calls
start_body_item()
which, by default, does nothing.Can return explicit
False
to stop visiting.
-
visit_break
(break_: Break)¶ Visits BREAK elements.
-
visit_continue
(continue_: Continue)¶ Visits CONTINUE elements.
-
visit_error
(error: Error)¶ Visits body items resulting from invalid syntax.
Examples include syntax like
END
orELSE
in wrong place and invalid setting like[Invalid]
.
-
visit_for
(for_: For)¶ Implements traversing through FOR loops.
Can be overridden to allow modifying the passed in
for_
without callingstart_for()
orend_for()
nor visiting body.
-
visit_for_iteration
(iteration: ForIteration)¶ 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 callingstart_for_iteration()
orend_for_iteration()
nor visiting body.
-
visit_if
(if_: If)¶ Implements traversing through IF/ELSE structures.
Notice that
if_
does not have any data directly. Actual IF/ELSE branches are in itsbody
and they are visited separately usingvisit_if_branch()
.Can be overridden to allow modifying the passed in
if_
without callingstart_if()
orend_if()
nor visiting branches.
-
visit_if_branch
(branch: IfBranch)¶ Implements traversing through single IF/ELSE branch.
Can be overridden to allow modifying the passed in
branch
without callingstart_if_branch()
orend_if_branch()
nor visiting body.
-
visit_message
(message: Message)¶ Implements visiting messages.
Can be overridden to allow modifying the passed in
msg
without callingstart_message()
orend_message()
.
-
visit_result
(result)¶
-
visit_return
(return_: Return)¶ Visits a RETURN elements.
-
visit_stat
(stat)¶
-
visit_suite
(suite: TestSuite)¶ Implements traversing through suites.
Can be overridden to allow modifying the passed in
suite
without callingstart_suite()
orend_suite()
nor visiting child suites, tests or setup and teardown at all.
-
visit_suite_statistics
(stats)¶
-
visit_tag_statistics
(stats)¶
-
visit_total_statistics
(stats)¶
-
visit_try
(try_: Try)¶ Implements traversing through TRY/EXCEPT structures.
This method is used with the TRY/EXCEPT root element. Actual TRY, EXCEPT, ELSE and FINALLY branches are visited separately using
visit_try_branch()
.
-
visit_try_branch
(branch: TryBranch)¶ Visits individual TRY, EXCEPT, ELSE and FINALLY branches.
-
visit_while
(while_: While)¶ Implements traversing through WHILE loops.
Can be overridden to allow modifying the passed in
while_
without callingstart_while()
orend_while()
nor visiting body.
-
visit_while_iteration
(iteration: WhileIteration)¶ Implements traversing through single WHILE 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 callingstart_while_iteration()
orend_while_iteration()
nor visiting body.
-