Concordion is a simple, but powerful, agile acceptance testing tool for Java.

Scripting Makeover

This makeover contrasts a typical Fit/FitNesse test with the Concordion equivalent specification.

Before

Fitnesse is a wiki-based system and has acceptance tests covering its wiki syntax. This example (taken from its website¹) covers the syntax for bold text:

FitNesse before (scripting)

This is a test script. It tells you how to test the bold text feature.

The test also includes several unexplained table cells. For example, what are "page attributes" and what does "valid?" mean in this context? These kinds of irrelevant details often occur in Fit/FitNesse tests because the standard usage pattern is to create a handful of generic fixtures and copy-and-paste them.


After

The equivalent Concordion active specification is written at a more abstract level. It doesn't care how you test it, it just tells you what's supposed to happen:

Concordion (specifying)

This is a specification. It describes the behaviour and gives an example.

Behind the scenes, the first <pre> will be instrumented to set a temporary variable:

concordion:set="#wikiText"

The second <pre> element will check the result:

concordion:assertEquals="renderAsHTML(#wikiText)"

And all the scripting necessary to render the wiki text will be hidden away in the accompanying Java fixture:

import org.concordion.integration.junit3.ConcordionTestCase;

public class BoldTextTest extends ConcordionTestCase {

    public String renderAsHTML(String wikiText) {
        // TODO
    }
}

¹ Source: http://fitnesse.org/FitNesse.SuiteAcceptanceTests.SuiteWidgetTests.TestBoldText [23 Oct 2007]