Reports and output objects
T-Plan Robot Enterprise scripts are able to produce the following output objects:
- Screen shots with
optional image comparison results (through the Screenshot
command),
- Warnings (through
the Warning
command) which may be optionally associated with a screen shot,
- Script mappings and
step results
(generated by the Script
and Step
commands as discussed in the previous topic; Enterprise
version
only),
- Exit code (defined
by the Exit
command) where the value of 0 indicates "pass" and any other value is
interpreted as "fail".
Each script is in addition able to produce an HTML or XML report (XML is supported
by Enterprise version only) which summarizes the output objects,
usually in the order in which they were created. Reports are generated
by so called report provider.
It is an object which typically attaches to the output object
generators and refreshes the report file as new objects are created.
This approach allows to view the report while the script is being
executed and track the automation progress.
Report providers are started by the Report command
which requires a mandatory target
report file argument and optional provider code and report description. If the target
file is relative, it gets saved to the output path (which has been
described in the Predefined variables topic).
If
the
code is not specified, it defaults to the value from the Report
command preferences. Format of the report is guessed from the file
extension (.html, .htm, .xml). T-Plan Robot Enterprise contains two
providers:
- Enterprise provider
(code "enterprise", Enterprise
version
only) supports
both XML and HTML formats. The XML document contains definitions of all
output objects, environment parameters and variables. It may be used
both as a report viewable in a web browser (through a linked XML Style
Sheet, XSL) or as a source of test data (test results) for export to
third party test management applications, for example T-Plan Professional 7.0.
The
XSL
file may be modified to provide a
custom view and plugged back into the provider through its preferences
(see instructions).
When
the
HTML format is requested, the provider initially generates the
XML and then applies the XSL transformation to produce the HTML code.
As this operation is costly with a large number of output objects, it
is recommended either to stick to the XML format or switch to the
default provider.
- Default provider
(code "default") is a legacy
HTML-only provider shared with the open source product version. Though
it provides a similar view of the data, it does not allow to customize
the produced HTML code and it also can not handle script mappings and
step results.
An important feature of both the providers is that they always process all output objects created by the
script (or by any library it calls). It has two important
impacts: First, even if you call the Report command at the end of
the script, the resulting report file will contain all objects created
before the call. Second, there's unfortunately no filtering mechanism
allowing to select just some output objects for the report (though the
XSL file could be customized to process just a subset of the XML data).
As report providers are implemented as plug ins, you are free to write
your own one in Java and plug it to the tool. See the Plugin Framework document
for instructions; the corresponding functional interface is ReportProvider.
The following example is a dummy and doesn't automate anything. It just
generates one of each supported output objects and we will use it for
report demonstration purposes:
dummy.tpr
|
Script
"1234"
name="Dummy script"
Screenshot
"d.jpg"
desc="Dummy"
template="dummy.png"
Warning
"Dummy
warning" image="d.jpg"
Step
"dummy step"
instruct="Dummy
instruction"
Exit
2 |
Here are reports created by all available provider and format
combinations:
Provider/format
|
Report
command
|
Report
file
example
|
Enterprise/XML
|
Report "enterprise.xml" provider="enterprise" desc="Dummy"
|
enterprise.xml
|
Enterprise/HTML
|
Report "enterprise.html" provider="enterprise" desc="Dummy" |
enterprise.html
|
Default/HTML
|
Report "default.html" provider="default" desc="Dummy" |
default.html
|
To reproduce it on your own follow these
steps:
- Start T-Plan Robot Enterprise and connect it to a desktop.
- Copy the script code to the editor.
- Add one of the Report commands (position doesn't
matter).
- Select Tools->Take A
Screenshot in the menu and save the
picture to a file called dummy.png in your home folder. It will serve
as image comparison template for the Screenshot command.
- Execute the script.
- Right click the Report command in the editor and select "View report in web browser"
in the context menu.
|