<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Looking for TDD Swing code</title>
	<link>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/</link>
	<description>Product Development in Brisbane</description>
	<pubDate>Fri, 05 Dec 2008 10:20:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
		<item>
		<title>By: Rob@Rojotek &#187; Blog Archive &#187; Utility method for TDD of a SwingBorderLayout</title>
		<link>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-16743</link>
		<dc:creator>Rob@Rojotek &#187; Blog Archive &#187; Utility method for TDD of a SwingBorderLayout</dc:creator>
		<pubDate>Thu, 12 Jun 2008 02:25:46 +0000</pubDate>
		<guid>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-16743</guid>
		<description>[...] have been working with different ideas for Test Driven Swing code for a while now. Recently, Suneth and I came up with a new strategy for testing Swing BorderLayouts (unfortunately [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] have been working with different ideas for Test Driven Swing code for a while now. Recently, Suneth and I came up with a new strategy for testing Swing BorderLayouts (unfortunately [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George Dinwiddie</title>
		<link>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-510</link>
		<dc:creator>George Dinwiddie</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-510</guid>
		<description>Jeff Waltzer and I started a small project to try out TDD GUI.  We started with straight junit, and found the code was driving us toward reimplementing jfcunit, so we switched to that.

We didn't finish the project, but the experiment was a success.  See &lt;a href="http://sourceforge.net/projects/mp3tagmaster/"&gt;http://sourceforge.net/projects/mp3tagmaster/&lt;/a&gt; for the code.

 - George</description>
		<content:encoded><![CDATA[<p>Jeff Waltzer and I started a small project to try out TDD GUI.  We started with straight junit, and found the code was driving us toward reimplementing jfcunit, so we switched to that.</p>
<p>We didn&#8217;t finish the project, but the experiment was a success.  See <a href="http://sourceforge.net/projects/mp3tagmaster/">http://sourceforge.net/projects/mp3tagmaster/</a> for the code.</p>
<p> - George</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Bourke</title>
		<link>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-491</link>
		<dc:creator>Ian Bourke</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-491</guid>
		<description>I don't actually have any code to give you, but I have written a Swing app in a test-driven manner (well, as test-driven as I could make it at the time). 

Basically, provided that you have a proper MVC design, you can mock one or two of the three pieces and test the third in isolation. However, unless you use a clever "I can mock a class" mock library, this does mean that you end up having a bunch of interfaces for your MVC classes. 

For the app that I worked on, we actually had a common interface for each view and controller that could be mocked, that provided pub-sub methods for gui "events". That meant that we could mock the controller and check that the view published the correct messages when we fiddled with the Swing components, and the mock view received the right messages when we called methods on the controller. If I remember correctly, we never needed to mock the model, as it was essentially just a value object. 

It might be more flexible to mock the classes directly, so that you aren't constrained by the potentially limited messages based notification through the limited methods on the interfaces described above.

Of course, this still leaves all of the layout to do with no tests at all ;-)</description>
		<content:encoded><![CDATA[<p>I don&#8217;t actually have any code to give you, but I have written a Swing app in a test-driven manner (well, as test-driven as I could make it at the time). </p>
<p>Basically, provided that you have a proper MVC design, you can mock one or two of the three pieces and test the third in isolation. However, unless you use a clever &#8220;I can mock a class&#8221; mock library, this does mean that you end up having a bunch of interfaces for your MVC classes. </p>
<p>For the app that I worked on, we actually had a common interface for each view and controller that could be mocked, that provided pub-sub methods for gui &#8220;events&#8221;. That meant that we could mock the controller and check that the view published the correct messages when we fiddled with the Swing components, and the mock view received the right messages when we called methods on the controller. If I remember correctly, we never needed to mock the model, as it was essentially just a value object. </p>
<p>It might be more flexible to mock the classes directly, so that you aren&#8217;t constrained by the potentially limited messages based notification through the limited methods on the interfaces described above.</p>
<p>Of course, this still leaves all of the layout to do with no tests at all <img src='http://www.rojotek.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart</title>
		<link>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-492</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-492</guid>
		<description>I've also done something similar to what Ian describes above. I've built my form using a factory and then mocked that, I've also bound the properties of the components through to an XWork action, using a binder class that can be mocked too.

That way the only things that are left out are the layout and the listeners on the components. Buttons are easy as you can call a doClick directly, but TreeControls / Tables etc are a pain. You have to get a handle on the listener and invoke it directly with an Event.
Check out &lt;a href="http://sourceforge.net/projects/pendulum/"&gt;http://sourceforge.net/projects/pendulum/&lt;/a&gt; from the CVS repository and give it a whirl.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve also done something similar to what Ian describes above. I&#8217;ve built my form using a factory and then mocked that, I&#8217;ve also bound the properties of the components through to an XWork action, using a binder class that can be mocked too.</p>
<p>That way the only things that are left out are the layout and the listeners on the components. Buttons are easy as you can call a doClick directly, but TreeControls / Tables etc are a pain. You have to get a handle on the listener and invoke it directly with an Event.<br />
Check out <a href="http://sourceforge.net/projects/pendulum/">http://sourceforge.net/projects/pendulum/</a> from the CVS repository and give it a whirl.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: No two</title>
		<link>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-493</link>
		<dc:creator>No two</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-493</guid>
		<description>Good luck!</description>
		<content:encoded><![CDATA[<p>Good luck!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ollie</title>
		<link>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-494</link>
		<dc:creator>Ollie</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-494</guid>
		<description>There's a realy good book on TDD which covers Swing tests in some detail. "Test Driven Development: A Practical Guide" by David Astels. From memory if focusus on the NetBeans "Jemmy" test framework.</description>
		<content:encoded><![CDATA[<p>There&#8217;s a realy good book on TDD which covers Swing tests in some detail. &#8220;Test Driven Development: A Practical Guide&#8221; by David Astels. From memory if focusus on the NetBeans &#8220;Jemmy&#8221; test framework.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart</title>
		<link>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-495</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-495</guid>
		<description>I see this "Test Driven Development : A practical guide" being pointed out everywhere on these sort of threads, and I bought it... more fool me! Although it introduces you to the EasyMock framework, the tests behind the GUI are exceptionally long and drawn out. They're fine for small apps, but for anything serious good luck in writing those tests!</description>
		<content:encoded><![CDATA[<p>I see this &#8220;Test Driven Development : A practical guide&#8221; being pointed out everywhere on these sort of threads, and I bought it&#8230; more fool me! Although it introduces you to the EasyMock framework, the tests behind the GUI are exceptionally long and drawn out. They&#8217;re fine for small apps, but for anything serious good luck in writing those tests!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Hall</title>
		<link>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-497</link>
		<dc:creator>David Hall</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid>http://www.rojotek.com/blog/2004/09/07/looking-for-tdd-swing-code/#comment-497</guid>
		<description>As part of my JGA library, I've developed a small set of swing models, renderers, and editors for which I've created junit tests using jfcunit.  It's an lgpl project, and the cvs tree is browsable from my homepage.  It's not a lot of code, but there's one datapoint you can work with.

http://jga.sf.net/</description>
		<content:encoded><![CDATA[<p>As part of my JGA library, I&#8217;ve developed a small set of swing models, renderers, and editors for which I&#8217;ve created junit tests using jfcunit.  It&#8217;s an lgpl project, and the cvs tree is browsable from my homepage.  It&#8217;s not a lot of code, but there&#8217;s one datapoint you can work with.</p>
<p><a href="http://jga.sf.net/" rel="nofollow">http://jga.sf.net/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
