HTTP::WebTest::Plugin::XMLReport - Report plugin for HTTP::WebTest, generates output in XML format
version 1.00 - $Revision: 1.4 $
Compatible with HTTP::WebTest version 2.x API
See HTTP::WebTest, the section about plugins.
Generate a WebTest report in XML format. The document element is the 'testresults' element. For each test definition, a 'group' element is included, containig individual test results as children of 'test' elements.
Example:
<?xml version="1.0" encoding="UTF-8"?> <testresults date="Mon Sep 16 17:00:03 2002"> <group name="Homepage" url="http://www.mysite.com"> <test name="Status code check"> <result status="PASS">200 OK</result> </test> <test name="Forbidden text"> <result status="PASS">Premature end of script headers</result> </test> <test name="Required text"> <result status="PASS">Please login:</result> <result status="PASS"></html></result> </test> <test name="Content size check"> <result status="PASS">Number of returned bytes ( 30381 ) is > or = 10000 ?</result> <result status="PASS">Number of returned bytes ( 30381 ) is < or = 99000 ?</result> </test> <test name="Response time check"> <result status="PASS">Response time ( 9.14 ) is > or = 0.01 ?</result> <result status="FAIL">Response time ( 9.14 ) is < or = 8.00 ?</result> </test> </group> [...] </testresults>
This global parameter specifies whether the testresults document includes the DTD.
For production work this will normally not be advised, but it can be helpful when validating the report during development, with a command like:
xmllint --valid saved_xml_report.xml
(xmllint is a utility program that comes bundled with the Gnome XML libraries, aka LibXML).
yes, no
yes
no
You may want to suppress the default report. From wtscript:
wtscript
default_report no
Or as optional global parameter from Perl:
$wt = new HTTP::WebTest($defs, { default_report => 'no' });
Note: these are set from the test definitions, see HTTP::WebTest for details.
The test_name attribute from wtscript will be used for the name attribute of the group element in the XML output document.
test_name
name
group
This attribute is the easiest way to identify each test group, so it is adviced that you define one unique name per group in the test definitions.
The full Document Type Definition for the output XML:
<?xml version="1.0" ?> <!ELEMENT testresults (group+)> <!ATTLIST testresults date CDATA #REQUIRED > <!ELEMENT group (test+)> <!ATTLIST group name CDATA #REQUIRED url CDATA #REQUIRED > <!ELEMENT test (result+)> <!ATTLIST test name CDATA #REQUIRED > <!ELEMENT result (#PCDATA)> <!ATTLIST result status (PASS | FAIL) #REQUIRED >
If the test run dies, the resulting XML report is not preperly terminated, resulting in malformed format which is not parsable by conforming XML processors.
This can happen for example when a document could not be fetched and when subsequently a test with the Click plugin is used.
The following limitations apply:
These options from the DefaultReport are missing:
show_headers show_html show_cookies
Sending email from this module is not implemented; a work around would be to parse the resulting XML document and generate an email message whenever a test result has status FAIL.
FAIL
Copyright (c) 2002 Johannes la Poutre. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
HTTP::WebTest
HTTP::WebTest::API
HTTP::WebTest::Plugin
HTTP::WebTest::Plugins
XML::Writer
To install HTTP::WebTest::Plugin::XMLReport, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::WebTest::Plugin::XMLReport
CPAN shell
perl -MCPAN -e shell install HTTP::WebTest::Plugin::XMLReport
For more information on module installation, please visit the detailed CPAN module installation guide.