# \[eggPlant Functional\] XML Report Format

**URL:** <https://forums.eggplantsoftware.com/t/eggplant-functional-xml-report-format/1682>\
**Category:** Eggplant Examples\
**Created:** [July 20, 2007, 5:08pm UTC](https://forums.eggplantsoftware.com/t/eggplant-functional-xml-report-format/1682 "2007-07-20T17:08:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SenseTalkDoug](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/sensetalkdoug/32/88_2.png) [@SenseTalkDoug](https://forums.eggplantsoftware.com/u/SenseTalkDoug)\
**Post date:** [July 20, 2007, 5:08pm UTC](https://forums.eggplantsoftware.com/t/eggplant-functional-xml-report-format/1682/1 "2007-07-20T17:08:36Z")

</div>

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](http://jra1mw.cvs.cern.ch:8180/cgi-bin/jra1mw.cgi/org.glite.testing.unit/config/JUnitXSchema.xsd?rev=HEAD&content-type=text/vnd.viewcvs-markup)).

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:

```auto
<?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>

```

---

<div class="post-metadata">

**Author:** ![Alex](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@Alex](https://forums.eggplantsoftware.com/u/Alex)\
**Post date:** [September 19, 2008, 10:59am UTC](https://forums.eggplantsoftware.com/t/eggplant-functional-xml-report-format/1682/2 "2008-09-19T10:59:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Navneeth](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/n/76d3ee/32.png) [@Navneeth](https://forums.eggplantsoftware.com/u/Navneeth)\
**Post date:** [February 5, 2009, 6:00am UTC](https://forums.eggplantsoftware.com/t/eggplant-functional-xml-report-format/1682/3 "2009-02-05T06:00:45Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![SenseTalkDoug](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/sensetalkdoug/32/88_2.png) [@SenseTalkDoug](https://forums.eggplantsoftware.com/u/SenseTalkDoug)\
**Post date:** [February 5, 2009, 10:52am UTC](https://forums.eggplantsoftware.com/t/eggplant-functional-xml-report-format/1682/4 "2009-02-05T10:52:05Z")

</div>

You might try the [example script posted here](http://www.testplant.com/phpBB2/viewtopic.php?t=24) as a starting point for generating HTML reports. There are a couple of different HTML templates included with that example.

---

<div class="post-metadata">

**Author:** ![eggtester](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/e/3be4f8/32.png) [@eggtester](https://forums.eggplantsoftware.com/u/eggtester)\
**Post date:** [September 1, 2010, 9:51am UTC](https://forums.eggplantsoftware.com/t/eggplant-functional-xml-report-format/1682/5 "2010-09-01T09:51:57Z")

</div>

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…

```auto
put merge(template) into file resultsName

```

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

---

<div class="post-metadata">

**Author:** ![jahanbadri](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@jahanbadri](https://forums.eggplantsoftware.com/u/jahanbadri)\
**Post date:** [January 26, 2017, 1:07pm UTC](https://forums.eggplantsoftware.com/t/eggplant-functional-xml-report-format/1682/6 "2017-01-26T13:07:26Z")

</div>

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:

```auto
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

```

---

<div class="post-metadata">

**Author:** ![EggplantMatt](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/eggplantmatt/32/3_2.png) [@EggplantMatt](https://forums.eggplantsoftware.com/u/EggplantMatt)\
**Post date:** [January 27, 2017, 10:57am UTC](https://forums.eggplantsoftware.com/t/eggplant-functional-xml-report-format/1682/7 "2017-01-27T10:57:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![EggplantMatt](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/eggplantmatt/32/3_2.png) [@EggplantMatt](https://forums.eggplantsoftware.com/u/EggplantMatt)\
**Post date:** [March 24, 2017, 2:19pm UTC](https://forums.eggplantsoftware.com/t/eggplant-functional-xml-report-format/1682/8 "2017-03-24T14:19:51Z")

</div>

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.
