Writing output logs from zope.testing.testrunner

View: New views
3 Messages — Rating Filter:   Alert me  

Writing output logs from zope.testing.testrunner

by Martin Aspeli-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm trying to turn the results of a test run using zope.testing
(zc.recipe.testrunner) into a JUnit compliant XML format so that I can
graph it with Hudson (a continuous integration tool).

Are there any hooks in zope.testing to write reporting to a file?

The output I want is something like this:

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="1" failures="3" hostname="hazelnut.osuosl.org"
name="net.cars.engine.PistonTest" tests="5" time="0.048"
timestamp="2007-11-02T23:13:50">
   <properties>
     ...
   </properties>
   <testcase classname="net.cars.engine.PistonTest" name="moveUp"
time="0.022">
     <error message="test timed out after 1 milliseconds"
type="java.lang.Exception">java.lang.Exception: test timed out after 1
milliseconds
</error>
   </testcase>
   <testcase classname="net.cars.engine.PistonTest" name="moveDown"
time="0.0010" />
   <testcase classname="net.cars.engine.PistonTest" name="checkStatus"
time="0.0030">
     <failure message="Plunger status invalid to proceed driving."
type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError:
Plunger status invalid to proceed driving.
        at net.cars.engine.PistonTest.checkStatus(PistonTest.java:42)
</failure>
   </testcase>
   <testcase classname="net.cars.engine.PistonTest" name="checkSpeed"
time="0.0080">
     <failure message="Plunger upward speed below specifications."
type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError:
Plunger upward speed below specifications.
        at net.cars.engine.PistonTest.checkSpeed(PistonTest.java:47)
</failure>
   </testcase>
   <testcase classname="net.cars.engine.PistonTest" name="lubricate"
time="0.0030">
     <failure message="Failed to lubricate the plunger."
type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError:
Failed to lubricate the plunger.
        at net.cars.engine.PistonTest.lubricate(PistonTest.java:52)
</failure>
   </testcase>
   <system-out><![CDATA[Slowly moving up]]></system-out>
   <system-err><![CDATA[]]></system-err>
</testsuite>

Obviously, this is a Java test case, but you get the idea. Incidentally,
I think nose supports this kind of thing already, but I don't think I
can run zope-like tests using layers etc via nose?

Martin

--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@...
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )

Re: Writing output logs from zope.testing.testrunner

by Chris Withers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Martin Aspeli wrote:
> Obviously, this is a Java test case, but you get the idea. Incidentally,
> I think nose supports this kind of thing already, but I don't think I
> can run zope-like tests using layers etc via nose?

Someone proposed writing a nose plugin to do zope.testing layers.
My vote would be to duplicate that rather than trying to rewrite the
output stack of zope.testing.

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@...
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )

Re: Writing output logs from zope.testing.testrunner

by Martin Aspeli-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Martin Aspeli wrote:
> Hi,
>
> I'm trying to turn the results of a test run using zope.testing
> (zc.recipe.testrunner) into a JUnit compliant XML format so that I can
> graph it with Hudson (a continuous integration tool).
>
> Are there any hooks in zope.testing to write reporting to a file?

I couldn't find any, so I created a new test runner which basically
wraps the output formatter to capture key events.

http://pypi.python.org/pypi/collective.xmltestreport

I was able to use this successfully with Hudson:

http://www.martinaspeli.net/articles/using-hudson-ci-for-plone-projects

(this is not Plone specific and would work for anyone using zope.testing)

Martin

--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@...
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )