<?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>Gojko Adzic &#187; tdd</title>
	<atom:link href="http://gojko.net/tag/tdd/feed/" rel="self" type="application/rss+xml" />
	<link>http://gojko.net</link>
	<description>Building software that matters</description>
	<lastBuildDate>Wed, 04 Aug 2010 11:38:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Effective exercises for teaching TDD</title>
		<link>http://gojko.net/2010/04/19/effective-exercises-for-teaching-tdd/</link>
		<comments>http://gojko.net/2010/04/19/effective-exercises-for-teaching-tdd/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 10:08:26 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[exercises]]></category>
		<category><![CDATA[goosgaggle]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=1792</guid>
		<description><![CDATA[At the Goosgaggle event last month, David Harvey and I ran an open space session on teaching TDD through exercises effectively. My goal with this session was to learn what are the good exercises, what&#8217;s common for them, and why they are effective. There were roughly 20 people in the room so we had a [...]]]></description>
			<content:encoded><![CDATA[<p>At the Goosgaggle event last month, <a href="http://www.teamsandtechnology.com/dh/">David Harvey</a> and I ran an open space session on teaching TDD through exercises effectively. My goal with this session was to learn what are the good exercises, what&#8217;s common for them, and why they are effective. There were roughly 20 people in the room so we had a good discussion and lots of great ideas. As with any other open space session, it&#8217;s hard to remember who suggested what first so I&#8217;m sorry about the rest of this post being more or less anonymous, but here are the ideas we discussed:<span id="more-1792"></span></p>
<p>Early on we started breaking down the exercises designed to teach basic ideas (such as test first and unit testing tool usage) and exercises designed to teach design or technique subtleties. There wasn&#8217;t much interest in discussing basic exercises apart from the idea that they should be as simple as possible, so that people don&#8217;t get confused by the problem itself. Someone suggested the <a href="http://osherove.com/tdd-kata-1/">String Calculator</a> exercise as a good example of this.</p>
<p>As examples of good exercises that teach advanced TDD techniques and subtleties, the group suggested the following:</p>
<ul>
<li><a href="http://robocode.sourceforge.net/">Robocode competitions</a> seem to be good in teaching evolutionary design. Using Google, I found a reference to a TDD Robocode workshop from <a href="http://duncanpierce.org/xbots">XPDay 2 organised by Paul Simmons and Duncan Pierce</a> with detailed instructions on how to run the exercise.</li>
<li><a href="http://gojko.net/2009/08/02/tdd-as-if-you-meant-it-revisited/">TDD as if you meant it</a>, conceived by <a href="http://peripateticaxiom.blogspot.com/">Keith Braithwaite</a> and ran for the first time during the <a href="http://gojko.net/2009/02/27/thought-provoking-tdd-exercise-at-the-software-craftsmanship-conference/">Software Craftsmanship 09 conference</a>, is a great way to expose design presumptions and make people think hard about actually driving the design by tests. </li>
<li>I use the Roulette Wheel exercise during my <a href="http://neuri.co.uk/training/tdd/">TDD In Practice</a> workshops to make people run into the trap of trying to apply TDD with temporal constraints and random events. There is no write-up of this exercise online yet, but generally the problem is to describe a simple rule such as &#8220;the wheel will spin for twenty seconds and the ball will stop on a random number&#8221; using unit tests and design the wheel functionality with TDD. Solving the problem is a good way make people think what actually they need to describe in a test, where the context of that particular unit ends, to teach <a href="http://gojko.net/2009/09/21/mocks-are-not-about-isolation-but-about-responsibilities/">hexagonal architecture principles and using mocks for design</a>.</li>
<li><a href="http://www.cleal.com/refactoringgolf.html">Refactoring Golf</a>, an exercise suggested for Software Craftsmanship 2010, teaches refactoring techniques by giving participants <a href="http://parlezuml.com/blog/?postid=867">the code &#8220;before&#8221; and &#8220;after&#8221;</a> and they have to refactor it to get from one shape to another in a disciplined way, using IDE tools as much as possible. While discussing this exercise, someone said that it was particularly effective when done on real project code for in-house workshops. In-house coaches can use this exercise to teach team members why the code they wrote is suboptimal and how to fix it. &#8220;Bottling code smells&#8221; was mentioned as a really good idea to facilitate this: if a class needs to be refactored, team members should capture a class before the refactoring and use that as a starting point for later exercises. </li>
<li>Pairing Roulette, where participants frequently switch pairs to work on the same problem over and over, such as in <a href="http://coderetreat.ning.com/profiles/blogs/how-to-run-a-coderetreat">Corey Haines&#8217; code retreat</a> events, is a great way to learn how other people are doing TDD and to see the value of naming conventions and learn different techniques for that.</li>
</ul>
<p>Analysing further these exercises, we tried to identify as what makes a good TDD exercise. These are the ideas we identified as common for all of them:</p>
<ul>
<li>All of them require participants to do something in a very constrained and disciplined way. This helps focus the exercise on a particular thing and make it possible to do a meaningful piece of work with lots of people in a short time. Some further ideas how this could be applied was to impose a constraint that setters or getters cannot be used (for example, to teach Tell Don&#8217;t Ask)</li>
<li>All of them provide relatively instant feedback. Further ideas on how this can be applied to improve other exercises, mostly coming from <a href="http://parlezuml.com/">Jason Gorman</a>&#8216;s work on pair-coaching TDD, are to work against checklists, get pairs to asses themselves (Gorman advises still having a principle coach review this to avoid the problem of blind leading blind and also to switch pairs to get more objective assessments) and playing the role of a teacher (which makes participants think harder about something because they have to explain it). Another great idea coming from the Software Craftsmanship 2010 submission process is to record yourself doing an exercise and watch the video &#8211; this technique has been used for a long time by public speakers to &#8220;step out of the box&#8221; and see their flaws more objectively.</li>
<li>All of them start with a full context that is easy to understand. Simple tasks, more or less already known to the participants, such as the <a href="http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Convay&#8217;s game of life</a>, work best because they allow participants to focus on the goal of the workshop and not waste time understanding the problem to be solved. For me, the Tic Tac Toe variant of TDD As If You Meant It worked much better than the original Go version for that same reason. Having a full context is also very important because it allows people to get on with the exercise without spending time setting up external dependencies. This is why the temporal constraints work better for a short exercise than trying to demonstrate mocks and hexagonal architecture by making people run into a problem of using an external context or a database or a queue.</li>
<li>Longer exercises start out small and allow participants to build up a model</li>
<li>They all focus on building habits, not giving participants a list of rules to follow in day to day work</li>
</ul>
<p>See also <a href="http://www.teamsandtechnology.com/dh/component/option,com_mojo/Itemid,44/p,96/">David Harvey&#8217;s post about this session</a>. Also, see <a href="/tag/goosgaggle">other posts about the GoosGaggle event</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2010/04/19/effective-exercises-for-teaching-tdd/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How to implement UI testing without shooting yourself in the foot</title>
		<link>http://gojko.net/2010/04/13/how-to-implement-ui-testing-without-shooting-yourself-in-the-foot-2/</link>
		<comments>http://gojko.net/2010/04/13/how-to-implement-ui-testing-without-shooting-yourself-in-the-foot-2/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 06:56:58 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[agile acceptance testing]]></category>
		<category><![CDATA[atdd]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[page object]]></category>
		<category><![CDATA[robot framework]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[twist]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=1782</guid>
		<description><![CDATA[I&#8217;m currently interviewing lots of teams that have implemented acceptance testing for my new book. A majority of those interviewed so far have at some point shot themselves in the foot with UI test automation. After speaking to several people who are about to do exactly that at the Agile Acceptance Testing Days in Belgium [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently interviewing lots of teams that have implemented acceptance testing for my new book. A majority of those interviewed so far have at some point shot themselves in the foot with UI test automation. After speaking to several people who are about to do exactly that at the Agile Acceptance Testing Days in Belgium a few weeks ago, I&#8217;d like to present what I consider a very good practice for how to do UI test automation efficiently. <span id="more-1782"></span></p>
<p><a href="http://gojko.net/2007/09/25/effective-user-interface-testing/">I&#8217;ve written against UI test automation several times so far, so I won&#8217;t repeat myself</a>. However, many teams I interviewed seem to prefer UI level automation, or think that such level of testing is necessary to prove the required business functionality. Almost all of them have realised six to nine months after starting this effort that the cost of maintaining UI level tests is higher than the benefit they bring. Many have thrown away the tests at that point and effectively lost all the effort they put into them. If you have to do UI test automation (which I&#8217;d challenge in the first place), here is how do go about doing it so that the cost of maintenance doesn&#8217;t kill you later.</p>
<h2>Three levels of UI test automation</h2>
<p>A very good idea when designing UI level functional tests is to think about describing the test and the automation at these three levels:</p>
<p><img align="right" src="http://gojko.s3.amazonaws.com/three_levels.png"/></p>
<ul>
<li>Business rule/functionality level: what is this test demonstrating or exercising. For example: Free delivery is offered to customers who order two or more books.</li>
<li>User interface workflow level: what does a user have to do to exercise the functionality through the UI, on a higher activity level. For example, put two books in a shopping cart, enter address details, verify that delivery options include free delivery.</li>
<li>Technical activity level: what are the technical steps required to exercise the functionality. For example, open the shop homepage, log in with &#8220;testuser&#8221; and &#8220;testpassword&#8221;, go to the &#8220;/book&#8221; page, click on the first image with the &#8220;book&#8221; CSS class, wait for page to load, click on the &#8220;Buy now&#8221; link&#8230; and so on.</li>
</ul>
<p><br clear="all" /></p>
<p>At the point where they figured out that UI testing is not paying off, most teams I interviewed were describing tests at the technical level only (an extreme case of this are recorded test scripts, where even the third level isn&#8217;t human readable). Such tests are very brittle, and many of them tend to break with even the smallest change in the UI. The third level is quite verbose as well, so it is often hard to understand what is broken when a test fails. Some teams were describing tests at the workflow level, which was a bit more stable. These tests weren&#8217;t bound to a particular layout, but they were bound to user interface implementation. When the page workflow changes, or when the underlying technology changes, such tests break.</p>
<p>Before anyone starts writing an angry comment about the technical level being the only thing that works, I want to say: <i>Yes, we do need the third level</i>. It is where the automation really happens and where the test exercises our web site. But there are serious benefits to not having <i>only the third level</i>.</p>
<p>The stability in acceptance tests comes from the fact that business rules don&#8217;t change as much as technical implementations. Technology moves much faster than business. The closer your acceptance tests are to the business rules, the more stable they are. Note that this doesn&#8217;t necessarily mean that these tests won&#8217;t be executed through the user interface &#8211; just that they are defined in a way that is not bound to a particular user interface. </p>
<p>The idea of thinking about these different levels is good because it allows us to write UI-level tests that are easy to understand, efficient to write and relatively inexpensive to maintain. This is because there is a natural hierarchy of concepts on these three levels. Checking that delivery is available for two books involves putting a book in a shopping cart. Putting a book in a shopping cart involves a sequence of technical steps. Entering address details does as well. Breaking things down like that and combining lower level concepts into higher level concepts reduces the cognitive load and promotes reuse.</p>
<h2>Easy to understand</h2>
<p>From the bottom up, the clarity of the test increases. At the technical activity level, tests are very technical and full of clutter &#8211; it&#8217;s hard to see the forest for the trees. At the user interface workflow level, tests describe how something is done, which is easier to understand but still has too much detail to efficiently describe several possibilities. At the business rule level, the intention of the test is described in a relatively terse form. We can use that level to effectively communicate all different possibilities in important example cases. It is much more efficient to give another example as &#8220;Free delivery is not offered to customers who have one book&#8221; than to talk about logging in, putting only a single book in a cart, checking out etc. I&#8217;m not even going to mention how much cognitive overload a description of that same thing would require if we were to talk about clicking check-boxes and links.</p>
<h2>Efficient to write</h2>
<p>From the bottom up, the technical level of tests decreases. At the technical activity level, you need people who understand the design of a system, HTTP calls, DOM and such to write the test. To write tests at the user interface workflow level, you only need to understand the web site workflow. At the business rule level, you need to understand what the business rule is. Given a set of third-level components (eg login, adding a book), testers who are not automation specialists and business users can happily write the definition of second level steps. This allows them to engage more efficiently during development and reduce the automation load on developers. </p>
<p>More importantly, the business rule and the workflow level can be written before the UI is actually there. Tests at these levels can be written before the development starts, and be used as guidelines for development and as acceptance criteria to verify the output. </p>
<h2>Relatively inexpensive to maintain</h2>
<p>The business rule level isn&#8217;t tied to any particular web site design or activity flow, so it remains stable and unchanged during most web user interface changes, be it layout or workflow improvements. The user interface workflow level is tied to the activity workflow, so when the flow for a particular action changes we need to rewrite only that action. The technical level is tied to the layout of the pages, so when the layout changes we need to rewrite or re-record only the implementation of particular second-level steps affected by that (without changing the description of the test at the business or the workflow level). </p>
<p>To continue with the free delivery example from above, if the login form was suddenly changed not to have a button but an image, we only need to re-write the &#8220;login&#8221; action at the technical level. From my experience, it is the technical level where changes happen most frequently &#8211; layout, not the activity workflow. So by breaking up the implementation into this hierarchy, we&#8217;re creating several layers of insulation and limiting the propagation of changes. This reduces the cost of maintenance significantly.</p>
<h2>Implementing this in practice</h2>
<p>There are many good ways to implement this idea in practice. Most test automation tools provide one or two levels of indirection that can be used for this. In fact, this is why I think Cucumber found such a sweet spot for browser based user interface testing. With Cucumber, step definitions implemented in a programming language naturally sit with developers and this is where the technical activity level UI can be described. These step definition can then be reused to create scenarios (user interface workflow level), and <a href="http://gojko.net/2010/01/05/bdd-in-net-with-cucumber-part-3-scenario-outlines-and-tabular-templates/">scenario outlines</a> can be used to efficiently describe tests at the business rule level.</p>
<p>New SLIM test runner for FitNesse provides similar levels of isolation. The bottom fixture layer sits naturally with the technical activity level. Scenario definitions can be used to describe workflows at the activity level. Scenario tables then present a nice, concise view at the business rule level. </p>
<p><a href="http://gojko.net/2009/05/28/robot-framework-review/">Robot Framework</a> uses &#8220;keywords&#8221; to describe tests, and allows us to define keywords either directly in code (which becomes the technical level) or by combining existing keywords (which becomes the workflow and business rule level).</p>
<p>The <a href="http://code.google.com/p/webdriver/wiki/PageObjects">Page Object</a> idea from Selenium and WebDriver is a good start, but stops short of finishing the job. It requires us to encapsulate the technical activity level into higher level &#8220;page&#8221; functionality. These can then be used to describe business workflows. It lacks the consolidation of workflows into the top business rule level &mdash; so make sure to do create this level yourself in the code. (Antony Marcano also raised a valid point that users <a href="http://gojko.net/2009/10/06/putting-selenium-in-the-right-place/">think about business activities, not page functionality</a> during CITCON Europe 09, so page objects might not be the best way to go anyway).</p>
<p>TextTest works with <a href="http://texttest.carmen.se/index.php?page=concepts&#038;n=xusecase">xUseCase recorders</a>, an interesting twist on this concept that allows you to record the technical level of step definitions without having to program it manually. This might be interesting for thick-client UIs where automation scripts are not as developed as in the web browser space.</p>
<p>With <a href="http://gojko.net/2010/04/06/twist-2-0-acceptance-testing-the-productive-way/">Twist</a>, you can record the technical level and it will create fixture definitions for you. Instead of using that directly in the test, you can use &#8220;abstract concepts&#8221; to combine steps into workflow activities and then use that for business level testing. Or you can add fixture methods to produce workflow activities in code. </p>
<h2>Beware of programming in text</h2>
<p>Looking at UI tests at these three levels is I think generally a good practice. Responsibility for automation at the user interface level is something that each team needs to decide depending on their circumstances. </p>
<p>Implementing the workflow level in plain text test scripts (Robot Framework higher level keywords, Twist abstract concepts, SLIM scenario tables) allows business people and testers who aren&#8217;t automation specialists to write and maintain them. For some teams, this is a nice benefit because developers can then focus on other things and testers can engage earlier. That does mean, however, that there is no automated refactoring, syntax checking or anything like that at the user interface automation level. </p>
<p>Implementing the workflow level in code enables better integration and reuse, also giving you the possibility of implementing things below the UI when that is easier, without disrupting the higher level descriptions. It does, however, require people with programming knowledge to automate that level.</p>
<p>An interesting approach that one team I interviewed had is to train testers to write code enough to be able to implement the user activity level in code as well. This doesn&#8217;t require advanced programming knowledge, and developers are there anyway to help if someone gets stuck. </p>
<h2>Things to remember</h2>
<p>To avoid shooting yourself in the foot with UI tests, remember these things:</p>
<ul>
<li>Think about UI test automation at three levels: business rules, user interface workflow and technical activity</li>
<li>Even if the user interface workflow automation gets implemented in plain text, make sure to put one level of abstraction above it and describe business rules directly. Don&#8217;t describe rules as workflows (unless they genuinely deal with workflow decisions &#8211; and even then it&#8217;s often good to describe individual decisions as state machines).</li>
<li>Even if the user interface workflow automation gets implemented in code, make sure to separate technical activities required to fulfil a step into a separate layer. Reuse these step definitions to get stability and easy maintenance later.</li>
<li>Beware of programming in plain text.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2010/04/13/how-to-implement-ui-testing-without-shooting-yourself-in-the-foot-2/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>TDD with complex infrastructures</title>
		<link>http://gojko.net/2010/03/31/tdd-with-complex-infrastructures/</link>
		<comments>http://gojko.net/2010/03/31/tdd-with-complex-infrastructures/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 23:38:03 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[goosgaggle]]></category>
		<category><![CDATA[nat pryce]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=1685</guid>
		<description><![CDATA[At the GOOSGaggle event last weekend, Nat Pryce gave a presentation on &#8220;System Test Driven Development&#8221; &#8212; an approach he uses to apply TDD when working with complex heterogeneous infrastructures. According to Pryce, people often jump into unit testing the business domain core of their context, and with complicated technical infrastructures such as in heterogeneous [...]]]></description>
			<content:encoded><![CDATA[<p>At the <a href="/tag/goosgaggle">GOOSGaggle</a> event last weekend, <a href="http://natpryce.com/">Nat Pryce</a> gave a presentation on &#8220;System Test Driven Development&#8221; &mdash; an approach he uses to apply TDD when working with complex  heterogeneous infrastructures.   <span id="more-1685"></span></p>
<p>According to Pryce, people often jump into unit testing the business domain core of their context, and with complicated technical infrastructures such as in heterogeneous financial systems the result is that the domain model often doesn&#8217;t really fit into how it needs to plug into the infrastructure. Sometimes the resulting design is impossible to integrate at the end. </p>
<p>Pryce recommended an alternative approach when working with complicated infrastructure: start with end-to-end system tests and a very rough model of the core (&#8220;only enough of the process that it needs&#8221;). Then “jump in and out of the domain level [implementing scenarios] to ensure easy integration”. In this approach, end-to-end technical tests are used to guide the development of whole feature sets, very similar to how high level acceptance tests are used when the risk is in the complexity of the business domain. They are used to guide development at a larger scale, pointing out which details need to be fleshed out by unit tests and helping to avoid the “TDD equivalent of analysis by paralysis”, where teams keep writing unit tests for all possible cases even if they don&#8217;t contribute to the design. Jim Shore, in his article <a href="http://jamesshore.com/Blog/Microsoft-Gets-TDD-Completely-Wrong.html">Microsoft Gets TDD Completely Wrong</a>, wrote that figuring out what test will best move your code towards completion is the hardest step for beginners. End-to-end system tests can certainly help with this. </p>
<p><img src='http://gojko.s3.amazonaws.com/goosgaggle-endtoend.png' /></p>
<p>Pryce gave several examples where system end-to-end tests pointed to infrastructural solutions and configuration changes as alternatives to developing custom software. With complicated technical infrastructures, some existing components might be able to provide parts of the required functionality.  In one case 20000 lines of Java code was replaced with a few XSLT files that transformed messages in a message broker. The system tests ensured that the system still gave the same functionality. He proposed that starting with system end-to-end tests might help point out similar situations in the future where such unnecessary development won&#8217;t be done in the first place. </p>
<h2>Isolation</h2>
<p>This approach isn&#8217;t without challenges, though. “In a large system, your system fits into a set of byzantine systems controlled by someone else, chosen for political reasons and hard or impossible to test”, said Pryce. Major challenges to implementing an end-to-end system test efficiently are scaling to handle computing intensive tasks, reliably handling asynchronous operations, concurrency and distribution. Figuring out where exactly are the borders of your sub-system and isolating it from the rest of the world are key decisions for this approach to succeed. Pryce provided a rule of thumb: “If I can change it or replace it, it&#8217;s part of my system”. </p>
<p><img src='http://gojko.s3.amazonaws.com/goosgaggle-api.png' /></p>
<p>He said that it is crucial to simplify byzantine APIs and protocols, in order to speed up development but also to provide natural isolation points. This approach is very similar to Anti-corruption layers from Domain Driven Design, with a difference that Pryce advises isolating at the level of the simpler protocol rather than providing an alternative implementation of the simpler API. Such isolation allowed him to keep more code under test (the real implementation of the simpler API) and also to choose whether to run tests against a fake test dependency or a real system. Isolating at the protocol level also allowed him to control the load that automated tests were putting on other real components. </p>
<p>Pryce advised running overnight tests again snapshot releases of external systems to get early warning of release candidate problems. Talking about a project for a financial institution where he applied this approach, he said that they got it to such a level that teams working on legacy components checked build monitors of his team before signing off a release of their systems.</p>
<h2>Side-effect: systems easy to support</h2>
<p>Because of a large number of moving parts, implementing end-to-end tests reliably requires us to be able to answer the following questions:</p>
<ul>
<li>Where are the system edges?</li>
<li>What is the system doing?</li>
<li>Has it stopped doing it yet?</li>
<li>Has it failed?</li>
<li>Why has it failed?</li>
</ul>
<p>The same answers are important for supporting the system in production. Because of that, Pryce concluded that development driven by system tests led to a system that is very easy to support. Implementing end-to-end system tests reliably requires us to design and implement modules, provide integration and inspection points to answer these questions. The same mechanisms can be used in production to monitor and support the system. Similar to how a side effect of (unit) TDD is a system that is easy to modify, end-to-end system test driven development leads to a system easy to support.</p>
<p><i><a href="/tag/goosgaggle">see other articles about the GOOSGaggle event</a></i></p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2010/03/31/tdd-with-complex-infrastructures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brian Marick: Mocks lead to better design faster</title>
		<link>http://gojko.net/2010/03/28/brian-marick-mocks-lead-to-better-design-faster/</link>
		<comments>http://gojko.net/2010/03/28/brian-marick-mocks-lead-to-better-design-faster/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 13:00:32 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[goos]]></category>
		<category><![CDATA[goosgaggle]]></category>
		<category><![CDATA[mocking]]></category>
		<category><![CDATA[mocks]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=1671</guid>
		<description><![CDATA[Today at the GOOSgaggle event in London, Brian Marick gave the presentation &#8220;I Think I Finally Understand Mocks&#8221;. Nat Pryce said that I was the person most likely to bother with entering the wireless key (64 character random code, they really do take their security seriously at Zuhlke), in order to blog in real time. [...]]]></description>
			<content:encoded><![CDATA[<p>Today at the GOOSgaggle event in London, <a href="http://www.exampler.com/blog/">Brian Marick</a> gave the presentation &#8220;I Think I Finally Understand Mocks&#8221;. <a href="http://www.natpryce.com/">Nat Pryce</a> said that I was the person most likely to bother with entering the wireless key (64 character random code, they really do take their security seriously at Zuhlke), in order to blog in real time. In order not to disappoint Nat, here goes&#8230;<span id="more-1671"></span></p>
<p><img src="http://gojko.s3.amazonaws.com/surgeon.jpg" align="left" style="margin:5px 5px 5px 5px" />Marick started by saying that he was one of the reviewers of the original mock paper, and that he at that point completely misunderstood the idea and thought that the authors were reinventing test stubs. It wasn&#8217;t until four months ago, when he read <a href="http://gojko.net/2009/11/20/dark-arts-of-tdd-explained/">Growing Object Oriented Software</a>, that he really understood what the concept is all about. Marick said that &#8220;the point of mocks is illustrated by a photo of surgeon working on a cow. [You, the surgeon, work with a team and when] you explain what you want to do, reach out your hand and magically the tool you want appears in your hand&#8221;. <br clear="all" /></p>
<p>Demonstrating how he uses now mocks, Marick went through the design and implementation of a recent project with an exercise involving attendees pretending to be objects and mocks in four iterations. After that, he pointed out that he really designed the code in the test, rather than in the implementation. &#8220;This is just stenography&#8221;, said Marick pointing to the implementation. </p>
<p><img src="http://gojko.s3.amazonaws.com/marick-exercise.jpg" /></p>
<p>There isn&#8217;t much more that happens in the implementation apart from what was in the test, and mocks allow us to describe the design in tests with less friction (note: this refers to the implementation of the object under test, not its dependent objects). Objects with complex dependencies require us to set up all those complicated dependencies in the test with classic TDD. This increases the clutter in the test. Using mocks allows us to avoid setting all that up in a test and describing the test (and design) more efficiently. Marick said that this benefit surprised him once he started using mocks properly. &#8220;Instead of giving the right time slice, mocks allow you to just give back a token representing a time slice,&#8221; said Marick, pointing how mocks facilitate outside-in design, &#8220;If it looks as if there is going to be some complicated work, I push the work away into a new object&#8221;.</p>
<p>&#8220;Doing top-down makes it much more likely that I&#8217;ll hit my destination&#8221;, said Marick, pointing out that there is no rational reason to choose top-down over bottom-up design, but from his experience the style of working with mocks leads to better design faster. &#8220;Things are flowing smoothly without a lot of friction.&#8221;, said Marick. Analysing the resulting code, Marick said that the objects ended up not doing much. He stressed out that conventional TDD makes him pile more and more code into a class or a method until it gets so big that &#8220;shame forces me to notice that these five methods are doing the same thing and pull them out. Things get big, then small, then big again&#8221;. &#8220;Mocking really encourages me to push&#8221;, said Marick, pointing out that with mocks he gets to smaller objects quicker, allowing him to &#8220;make decisions at the last responsible moments&#8221;.</p>
<p><i>Image credits:<a href="http://www.flickr.com/photos/interplast/116688808/sizes/s/">Interplast @ Flickr</a></i></p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2010/03/28/brian-marick-mocks-lead-to-better-design-faster/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Two new BDD workshops available</title>
		<link>http://gojko.net/2009/12/14/two-new-bdd-workshops-available/</link>
		<comments>http://gojko.net/2009/12/14/two-new-bdd-workshops-available/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 15:43:58 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[workshops]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=1490</guid>
		<description><![CDATA[I&#8217;m launching two new Behaviour-Driven Development workshops in late January. Introduction to BDD is an intensive one day workshop which introduces behaviour-driven development to developers, business analysts and testers. The optional programming module is offered in Java or .NET, with Cucumber to automate BDD scenarios. Hands-on BDD with Cucumber is a three day workshop which [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m launching two new Behaviour-Driven Development workshops in late January. </p>
<p><a href="http://neuri.co.uk/training/introduction-to-bdd">Introduction to BDD</a> is an intensive one day workshop which introduces behaviour-driven development to developers, business analysts and testers. The optional programming module is offered in Java or .NET, with Cucumber to automate BDD scenarios.</p>
<p><a href="http://neuri.co.uk/training/hands-on-bdd-with-cucumber">Hands-on BDD with Cucumber</a>  is a three day workshop which immerses the participants into a project driven by Specification by Example and Behaviour-Driven Development. The workshop is adjusted to fit your business domain and particular needs, so that the participants get real-world experience and instant benefits. It is combines the <a href="http://neuri.co.uk/training/introduction-to-bdd/">Introduction to BDD</a>, a day of working on a realistic domain example taken from your recent project or a future phase of a project, and a day of programming exercises for test automation developers. During the workshop, we use Cucumber to manage BDD Scenarios. The programming modules can be either in Java or .NET. </p>
<p>These two workshops are offered at a 20% discount for all bookings made before 31st January 2010. For more information on these and my other workshops, check out the <a href="http://neuri.co.uk/training">training</a> page. </p>
<p>Both workshops are offered as on-site training only (there are no public workshops scheduled at this time). <a href="http://neuri.co.uk/contact/">Contact my company, Neuri Ltd</a> for more information and to book a workshop. </p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2009/12/14/two-new-bdd-workshops-available/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
