What's a good XSL to translate xmlrunner.py output into a test report?

Phlip phlip2005 at gmail.com
Thu Jun 3 12:47:49 EDT 2010


Hypo Nt:

Here's xmlrunner.py:

  http://www.rittau.org/python/xmlrunner.py

you attach it to your developer tests, and it emits a file called
"TEST-unittest.TestSuite.xml", containing auspicious wackiness like
this:

  <testcase
classname="tests.unit.gateways.authorize_net_tests.AuthorizeNetTests"
name="test_failed_credit" time="0.0017"></testcase>
  <testcase
classname="tests.unit.gateways.authorize_net_tests.AuthorizeNetTests"
name="test_fraudulent_avs_result" time="0.0010"></testcase>
  <testcase
classname="tests.unit.gateways.authorize_net_tests.AuthorizeNetTests"
name="test_fraudulent_cvv_result" time="0.0011"></testcase>

That looks just like the kind of stereotypical XML that XSL was
designed to convert into HTML, for civilian reading! All the verbiage
for XML test runners claim they do JUnit output, so that JUnit XSL
files can convert them into HTML.

So here's a sample JUNIT.XSL:

http://www.google.com/codesearch/p?hl=en#T32D24pjTaw/trunk/test-integration-ui/resources/test-plugins/org.eclipse.swtbot.eclipse.junit4.headless_2.0.0.329-dev/JUNIT.XSL

It contains matchers like these:

  <xsl:template match="testcase" mode="print.test">

And when I run it with this command line...

   xsltproc JUNIT.XSL TEST-unittest.TestSuite.xml

...it outputs nothing!

Long story short, how do I format my test output prettily? All the
bloggage on this seems to assume that everyone already knows this
because _everyone_ graduated to Python thru Java...

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand



More information about the Python-list mailing list