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

Discussion in 'Python' started by Phlip, Jun 3, 2010.

  1. Phlip

    Phlip Guest

    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?...lipse.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
    Phlip, Jun 3, 2010
    #1
    1. Advertising

  2. Phlip

    Phlip Guest

    On Jun 3, 9:47 am, Phlip <> wrote:
    > 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 thatXSLwas
    > designed to convert into HTML, for civilian reading! All the verbiage
    > for XML test runners claim they do JUnit output, so that JUnitXSL
    > files can convert them into HTML.
    >
    > So here's a sample JUNIT.XSL:
    >
    > http://www.google.com/codesearch/p?hl=en#T32D24pjTaw/trunk/test-integ....
    >
    > It contains matchers like these:
    >
    >   <xsl:template match="testcase" mode="print.test">
    >
    > And when I run it with this command line...
    >
    >    xsltproc JUNIT.XSLTEST-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...


    Bump? Anyone reporting on their unit tests here?
    Phlip, Jun 6, 2010
    #2
    1. Advertising

  3. Phlip, 06.06.2010 19:12:
    >> 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>

    >
    > Bump? Anyone reporting on their unit tests here?


    I only use XML reporting in combination with the Hudson-CI tool. It parses
    the output and (amongst other things) reports the results over a serious of
    builds through its web site. It's also very easy to set up, so maybe that's
    what you are actually looking for?

    Stefan
    Stefan Behnel, Jun 13, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ray Tayek
    Replies:
    3
    Views:
    505
    Ray Tayek
    Nov 30, 2003
  2. Replies:
    1
    Views:
    3,591
    A. Bolmarcich
    May 27, 2005
  3. Replies:
    0
    Views:
    544
  4. Replies:
    0
    Views:
    522
  5. jeanph01

    xsl translate function in javascript

    jeanph01, Aug 3, 2009, in forum: Javascript
    Replies:
    3
    Views:
    134
    Dr J R Stockton
    Aug 5, 2009
Loading...

Share This Page