JUnit Compatible Reporting for Windmill
adam
August 29, 2008
Contrib, Slide, Technology, Windmill, continuous, integration, reporting, testing, windmill-dev
A large part of the utility in a testing framework like Windmill is the ability to interoperate with a continuous integration environment. Much of the work that has gone into Windmill recently has been the result of continuous integration needs. There are many ways to do this with existing software packages out there that include Tinderbox,Buildbot and Cruise Control however we picked Hudson as a result of the super small learning overhead and amazing simplicity required to setup slaves on the network.
One of the requirements of course for parsing results is the need for JUnit compatible XML output from the Windmill test runs. I don't claim to be a Python wizard, or a XML/Java wizard for that matter but it wasn't that painful to hammer out a function to generate some minimal output to get the process off the ground.
I would love to get a wiki page up on Get Windmill to start documenting the many ways to use Windmill in a continuous integration environment. So let me know if you have a working setup and would like to contribute.
Example Reporting Excerpt from __init__.py:
Example Reporting Excerpt from __init__.py:
from functest import reports
from datetime import datetime
class JUnitReport(reports.FunctestReportInterface):
def summary(self, test_list, totals_dict, stdout_capture):
total_sec = 0
for entry in test_list:
time_delta = entry.endtime - entry.starttime
total_sec += time_delta.seconds
out = '\n'
out += '\n'
for entry in test_list:
if entry.result is not True:
entry_time = entry.endtime - entry.starttime
out += '\n'
out += '\n'
#out += str(stdout_capture)
#until I can figure out how to get the traceback
out += 'There was an error in '+ entry.__name__
out += '\n\n'
out += ''
else:
entry_time = entry.endtime - entry.starttime
out += '\n'
out += '\n\n'
out += ''
f=open('continuous_test.log','w')
f.write(out);
f.close()
reports.register_reporter(JUnitReport())
Happy automating!