Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti.

Post on 26-Mar-2015

215 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

Transcript

Concordion

You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti.

How can we stop it?

Clean code expresses its logic clearly. It's well presented and makes good use of abstraction to hide irrelevant details.

Or to put it simply...

It's readable.

So, focus relentlessly on readability. Not just in code,

but in everything:

Build scripts, class names, log files, story cards, acceptance tests,

method names, e-mails, unit tests,management reports, etc.

Don't tolerate acceptance tests written like this...

Use Concordion and write them like this instead...

Clear tests lead to clear fixture code

Notice you are not forced to use tables or a "Given... When... Then..." structure

"Given... When... Then..." is an excellent thinking tool, but it's not a natural way to explain things.

Concordion lets you focus on readability.

Visibility to Management

A huge benefit of having readable tests is that managers can actually read them and gauge their quality.

This provides the team with an incentive for writing them well and not cutting corners.

• Tables <table>, <tr>, <th>, <td>

• Paragraphs <p>

• Bold <b>

• Headings <h1>

You don't need to know much HTMLto use Concordion...

A Worked Example of Concordion

Although this HTML might look a bit complicated, most of it is just a template.

You only need to worry about the bits in the middle...

Now, highlight the key phrases in bold...

Once agreed, the developer can instrument it with hidden attributes that

communicate with the fixture...

Here's our base fixture...

If we run it with JUnit, then currently it will fail...

The test output is written to a filein the temp directory*...

* You can change this via a system variable, if you like.

Let's add the missing methodand run it again...

It still fails, so let's get it to pass.

Normally this would be a call to the system under test, but for this demowe'll just implement it in the fixture...

There are versions for...

• Java

• .NET

• Ruby

• Python

http://www.concordion.org

Coaching

Although Concordion is very easy to use, the way of thinking - distilling and decomposing behaviours - can take some to get used to.

I'm an independent consultant based in London, UK.

Please contact me if you would like some help getting your team off on the right track with Concordion.

David Peterson

david@crowdsoft.comhttp://www.davidpeterson.co.uk

top related