HandleLoadNightly
John Schmitt
jschmitt at kealia.com
Thu Mar 27 20:11:02 UTC 2003
I added a feature to my local install of QMTest. We wanted to be able
to do a 1-click nightly test report page. IOW, the email message that
goes out after a test run should have a click-able URL that loads up the
test report from the server on which it was generated. I kludged it
together with the code I've posted down below.
I couldn't figure out how to pass the complete URL to the report so I
hard-coded it. I guess I don't know enough about web stuff, or
dtml/zope to know how to do this correctly. Can you provide any
suggestions on how to do this a little smarter?
One behavior I noticed here was that if I loaded the nightly-generated
report this way, and then ran another test, its results didn't get shown
until I clicked on View->Directory. Is this what you would expect?
(Please pardon the formatting - a little hard to get right with outlook)
<code>
class QMTestServer(qm.web.WebServer):
def __init__(self, database, port, address, log_file,
targets, context):
#...
( "load-nightly", self.HandleLoadNightly ),
#...
# added by jschmitt
# Purpose: display the nightly results page
def HandleLoadNightly(self, request):
"""Handle a request to upload results.
'request' -- The 'WebRequest' that caused the event."""
import urllib
filename,headers = urllib.urlretrieve(
"http://wwwin/eng/sw/nightly-builds/latest/testresults.qmr" )
f = open( filename )
results = qm.test.base.load_results( f )
self.__results_stream = StorageResultsStream()
for r in results:
self.__results_stream.WriteResult( r )
self.__results_stream.Summarize()
f.close()
# Redirect to the results page.
request = qm.web.WebRequest("show-results", base=request)
raise qm.web.HttpRedirect, request
</code>
-- John
More information about the qmtest
mailing list