<?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>Tue, 22 May 2012 19:12:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>23rd Feb Workshop on Advanced TDD: Transformation Priority Premise</title>
		<link>http://gojko.net/2011/02/01/23rd-feb-workshop-on-advanced-tdd-transformation-priority-premise/</link>
		<comments>http://gojko.net/2011/02/01/23rd-feb-workshop-on-advanced-tdd-transformation-priority-premise/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 12:00:03 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=2227</guid>
		<description><![CDATA[SpeedCoding 2011 is a series of four hands-on workshops aimed at exploring the advanced aspects of TDD, inspired by an openspace session at CITCON London 2010 on practices and techniques that take people beyond basic TDD. In these workshops, you&#8217;ll work in pairs, frequently switching who you&#8217;ll pair with, to...]]></description>
			<content:encoded><![CDATA[<p><a href="http://skillsmatter.com/go/speed-coding-2011/ad-1342" target="_blank" ><img border="0" style="float:left;margin:5px 5px 5px 5px" src="http://skillsmatter.com/custom/images/speedcoding-2011_hp_300px.gif"/></a><a href="http://skillsmatter.com/go/speed-coding-2011/gojko">SpeedCoding 2011</a> is a series of four hands-on workshops aimed at exploring the advanced aspects of TDD, inspired by an openspace <a href="http://gojko.net/2010/11/09/beyond-basic-tdd/" target="_blank">session at CITCON London 2010 on practices and techniques that take people beyond basic TDD</a>. In these workshops, you&#8217;ll work in pairs, frequently switching who you&#8217;ll pair with, to explore different models, provide and benefit from pair coaching. Bring your own laptop and work in your favourite IDE/language. The speed coding exercises are designed by Gojko Adzic, who will facilitate the workshops. The first<br />
workshop will be on 23rd Feb 2011 to explore Uncle Bob&#8217;s  <a target="_blank" href="http://cleancoder.posterous.com/the-transformation-priority-premise">transformation priority premise</a> idea. <b>You can <a href="http://skillsmatter.com/course/agile-testing/gojko-adzic-transformation-priority-premise/ad-1342" target="_blank">sign up here</a></b>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2011/02/01/23rd-feb-workshop-on-advanced-tdd-transformation-priority-premise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three cool Java TDD ideas from Oredev</title>
		<link>http://gojko.net/2010/11/15/three-cool-java-tdd-ideas-from-oredev/</link>
		<comments>http://gojko.net/2010/11/15/three-cool-java-tdd-ideas-from-oredev/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 14:10:36 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jtestr]]></category>
		<category><![CDATA[mockrunner]]></category>
		<category><![CDATA[oredev]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[unitils]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=2107</guid>
		<description><![CDATA[Neal Ford presented several ideas, tools and libraries for more productive Java unit testing at Oredev 2010. Ford suggested going outside the box and looking at writing unit tests in other JVM languages even if the target language is Java. “Always test a weaker language with a stronger one”, said...]]></description>
			<content:encoded><![CDATA[<p><a href="http://memeagora.blogspot.com/">Neal Ford</a> presented several ideas, tools and libraries for more productive Java unit testing at <a href='/tag/oredev'>Oredev 2010</a>.<span id="more-2107"></span></p>
<p>Ford suggested going outside the box and looking at writing unit tests in other JVM languages even if the target language is Java. “Always test a weaker language with a stronger one”, said Ford, suggesting that people should use Groovy to write Java unit tests. According to him, Groovy makes writing unit tests easier because it ignores privates and exceptions. Another option is JRuby. “Ruby guys have the coolest testing tools in the world”, said Ford. Java developers can use those tools with the help of <a href="http://jtestr.codehaus.org/">JTestR</a>, which makes it easy to write Java unit tests in JRuby and use standard Ruby testing tools for Java projects. </p>
<p>For teams working with J2EE technologies, he suggested using <a href="http://mockrunner.sourceforge.net/">Mockrunner</a>, which “stubs out J2EE by magic”, according to Ford. Mockrunner has stubs that provide out of the box functionality for JMS, JDBC, Servlet and many other J2EE APIs. It should allow unit testing of code that depends on J2EE APIs outside a container.</p>
<p>For teams that work with the Spring stack and related APIs, he suggested using <a href="http://unitils.org">Unitils</a>, a “swiss army chainsaw of useful stuff”. It supports stubbing out Hibernate, Spring, JPA and similar APIs to speed up unit testing without having to really load the spring context or work against a database</p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2010/11/15/three-cool-java-tdd-ideas-from-oredev/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Beyond basic TDD</title>
		<link>http://gojko.net/2010/11/09/beyond-basic-tdd/</link>
		<comments>http://gojko.net/2010/11/09/beyond-basic-tdd/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 12:05:12 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[citcon]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=2093</guid>
		<description><![CDATA[CITCON Europe last weekend proved again to be one of the best conferences for networking and keeping up with the developments in the community. The most important session for me personally was &#8220;Beyond Basic TDD&#8221;, an openspace discussion on the topics that people with a few years of TDD experience...]]></description>
			<content:encoded><![CDATA[<p><a href="http://citconf.com">CITCON Europe</a> last weekend proved again to be one of the best conferences for networking and keeping up with the developments in the community. The most important session for me personally was &#8220;Beyond Basic TDD&#8221;, an openspace discussion on the topics that people with a few years of TDD experience should learn to take the next step.  Here are the ideas we discussed:<span id="more-2093"></span></p>
<p>(As with any other openspace discussion it is sometimes hard to capture who came up with what idea, so some parts of this post will be relatively anonymous.)</p>
<p>The discussion was kicked off by a case study from one of the participants who complained that his evolutionary design process failed to capture the model elegantly, which was probably due to focusing on testing methods, not describing activities/features, and not refactoring enough. <a href="http://puttingtheteaintoteam.blogspot.com/">Ivan Moore</a> suggested <b>refactoring mercilessly</b> as a solution. This led to a discussion about Kent Beck&#8217;s <a href="http://c2.com/cgi/wiki?XpSimplicityRules">Four rules of simple code</a>, which which we paraphrased as:</p>
<ul>
<li>express intent</li>
<li>remove duplication</li>
<li>use the smallest amount of source possible</li>
</ul>
<p>(the fourth rule &#8220;runs all the tests&#8221; was not mentioned because it really is a basic thing). </p>
<p>As ways to teach people to express intent, we discussed <b>writing assertions first</b> when writing unit tests and asking people to <b>explain what their test does and rephrasing it using those words</b>. <a href="http://www.m3p.co.uk/blog/">Steve Freeman</a> said that it is very important to <b>name features</b> described in the name of the test method. Someone else suggested that <b>bdd style naming</b> (as in <i>should do something</i>) is good to drive intent-revealing tests.</p>
<p>We also discussed <b>not getting tied up with the current design</b> (which is probably a reflection of the DDD idea that there are always multiple models). Some practical techniques to show that are:</p>
<ul>
<li><b>write code in test methods first, then refactor it out</b>, to be able to experiment more freely</li>
<li><b>reverse refactoring</b>, go back after a change and see if the code has really improved</li>
<li><b>delete and reimplement</b>, time box changes but don&#8217;t commit after the first implementation &#8211; revert the changes and try again to see if the solution will be different. </li>
</ul>
<p>Another important idea we discussed was <b>working in small steps</b>, and <a href="http://pauljulius.com/blog/">Paul Julius</a> suggested that he now <b>stops every 15 minutes and if he is not ready to commit discusses with his pair why not</b>. Someone else suggested an exercise where several pairs <b>work on the same code</b> which will incentivise people to commit often to avoid merge conflicts (if someone else commits before you, you&#8217;ll have to merge the changes).</p>
<p>The last very important take-away for me from this session was <b>organising coding dojos to experiment with real code</b>. Many participants said that most these ideas have to be experienced and seen in practice in order for people to really understand them, and that showing them on simplistic code doesn&#8217;t work well. Someone said that his company runs coding dojos to refactor real production code with the idea to throw the result away, so people are free to experiment and play with the design.</p>
<p>Related post: <a href="http://gojko.net/2010/04/19/effective-exercises-for-teaching-tdd/">Effective exercises for teaching TDD</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2010/11/09/beyond-basic-tdd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<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...]]></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...]]></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>12</slash:comments>
		</item>
	</channel>
</rss>

