<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-18140762.comments</id><updated>2008-10-10T02:20:46.432-07:00</updated><category term='breakage'/><category term='dependency injection'/><category term='java'/><category term='refactoring'/><category term='stub'/><category term='unit'/><category term='mock'/><category term='explorer'/><category term='complexity'/><category term='pinpoint'/><category term='fake'/><category term='code coverage'/><category term='easymock'/><category term='qa'/><category term='metrics'/><category term='testability'/><category term='code smells'/><category term='unit testing'/><category term='dependency'/><category term='emma'/><category term='eclipse'/><category term='code'/><category term='cyclomatic'/><category term='injection'/><category term='testing'/><category term='manual'/><title type='text'>AssertionFailed...</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://shyamseshadri.blogspot.com/feeds/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/comments/default'/><link rel='alternate' type='text/html' href='http://shyamseshadri.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Shyam Seshadri</name><uri>http://www.blogger.com/profile/17328035298561522443</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-18140762.post-1455981466960815052</id><published>2008-10-10T02:20:00.000-07:00</published><updated>2008-10-10T02:20:00.000-07:00</updated><title type='text'>A nice article. Lot of information. I have a small...</title><content type='html'>A nice article. Lot of information. I have a small problem, though. I plugged in EclEmma to Eclipse and it works fine for stand alone applications. How does it work for web applications?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/3069166580029740907/comments/default/1455981466960815052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/3069166580029740907/comments/default/1455981466960815052'/><link rel='alternate' type='text/html' href='http://shyamseshadri.blogspot.com/2008/07/of-emmas-and-eclipses.html?showComment=1223630400000#c1455981466960815052' title=''/><author><name>Alok</name><uri>http://www.blogger.com/profile/10624073878183032930</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://shyamseshadri.blogspot.com/2008/07/of-emmas-and-eclipses.html' ref='tag:blogger.com,1999:blog-18140762.post-3069166580029740907' source='http://www.blogger.com/feeds/18140762/posts/default/3069166580029740907' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1748383134'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.displayTime' value='2:20 AM'/></entry><entry><id>tag:blogger.com,1999:blog-18140762.post-618498140201601603</id><published>2008-08-08T17:21:00.000-07:00</published><updated>2008-08-08T17:21:00.000-07:00</updated><title type='text'>To expand on the concept of the Mockery, a simple ...</title><content type='html'>To expand on the concept of the Mockery, a simple example:&lt;BR/&gt;&lt;I&gt;Foo foo = EasyMock.createMock(Foo.class);&lt;BR/&gt;&lt;BR/&gt;Bar bar = EasyMock.createMock(Bar.class);&lt;BR/&gt;&lt;BR/&gt;Oof oof = EasyMock.createMock(Oof.class);&lt;BR/&gt;&lt;BR/&gt;EasyMock.expect(foo.generateBar())&lt;BR/&gt;        .andReturn(bar);&lt;BR/&gt;&lt;BR/&gt;EasyMock.expect(foo.oofed())&lt;BR/&gt;        .andReturn(oof);&lt;/I&gt;&lt;BR/&gt;&lt;BR/&gt;From these humble beginnings, you can grow an immense Mockery.&lt;BR/&gt;&lt;BR/&gt;Another side effect of excessive mocks is a straight jacketed test, where the test is brittle and confusing to be much more than a regression lock. Which doesn't help, because the failures are invariably hard to debug and fix.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/656101154951473508/comments/default/618498140201601603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/656101154951473508/comments/default/618498140201601603'/><link rel='alternate' type='text/html' href='http://shyamseshadri.blogspot.com/2008/08/mock-mock-whos-there.html?showComment=1218241260000#c618498140201601603' title=''/><author><name>Cory</name><uri>http://www.blogger.com/profile/09359756658186677138</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://shyamseshadri.blogspot.com/2008/08/mock-mock-whos-there.html' ref='tag:blogger.com,1999:blog-18140762.post-656101154951473508' source='http://www.blogger.com/feeds/18140762/posts/default/656101154951473508' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1124670843'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.displayTime' value='5:21 PM'/></entry><entry><id>tag:blogger.com,1999:blog-18140762.post-5734992998882947517</id><published>2008-07-20T09:59:00.000-07:00</published><updated>2008-07-20T09:59:00.000-07:00</updated><title type='text'>@akuhn: Thanks for the great reply. Example driven...</title><content type='html'>@akuhn: Thanks for the great reply. Example driven testing seems like an interesting approach, especially if you prefer to do TDD or EDD. But still, as you mentioned, the House test being shown as white due to a failed dependency means you wouldn't know if House works or not. There might be additional failures which you wouldn't catch until you fix the problem in Kitchen. With mocks on the other hand, Kitchen test fails, we know kitchen has a problem, while the House which uses a mock, and thus probably wouldn't be having the bug allows the House test to pass. Just my thought on the subject.&lt;BR/&gt;&lt;BR/&gt;Well, yes, sadly we are not yet at the level of line level assertion failures. Thought generally, I try not to have too much same class method dependencies. Usually those kind of methods are private as well. And technically, you could mock out public methods with EasyMock, I believe.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/6701700645973070098/comments/default/5734992998882947517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/6701700645973070098/comments/default/5734992998882947517'/><link rel='alternate' type='text/html' href='http://shyamseshadri.blogspot.com/2008/07/getting-to-root-of-problem.html?showComment=1216573140000#c5734992998882947517' title=''/><author><name>Shyam Seshadri</name><uri>http://www.blogger.com/profile/17328035298561522443</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://shyamseshadri.blogspot.com/2008/07/getting-to-root-of-problem.html' ref='tag:blogger.com,1999:blog-18140762.post-6701700645973070098' source='http://www.blogger.com/feeds/18140762/posts/default/6701700645973070098' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-627170722'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.displayTime' value='9:59 AM'/></entry><entry><id>tag:blogger.com,1999:blog-18140762.post-1537587037108694260</id><published>2008-07-13T06:44:00.000-07:00</published><updated>2008-07-13T06:44:00.000-07:00</updated><title type='text'>First of all, thanks for the answer on my blog and...</title><content type='html'>First of all, thanks for the answer on my blog and addressing my comment in a full blog post here. Let my structure this comment in two parts. First I will present example-driven testing, an alternative to mock-based testing. An alternative which I personally find more pragmatic. Ads second, I will show why we are still not at the level of source-line assertion failures.&lt;BR/&gt;&lt;BR/&gt;1)&lt;BR/&gt;&lt;BR/&gt;Given your House with a Kitchen, you propose to use a mock kitchen to test the house. However, setting up a mock can be quite some work. And why do that work if somewhere else we already do all the work of creating a working kitchen? Yes, if only there would be a &lt;I&gt;return value at the end of the kitchen tests&lt;/I&gt; we could use that instead of the mock. &lt;BR/&gt;&lt;BR/&gt;This is exactly what we do in JExample (a JUnit extension): we avoid all the mocks, because our test methods can have return values and dependency injections. Let me give an example&lt;BR/&gt;&lt;BR/&gt;@Test&lt;BR/&gt;public Kitchen testKitchen() {&lt;BR/&gt;    Kitchen k = new Kitchen;&lt;BR/&gt;    // ... assertions&lt;BR/&gt;    return k;&lt;BR/&gt;}&lt;BR/&gt;&lt;BR/&gt;@Test &lt;BR/&gt;@Depends("testKitchen")&lt;BR/&gt;public void testHouse(Kitchen k) {&lt;BR/&gt;    House h = new House(k);&lt;BR/&gt;    // ... assertions&lt;BR/&gt;    return h;&lt;BR/&gt;}&lt;BR/&gt;&lt;BR/&gt;When executing testKitchen, the framework caches the return value: an example kitchen! When executing testHouse this example is injected as invokation argument in the test call.&lt;BR/&gt;&lt;BR/&gt;If however testKitchen fails, the framework reports testKitchen as red and testHouse as white (ie failed due to dependency. Thus pin-pointing us to kitchen as the source of the failure!  &lt;BR/&gt;&lt;BR/&gt;Example injection is also very handy when testing different states of the same instance under test. You just inject the example from one test method to the next, thus testing all different states.&lt;BR/&gt;&lt;BR/&gt;2)&lt;BR/&gt;&lt;BR/&gt;Still, whether using mocks or examples, we are still not level of source-line assertion failures. Why? Even if you know the MUT (method under test) there is no bijective, ie 1:1, relation between methods and test-methods.&lt;BR/&gt;Given the method under test delegates to four private methods (ie 1:n), where is the bug the test fails?&lt;BR/&gt;Given two methods under test delegate to the same private method (ie n:1), where is the bug if only one fails? &lt;BR/&gt;EzUnit by Friedrich Steimann addresses these issues by analysing both the static and runtime coverage of tests and comparing it to each other.&lt;BR/&gt;&lt;BR/&gt;But alas, their tool has no example injection :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/6701700645973070098/comments/default/1537587037108694260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/6701700645973070098/comments/default/1537587037108694260'/><link rel='alternate' type='text/html' href='http://shyamseshadri.blogspot.com/2008/07/getting-to-root-of-problem.html?showComment=1215956640000#c1537587037108694260' title=''/><author><name>akuhn</name><uri>http://www.blogger.com/profile/17211501021299556583</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp3.blogger.com/_TlWuu0D5QkM/R-dz6gCsgsI/AAAAAAAAAAM/VbqAb8rqHYk/S220/passfoto4.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://shyamseshadri.blogspot.com/2008/07/getting-to-root-of-problem.html' ref='tag:blogger.com,1999:blog-18140762.post-6701700645973070098' source='http://www.blogger.com/feeds/18140762/posts/default/6701700645973070098' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-137544115'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.displayTime' value='6:44 AM'/></entry><entry><id>tag:blogger.com,1999:blog-18140762.post-6671041291020519859</id><published>2008-07-12T00:07:00.000-07:00</published><updated>2008-07-12T00:07:00.000-07:00</updated><title type='text'>SO you do have time....</title><content type='html'>SO you do have time....</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/617710378040343865/comments/default/6671041291020519859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/617710378040343865/comments/default/6671041291020519859'/><link rel='alternate' type='text/html' href='http://shyamseshadri.blogspot.com/2008/07/joys-of-testing.html?showComment=1215846420000#c6671041291020519859' title=''/><author><name>Gaurang</name><uri>http://www.blogger.com/profile/10741695961816787973</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://lh3.google.com/gaurang.swarge/RuuC-tO1eWI/AAAAAAAAASo/dXz9NIXY0uU/s144/IMG_2259.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://shyamseshadri.blogspot.com/2008/07/joys-of-testing.html' ref='tag:blogger.com,1999:blog-18140762.post-617710378040343865' source='http://www.blogger.com/feeds/18140762/posts/default/617710378040343865' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1249041969'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.displayTime' value='12:07 AM'/></entry><entry><id>tag:blogger.com,1999:blog-18140762.post-3581113810652736556</id><published>2008-07-11T21:56:00.000-07:00</published><updated>2008-07-11T21:56:00.000-07:00</updated><title type='text'>You wrote:&lt;br&gt;&amp;gt;&amp;quot;Pin point breakages and ca...</title><content type='html'>You wrote:&lt;BR/&gt;&gt;"Pin point breakages and causes of failures to the line level"&lt;BR/&gt;&lt;BR/&gt;Caught my attention. Do you refer to "line of test code" or "line of app code"? If the latter, how do you achieve this? With common unit test, you get the failing line of test code not the failing line of app code. Or even worse, one buggy app line causes dozens or hundreds of test to fail. What is your experience to deal with this?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/617710378040343865/comments/default/3581113810652736556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18140762/617710378040343865/comments/default/3581113810652736556'/><link rel='alternate' type='text/html' href='http://shyamseshadri.blogspot.com/2008/07/joys-of-testing.html?showComment=1215838560000#c3581113810652736556' title=''/><author><name>akuhn</name><uri>http://www.blogger.com/profile/17211501021299556583</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp3.blogger.com/_TlWuu0D5QkM/R-dz6gCsgsI/AAAAAAAAAAM/VbqAb8rqHYk/S220/passfoto4.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://shyamseshadri.blogspot.com/2008/07/joys-of-testing.html' ref='tag:blogger.com,1999:blog-18140762.post-617710378040343865' source='http://www.blogger.com/feeds/18140762/posts/default/617710378040343865' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-137544115'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.displayTime' value='9:56 PM'/></entry></feed>
