Skip to content

Recent Articles


Serenity 1.0.42 and the new Timeout API

Serenity core 1.0.42 is out, with a major overhaul to implicit and explicit timeouts, making the timeout behaviour more consistent and more flexible.

Modern AJAX-based web applications add a great deal of complexity to web testing. The basic problem is, when you access a web element on a page, it may not be available yet. So you need to wait a bit. Indeed, many tests contain hard-coded pauses scattered through the code to cater for this sort of thing.

But hard-coded waits are evil. They slow down your test suite, and cause them to fail randomly if they are not long enough. Rather, you need to wait for a particular state or event. Selenium provides great support for this, and Serenity builds on this support to make it easier to use.

Implicit Waits

The first way you can manage how WebDriver handles tardy fields is to use the  webdriver.timeouts.implicitlywait property. This determines how long, in milliseconds, WebDriver will wait if an element it tries to access is not present on the page. To quote the WebDriver documentation:

“An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available.”

The default value in Serenity for this property is currently 2 seconds. This is different from standard WebDriver, where the default is zero.

Let’s look at an example. Suppose we have a PageObject with a field defined like this:

public WebElementFacade slowLoadingField;

This field takes a little while to load, so won’t be ready immediately on the page.

Now suppose we set the webdriver.timeouts.implicitlywait value to 5000, and that our test uses the slowLoadingField:

boolean loadingFinished = slowLoadingField.isDisplayed()

When we access this field, two things can happen. If the field takes less than 5 seconds to load, all will be good. But if it takes more than 5 seconds, a NoSuchElementException (or something similar) will be thrown.

That this timeout also applies for lists. Suppose we have defined a field like this, which takes some time to dynamically load:

@FindBy(css="#elements option")
public List<WebElementFacade> elementItems;

Now suppose we count the values of the element like this:

int itemCount = elementItems.size()

The number of items returned will depend on the implicit wait value. If we set the webdriver.timeouts.implicitlywait value to a very small value, WebDriver may only load some of the values. But if we give the list enough time to load completely, we will get the full list.

The implicit wait value is set globally for each WebDriver instance, but you can override the value yourself. The simplest way to do this from within a Serenity PageObject is to use the setImplicitTimeout() method:

setImplicitTimeout(5, SECONDS)

But remember this is a global configuration, so will also affect other page objects. So once you are done, you should always reset the implicit timeout to its previous value. Serenity gives you a handy method to do this:


See for more details on how the WebDriver implicit waits work.

Explicit Timeouts

You can also wait until an element is in a particular state. For example, we could wait until a field becomes visible:


You can also wait for more arbitrary conditions, e.g.


The default time that Serenity will wait is determined by the webdriver.wait.for.timeout property. The default value for this property is 5 seconds.

Sometimes you want to give WebDriver some more time for a specific operation. From within a PageObject, you can override or extend the implicit timeout by using the withTimeoutOf() method. For example, you could wait for the #elements list to load for up to 5 seconds like this:

withTimeoutOf(5, SECONDS).waitForPresenceOf(By.cssSelector("#elements option"))

You can also specify the timeout for a field. For example, if you wanted to wait for up to 5 seconds for a button to become clickable before clicking on it, you could do the following:

 someButton.withTimeoutOf(5, SECONDS).waitUntilClickable().click()

You can also use this approach to retrieve elements:

elements = withTimeoutOf(5, SECONDS).findAll("#elements option")

Finally, if a specific element a PageObject needs to have a bit more time to load, you can use the timeoutInSeconds attribute in the Serenity @FindBy annotation, e.g.

import net.serenitybdd.core.annotations.findby.FindBy;
@FindBy(name = "country", timeoutInSeconds="10")
public WebElementFacade country;

You can also wait for an element to be in a particular state, and then perform an action on the element. Here we wait for an element to be clickable before clicking on the element:

addToCartButton.withTimeoutOf(5, SECONDS).waitUntilClickable().click()

Or, you can wait directly on a web element:

WebElementFacade facebookIcon;
public WebElementState facebookIcon() {
    return withTimeoutOf(5, TimeUnit.SECONDS).waitFor(facebookIcon);

Or even:

List<WebElementFacade> currencies = withTimeoutOf(5, TimeUnit.SECONDS)

This is just an overview of a few of the ways you can handle asynchronous fields in Serenity – there are many variations around these themes. More detailed documentation will be available soon in the Serenity BDD documentation.


Serenity Core 1.0.38 Released

Serenity Core 1.0.38 includes a number of bug fixes and improvements, including:

  • The CSVReader can now parse special characters like \n,\t etc.
  • Fixed a bug with requirements reporting for @pending Cucumber scenarios
  • Updated to Selenium 2.45.0
  • Fixed an issue in which tests were slowed down after a failing step because Serenity continued to try to take snapshots.

Keep tabs on the latest releases on Bintray!


Handling work-in-progress with Thucydides and JBehave using @pending and @wip tags

Thucydides version 0.9.268 has just been released, with a few very interesting new features. Thucydides is an open source reporting library that helps you write more effective BDD-style automated acceptance criteria, and generate richer test reports, requirements reports and living documentation. In this article, we will look at some of the new ways this version lets you handle work-in-progress or pending scenarios with Thucydides and JBehave. Read more »


BDD Requirements Management with JBehave, Thucydides and JIRA – Part 2

Thucydides is an open source library designed to make practicing Behaviour Driven Development easier. Thucydides plays nicely with BDD tools such as JBehave, or even more traditional tools like JUnit, to make writing automated acceptance tests easier, and to provide richer and more useful living documentation. In this series of articles, we look at the tight one and two-way integration that Thucydides offers with JIRA. The first article discussed basic one-way integration with JIRA. In this article, we will looking at taking that integration further. We will see how to insert links to the Thucydides reports into JIRA, how to update the state of JIRA issues based on the Thucydides test outcomes, and how to report on JIRA versions and releases in the Thucydides reports.

The rest of this article assumes you have some familiarily with Thucydides. For a tutorial introduction to Thucydides, check out the Thucydides Documentation or this article for a quick introduction.

The simplest form of two-way integration between Thucydides and JIRA is to get Thucydides to insert a comment containing links to the Thucydides test reports for each related issue card. To get this to work, you need to tell Thucydides where the reports live. One way to do this is to add a property calledthucydides.public.url to your file with the address of the thucydides reports.


This will tell Thucydides that you not only want links from the Thucydides reports to JIRA, but you also want to include links in the JIRA cards back to the corresponding Thucydides reports. When this property is defined, Thucydides will add a comment like the following to any issues associated with the executed tests:


The thucydides.public.url will typically point to a local web server where you deploy your reports, or to a path within your CI server. For example you could publish the Thucydides reports on Jenkins using theJenkins HTML Publisher Plugin, and then add a line like the following to your file:


If you do not want Thucydides to update the JIRA issues for a particular run (e.g. when running your tests locally), you can also set thucydides.skip.jira.updates to true, e.g.


This will simply write the relevant issue numbers to the log rather than trying to connect to JIRA.

Updating JIRA issue states

You can also configure the plugin to update the status of JIRA issues. This is deactivated by default: to use this option, you need to set the option to true, e.g.

The default configuration will work with the default JIRA workflow: open or in progress issues associated with successful tests will be resolved, and closed or resolved issues associated with failing tests will be reopened. If you are using a customized workflow, or want to modify the way the transitions work, you can write your own workflow configuration. Workflow configuration uses a simple Groovy DSL. The following is an example of the configuration file used for the default workflow:

    when 'Open', {
        'success' should: 'Resolve Issue'

    when 'Reopened', {
        'success' should: 'Resolve Issue'

    when 'Resolved', {
        'failure' should: 'Reopen Issue'

    when 'In Progress', {
        'success' should: ['Stop Progress','Resolve Issue']

    when 'Closed', {
        'failure' should: 'Reopen Issue'

You can write your own configuration file and place it on the classpath of your test project (e.g. in theresources directory). Then you can override the default configuration by using thethucydides.jira.workflow property, e.g.


Alternatively, you can simply create a file called jira-workflow.groovy and place it somewhere on your classpath (e.g. in the src/test/resources directory). Thucydides will then use this workflow. In both these cases, you don’t need to explicitly set the property.

Release management

In JIRA, you can organize your project releases into versions, as illustrated here:


You can and assign cards to one or more versions using the Fix Version/s field:


By default, Thucydides will read version details from the Releases in JIRA. Test outcomes will be associated with a particular version using the “Fixed versions” field. The Releases tab gives you a run-down of the different planned versions, and how well they have been tested so far:


JIRA uses a flat version structure – you can’t have for example releases that are made up of a number of sprints. Thucydides lets you organize these in a hierarchical structure based on a simple naming convention. By default, Thucydides uses “release” as the highest level release, and either “iteration” or “sprint” as the second level. For example, suppose you have the the following list of versions in JIRA – Release 1 – Iteration 1.1 – Iteration 1.2 – Release 2 – Release 3

This will produce Release reports for Release 1, Release 2, and Release 3, with Iteration 1.2 and Iteration 1.2 appearing underneath Release 1. The reports will contain the list of requirements and test outcomes associated with each release. You can drill down into any of the releases to see details about that particular release


You can also customize the names of the types of release usinge the thucydides.release.typesproperty, e.g.

thucydides.release.types=milestone, release, version


Thucydides has powerful one and two-way integration with JIRA. In these articles, we have seen how you can incoporate links from Thucydides to JIRA, from JIRA to Thucyides, and even update the status of issues in JIRA based on the test results. And, if you are managing your versions in JIRA, you can also report on how well each version has been tested, and what remains to be tested before the next release.

Want to learn more? Be sure to check out the Thucydides web site, the Thucydides Blog, or join theThucydides Google Users Group to join the discussion with other Thucydides users.

Wakaleo Consulting, the company behind Thucydides, also runs regular courses in Australia, London and Europe on related topics such as Agile Requirements GatheringBehaviour Driven DevelopmentTest Driven Development, and Automated Acceptance Testing.


New Thucydides release: 0.9.260

This new release integrates Selenium 2.42.2, has improved reporting, a number of improvements to the internal APIs, and addresses a number of issues and improvements. Some of the more notable ones include:

  • THUCYDIDES-242 – Need some way to obtain current TestStep within custom StepListener: You can get (a copy of) the current test step by calling
  • THUCYDIDES-192 – Fixed a reporting issue when multiple features or stories had identical names
  • THUCYDIDES-232 – get page source on step failure: You can retrieve the page source of the latest step using the StepEventBus.getEventBus().getCurrentStep() method.
  • THUCYDIDES-148 – Thucydides.ignoredStep should not be marked as pended: Thucydides now handles failed assumptions (e.g  Assume.assumeThat(true, is(false))) in JUnit correctly. Tests with failing assumptions are marked as skipped and reported with an “assumption violation” error.
  • THUCYDIDES-35 – Allow using multibyte charactor in class name and method name.
  • THUCYDIDES-151 – Report aggregate – Running test with parametrized test data seems to have a limitation of 10 parameter pairs
  • THUCYDIDES-177 – Report groups test cases for data-driven tests using a CSV file
  • THUCYDIDES-214 – thucydides-jira-plugin produces wrong test ID in link posted back to JIRA when using ParameterizedRunner
  • THUCYDIDES-235 – Incorrect result appears in log in case if one “Step” using another “Step” (substep)
  • THUCYDIDES-227 – Show/hide tags on the main report page

Other fixes/improvements include

  • THUCYDIDES-88 logback.groovy in thucydides-core breaks application logging configuration
  • THUCYDIDES-239 Better exception reporting in ResizableImage
  • THUCYDIDES-228 Don`t write qualifier in console log for DDT Tests
  • THUCYDIDES-240 BeanMatcher throws IllegalArgumentException for field names containing dots (or opening parenthesis / square bracket)



BDD Requirements Management with JBehave, Thucydides and JIRA – Part 1

Thucydides is an open source library designed to make practicing Behaviour Driven Development easier. Thucydides plays nicely with BDD tools such as JBehave, or even more traditional tools like JUnit, to make writing automated acceptance tests easier, and to provide richer and more useful living documentation. In a series of two articles, we will look at the tight one and two-way integration that Thucydides offers with JIRA.

The rest of this article assumes you have some familiarily with Thucydides. For a tutorial introduction to Thucydides, check out the Thucydides Documentation or this article for a quick introduction.

Getting started with Thucydides/JIRA integration

Atlassian JIRA

JIRA is a popular issue tracking system that is also often used for Agile project and requirements management. Many teams using JIRA store their requirements electronically in the form of story cards and epics in JIRA

Suppose we are implementing a Frequent Flyer application for an airline. The idea is that travellers will earn points when they fly with our airline, based on the distance they fly. Travellers start out with a “Bronze” status, and can earn a better status by flying more frequently. Travellers with a higher frequent flyer status benefit from advantages such as lounge access, prioritized boarding, and so on. One of the story cards for this feature might look like the following:


This story contains a description following one of the frequently-used formats for user story descriptions (“as a..I that”). It also contains a custom “Acceptance Criteria” field, where we can write down a brief outline of the “definition of done” for this story.

These stories can be grouped into epics, and placed into sprints for project planning, as illustrated in the JIRA Agile board shown here:


As illustrated in the story card, each of these stories has a set of acceptance criteria, which we can build into more detailed scenarios, based on concrete examples. We can then automate these scenarios using a BDD tool like JBehave.

The story in Figure 1 describes how many points members need to earn to be awarded each status level. A JBehave scenario for the story card illustrated earlier might look like this:

Frequent Flyer status is calculated based on points

@issue FH-17

Scenario: New members should start out as Bronze members
Given Jill Smith is not a Frequent Flyer member
When she registers on the Frequent Flyer program
Then she should have a status of Bronze

Scenario: Members should get status updates based on status points earned
Given a member has a status of <initialStatus>
And he has <initialStatusPoints> status points
When he earns <extraPoints> extra status points
Then he should have a status of <finalStatus>
| initialStatus | initialStatusPoints | extraPoints | finalStatus | notes                    |
| Bronze        | 0                   | 300         | Silver      | 300 points for Silver    |
| Silver        | 0                   | 700         | Gold        | 700 points for Gold      |
| Gold          | 0                   | 1500        | Platinum    | 1500 points for Platinum |

Thucydides lets you associate JBehave stories or JUnit tests with a JIRA card using the @issue meta tag (illustrated above), or the equivalent @Issue annotation in JUnit. At the most basic level, this will generate links back to the corresponding JIRA cards in your test reports, as illustrated here:


For this to work, Thucydides needs to know where your JIRA server. The simplest way to do this is to define the following properties in a file called in your project root directory:


You can also set these properties up in your Maven pom.xml file or pass them in as system properties.

Thucydides also supports two-way integration with JIRA. You can also get Thucydides to update the JIRA issue with a comment pointing to the corresponding test result.

Feature Coverage

But test results only report part of the picture. If you are using JIRA to store your stories and epics, you can use these to keep track of progress. But how do you know what automated acceptance tests have been implemented for your stories and epics, and, equally importantly, how do you know which stories or epics have no automated acceptance tests? In agile terms, a story cannot be declared “done” until the automated acceptance tests pass. Furthermore, we need to be confident not only that the tests exist, but they test the right requirements, and that they test them sufficiently well.

We call this idea of measuring the number (and quality) of the acceptance tests for each of the features we want to build “feature coverage”. Thucydides can provide feature coverage reporting in addition to the more conventional test results. If you are using JIRA, you will need to add thucydides-jira-requirements-provider to the dependencies section of your pom.xml file:


(The actual version number might be different for you – always take a look at Maven Central to know what the latest version is).

You will also need to add this dependency to the Thucydides reporting plugin configuration:


Now, when you run the tests, Thucydides will query JIRA to determine the epics and stories that you have defined, and list them in the Requirements page. This page gives you an overview of how many requirements (epics and stories) have passing tests (green), how many have failing (red) or broken (orange) tests, and how many have no tests at all (blue):


If you click on an epic, you can see the stories defined for the epic, including an indicator (in the “Coverage” column) of how well each story has been tested.


From here, you may want to drill down into the details about a given story, including what acceptance tests have been defined for this story, and whether they ran successfully:


Both JIRA and the JIRA-Thucydides integration are quite flexible. We saw earlier that we had configured a custom “Acceptance Criteria” field in our JIRA stories. We have displayed this custom field in the report shown above by including it in the file, like this:

jira.custom.field.1=Acceptance Criteria

Thuydides reads the narrative text appearing in this report (“As a frequent flyer…”) from the Descriptionfield of the corresponding JIRA card. We can override this behavior and get Thucydides to read this value from a different custom field using the jira.custom.narrative.field property. For example, some teams use a custom field called “User Story” to store the narrative text, instead of the Description field. We could get Thucydides to use this field as follows:

jira.custom.narrative.field=User Story


Thucydides has rich and flexible one and two-way integration with JIRA. Not only can you link back to JIRA story cards from your acceptance test reports and display information about stories from JIRA in the test reports, you can also read the requirements structure from JIRA, and report on which features have been tested, and which have not.

In the next article in this series, we will learn how to insert links to the Thucydides reports into the JIRA issues, and how to actively update the state of the JIRA cards based on the outcomes of your tests.

Want to learn more? Be sure to check out the Thucydides web site, the Thucydides Blog, or join theThucydides Google Users Group to join the discussion with other Thucydides users.

Wakaleo Consulting, the company behind Thucydides, also runs regular courses in Australia, London and Europe on related topics such as Agile Requirements GatheringBehaviour Driven DevelopmentTest Driven Development, and Automated Acceptance Testing.


Thucydides version 0.9.235 Released

A new version of Thucydides is out (version 0.9.235), with bug fixes and new features!

Bug fixes

The bug fixes include:

  • THUCYDIDES-226 and THUCYDIDES-224: You can now pass arbitrarily complex chrome switches in the ‘chrome.switches’ property, containing spaces, commas etc, e.g.
    –user-agent=Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B)AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 MobileSafari/535.19

  • THUCYDIDES-215 – Provided drivers can take screenshots
  • THUCYDIDES-225 – The webdriver.timeouts.implicitlywait system property now works to configure the timeout value of a PageObject.
  • THUCYDIDES-223 – You can now pass absolute path values in the thucydides.driver.capabilities system property.
  • Session data and step libraries are cleared between unit tests: A bug in previous versions of Thucydides meant that session data (accessed via the Thucydides.getCurrentSession() method) and step libraries were preserved between session states. This could occasionally cause problems, so session data is now cleared between each test in both JUnit and JBehave. This can be deactivated by setting the ‘thucydides.maintain.session’ property to true. Step libraries are now always reinitialized between scenarios or tests.

    THUCYDIDES-215 deserves some more detail. You can add your own custom WebDriver provider by implementing the DriverSource interface. First, you need to set up the following system properties (e.g. in your ‘’ file):

    webdriver.driver = provided
    webdriver.provided.type = mydriver
    webdriver.provided.mydriver = com.acme.MyPhantomJSDriver
    thucydides.driver.capabilities = mydriver

    Previously, it was hard to configure Thucydides to take screenshots using provided drivers. Now, you implement the DriverSource interface (as before), but with the new takesScreenshots() method:

    public class MyPhantomJSDriver implements DriverSource {
        public WebDriver newDriver() {
            try {
                DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();
                // doesn't work :(
                capabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, true);
                return new PhantomJSDriver(ResolvingPhantomJSDriverService.createDefaultService(),
            catch (IOException e) {
                throw new Error(e);
        public boolean takesScreenshots() {
            return true;

    This driver will now take screenshots normally.

    New Features

    And two cool new features:

    Custom messages for WebElementFacade assertions

    Normally, to check the state of a WebElementFacade, you do something like this:

    WebElementFacade myfield;

    But in this case, the error message was always the same. Now you can also do this:

    myField.expect("My field should be visible").shouldBeVisible();

    This will work for any of the "should"-style methods (shouldBeVisible, shouldContainText, etc.).

    Clever reuse of screenshots

    In previous versions, Thucydides recorded a different set of screenshots for each test run. This could lead to a lot of screenshots and the need for very large disks. Now, if screenshots are identical (i.e. if they have the same MD5 digest), the same file will be used.


Thucydides Release 0.9.229

There have been many releases since the last release notes were published, so this entry will summarize some of the highlights that are included in release 0.9.229 (though many came out in releases previous to that). Some of the highlights include:

  • Added support for Selenium 2.39.0
  • Testing AngularJS is made easier with support for the ng-model attribute in the Thucydides @FindBy annotation. Suppose you have this AngularJS input field:
<input ng-model="angularField" value="Model value" />

You can now find this directly using the Thucydides @FindBy:

import net.thucydides.core.annotations.findby.FindBy
 @FindBy(ngModel = "angularField")
 public WebElementFacade ngModelField;
  • Support for nested page objects – you can have page object fields inside other page objects. This makes it easier to write page objects for smaller reusable sections of the screen.
  • You don’t need to override the constructors for ScenarioSteps and PageObjects any more
  • You can provide your own webdriver instance using the ‘webdriver.provided.type’. Just implement the DriverSource interface. For example, you could implement a class like this:
package com.acme
public class MyFunkyDriverSourceImpl implements DriverSource {
    public WebDriver newDriver() {
       return new FunkyWebDriver();

Then just run the tests with the following properties (e.g. in the file or on the command line):

webdriver.driver = provided
 webdriver.provided.type = funky
 webdriver.provided.funky = com.acme.MyFunkyDriverSourceImpl
  • Lots of improvements to the reports, including:
    • Reports now have the option to hide the pie chart on the aggregate pages
    • Test reports now display the date and time of the report generation on each page.
    • You can use the ‘show.related.tags’ system property to display (default) or hide related tag statistics on the dashboard
    • Support for reporting on releases/versions by integrating with JIRA (there will be a full article on this feature shortly)
    • Support for integration with 3rd party test management software such as the JIRA Zephyr plugin to report on manual as well as automated tests
  • Many bug fixes

If you are still on an older version, update your dependencies today!


Thucydides Release 0.9.125

We made several minor releases in the last two months.  The latest release version is 0.9.125 which is now available for download. Here is a list of some of the key features and bug fixes added recently.

More flexible Examples tables for data-driven tests on the details page

Examples table now supports pagination, sorting of columns and text search.

Examples table with pagination, sorting and text search

Examples table with pagination, sorting and text search

Better handling of foreign characters in reports

Reports now display non-English characters properly.





Test results can be downloaded

The main report page now has a link to download test results in CSV format.

Test results can be downloaded in CSV format

Test results can be downloaded in CSV format

Fluent field entry using into a WebElementFacade

A new method has been added to provide a more fluid way to enter data in a web element facade. The following code snippet will explain.


page.enter("some value").into(facade);


Support for GivenStories in jBehave stories

jBehave style GivenStories keyword can now be used in .story files. GivenStories is used to specify pre-requisites for a story in jBehave. This is a very useful feature of jBehave that helps organize the stories better and reduces duplication. See here for examples.

Filter tests by tag in jUnit

You can now filter tests by tag while running Thucydides. This can be achieved by providing a single tag or a comma separated list of tags from command line. If provided, only classes and/or methods with tags in this list will be executed.


mvn verify -Dtags="iteration:I1"


mvn verify -Dtags="color:red,flavor:strawberry"

Support for jUnit Assumptions

If steps include junit style assumptions, then those steps where the conditions under assumptions fail are marked as PENDING instead of ERROR. Subsequent steps are also marked as PENDING.

Bug Fixes

  • Thucydides-146: Fixed a bug that caused chromedriver to fail with error message “Error communicating with the remote browser. It may have died” when @Managed(uniqueSession) was set to true.
  • Thucydides-149: Fixed a bug due to which test where no steps were executed due to error was reported as pending in the aggregate report.
  • Thucydides-150: Tests where no steps ae executed due to errors now show relevant exception cause in the report. Earlier the test was reported as error but no details were provided.
  • Thucydides-152 : XML reports now support UTF-8 encoding.
  • Thucydides-155: Fixed a bug that prevented webdriver from correctly restarting for parameterized tests even when thucydides.restart.browser.frequency property is set to 1
  • Thucydides-158 : Fixed a bug that was causing reports to throw errors for data-driven tests when @TestData contained an array.

It ain’t just reds and greens: Automated Acceptance Testing and quaternary test outcomes

Although they seem simple enough on the surface, test outcomes are actually quite complicated beasts. Traditional unit tests, and basic TDD tests, have just two states, passing or failing, represented by red and green in the famous “RED-GREEN-REFACTOR” dicton. In Behaviour Driven Development (BDD), on the other hand, we have the additional concept of ‘pending’ tests: tests that have been specified (for example, in a Cucumber or JBehave story) but not yet implemented. When we report on test results, we need to be able to distinguish these three states, as a pending test has very different semantics to a failing test. Pending means it’s not yet done yet, but this may well be as expected, especially towards the start of a sprint. A failing test, on the other hand, needs fixing. Now.

Most BDD tools, such as Cucumber, JBehave, Concordion, easyb and so forth, report test results in terms of these three states. However, the complexity doesn’t stop here. Maintaining web tests, for example, requires ongoing effort, and can perturb the test reporting if not handed with care. For example, if a web page changes during normal development or refactoring work, the tests that use this page may break. Although good software engineering practices such as the use of Page Objects can reduce the risk of this quite a bit, and reduce the work involved in maintaining the tests when it does, it is still something that will happen regularly. And again, the semantics of a test that is broken is quite different to those of a failing test. A broken test needs maintenance work on the test suite. It may also mask an application error, but you will need to investigate to find out. A failing test means that the application is broken, and therefore needs urgent fixing.

In an attempt to address this limitation in conventional BDD reporting, Thucydides now distinguishes between test failures (triggered by an assertion error) from test errors (triggered by any other exception). When you run your automated acceptance tests using Thucydides, any error that triggers an AssertionError (or a subclass of AssertionError) will be considered a test failure. Anything else (such as the NotFoundException, when an element is not found on the page) is considered to be an error, and therefore indicative of a broken test.

In the future we may extend Thucydides further to make this concept more configurable: for example, so that users can provide exceptions that should be considered as either an error or a test failure, or even adding additional outcome states (e.g infrastructure failure, database not setup, etc.).


Get every new post delivered to your Inbox.

Join 3,019 other followers