<?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>maxheapsize.com &#187; concordion</title>
	<atom:link href="http://maxheapsize.com/tag/concordion/feed/" rel="self" type="application/rss+xml" />
	<link>http://maxheapsize.com</link>
	<description>Oliver Wehrens on Programming and Agile</description>
	<lastBuildDate>Tue, 14 Jun 2011 20:41:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Concordion vs. Cucumber and Java based Acceptance Testing</title>
		<link>http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/</link>
		<comments>http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 05:57:03 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[acceptance]]></category>
		<category><![CDATA[concordion]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[cuke4duke]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=349</guid>
		<description><![CDATA[If you want your Business Analyst to provide some acceptance tests for your implementation it would be best to make sure you get it in some form your tests can read. That way you can make sure your code does really do that what the customers wants. Two tools to achieve that are Concordion and [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2009%2F10%2F13%2Fconcordion-vs-cucumber-and-java-based-acceptance-testing%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2009%2F10%2F13%2Fconcordion-vs-cucumber-and-java-based-acceptance-testing%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>If you want your Business Analyst to provide some acceptance tests for your implementation it would be best to make sure you get it in some form your tests can read. That way you can make sure your code does really do that what the customers wants. </p>
<p>Two tools to achieve that are <a href="http://www.concordion.org">Concordion</a> and <a href="http://cukes.info">Cucumber</a> (and cuke4duke).  Both taking the approach of <a href="http://c2.fit.com">Fit</a> a step further. You can find very good documentation for the tools on their web pages or as examples along with the code.</p>
<h2>Concordion</h2>
<p>Concordion let&#8217;s you write the specifications in html. You can  instrument them with some Concordion code. Since the instrumentation code is in html, it is hidden when you render it.</p>
<pre class="brush: xml; title: ;">
&lt;html xmlns:concordion=&quot;http://www.concordion.org/2007/concordion&quot;
      xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:schemaLocation=&quot;http://www.concordion.org/2007/concordion &quot;&gt;
&lt;body&gt;
&lt;p&gt;
  &lt;span concordion:execute=&quot;setCurrentTime(#TEXT)&quot;&gt;09:00AM&lt;/span&gt;
  The greeting for user &lt;span concordion:set=&quot;#firstName&quot;&gt;Bob&lt;/span&gt;
  will be:
  &lt;span concordion:assertEquals=&quot;greetingFor(#firstName)&quot;&gt;Hello Bob!&lt;/span&gt;
&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Concordion can instrument free text as well as tables to have some sort of data provider for tests. It  integrates directly with JUnit (no TestNG support yet).</p>
<div class="wp-caption aligncenter" style="width: 417px"><img alt="Concordion Specification/Fixture/System" src="http://maxheapsize.com/static/ConcordionFixture.png" title="Concordion Specification/Fixture/System" width="407" height="114" /><p class="wp-caption-text">Concordion Specification/Fixture/System</p></div>
<p>The idea is that your specifications is stable. This will not change as much as maybe your code to fulfill the requirements of the customer. Your fixture bridges these two together. </p>
<pre class="brush: java; title: ;">
package com.maxheapsize.concordion;
import org.concordion.integration.junit3.ConcordionTestCase;
public class DemoTest extends ConcordionTestCase {

    public String greetingFor(String firstName) {
        return &quot;Hello &quot; + firstName + &quot;!&quot;;
    }

    public void setCurrentTime(String time) {
        System.out.println(time);
    }
}
</pre>
<p>Your java code provides the methods which are called from the specification. At that point you are most likely to use a DSL to build up your business logic. Concordion will assert the expected values. </p>
<p>After you run the unit test you will get a nice looking html page. </p>
<div class="wp-caption aligncenter" style="width: 640px"><img alt="Concordion output" src="http://maxheapsize.com/static/ConcordionResult.png" title="Concordion output" width="630" height="122" /><p class="wp-caption-text">Concordion output</p></div>
<p>Passed tests will be green, failed red, pretty easy.</p>
<p>Pro Concordion:</p>
<ul>
<li>Instrumention of  free text</li>
<li>The final report is nice looking</li>
<li>JUnit support</li>
<li>Easy setup</li>
<li>Pure Java</li>
</ul>
<p>Con Concordion:</p>
<ul>
<li>The business analyst needs to know a little bit of html</li>
<li>Usually the programmer needs to change the specification to instrument it</li>
<li>You program parts in html, refactoring support is missing</li>
<li>No TestNG support</li>
</ul>
<h2>Cucumber</h2>
<p>Cucumber is a ruby based behaviour driven development tool. Since you can run Ruby code inside the JVM with the help of JRuby it is possible to use it for your Java code. The usually way so far is that you use maven or ant to startup JRuby and the Cucumber ruby code.</p>
<p>In Cucumber you write your specification (or feature) in plain english (or russian, german,<a href="http://en.wikipedia.org/wiki/LOLCODE">lolcode</a> or 36 or so more supported languages). No instrumentation is necessary but your customer has to stick to a certain layout (or better: structure). It follows the well known given-when-then pattern.</p>
<pre class="brush: plain; title: ;">
Feature: Demo

  Scenario: A Car with 4 wheels
    Given I have a car
    When I add 4 wheels
    Then I should be able to drive the car
</pre>
<p>You can write your step definitions (like the fixture in Concordion) with the help of annotations.</p>
<pre class="brush: java; title: ;">
package com.maxheapsize.cucumber;

import cuke4duke.Given;
import cuke4duke.Then;
import cuke4duke.When;
import org.junit.Assert;

public class CarFeature {
  private Car car;
  @Given(&quot;I have a car&quot;)
  public void iHaveACar() {
    car = new Car();
  }

  @When(&quot;I add (\\d+) wheels&quot;)
  public void iAddWheels(int numberOfWheels) {
    car.setWheels(numberOfWheels);
  }

  @Then(&quot;I should be able to drive the car&quot;)
  public void iShouldBeAbleToDriveTheCar() {
    Assert.assertTrue(car.canDrive());
  }
}
</pre>
<p>The regular expressions defined in the annotations must match the feature definitions.</p>
<div class="wp-caption aligncenter" style="width: 490px"><img alt="Cucumber results" src="http://maxheapsize.com/static/cucumber.png" title="Cucumber results" width="480" height="159" /><p class="wp-caption-text">Cucumber results</p></div>
<p>You can define information in a table like structure as well to provide more data in an easy way. The given when then structure can be used to have multiple when&#8217;s or then&#8217;s. So it is very flexible that way.</p>
<p>Pro Cucumber</p>
<ul>
<li>Feature can be described in plain language</li>
<li>No extra programmer work on he feature required</li>
<li>Instrumentation is directly on the Java code via annotations</li>
</ul>
<p>Con Cucumber</p>
<ul>
<li>More complex due to the Ruby/JRuby/Java chain</li>
<li>Business analyst needs to stick to predefined format</li>
<li>The only way (without extra work to write a runner)  to run it seems to be within ant or maven, for rapid turn around and TDD I would like to have JUnit/TestNG support of some kind</li>
</ul>
<h2>Verdict</h2>
<p>It is easy to get started with both tools. I spent about a couple of hours with each of them and was able to get simple and a bit more complex examples running. They get you going with BDD and acceptance based testing.</p>
<p>I like parts of both concepts. I want to be able to write a feature like in Cucumber. The instrumentation should be directly on my code and not in the part of the customer. The easy setup and integration of Concordion with JUnit (need TestNG here) and the output of it is very nice. So where is the tool which has these features <img src='http://maxheapsize.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p>
<p>So which tools will I use?</p>
<p>I have yet to see the use case where the business analyst writes the (and updates) the acceptance tests.  I don&#8217;t mind add some extra code to the specification and I know html. I might get started with Concordion for now.</p>
<p>You might also check my post about <a href="http://maxheapsize.com/2009/02/10/behavior-driven-development-with-easyb-and-vs-testng/">Behavior driven development with EasyB (and vs. TestNG)</a>.</p>
<p>Do you use any of these tools? Or a different one? What&#8217;s your expierence?</p>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing&amp;url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;bm_description=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing+@+http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

