<?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; fit</title>
	<atom:link href="http://gojko.net/tag/fit/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>FIT vs SLIM</title>
		<link>http://gojko.net/2010/03/12/fit-vs-slim/</link>
		<comments>http://gojko.net/2010/03/12/fit-vs-slim/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 07:59:33 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[fit]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[slim]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=1631</guid>
		<description><![CDATA[I got this question from a blog reader recently: I just wanted your opinion on SLIM as opposed to standard FIT/Fitnesse. Are there things that can only be done via the FIT/Fitnesse route that cannot be done via SLIM? So for acceptance tests and integration tests can I just use SLIM? We want to exploit [...]]]></description>
			<content:encoded><![CDATA[<p>I got this question from a blog reader recently:</p>
<blockquote><p>I just wanted your opinion on SLIM as opposed to standard FIT/Fitnesse. Are there things that can only be done via the FIT/Fitnesse route that cannot be done via SLIM? So for acceptance tests and integration tests can I just use SLIM?</p>
<p>We want to exploit the BDD abilities of Scenario tables in SLIM. Ideally I would like to use SLIM to undertake all kinds of tests. I assume it has all the same capabilities? Are there any issues? </p></blockquote>
<p> <span id="more-1631"></span></p>
<p>On the face of it, SLIM seems to be the preferred way forward for new FitNesse implementations as it is being actively developed and maintained by the same folks who develop FitNesse. FIT is a bit of an orphan at the moment, Rick Mugridge and I were talking about taking over that integration and enhancing it.</p>
<p>In terms of features, SLIM gives you better compatibility across platforms because a lot of the test system responsibility has been taken over by FitNesse itself (parsing HTML, deciding how to interpret a table, storing and reading symbol values). <a href="http://gojko.net/2009/04/17/slim-and-the-future-of-fitnesse-video/">Watch this video for more information about the differences in responsibilities</a>.</p>
<p>On the other hand, because of the way SLIM works, fitlibrary flow-mode interaction is practically impossible. Most of my clients still use flow mode tests as that is a great way to write and maintain a very thin fixture layer for complex tests.</p>
<p>SLIM also allows you to use Scenario tables, as you mentioned. Scenario tables give testers a lot more power as they can script multi-step execution and compose lower level fixtures into higher level tables, without involving developers to do the same in fixtures. Depending on your environment and team, this might or might not make sense. For covering and existing system with regression tests, it probably does. For using acceptance tests as a guide for development, beware of overdoing it. I am very concerned about long-term maintenance costs of such tests. What happens in this case is that people are effectively programming with tables &#8211; doing the same in code would allow you to benefit from IDE support for refactoring, file management and all sorts of other things that make IDEs useful. You lose all that by using scenario tables in order to make testers a bit more independent. I would rather suggest training the testers some basic coding skills so that they can write fixtures. </p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2010/03/12/fit-vs-slim/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Are tools necessary for acceptance testing, or are they just evil?</title>
		<link>http://gojko.net/2010/03/01/are-tools-necessary-for-acceptance-testing-or-are-they-just-evil/</link>
		<comments>http://gojko.net/2010/03/01/are-tools-necessary-for-acceptance-testing-or-are-they-just-evil/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 08:05:47 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[acceptance testing]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[agile acceptance testing]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[fit]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=1633</guid>
		<description><![CDATA[While doing research for my new book, I was very surprised to find out that Jim Shore gave up on acceptance testing. I use his &#8220;describe-demonstrate-develop&#8221; process description all the time in my workshops, so I guess I better stop doing that. Jim Shore wrote: My experience with Fit and other agile acceptance testing tools [...]]]></description>
			<content:encoded><![CDATA[<p>While doing research for my new book, I was very surprised to find out that <a href="http://jamesshore.com">Jim Shore gave up on acceptance testing</a>. I use his <a href="http://jamesshore.com/Blog/How-I-Use-Fit.html">&#8220;describe-demonstrate-develop&#8221; process description</a> all the time in <a href="http://neuri.co.uk/training">my workshops</a>, so I guess I better stop doing that. Jim Shore <a href="http://jamesshore.com/Blog/The-Problems-With-Acceptance-Testing.html">wrote</a>:</p>
<blockquote><p>My experience with Fit and other agile acceptance testing tools is that they cost more than they&#8217;re worth. There&#8217;s a lot of value in getting concrete examples from real customers and business experts; not so much value in using &#8220;natural language&#8221; tools like Fit and similar.</p></blockquote>
<p>The two failure patterns that Shore describes in <a href="http://jamesshore.com/Blog/The-Problems-With-Acceptance-Testing.html">his post</a> are falling back on testers to write everything and merging acceptance and integration tests. I&#8217;ve experienced both of these myself, and it seems that they are common in general. We discussed both during the <a href="http://gojko.net/2009/09/24/top-10-reasons-why-teams-fail-with-acceptance-testing/">top 10 ways to fail with acceptance testing</a> openspace session at <a href="/tag/citcon">CITCON</a>  Europe last year. However, there are good ways to solve both problems. <span id="more-1633"></span></p>
<p>I never really expected customers to write anything themselves, but I was relatively successful in persuading them to participate in <a href="http://www.acceptancetesting.info/key-ideas/specification-workshop">specification workshops</a> that led to examples which were then converted to acceptance tests later. Another idea I discovered while doing the research for my new book is discussing the key examples with customers and then going off to write detailed test pages, which then get verified by the customers. The third good idea is doing ad-hoc specification writing sessions when a developer needs information, by involving a tester and a business analyst. This is a lot less formal than a specification workshop and gives you similar benefits if you have all the knowledge in the room (or readily available) most of the time. </p>
<p>Not preserving acceptance tests as a separate group and mixing quick and slow tests is something that most people, at least according to my ongoing research, get burned with at some point but again teams learn from that and improve.</p>
<p>One of the biggest benefits from acceptance testing for me was that the teams finally get a source of information on what goes on in the system as reliable as the code itself. Without acceptance tests, code is the only thing you can really trust and any other documentation gets outdated very quickly. And such tests are much easier to read and understand than the code because they are on a higher level and in a natural language. Having a <a href="http://www.acceptancetesting.info/key-ideas/live-documentation">live specification</a> helps me quite a lot when change requests come in later. It also helps with handing over and taking over code. Acceptance tests stay relevant throughout the project because they are automated, and automated tests are kept up to date in order for them to pass. Automation, and consequently a tool, are necessary to get this benefit. With informal agreements and on-site reviews that Jim Shore describes, I guess something else needs to be in place to facilitate this. </p>
<p>I agree with Shore that it takes a while for the problems with tools such as FIT to surface, but I&#8217;m not sure whether that is tool related or not. Most people I spoke to so far said that it took them between six months and a year to discover that acceptance testing isn&#8217;t about the tools but about communication, and that the biggest benefit is in the examples as Shore wrote. A notable exception to six months to a year rule was <a href="http://lisacrispin.com/wordpress/">Lisa Crispin</a>&#8216;s team who generally started out knowing what they need (but that&#8217;s because she had done it before). Clear examples and improved communication are the biggest benefits of the process, but using a tool brings some additional nice benefits as well. A tool gives us an impartial measure of progress. <a href="http://codebetter.com/blogs/ian_cooper/">Ian Cooper</a> said during the interview for my new book that &#8220;the tool keeps developers honest&#8221;, and I can certainly relate to that. With tests that are evaluated by an impartial tool, &#8220;done&#8221; is really &#8220;what everyone agreed on&#8221;, not &#8220;almost done with just a few things to fill in tomorrow&#8221;. I&#8217;m not sure whether an on-site review is enough to guard against this completely.</p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2010/03/01/are-tools-necessary-for-acceptance-testing-or-are-they-just-evil/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Concordion: Agile Acceptance Testing with free-form text</title>
		<link>http://gojko.net/2008/08/25/concordion-agile-acceptance-testing-with-free-form-text/</link>
		<comments>http://gojko.net/2008/08/25/concordion-agile-acceptance-testing-with-free-form-text/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 15:42:12 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[acceptance testing]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[concordion]]></category>
		<category><![CDATA[fit]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=302</guid>
		<description><![CDATA[I finally had some time to take a look at Concordion, an acceptance testing tool that I&#8217;ve heard about on several conferences. Concordion is an interesting alternative to FIT. It is developed by David Peterson and released under the Apache opensource license. Similar to FIT, Concordion uses HTML documents as an executable specification and requires [...]]]></description>
			<content:encoded><![CDATA[<p>I finally had some time to take a look at Concordion, an acceptance testing tool that I&#8217;ve heard about on several conferences. <a href="http://www.concordion.org" target="_blank">Concordion</a> is an interesting alternative to FIT. It is developed by <a href="http://www.davidpeterson.co.uk/" target="_blank">David Peterson</a> and released under the Apache opensource license. Similar to FIT, Concordion uses HTML documents as an executable specification and requires some glue code (fixtures) to connect the executable elements of that specification to the domain code. Unlike FIT, Concordion does not require the specification to be in any particular format &mdash; you can write examples as normal sentences, without any restrictions. <span id="more-302"></span></p>
<p>Concordion is really simple. Its instrumentation only allows programmers to set global test variables, execute fixture methods and compare actual results with expected values. Programmers can use special HTML element attributes to mark words or phrases that are used as test inputs or compared to test results. Web browsers will just ignore unknown element attributes, so Concordion test instrumentation is effectively invisible to people that are not interested in test automation. For example, here is a HTML document that I&#8217;ve used as a simple test:</p>
<div style="margin-bottom:10px">
<pre>
&lt;html xmlns:concordion="http://www.concordion.org/2007/concordion"&gt;
&lt;body&gt;
&lt;h1&gt;Free delivery&lt;/h1&gt;
&lt;ul&gt;

 &lt;li concordion:execute="#offer = checkFreeDelivery(#type, #books)"&gt;
 Free delivery &lt;span concordion:assertEquals="#offer"&gt;is&lt;/span&gt;
 offered to a &lt;b concordion:set="#type"&gt;VIP&lt;/b&gt;
 customer with &lt;b concordion:set="#books"&gt;10&lt;/b&gt; books in the cart.
 &lt;/li&gt;

 &lt;li concordion:execute="#offer = checkFreeDelivery(#type, #books)"&gt;
  It &lt;b concordion:assertEquals="#offer"&gt;is not&lt;/b&gt; offered to
  a &lt;b concordion:set="#type"&gt;regular&lt;/b&gt; customer
  with &lt;b concordion:set="#books"&gt;10&lt;/b&gt; books&lt;/li&gt;

 &lt;li concordion:execute="#offer = checkFreeDelivery(#type, #books)"&gt;
  It &lt;b concordion:assertEquals="#offer"&gt;is not&lt;/b&gt; offered to
  a &lt;b concordion:set="#type"&gt;VIP&lt;/b&gt; customer with
  only &lt;b concordion:set="#books"&gt;9&lt;/b&gt; books.&lt;/li&gt;

&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
</div>
<p>The <i>concordion:execute</i> command on the LI element specifies that the <i>offer</i> variable is set by executing the <i>checkFreeDelivery</i> method and passing <i>type</i> and <i>books</i> variables set in the element text. The <i>concordion:set</i> command is used to set a variable based on the inner text in the element. The <i>concordion:assertEquals</i> command inspects the inner text in the element and compares that with the result of a method or current variable value. For repetitive specifications and calculation rules, Concordion also supports attributes for tables similar to the FIT ColumnFixture. </p>
<p>At the moment, Concordion only supports Java fixtures &mdash; It actually works as a JUnit extension. This provides direct integration with JUnit test runners, making it much easier to execute Concordion tests from popular development environments and integrate into continuous build systems. It also shortens the learning curve required to start using Concordion. The fixture is simply a JUnit test class. It should be called the same as the HTML file (in this case, the file was ConcordionTest.html, so the class is ConcordionTest.java), and declare the methods that are used by <i>concordion:execute</i>. </p>
<div style="margin-bottom:10px">
<pre>
package conctest;

import org.concordion.integration.junit4.ConcordionRunner;
import org.junit.runner.RunWith;

@RunWith(ConcordionRunner.class)

public class ConcordionTest {
	public boolean freeDelivery(String type, int books){
			if (books&lt;9) return false;
			if (!"VIP".equals(type)) return false;
			return true;
	}
	public String checkFreeDelivery(String type, int books){
		return freeDelivery(type, books)?"is":"is not";
	}
}
</pre>
</div>
<p>My first impression of this is that the fixture model of Concordion does not depend on inheritance so it is a lot simpler to learn than FIT and somewhat more flexible to write Concordion than FIT fixtures. On the other hand, Concordion lacks the extensibility and powerful model of type adapters and cell handlers that enable FIT to bind domain objects and business services directly to the specification. </p>
<p>When the JUnit test is executed, Concordion runs through the files and executes commands, verifying expected outputs with actual results in <i>assertEquals</i>. JUnit test run will tell you whether all tests passed or were there failures, and Concordion also saves the results in the system temporary folder in HTML form, making it easier to see what actually went wrong. The example above intentionally has an error &mdash; here is the screenshot of the result:</p>
<p><img src="/images/concordion.png" style="border:1px solid black" />  </p>
<p>Concordion does not have a test management tool and relies completely on the programmer&#8217;s IDE to manipulate and execute tests. I have mixed feelings about this. Although file management within an IDE makes it much easier to put tests in the same version control system as the domain code, I miss the ability to re-use parts of the test specification such as common set-ups or test components with macro variables that are available in FitNesse. It also puts tests completely under the control of programmers.</p>
<p>Concordion takes some ideas that have evolved as best practices to use FIT/FitNesse and makes them very explicit, actively discouraging other ways of working. For example, acceptance tests have to be stored in the same version control system as the code, there are no pre-built test building blocks that would encourage scripting. On the other hand, while FIT/FitNesse community is moving firmly towards using domain objects directly in acceptance tests and reducing the amount of glue code, to eliminate translation between layers and promote domain-driven design, Concordion model is stuck in requiring you to create an explicit test method for every verification in the fixture.</p>
<p>The thing that really worries me is the fact that HTML files are stored next to Java classes and that developers need to add non-standard HTML attributes to the test page. This smells to me of a hand-over of tests from business people to developers at some point, which is a practice that I don&#8217;t approve at all. In my opinion, tests should be shared between the whole team and not handed-over down the pipeline. I guess that this can be avoided with some discipline and research into tools that will surely not overwrite non-standard HTML attributes. But I would still like to see a proper test management tool for business people to use.</p>
<p>I&#8217;ve been hearing a lot about Concordion recently, mostly being mentioned by people as an interesting tool to look into. Safari has no books about it, all I could find on Google and Technorati blog searches are reports of people coming across the tool and doing some basic things with it, such as this post. I would be really interested in hearing stories from people that have real-world experiences with this tool to share. What happens six months later &mdash; are tests easier to manage than with FitNesse, has it turned out to be good enough tool to talk to business people? Is my fear of hand-over real, or is it not a problem at all? </p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2008/08/25/concordion-agile-acceptance-testing-with-free-form-text/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>FIT without fixtures</title>
		<link>http://gojko.net/2008/08/12/fit-without-fixtures/</link>
		<comments>http://gojko.net/2008/08/12/fit-without-fixtures/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 18:36:46 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[acceptance testing]]></category>
		<category><![CDATA[agile2008]]></category>
		<category><![CDATA[fit]]></category>
		<category><![CDATA[fitlibrary]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=281</guid>
		<description><![CDATA[During the Agile 2008 conference, Mike Stockdale organised a mini-session where he and Rick Mugridge presented some new features and ideas that they are working on at the moment. The session led to a very interesting discussion on whether we could produce a variant of domain adapter/domain fixtures that allows FIT to connect directly to [...]]]></description>
			<content:encoded><![CDATA[<p>During the <a href="/tag/agile2008">Agile 2008</a> conference, Mike Stockdale organised a mini-session where he and Rick Mugridge presented some new features and ideas that they are working on at the moment. The session led to a very interesting discussion on whether we could produce a variant of domain adapter/domain fixtures that allows FIT to connect directly to most domain services and objects without the need for any fixtures. <span id="more-281"></span></p>
<h2>The case against inheritance</h2>
<p>FIT and its architecture started back in 2002 and heavily relies on inheritance as a way to extend the framework and integrate business domain code into the framework. That makes it hard to maintain the framework, which Mike pointed out, as lots of people depend on inner workings of the Fixture class. (I myself have complained a few times about his refactorings of the .NET test runner that broke my existing code). It also limits the options we have to integrate domain code with the framework. I often write a lot of boilerplate code to wrap domain objects into fixtures, since the integration layer has to extend from the Fixture class. Some options like target objects, system under test and domain adapters make it easier to connect domain objects directly to fixtures, but they require us to write lots of boilerplate code and we still have to use fixtures. It is hard to incorporate some generic test management functionality, such as starting and rolling back transactions or invoking the debugger, without changing the test runner or again extending fixtures.</p>
<h2>Rich domain models and fixtures</h2>
<p>Both FIT.NET and Java FitLibrary have started to move towards using a rich domain model (as in DDD) more effectively than with traditional mapping of each step into a fixture or a Dofixture method. Domain fixtures and domain adapters in FIT.NET and Java FitLibrary “explain” how to utilise rich domain objects. What we&#8217;ve noticed on the mini-session is that these domain adapters effectively do two things:</p>
<ol>
<li>explain how to create and access domain objects (for setup and verification tasks)</li>
<li>explain how to find domain objects and execute methods on business services (action tasks between setup and verification)</li>
</ol>
<p>In addition to that, it is interesting that FIT.NET and Java FitLibrary now have a mechanism to define meta-data about a whole test suite (suite configuration file in .NET and the suite fixture in FitLibrary).</p>
<p>Moving forward in that direction, we felt that we could lift the requirement to implement fixtures for a large majority of cases if the underlying business code is developed using a rich domain model and other DDD principles.</p>
<h2>Integration with repositories</h2>
<p>Most projects based on a rich domain model will now effectively use a repository to store and find objects, so the first benefit could be achieved by implementing support for a few popular repository method naming conventions instead of encapsulating it into a custom domain adapter/fixture. The suite meta-data could be used to select the appropriate naming convention and define the appropriate repository objects for domain objects. This could be used to prepare domain objects for the test or verify changes in domain objects later. For example, the traditional setup fixture becomes obsolete and could be replaced simply by a repository call. For example, this is a common set-up table:</p>
<table border="1" style="border:1px solid black; margin-bottom:10px;">
<tr>
<td colspan="3">Customers</td>
</tr>
<tr>
<td>Name 	</td>
<td>Phone </td>
<td>Address</td>
</tr>
<tr>
<td>Mike Smith</td>
<td>0198919</td>
<td>&#8230;</td>
</tr>
<tr>
<td>Mike Scott</td>
<td>929292 </td>
<td>&#8230;</td>
</tr>
<tr>
<td>Tom Cruise</td>
<td>22929292 </td>
<td>&#8230;</td>
</tr>
</table>
<p>If there is a repository defined for the Customer class, this table in the setup part of the test would be executed by instantiating a Customer object for every row, populating FirstName, LastName and Phone and calling CustomerRepository.Save(Customer c) method. </p>
<p>A very important new idea is to store the result of this operation directly into a symbol; we discussed the option to mark a column that contains the appropriate symbol key with a * or similar, but concluded that it would be better to just use the first column as the key name. So the previous table would create three Customer objects and store them automatically into symbols “Mike Smith”, “Mike Scott” and “Tom Cruise”. So this would effectively replace even Column Fixtures that are used to extract the result and store it into a symbol. The rationale behind storing objects automatically into symbols is that the objects prepared in the setup are most likely required later in the test (why else would they be created?). </p>
<p>If there is no repository, objects would just be created by instantiating the domain class and storing it into the symbol. If there is a repository, this would result in an additional call to the repository and the result of the repository call would be stored into the symbol. The reason behind that is to allow the repository to further amend the object if required by business rules.</p>
<p>If the first cell in the first row is not a class name, then it could map to a service method name or a repository method name. The corresponding method would get called by mapping the parameters directly and the result (if not void) would again be stored in the symbol. Repositories and services would be configured in the suite meta-data, so there would be no requirement to implement additional code.</p>
<p>In the verification part of the test, the same table (if the first cell maps to a domain class name) would act as a column fixture that retrieves the symbol value based on the first column, and then compares the other fields to actual domain object values retrieved from the symbol. (Possibly by going to the repository again to find an object by id if there is a repository, to support test-specific stuff). If the first cell in the first row maps to a method name, the method would be executed and the results would be compared to the table. A third option would work on repository finders and would also test for list length (similar to a list or set fixture). For example</p>
<table border="1" style="border:1px solid black; margin-bottom:10px;">
<tr>
<td colspan="3">All Customers</td>
</tr>
<tr>
<td>Name 	</td>
<td>Phone </td>
<td>Address</td>
</tr>
<tr>
<td>Mike Smith</td>
<td>0198919</td>
<td>&#8230;</td>
</tr>
<tr>
<td>Mike Scott</td>
<td>929292 </td>
<td>&#8230;</td>
</tr>
<tr>
<td>Tom Cruise</td>
<td>22929292 </td>
<td>&#8230;</td>
</tr>
</table>
<p>would call CustomerRepository.FindAll() and compare the results with the table looking for missing or surplus customers as well.</p>
<table border="1" style="border:1px solid black; margin-bottom:10px;">
<tr>
<td colspan="3">Active Customers</td>
</tr>
<tr>
<td>Name 	</td>
<td>Phone </td>
<td>Address</td>
</tr>
<tr>
<td>Mike Smith</td>
<td>0198919</td>
<td>&#8230;</td>
</tr>
<tr>
<td>Mike Scott</td>
<td>929292 </td>
<td>&#8230;</td>
</tr>
<tr>
<td>Tom Cruise</td>
<td>22929292 </td>
<td>&#8230;</td>
</tr>
</table>
<p>would call CustomerRepository.FindActive() and so on.</p>
<h2>Test-specific functionality</h2>
<p>The acceptance sometimes do not list all the properties, to make tests more focused. If there is no fixture in between, the creation of objects in the repository might fail because of that. A solution for this case is to implement a decorator over the normal repository that adds the test-specific functionality (eg populates 10 remaining mandatory fields), and then using the test repository instead of the default repository in the suite meta-data configuration. This would also be the way to implement any other test-specific functionality. There is no way to avoid implementing this test-specific code, but this model would not require test-specifics to inherit from Fixture or require writing any other boilerplate code.</p>
<h2>Talking to business services</h2>
<p>One of the most important practices that DDD introduced is the ubiquitous language, a common jargon shared across all phases and participants of a project. One of the best practices for acceptance testing arising from that is using the same phrases for the same concepts in examples, acceptance tests and code. With this in mind, we really should not need any translation layers between the fixture tables and the domain code (both in objects and services). They should use the same jargon so we should be just able to glue them together by implementing a few naming conventions. </p>
<p>DoFixture and SequenceFixture support the concept of system under test, mapping calls directly to domain services. However, using SequenceFixture makes the test too technical and not really suitable for discussion with business people. Although this is relatively understandable:</p>
<table border="1" style="border:1px solid black; margin-bottom:10px;">
<tr>
<td>EnterRoom</td>
<td>Ana</td>
<td>LOTR</td>
</tr>
<tr>
<td>Invite</td>
<td>Ana</td>
<td>Mark</td>
<td>Join in</td>
<td>LOTR</td>
</tr>
<tr>
<td>Say</td>
<td>Ana</td>
<td>Hello</td>
</tr>
</table>
<p>It is much more natural to write this example as </p>
<table border="1" style="border:1px solid black; margin-bottom:10px;">
<tr>
<td>User</td>
<td>Ana</td>
<td>Enters room</td>
<td>LOTR</td>
</tr>
<tr>
<td>User</td>
<td>Ana</td>
<td>Sends Invitation</td>
<td>Join In</td>
<td>To User</td>
<td>Mark</td>
<td>For Room</td>
<td>LOTR</td>
</tr>
<tr>
<td>User</td>
<td>Ana</td>
<td>Says</td>
<td>Hello</td>
</tr>
</table>
<p>DoFixture allows us to write scripts like this, but then requires the system under test to implement silly method name such as UserSendsInvitationToUserForRoom. No self-respecting programmer would create such a name in a business service.</p>
<h2>Guessing the operation</h2>
<p>Working on a few examples from the FIT book, we discussed how this link could be implemented better, for example creating something similar to DoFixture but that would map to more sensible method names, which would be written in normal domain objects and services. This would promote the idea of ubiquitous language even further, because it would suggest the correct service method or domain object method name. The final idea was to try out a few keyword combinations and find what the method name is, similar to service fixture but not requiring it to be the first keyword.</p>
<table border="1" style="border:1px solid black; margin-bottom:10px;">
<tr>
<td>User</td>
<td>Ana</td>
<td>Enters room</td>
<td>LOTR</td>
</tr>
</table>
<p>This could theoretically map to three methods: ChatService.Enter(User u, Room r), Room.Enter(User u) or User.Enter(Room r). If we have a ChatService in the suite meta-data configuration, then the algorithm could try to map keywords to either the service methods or class methods and look for the appropriate call. A possible pitfall is that this could lead to ambiguity. To promote the use of natural language, we would apply some basic transformations (such as stripping the final s from Enters), and ignoring some words (such as “a” or “on”). So we could use “Book a flight”, not forcing people to write “book flight”. Then:</p>
<table border="1" style="border:1px solid black; margin-bottom:10px;">
<tr>
<td>Book a flight from</td>
<td>LAX</td>
<td>to</td>
<td>JFK</td>
</tr>
</table>
<p>would map to FlightService.BookFlight(Location from, Location to). The list of ignored words would probably also be configured on the suite level with some defaults.</p>
<p>The sentences could be even shorter, since the setup part would already have stored Ana, LOTR, LAX and JFK in symbols and we could extract the correct type. </p>
<p>We also discussed automatic object tree traversal, for example “Mike&#8217;s credit card number” would map to (Symbol(&#8216;mike&#8217;)).CreditCard.Number.</p>
<h2>Checking in natural language</h2>
<p>Instead of </p>
<table border="1" style="border:1px solid black; margin-bottom:10px;">
<tr>
<td>Check</td>
<td>Mike&#8217;s credit card number</td>
<td>41111111</td>
</tr>
</table>
<p>we would use the &#8220;is&#8221; keyword:</p>
<table border="1" style="border:1px solid black; margin-bottom:10px;">
<tr>
<td>Mike&#8217;s credit card number</td>
<td>is</td>
<td>41111111</td>
</tr>
</table>
<p>this would work very similar to &#8220;check&#8221; at the moment, meaning it will execute everything on the left how ever it is marked up, and compare the result to the cell on the right, but it reads much more naturally.</p>
<h2>Tables or no tables</h2>
<p>An interesting discussion followed after this on whether we need tables at all, or should we just try to recognise keywords. My personal opinion is that tables are good because they clearly identify what is a test script and what is just a description on the page. In any case, a bit of CSS tweaking can make the cells invisible.</p>
<h2>Extension points</h2>
<p>We also discussed the importance of providing a number of extension points or hooks for acceptance test execution, that would enable us to augment or modify the way tests are executed (eg run the test in a transaction and roll back, filter/debug on individual cells). The idea was to use something similar to filters (aspect-oriented) to attach to test runners and again encapsulate only test-specific code into that. The suite meta-data configuration file should allow us to specify filters that are applied to the whole test, to individual tables and individual cells (possibly with regex content matching to narrow it down).</p>
<h2>Conclusion</h2>
<p>With direct domain mapping to repositories and domain objects, setup and verification parts of most of the tests in a rich domain model project can easily be automated without writing fixtures if there is no test specific functionality. Smart keyword mapping will allow us to do the same for the middle parts of the test, where we mostly talk to domain services. Automatically storing objects from the setup part in symbols will make it easy to use those objects in the rest of the test. Using all that, we could effectively connect acceptance tests directly to rich domain models, without fixtures. Repositories and services would be configured in the test suite configuration file, so there would be no additional code required apart from genuinely test-specific code. Any genuinely test specific code could be encapsulated in test-specific repository decorators, and test-specific services, without the requirement to extend any class from the Fixture framework. Generic test-control functionality could be injected and reused across tests using configurable extension points, which should probably just implement a particular filter interface. </p>
<h2>Challenges</h2>
<p>Ambiguity seems to be the biggest challenge at the moment, and we need to work out strategies for avoiding ambiguity. Another challenge is to identify important naming conventions for repositories so that people can use this approach without changing the way they work at the moment. </p>
<p>An open question is how to divide the test clearly into three parts (setup, action, verification) while keeping them optional (eg support setup-verification or setup-action or action-verification). Rick&#8217;s domain fixture at the moment relies on a horisontal line (&lt;HR/&gt;) but this does not work with the standard FitServer. Possibly have some keywords (such as Given, When, Then from BDD) that stand as separate tables on the page.</p>
<h2>Going forward</h2>
<p>We experimented with relatively simplistic examples, and although this looks promising we need to try it out on some more complicated code. I promised to try to re-write some of my production tests using this model to identify potential pitfalls. If you did not give up reading this by now, then you are probably genuinely interested in the subject, so your feedback and ideas would also be greatly appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2008/08/12/fit-without-fixtures/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>The Fixture Gallery in Portugese</title>
		<link>http://gojko.net/2008/08/11/the-fixture-gallery-in-portugese/</link>
		<comments>http://gojko.net/2008/08/11/the-fixture-gallery-in-portugese/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 14:27:25 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[fit]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[fixture gallery]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=278</guid>
		<description><![CDATA[Ivan Sanchez translated the FIT/FitNesse Fixture Gallery to Portugese. Translation of release 2.1 (2008-08-11) is now online: a print-ready PDF an executable FitNesse wiki a live web site]]></description>
			<content:encoded><![CDATA[<p><a href="http://dojofloripa.wordpress.com/" target="_blank">Ivan Sanchez</a> translated the <a href="/fitnesse/fixturegallery">FIT/FitNesse Fixture Gallery</a> to Portugese. Translation of release 2.1 (2008-08-11) is now online: </p>
<ul>
<li><a target="_blank" href="http://downloads.sourceforge.net/fixturegallery/fixturegallery-pt-20080811.pdf">a print-ready PDF</a></li>
<li><a target="_blank" href="http://downloads.sourceforge.net/fixturegallery/fixturegallery-pt-wiki-20080811.zip?use_mirror=osdn">an executable FitNesse wiki</a></li>
<li><a href="http://www.fitnesse.info/pt:fixturegallery"  target="_blank">a live web site</a>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2008/08/11/the-fixture-gallery-in-portugese/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
