<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Comments for page &quot;Unit Test Fetish&quot;</title>
		<link>http://250bpm.com/forum/t-869845/unit-test-fetish</link>
		<description>Posts in the discussion thread &quot;Unit Test Fetish&quot;</description>
				<copyright></copyright>
		<lastBuildDate>Sat, 01 Aug 2015 21:47:33 +0000</lastBuildDate>
		
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2252964</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2252964</link>
				<description></description>
				<pubDate>Wed, 18 Mar 2015 17:26:30 +0000</pubDate>
				<wikidot:authorName>francois</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Excellent point 3 (&quot;Unit tests ossify the internal architecture&quot;).<br /> I work in research and I always avoided them to let the software easier/faster<br /> to modify in the future (but I do very rigorous end to end tests at some point of the lifetime of a project).<br /> I even avoid to cast interfaces in stone for the same reason.<br /> Also, I know of some languages where the need for unit tests is quite low: OCaml and Haskell<br /> are good examples.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2239522</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2239522</link>
				<description></description>
				<pubDate>Wed, 25 Feb 2015 01:57:44 +0000</pubDate>
				<wikidot:authorName>citizenfour</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>TDD is religion&#8230; or bible, to be exact</p> <p>It's intent is to provide guide when times are trying, e.g. &quot;I’d fall into despair :)&quot;&#8230;<br /> Bibles are collections of fun stories to read, BTW.</p> <p>:)</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2060939</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2060939</link>
				<description></description>
				<pubDate>Mon, 30 Jun 2014 12:07:56 +0000</pubDate>
				<wikidot:authorName>martin_sustrik</wikidot:authorName>				<wikidot:authorUserId>939</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Frankly, I don't know. I've never tried TDD myself, so it's hard to say. My feeling though is that TDD may be useful in the cases where the problem is well understood (i.e. when you are writing your 5th system doing basically the same task). In such cases it may be possible to get the unit boundaries right immediately and write the unit tests accordingly.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2059434</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2059434</link>
				<description></description>
				<pubDate>Fri, 27 Jun 2014 10:17:16 +0000</pubDate>
				<wikidot:authorName>Przemyslaw Wegrzyn</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>While I usually write unit tests (for parts where it’s worth to), point 3 is exactly the reason why I don’t subscribe to TDD’s “tests first” approach at all.</p> <p>During the creative process I frequently change the interfaces (simply because I’m a mere mortal and I occasionaly overlook some dependencies, or other issues). If I had to write test cases first and rewrite them again and again any time I change my mind about the code structure, I’d fall into despair :) It makes much more sense to write tests once the APIs settle down a bit.</p> <p>Perhaps it very much depends on one’s personal coding style? Or maybe TDD works best for simple pieces of code, where you can decide upon the interface upfront?</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046952</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046952</link>
				<description></description>
				<pubDate>Fri, 06 Jun 2014 15:54:13 +0000</pubDate>
				<wikidot:authorName>martin_sustrik</wikidot:authorName>				<wikidot:authorUserId>939</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Yep, I was ranting against testing private interfaces. I think we are in accord here.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046847</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046847</link>
				<description></description>
				<pubDate>Fri, 06 Jun 2014 13:11:49 +0000</pubDate>
				<wikidot:authorName>Jonty</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Contexts are a business concern. A library would usually be an implementation detail of a particular context, and changing implementation details will not affect tests. In the case of hexagonal architecture/ports and adapters you are making an explicit business decision that you want to de-couple that component from your core domain.</p> <p>A more concrete example would be a UI, Product, Order and Billing context. Unit tests would be:</p> <p>UI - Given known response from Product context, does UI display products correctly<br /> Product context - Given a request for products, are the correct products returned<br /> UI - When clicking submit, does the UI send the correct request to the Order context<br /> Order context - Given an order request, is the correct order placed event raised<br /> Billing - Given order placed event is received, is the correct amount invoiced</p> <p>e2e test would be the whole flow through these.</p> <p>This is just an example of how you might choose to define your contexts/public interfaces. You could decide that the app is one context, but then you should test everything through the UI. Also, you shouldn't be constrained into thinking that the public API is what the &quot;customer&quot; sees. Architectural quality factors play an important part and testability is an important factor that may lead you to split contexts. A common example of this is splitting a processing pipeline into intermediary outputs. It's all a trade off.</p> <p>Also, the idea of testing at the public interface is an ideal. Sometimes you might need to be pragmatic and place tests around implementation details, but you should always be aware these tests are brittle and you should be prepared to throw them away.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046803</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046803</link>
				<description></description>
				<pubDate>Fri, 06 Jun 2014 11:06:24 +0000</pubDate>
				<wikidot:authorName>anti-agile</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>TDD is fascism.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046801</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046801</link>
				<description></description>
				<pubDate>Fri, 06 Jun 2014 11:05:11 +0000</pubDate>
				<wikidot:authorName>martin_sustrik</wikidot:authorName>				<wikidot:authorUserId>939</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>So, afaiu, if i have an app that uses a library, the library API is one context, app's API is another context.</p> <p>So we can have one unit test for the library and another unit test for the app.</p> <p>End-to-end test is a test that test both the library API and the app's API in parallel.</p> <p>If that's the definition of end-to-end, I don't see much point in writing e2e tests at all.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046798</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046798</link>
				<description></description>
				<pubDate>Fri, 06 Jun 2014 10:54:37 +0000</pubDate>
				<wikidot:authorName>Jonty</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>I'm talking about the public API of the particular defined context. The end user of a context might not be a customer/user, that is usually only the case with the UI. There are many influences that introduce contexts, I listed some above. DDD bounded contexts are a good example, the public API's are typically event contracts.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046793</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046793</link>
				<description></description>
				<pubDate>Fri, 06 Jun 2014 10:42:15 +0000</pubDate>
				<wikidot:authorName>martin_sustrik</wikidot:authorName>				<wikidot:authorUserId>939</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>How is the server API part of the public interface? Public interface is what the end user is using, i.e. the GUI in the case of web app.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046789</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046789</link>
				<description></description>
				<pubDate>Fri, 06 Jun 2014 10:37:02 +0000</pubDate>
				<wikidot:authorName>Jonty</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>e2e tests would be across contexts. A better debate might be what constitutes a context. This can vary by project. In a typical web app, there would probably be contexts for the UI and the server, and it might be split by functionality or bounded context (DDD). UI unit tests would mock calls to the server as they are not part of the context. Server tests would be at the http level. If you have separate contexts on the server you would want to test the contracts between them. Also, architectural influences may introduce contexts, for example, if you use hexagonal architecture/ports and adapters/DDD, the domain may be considered a context. This is typically because you desire isolation from 3rd party components that may change over time, so your public API would be at the port (ports and adapters) and you would have test implementations of your adapter layers. e2e tests would then be using real implementations. So, in short, public API is influenced by product, technical and architectural concerns.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046780</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046780</link>
				<description></description>
				<pubDate>Fri, 06 Jun 2014 10:04:27 +0000</pubDate>
				<wikidot:authorName>martin_sustrik</wikidot:authorName>				<wikidot:authorUserId>939</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>If unit test uses public interface of the product how does it differ from e2e test then?</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046778</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046778</link>
				<description></description>
				<pubDate>Fri, 06 Jun 2014 10:02:54 +0000</pubDate>
				<wikidot:authorName>Jonty</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>You are making an incorrect assumption about the scope of a unit test. The slew of this type of post recently would seem to suggest that many people are defining a unit as too small. Unit tests should be written from the public API of the context that you are working in. If this is not a critical path through your system, then you have got the public API wrong. For example, there is nothing &quot;wrong&quot; with a unit test hitting the database, as long as you have suitable isolation.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046760</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046760</link>
				<description></description>
				<pubDate>Fri, 06 Jun 2014 09:18:46 +0000</pubDate>
				<wikidot:authorName>Kartik Agaram</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>I spent some time trying to address points 3 and 4: <a href="http://akkartik.name/post/tracing-tests">http://akkartik.name/post/tracing-tests</a></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046686</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046686</link>
				<description></description>
				<pubDate>Fri, 06 Jun 2014 07:17:26 +0000</pubDate>
				<wikidot:authorName>martin_sustrik</wikidot:authorName>				<wikidot:authorUserId>939</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>@Tony: It's external API (the one exposed to the user) that stayed the same, right? That's what end-to-end tests are supposed to test. Unit tests test internal APIs (invisible to the end user).</p> <p>@Luis: There's in interesting paradox involved here: Unit tests work great once the project is nearing the maintenance phase. There's no much change going on, so the test are never broken by rafactoring or such. At the same time, however, the product in the maintenance phase is already pretty stable and there's not much incentive to write unit tests.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046484</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046484</link>
				<description></description>
				<pubDate>Thu, 05 Jun 2014 22:19:03 +0000</pubDate>
				<wikidot:authorName>Luis</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>&quot;The unit tests were still valid because the API didn't change. Having the tests in place made me feel confident to replace the guts in a weekend. This was a huge benefit.&quot;</p> <p>See, the thing is that you're in a situation where the API is already ossified—you can't change its API very much because you'd break existing clients. Unit tests work great in that situation.</p> <p>Where they don't work so great is when you still don't have clients and you're trying to come up with a good API. You spend a lot of effort writing a bunch of unit tests&#8230; and then you realize your API, which still doesn't have any code using it, is poorly organized. Now you have to throw out all of the existing unit tests.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046423</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046423</link>
				<description></description>
				<pubDate>Thu, 05 Jun 2014 20:29:40 +0000</pubDate>
				<wikidot:authorName>Tony Di Croce</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>I have a library in charge of writing video to disk. The entire internal mechanism of the library changed (from fopen() to mmap()) but the API stayed the same. I suspect 90% of the LOC were changed in the whole library&#8230;</p> <p>The unit tests were still valid because the API didn't change. Having the tests in place made me feel confident to replace the guts in a weekend. This was a huge benefit.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046331</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046331</link>
				<description></description>
				<pubDate>Thu, 05 Jun 2014 17:36:13 +0000</pubDate>
				<wikidot:authorName>martin_sustrik</wikidot:authorName>				<wikidot:authorUserId>939</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Nicely put!</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046329</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046329</link>
				<description></description>
				<pubDate>Thu, 05 Jun 2014 17:29:15 +0000</pubDate>
				<wikidot:authorName>Tim Gifford</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>The problem that I frequently run into with teams that have a large suite of e2e tests is that they are brittle and are frequently broken and become untrusted. These teams are out of balance.</p> <p>Please remember that your tests form a portfolio. This portfolio of test boundaries needs to balanced based on multiple factors; engineer experience &amp; professionalism level, technology and economic impact of a defect to name a few. Also remember to rebalance as the factors change.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046316</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046316</link>
				<description></description>
				<pubDate>Thu, 05 Jun 2014 17:01:39 +0000</pubDate>
				<wikidot:authorName>martin_sustrik</wikidot:authorName>				<wikidot:authorUserId>939</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thanks for the kind words!</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046315</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046315</link>
				<description></description>
				<pubDate>Thu, 05 Jun 2014 17:01:07 +0000</pubDate>
				<wikidot:authorName>martin_sustrik</wikidot:authorName>				<wikidot:authorUserId>939</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>It also questionable whether there's a real need to have maintainable test code. The application code should be maintainable. Yes. But tests? I would rather keep the test as simple possible so that they can be thrown away without much regret when the application is refactored for better maintainability.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046308</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046308</link>
				<description></description>
				<pubDate>Thu, 05 Jun 2014 16:47:41 +0000</pubDate>
				<wikidot:authorName>FlavorScape</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Arguably e2e tests are more behavior driven. What you’re after is the result, not necessarily good maintainable code. E2e does not necessitate “better code” by enforcing modularity etc. but it could potentially foster much quicker development for a skunkworks dev studio where often fast churn-out of quick creative/marketing apps is praised over long term maintainability.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046299</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046299</link>
				<description></description>
				<pubDate>Thu, 05 Jun 2014 16:31:00 +0000</pubDate>
				<wikidot:authorName>Ron</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Thanks for the good thoughtful blog post. I like your analogies with the paint brushes and the gears. I've seen the most value come out of what we call automated functional tests, which is another name for end-to-end tests.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046293</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046293</link>
				<description></description>
				<pubDate>Thu, 05 Jun 2014 16:21:23 +0000</pubDate>
				<wikidot:authorName>martin_sustrik</wikidot:authorName>				<wikidot:authorUserId>939</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Of course it's a false dichotomy :)</p> <p>It just seems that people today are overemphasising unit testing and ignoring e2e tests. I felt like a reminder of importance of e2e tests would be worth it.</p> <p>As for refactoring, I don't agree. You can change the internal implementation of the component, but that's not what I call refactoring. On the other hand, you can't change the component's interaface (refactoring proper) because that would break all the unit tests.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://250bpm.com/forum/t-869845#post-2046278</guid>
				<title>(no title)</title>
				<link>http://250bpm.com/forum/t-869845/unit-test-fetish#post-2046278</link>
				<description></description>
				<pubDate>Thu, 05 Jun 2014 16:02:06 +0000</pubDate>
				<wikidot:authorName>Sourav Chakraborty</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>This is a false dichotomy. You don't choose between unit tests and e2e tests, you write them both. And they serve rather different purposes. Unit tests are most helpful while you are still developing your components, and can not test the system as a whole. By definition e2e tests can be run only after the system is near completion, and waiting until that point is a recipe for disaster.</p> <p>I think the most important value derived from unit tests is having a quick feedback cycle. You write code, build it, and immediately get results. If your have nothing but e2e tests, it often takes much longer to verify that the piece you are working on works correctly.</p> <p>Also, most people overlook this benefit of having good unit tests - easier refactoring. If your unit tests verify the interface of your component, you can confidently refactor and move stuff around - as long as all your unit tests passed, you can be reasonably confident that you have not broken anything. Of course, e2e test will still have to be run, unit tests are not meant to replace them. They are a tool in your arsenal that helps you write better code quickly and efficiently.</p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>