[Zope-dev] Writing output logs from zope.testing.testrunner

Martin Aspeli optilude+lists at gmail.com
Fri Nov 6 10:12:00 EST 2009


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



More information about the Zope-Dev mailing list