Generating Reports

After you have played your Badboy script you can review the results by looking at the Summary View and browsing the script to look at items that have passed and failed.   For some people this is perfectly reasonable but for others it lacks some important features:
  • The summary view isn't very detailed.  It only shows 5 top level statistics for a particular item you select in the script.
  • You can only view the summary properly by running Badboy so you can't easily email it to other people who might not have Badboy.
  • It doesn't support integration with external programs or documents.  Many people would like to put the results from their Badboy tests, for example, into a word-processor document or spread sheet.
Fortunately, Badboy offers some great features to generate reports for you which give you an unlimited amount of detail about how your script played.   This section describes how you can use Badboy to generate such reports, both manually and also as part of your script execution.

HTML Reports

The easiest report to use is the HTML Report - you can easily see it any time just by clicking the "View" menu and selecting "Report".  When you do this, Badboy will save the an HTML version of your script (including images from screen shots) to a temporary file and will show the report in the main Badboy window.  This simple report is easy to use and a great way to get a quick snapshot of your script.

If you want to save the HTML report to keep on your computer or send to someone else you can use the File=>Save As menu:

Save As Menu

The figure below shows an example of how the HTML Report looks after you generate it:

Example of HTML Report

When you save the HTML Report, Badboy saves the images that are used in the report in a sub-directory that is named with the same name as the HTML file with "-images" appended.   If you want to copy your report to another location then you need to copy this folder with the images as well.  To send to another person, the most convenient way may be to "zip" the files using a Zip utility or a "Compressed Folder" (Windows XP only).

Saving  an HTML Report as part of your Script

Often you want to run a test and have it automatically save a report for you so that you can review the results later without having to remember to manually save the report.  This is especially useful when scripts run unsupervised as part of a batch process.  You can do this in Badboy by using the Save Item from the toolbox.  Just drop a Save Item into your script at the place where you would like it to execute.  The Save Item Properties dialog will show (see image below).   You should then select the "Script" radio button and choose "HTML Report" from the adjacent drop down menu. 

Save Item Properties

If you would like Badboy to display the report in the browser window as part of playing the script, check the "Show Saved File in Browser after Saving" option in the properties dialog box.

Including Screen Shots in your Report

Badboy automatically includes any screen shots that were captured as part of your script in the saved reports, including those that may have been automatically captured by Assertions. Additionally, if you configure screen shots of Response Time graphs then your report will display graphs of response times for the configured items as well (see Taking Screen Shots for more information).

Exporting Raw XML

Many tools can read and write XML files to import and export data.  If you such tools then you can use them with Badboy by saving the script as XML.   To do this, follow the same steps as above for the HTML Report, but choose either "Badboy XML" or "Badboy Script (XML)" instead of "HTML Report" in the menu and/or properties dialog option.  Saving as XML can also be a very convenient way to integrate your scripts with other automated processes as the XML is a human-readable format  - allowing you to easily write scripts that perform tasks based on the output of Badboy.

Note that Badboy supports two different XML formats - the "Badboy Script (XML)" format is now the preferred format and should be used unless you have a particular reason to use the old format. See the File Formats section for more information.

Generating Custom Reports

With some simple XML knowledge the Save Item allows you to generate customized reports containing exactly the details that you want or even in a completely arbitrary format that you design.  This is achieved by specifying an XSL Stylesheet for Badboy to use to format the saved file.   XSL Stylesheets are a highly popular and standard way of formatting  XML documents.   They use a file called a "Stylesheet" to describe what should appear in the output document based on the input document (in this case the input document is Badboy's XML file format).  You can find many sources of information on how to write XSL on the internet.

Since Badboy itself uses XML Stylesheets to perform it's file export functions, the best way to start learning about them is to look in your Badboy install directory for a directory called "xsl".  In here you can see all the stylesheets that Badboy uses to perform functions such as producing the HTML Report, exporting JMeter files and rendering the Summary View in the Badboy window.   If you wish, you can even modify these default stylesheets to reflect your own preferences.

Note:  if you modify the default style sheets, please remember that re-installing or upgrading Badboy may overwrite these stylesheets and you may lose your work.  It is strongly suggested to keep a backup so that you can restore them if this happens!

To apply a style sheet of your own, use the Save item and choose the "Script" radio button and then "Badboy XML" as the output format in the properties dialog.  Then you will see that the "Stylesheet" box becomes enabled and you can choose the stylesheet file for Badboy to apply.  If the box is blank Badboy will not apply any stylesheet and will instead export raw Badboy XML.

Badboy used to save reports using BadboyXML by default. However in version 2.0 a new XML Format was introduced and the HTML report is now generated by default from this new format. If you still wish to use the old format, you can select Badboy XML in the Save Item dropdown instead of "Badboy Script (XML)" and then the old Badboy XML format will be generated and you can use a stylesheet with that, if you wish.

Badboy Documentation Generated on Mon Dec 29 22:28:42 EST 2008