<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Adam Christian &#187; Reporting</title>
	<atom:link href="http://www.adamchristian.com/archives/tag/reporting/feed" rel="self" type="application/rss+xml" />
	<link>http://www.adamchristian.com</link>
	<description></description>
	<lastBuildDate>Wed, 08 Feb 2012 17:41:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>JUnit Compatible Reporting for Windmill</title>
		<link>http://www.adamchristian.com/archives/40</link>
		<comments>http://www.adamchristian.com/archives/40#comments</comments>
		<pubDate>Fri, 29 Aug 2008 15:52:38 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Slide]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Windmill]]></category>
		<category><![CDATA[Windmill-dev]]></category>
		<category><![CDATA[Continuous]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Reporting]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://adamchristian.com/?p=40</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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 <a href="http://www.mozilla.org/projects/tinderbox/">Tinderbox</a>,<a href="http://buildbot.net/trac">Buildbot</a> and <a href="http://cruisecontrol.sourceforge.net/">Cruise Control</a> however we picked <a href="https://hudson.dev.java.net/">Hudson</a> as a result of the super small learning overhead and amazing simplicity required to setup slaves on the network.</p>
<p>One of the requirements of course for parsing results is the need for JUnit compatible XML output from the Windmill test runs. I don&#8217;t claim to be a Python wizard, or a XML/Java wizard for that matter but it wasn&#8217;t that painful to hammer out a function to generate some minimal output to get the process off the ground.</p>
<p>I would love to get a wiki page up on <a href="http://www.getwindmill.com">Get Windmill</a> 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.</p>
<p><strong>Example Reporting Excerpt from <em>__init__.py</em>:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> functest <span style="color: #ff7700;font-weight:bold;">import</span> reports
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">datetime</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">datetime</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> JUnitReport<span style="color: black;">&#40;</span>reports.<span style="color: black;">FunctestReportInterface</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> summary<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, test_list, totals_dict, stdout_capture<span style="color: black;">&#41;</span>:
&nbsp;
        total_sec = <span style="color: #ff4500;">0</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> entry <span style="color: #ff7700;font-weight:bold;">in</span> test_list:
            time_delta = entry.<span style="color: black;">endtime</span> - entry.<span style="color: black;">starttime</span>
            total_sec += time_delta.<span style="color: black;">seconds</span> 
        out = <span style="color: #483d8b;">'&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>
        out += <span style="color: #483d8b;">'&lt;testsuite errors=&quot;'</span>+<span style="color: #008000;">str</span><span style="color: black;">&#40;</span>totals_dict<span style="color: black;">&#91;</span><span style="color: #483d8b;">'fail'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">'&quot; failures=&quot;'</span>+<span style="color: #008000;">str</span><span style="color: black;">&#40;</span>totals_dict<span style="color: black;">&#91;</span><span style="color: #483d8b;">'fail'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">'&quot; name=&quot;windmill.functional&quot; tests=&quot;'</span>+<span style="color: #008000;">str</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>test_list<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">'&quot; time=&quot;'</span>+<span style="color: #008000;">str</span><span style="color: black;">&#40;</span>total_sec<span style="color: black;">&#41;</span>+<span style="color: #483d8b;">'&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">for</span> entry <span style="color: #ff7700;font-weight:bold;">in</span> test_list:
            <span style="color: #ff7700;font-weight:bold;">if</span> entry.<span style="color: black;">result</span> <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">True</span>:    
                entry_time = entry.<span style="color: black;">endtime</span> - entry.<span style="color: black;">starttime</span>
                out += <span style="color: #483d8b;">'&lt;testcase classname=&quot;'</span>+entry.__name__+<span style="color: #483d8b;">'&quot; name=&quot;'</span>+entry.__name__+<span style="color: #483d8b;">'&quot; time=&quot;'</span>+<span style="color: #008000;">str</span><span style="color: black;">&#40;</span>entry_time.<span style="color: black;">seconds</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">'.'</span>+<span style="color: #008000;">str</span><span style="color: black;">&#40;</span>entry_time.<span style="color: black;">microseconds</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">'&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>
                out += <span style="color: #483d8b;">'&lt;failure type=&quot;exceptions.AssertionError&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>
                <span style="color: #808080; font-style: italic;">#out += str(stdout_capture)</span>
                <span style="color: #808080; font-style: italic;">#until I can figure out how to get the traceback</span>
                out += <span style="color: #483d8b;">'There was an error in '</span>+ entry.__name__
                out += <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>&lt;/failure&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>
                out += <span style="color: #483d8b;">'&lt;/testcase<span style="color: #000099; font-weight: bold;">\n</span>&gt;'</span>
            <span style="color: #ff7700;font-weight:bold;">else</span>:
                entry_time = entry.<span style="color: black;">endtime</span> - entry.<span style="color: black;">starttime</span>
                out += <span style="color: #483d8b;">'&lt;testcase classname=&quot;'</span>+entry.__name__+<span style="color: #483d8b;">'&quot; name=&quot;'</span>+entry.__name__+<span style="color: #483d8b;">'&quot; time=&quot;'</span>+<span style="color: #008000;">str</span><span style="color: black;">&#40;</span>entry_time.<span style="color: black;">seconds</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">'.'</span>+<span style="color: #008000;">str</span><span style="color: black;">&#40;</span>entry_time.<span style="color: black;">microseconds</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">'&quot;&gt;&lt;/testcase&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> 
&nbsp;
        out += <span style="color: #483d8b;">'&lt;system-out&gt;&lt;![CDATA[]]&gt;&lt;/system-out&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;system-err&gt;&lt;![CDATA[]]&gt;&lt;/system-err&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>
        out += <span style="color: #483d8b;">'&lt;/testsuite&gt;'</span>
        f=<span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'continuous_test.log'</span>,<span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span>
        f.<span style="color: black;">write</span><span style="color: black;">&#40;</span>out<span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
        f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
reports.<span style="color: black;">register_reporter</span><span style="color: black;">&#40;</span>JUnitReport<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Happy automating!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adamchristian.com/archives/40/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: www.adamchristian.com @ 2012-02-09 12:11:45 -->
