Thought I would spill the beans and announce that Alien-Factory (me!) is working on a new library called Fancordion.

It is based on Concordion for Java written a few years ago by a ex-collegue. The new Fantom version has some exciting changes!

The original Concordion uses HTML to drive JUnit tests, producing great looking acceptance test documents. The documents are written in plain English and have colour coded markup to show passing / failing assertions. Similar to Cucumber except without the hardship of regular expressions, re-use ambiguity, and they look great!!!

Whereas the original Concordion uses HTML, the Fantom version uses Fandoc! Because Fandoc is almost plain text and has very little markup, it is super easy to write your specifications!

And, whereas the original Concordion uses a separate HTML file for the specification, the Fantom version lets you use the Doc Comment from your Test - keeping the specification and fixture code nicely together in the same file!

Here's a current working example:

select all
using afFancordion

** My First Fixture
** ################
**
** This is a simple Fancordion fixture that verifies that the method
** 'greeting()' returns 'Hello World!'.
**
** Example
** -------
** Fancordion says, [Hello World!]`verify:eq(greeting)`
**
class HelloWorldFixture : FixtureTest {
    Str greeting() {
        "Hello World!"
    }
}

Note that FixtureTest extends the usual Fantom unit Test class - that means we can run it with fant, just like we do with any other unit test:

select all
C:\> fant HelloWorldFixture.fan

-- Run:  HelloWorldFixture_0::HelloWorldFixture.testFixture...
   Pass: HelloWorldFixture_0::HelloWorldFixture.testFixture [0]

[info] [afFancordion] file:/C:/temp/fancordion/HelloWorldFixture.html

Time: 691ms

***
*** All tests passed! [1 tests, 1 methods, 1 verifies]
***

From that test Fancordion produced a HTML output file. Lets open it up:

HTML result file generated by Fancordion

Wow! Beautiful!

Well okay, it looks better than console output! What you see is the default original Concordion look and feel. The Fantom version is very skinnable will also ship with a Bootstrap v3.2 skin. I think it is important for users to be able to customise their reports.

How does it work?

The Fandoc (once found) is parsed into a HTML efan template.

Links in the Fandoc specification have a special syntax and are used as commands. Ultimately these commands reference and call into your test / fixture code. Using the above example, the link:

[Hello World!]`verify:eq(greeting)`

is converted into the following Fantom code:

verifyEq("Hello World!", greeting())

Which is run and executed just like any other test code! And because the test code is embedded within an efan template, the HTML result file is generated at the same time.

Development progress on Fancordion is solid and so far has:

  • Fandoc parsing
  • efan template generation
  • Verify commands
  • Set commands
  • Execute commands
  • Skinnable API

Though there is still more to do before a preview release.

I'm also planning to incorporate simple tables into the Fandoc specifications, for tables are used a lot in Concordion tests.

Stay tuned!


Discuss