Using XML::XSLT to make your test results pretty
Q: Is it possible to export QTP results to HTML format?
A: Mercury has provided nearly everything you’d ever need to make this happen, and it’s highly customizable if you take the time to learn XSLT.
XSLT is a simple technology, used to transform XML documents into other kinds of documents. QTP comes with three XSL files, which transform the Results.xml file into perfectly readable HTML code.
These stylesheets live in the <QTP root>\dat\ folder (on mine, it’s C:\Program Files\Mercury Interactive\QuickTest Professional\dat):
PShort.xsl
PDetails.xsl
PSelection.xsl
When the test run report is generated, it’s stored in a directory something like this:
<test folder>\Res1\Report\Results.xml
To see it, you have to add the following line below the XML declaration in Results.xml, so it looks like this:
<?xml version=“1.0″?>
<!– This assumes you’ve made the PShort.xsl file available via a web server!! –>
<?xml-stylesheet href=“http://localhost/qtp/PShort.xsl” type=“text/xsl”?>
Then view the Results.xml file in IE (which has an XSL engine built into it).
What we do is, we use an external XSLT transformation tool called ‘xsltproc’ (which comes from the LibXML2 suite at XMLSoft) to generate an HTML file, which we then upload to a server that archives all our test result information. That way nobody needs Mercury’s Results Viewer app (that blasted thing takes you through too many clicks to get what you want, and it doesn’t remember your filter preferences from one session to the next… GARR!!!!)
This is much better for everyone on my team.
[...] formatting the QTP results to display as part of the Web dashboard reports. QTP itself uses different style sheets to format its own xml test results, so one option is to tweak their style sheets to conform to the [...]
Pingback by Part 7: Continuous Integration - The QtpBuild - From the software development trenches | September 17, 2007 |