In this article I will try to explain, how to use approach “Specification by Example” on real project. What tool and framework You need for this. This example will include part of real automation testing framework (ATF) for testing of Web UI application. ATF is based on Java, JUnit, Maven, Selenium and Concordion.

Ok, so what You need to know to start with thing like this? First of all it’s good to have some practice with Java, JUnit and automation Web UI testing (I mean Selenium). If You know everything of it and if You know what is Page Object pattern – let’s imagine, that You have ready ATF based on Java, Selenium and start with implementing of Concordion into this ATF. This examples shows a real example of creation new item on Atlassian’s Jira test project.

Let’s do everything step by step.

Step 1.

Add dependency in pom.xml


Step 2.

Need to configure pom.xml correctly for using correct folders and making of correct output reports. Add next section to Your pom.xml file:


Step 3.

From previous step You see, that out *.html example will be stored in /src/test/specs. So, create in Your project under /src/test folder specs. And create in this folder an empty HTML file. It will be our specification. Put next data into HTML file:

<html xmlns:concordion="http://www.concordion.org/2007/concordion">
    <head lang="en">
        <meta charset="UTF-8"/>
        <h2>Test - create new issue and verify that it's created successfully</h2>
        <p>Given username</p>
         <span concordion:set="#username">denys.zaiats@gmail.com</span>
        <p>Given password</p>       
         <span concordion:set="#password">dzaiats2015</span>       
         <p concordion:execute="performLogin(#username, #password)">Step 1. Perform login</p>       
        <p>Summary: </p>
         <span concordion:set="#summary">New issue created by automated test</span>        
        <p>Description: </p>
         <span concordion:set="#description">Issue description</span>       
        <p>Priority: </p>
         <span concordion:set="#priority">Major</span>
         <p concordion:execute="createNewIssue(#summary, #description, #priority)">
            Step 2. Create new issue
         <p concordion:assertTrue="isIssueCreated()">Step 3. Assert - new issue is created</p>

As You see – You need to use Concordion schema for using of concordion’s attributes. There are next most used concordion attributes which You can use:

  • concordion:assertEquals
  • concordion:assertTrue
  • concordion:set
  • concordion:execute
  • concordion:run
  • concordion:execute on a <table>
  • concordion:execute on a <list>
  • concordion:verifyRows

You can set parameters which You want to pass in methods. You can just execute method if You want to perform any void method. More information about using of this You can find here

Step 4.

Need to create correct java test with ConcordionRunner. Here is presented an example of it:

public class CreateNewIssueSuccessfullyTest extends TestBase{

    public void performLogin(String username, String password){
        LoginPage loginPage = home.loginPage();
        loginPage.login(username, password);

    public void createNewIssue(String summary, String description, String priority){
        home.createNewIssue(summary, description, priority);

    public boolean isIssueCreated(){
        return home.isNewIssueCreated();

Step 5.

If You did everything correctly – You should be able to clean and install project without problem with using of Maven. After successful test run new report-file will appear in folder /target/specs/

What the benefits of using this approach? The answer is obviously. You have good readable living documentations which are the part of tests. And business logic is represented not only in the code, but also in readable view for non-technical stuff.

A bit later I will post a link to live example with source code of this implementation. If You have any question – just send me e-mail to itarray.net@gmail.com

Thanks for reading my articles.