[eggPlant Functional] XML Report Format

Thanks to a recent request from a customer, here is a script that generates a file that reports the status of the most recent run of each script in a suite. The file is in XML format, using a proposed schema that has been adopted by some unit testing tools (the JUnitX schema is described here).

This is presented as an example of how SenseTalk’s merge() function can be used to create such a format using a template file. I’m not sure I’ve reported the appropriate pieces of information in every case, and some parts are definitely incomplete, but you should be able to adapt this example to your particular needs.

The output is a file that looks something like this:

<?xml version="1.0" ?>

<testsuite errors="1" failures="1" name="Examples.suite" tests="4" time="0.000">


      <testcase classname="" name="copyPaste1" time="0.000">

            <failure type="FAILURE">No Remote Connection click Error - Remote Connection UnavailableExecution Time 0:00:00 copyPaste1.script</failure>
      </testcase>

      <testcase classname="" name="rot13" time="0.000">
      </testcase>

      <testcase classname="" name="RunScheduledScripts" time="0.000">
      </testcase>

      <testcase classname="" name="tester" time="0.000">
      </testcase>


      <system-out><![CDATA[]]></system-out>

      <system-err><![CDATA[]]></system-err>

</testsuite>

Yes, I think this format would work for almost any automated tool, I’ll see if can get it running. Thank You so much

Hi
Is there a way to get the same converted to HTML format with the page opening the errors through a link incase of Failures and also displaying the total of Success and Failures in a summary report ?

You might try the example script posted here as a starting point for generating HTML reports. There are a couple of different HTML templates included with that example.

Hi when I try and run this, I get the following error message:

STUnknownMessage ERROR: No Such Function: ‘status’
Execution Time: 0:00:04 XMLReport.script

This is the line of code that gets highlighted (in XMLReport.script) when it fails…

put merge(template) into file resultsName

Any ideas what needs changing in order to make this work again?

I just got the same error and I was wondering whether anyone has a solution. It looks like inside the xml file doesn’t see the status and errors as functions and aborts the merge function:

set failures to zero
set totalErrors to zero
repeat with each test in testResults
    if the status of test is "Failure" then add 1 to failures
    add test's errors to totalErrors
end repeat

This example was written 10 years ago and as the original post says “you should be able to adapt this example to your particular needs.” So it was never intended to be a complete solution, even 10 years ago. If I find some time I might look at it and see if it can be easily updated, but it may be completely obsolete due to changes in available functionality.

Note that eggPlant already records summary results in XML format, so converting the text results to XML may be unnecessary.

I just tested this script and it worked on the large suite I tested it on. I think you may be running it against a suite that is missing an output file or has a corrupted logFile.txt. When the script fails, use the Show Script button to find the line it failed on. Put a breakpoint on that line and then run the script again. When the script pauses at the breakpoint, check the values that are feeding into it.

You can either clean up the suite so that the script will run, or you can add some checks to the values so that the script doesn’t try to process empty results.