The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTTP::WebTest::Plugin::XMLReport - Report plugin for HTTP::WebTest, generates output in XML format

VERSION

 version 1.00 - $Revision: 1.4 $

Compatible with HTTP::WebTest version 2.x API

SYNOPSIS

See HTTP::WebTest, the section about plugins.

DESCRIPTION

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">&lt;/html&gt;</result>
     </test>
     <test name="Content size check">
       <result status="PASS">Number of returned bytes ( 30381 ) is &gt; or = 10000 ?</result>
       <result status="PASS">Number of returned bytes ( 30381 ) is &lt; or = 99000 ?</result>
     </test>
     <test name="Response time check">
       <result status="PASS">Response time (  9.14 ) is &gt; or =  0.01 ?</result>
       <result status="FAIL">Response time (  9.14 ) is &lt; or =  8.00 ?</result>
     </test>
   </group>
   [...]
 </testresults>

GLOBAL PARAMETERS

xml_report_dtd

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).

Allowed values

yes, no

Default value

no

default_report

You may want to suppress the default report. From wtscript:

  default_report no

Or as optional global parameter from Perl:

  $wt = new HTTP::WebTest($defs, { default_report => 'no' });

Allowed values

yes, no

Default value

yes

TEST PARAMETERS

Note: these are set from the test definitions, see HTTP::WebTest for details.

test_name

The test_name attribute from wtscript will be used for the name attribute of the group element in the XML output document.

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.

REPORT DTD

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 >

BUGS

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.

COPYRIGHT

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.

SEE ALSO

HTTP::WebTest

HTTP::WebTest::API

HTTP::WebTest::Plugin

HTTP::WebTest::Plugins

XML::Writer