<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: A new approach to unit tests</title>
	<atom:link href="http://www.javalinux.it/wordpress/2008/10/20/a-new-approach-to-unit-tests/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javalinux.it/wordpress/2008/10/20/a-new-approach-to-unit-tests/</link>
	<description>Alessio &#38; Stefano ideas</description>
	<lastBuildDate>Thu, 06 May 2010 07:51:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Stefano MAESTRI</title>
		<link>http://www.javalinux.it/wordpress/2008/10/20/a-new-approach-to-unit-tests/comment-page-1/#comment-1278</link>
		<dc:creator>Stefano MAESTRI</dc:creator>
		<pubDate>Sat, 10 Jan 2009 22:17:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.javalinux.it/wordpress/?p=116#comment-1278</guid>
		<description>What do you mean exactly with &quot;can I copy&quot;?
Where do you want to copy it?</description>
		<content:encoded><![CDATA[<p>What do you mean exactly with &#8220;can I copy&#8221;?<br />
Where do you want to copy it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: purse</title>
		<link>http://www.javalinux.it/wordpress/2008/10/20/a-new-approach-to-unit-tests/comment-page-1/#comment-1262</link>
		<dc:creator>purse</dc:creator>
		<pubDate>Sat, 03 Jan 2009 07:23:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.javalinux.it/wordpress/?p=116#comment-1262</guid>
		<description>hi,
thanks,The article was very well written, very helpful to me</description>
		<content:encoded><![CDATA[<p>hi,<br />
thanks,The article was very well written, very helpful to me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TimurAlhimenkov</title>
		<link>http://www.javalinux.it/wordpress/2008/10/20/a-new-approach-to-unit-tests/comment-page-1/#comment-1255</link>
		<dc:creator>TimurAlhimenkov</dc:creator>
		<pubDate>Thu, 01 Jan 2009 21:30:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.javalinux.it/wordpress/?p=116#comment-1255</guid>
		<description>I really liked this post. Can I copy?
Thank you in advance.

Sincerely, Timur.</description>
		<content:encoded><![CDATA[<p>I really liked this post. Can I copy?<br />
Thank you in advance.</p>
<p>Sincerely, Timur.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: links for 2008-10-30 &#124; iLenceel</title>
		<link>http://www.javalinux.it/wordpress/2008/10/20/a-new-approach-to-unit-tests/comment-page-1/#comment-771</link>
		<dc:creator>links for 2008-10-30 &#124; iLenceel</dc:creator>
		<pubDate>Thu, 30 Oct 2008 19:07:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.javalinux.it/wordpress/?p=116#comment-771</guid>
		<description>[...] A new approach to unit tests &#124; Legolas in Minas Tirith BDD [...]</description>
		<content:encoded><![CDATA[<p>[...] A new approach to unit tests | Legolas in Minas Tirith BDD [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alistair</title>
		<link>http://www.javalinux.it/wordpress/2008/10/20/a-new-approach-to-unit-tests/comment-page-1/#comment-764</link>
		<dc:creator>Alistair</dc:creator>
		<pubDate>Mon, 27 Oct 2008 09:09:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.javalinux.it/wordpress/?p=116#comment-764</guid>
		<description>sorry, just realised the xml might not show up in my comment!

&lt;tests&gt;
  &lt;test name=&quot;org.funny.farm.APIInterface&quot; class=&quot;...&quot;/&gt;
&lt;tests&gt;</description>
		<content:encoded><![CDATA[<p>sorry, just realised the xml might not show up in my comment!</p>
<p>&lt;tests&gt;<br />
  &lt;test name=&#8221;org.funny.farm.APIInterface&#8221; class=&#8221;&#8230;&#8221;/&gt;<br />
&lt;tests&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alistair</title>
		<link>http://www.javalinux.it/wordpress/2008/10/20/a-new-approach-to-unit-tests/comment-page-1/#comment-763</link>
		<dc:creator>Alistair</dc:creator>
		<pubDate>Mon, 27 Oct 2008 09:06:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.javalinux.it/wordpress/?p=116#comment-763</guid>
		<description>Interesting idea. Why annotate every method though? It clutters the code and makes it difficult to change a test hierarchy (you have to change all the class references in code which has nothing to do with the test hierarchy and then recompile that code). Why annotate classes at all? Why not just annotate the interface? The test will know exactly what methods should be tested. It will know the signature of each method so can test each method, without having to annotate every method in the implementing class. So you would do:

@TestedBy(testClass = ...
public interface APIInterface {

but that&#039;s too much hard coding for my liking. If you&#039;re going to create a new testing framework, why not consider IOC? Allow the framework to inject the test hierarchy based on an abstraction?

package org.funnyfarm;

@TestedBy(testHierarchy = ...
public interface APIInterface {

but you could refine it further by using the interface name as a lookup into a set of hierarchies registered with the framework. i.e. something along the lines of:

@TestedBy
public interface APIInterface {


  


that way you have one hook in the interface. No hooks in implementation code - APIInterfaceImpl implements APIInterface should be enough for the framework to test APIInterfaceImpl. Who cares what else APIInterfaceImpl does. It might implement another interface but the framework would know that from the signature and test accordingly.</description>
		<content:encoded><![CDATA[<p>Interesting idea. Why annotate every method though? It clutters the code and makes it difficult to change a test hierarchy (you have to change all the class references in code which has nothing to do with the test hierarchy and then recompile that code). Why annotate classes at all? Why not just annotate the interface? The test will know exactly what methods should be tested. It will know the signature of each method so can test each method, without having to annotate every method in the implementing class. So you would do:</p>
<p>@TestedBy(testClass = &#8230;<br />
public interface APIInterface {</p>
<p>but that&#8217;s too much hard coding for my liking. If you&#8217;re going to create a new testing framework, why not consider IOC? Allow the framework to inject the test hierarchy based on an abstraction?</p>
<p>package org.funnyfarm;</p>
<p>@TestedBy(testHierarchy = &#8230;<br />
public interface APIInterface {</p>
<p>but you could refine it further by using the interface name as a lookup into a set of hierarchies registered with the framework. i.e. something along the lines of:</p>
<p>@TestedBy<br />
public interface APIInterface {</p>
<p>that way you have one hook in the interface. No hooks in implementation code &#8211; APIInterfaceImpl implements APIInterface should be enough for the framework to test APIInterfaceImpl. Who cares what else APIInterfaceImpl does. It might implement another interface but the framework would know that from the signature and test accordingly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A new approach to unit tests &#171; Stefon&#8217;s Blog</title>
		<link>http://www.javalinux.it/wordpress/2008/10/20/a-new-approach-to-unit-tests/comment-page-1/#comment-761</link>
		<dc:creator>A new approach to unit tests &#171; Stefon&#8217;s Blog</dc:creator>
		<pubDate>Sun, 26 Oct 2008 10:36:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.javalinux.it/wordpress/?p=116#comment-761</guid>
		<description>[...] More on this topic can be read in A new approach to unit tests. [...]</description>
		<content:encoded><![CDATA[<p>[...] More on this topic can be read in A new approach to unit tests. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefano MAESTRI</title>
		<link>http://www.javalinux.it/wordpress/2008/10/20/a-new-approach-to-unit-tests/comment-page-1/#comment-748</link>
		<dc:creator>Stefano MAESTRI</dc:creator>
		<pubDate>Fri, 24 Oct 2008 09:38:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.javalinux.it/wordpress/?p=116#comment-748</guid>
		<description>@Paul
A lot of good points here. May I ask you to join our discussion group (link in my last post) to help us in our discussions.
Just very brief answer:
1) yep it will be possible to do that. I have already thought about.
2) As said in the article TestedBy will also provide annotations for testclass&#039; factories. And finally APITest it&#039;s a JUnit class, but @Before can&#039;t accept parameter. As said in another comment @BeforeTestedBy is a very bad name, maybe @InjectTestClassInstance (or somthing like it) would be much better</description>
		<content:encoded><![CDATA[<p>@Paul<br />
A lot of good points here. May I ask you to join our discussion group (link in my last post) to help us in our discussions.<br />
Just very brief answer:<br />
1) yep it will be possible to do that. I have already thought about.<br />
2) As said in the article TestedBy will also provide annotations for testclass&#8217; factories. And finally APITest it&#8217;s a JUnit class, but @Before can&#8217;t accept parameter. As said in another comment @BeforeTestedBy is a very bad name, maybe @InjectTestClassInstance (or somthing like it) would be much better</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://www.javalinux.it/wordpress/2008/10/20/a-new-approach-to-unit-tests/comment-page-1/#comment-747</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Fri, 24 Oct 2008 08:56:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.javalinux.it/wordpress/?p=116#comment-747</guid>
		<description>I like the idea that one can specify near the code the tests that are expected to be run, and with ide/tool support that could be very powerful.

However two things occur to me after reading your post...

1) with the annotations, i know i would get pretty hacked off writing the testing class name over and over and over again....i dont know if its possible but if so wouldnt it be better to put a testedBy annotation on the class as well and list the test class there? then you wouldnt need to repeat it all the time but if you wanted too could override it in a specific method annotation.

This would of course restrict/ecourage you to put all the tests in one class, but most of us do that anyway dont we? and if you really wanted to you could still use the full anotation on each method....

2) With the interface tests and the running a test against each implementation, how do you envisage getting around the various constructors required for the different implementations? 

Currently I specify an abstract class for each Interface, The test methods in it test the interfaces contract, then for each implementation i provide a test class that extends the abstract class... I assume this pattern is used by many of us.

The TestedBy annotations could still be applied to that and would even allow you to ensure that the test classes for an implementation actually extend the abstract test class.

Im still skeptical about the BeforeTestedBy anotation ...after all its in the test class ( if i havent missunderstood ) In which case the annotation is then missleading .... Id also unclear if the APITest Class is a JUnit test? If not why not? and if it isnt why not use the Before annotation?</description>
		<content:encoded><![CDATA[<p>I like the idea that one can specify near the code the tests that are expected to be run, and with ide/tool support that could be very powerful.</p>
<p>However two things occur to me after reading your post&#8230;</p>
<p>1) with the annotations, i know i would get pretty hacked off writing the testing class name over and over and over again&#8230;.i dont know if its possible but if so wouldnt it be better to put a testedBy annotation on the class as well and list the test class there? then you wouldnt need to repeat it all the time but if you wanted too could override it in a specific method annotation.</p>
<p>This would of course restrict/ecourage you to put all the tests in one class, but most of us do that anyway dont we? and if you really wanted to you could still use the full anotation on each method&#8230;.</p>
<p>2) With the interface tests and the running a test against each implementation, how do you envisage getting around the various constructors required for the different implementations? </p>
<p>Currently I specify an abstract class for each Interface, The test methods in it test the interfaces contract, then for each implementation i provide a test class that extends the abstract class&#8230; I assume this pattern is used by many of us.</p>
<p>The TestedBy annotations could still be applied to that and would even allow you to ensure that the test classes for an implementation actually extend the abstract test class.</p>
<p>Im still skeptical about the BeforeTestedBy anotation &#8230;after all its in the test class ( if i havent missunderstood ) In which case the annotation is then missleading &#8230;. Id also unclear if the APITest Class is a JUnit test? If not why not? and if it isnt why not use the Before annotation?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefano MAESTRI</title>
		<link>http://www.javalinux.it/wordpress/2008/10/20/a-new-approach-to-unit-tests/comment-page-1/#comment-741</link>
		<dc:creator>Stefano MAESTRI</dc:creator>
		<pubDate>Thu, 23 Oct 2008 07:59:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.javalinux.it/wordpress/?p=116#comment-741</guid>
		<description>@VonC
yep and it&#039;s exactly what @TestedByList does: array of annotations inside another annotation.</description>
		<content:encoded><![CDATA[<p>@VonC<br />
yep and it&#8217;s exactly what @TestedByList does: array of annotations inside another annotation.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
