John Ferguson Smart

John's latest articles

Handling Waits and Asynchronous Pages in Serenity BDD

Posted by John Ferguson Smart

Modern web applications are asynchronous by nature. So knowing how to wait for elements, before trying to interact with them, is an essential skill in modern test automation. Many testers pepper their web tests with Thread.sleep() statements, but this is the sub-optimal at best. It slows down the tests, makes them more brittle, and can…

Read More

Learn about Cucumber 4, Java, and Serenity BDD in a new chapter of the Serenity BDD book

Posted by John Ferguson Smart

Cucumber 4 has a lot of new features which can help make our Cucumber test automation code cleaner and more expressive. But there are also some big changes under the hood! Fortunately, Serenity BDD is here to help. The Serenity BDD Book has a brand new and very detailed guide on working with Cucumber 4,…

Read More

Test setup and teardown in Cucumber and Serenity BDD

Posted by John Ferguson Smart

When we write automated acceptance tests we often need to perform some initial tasks to prepare test data or set up the test environment. Likewise, when a test finishes, we often need to tidy up the database or put the environment into a clean state. With Serenity BDD and Cucumber, there are several ways to…

Read More

Serenity Ensure – Fluent Assertions in Serenity Screenplay

Posted by John Ferguson Smart

Assertions are an important part of any test automation framework, and Serenity gives us many options. You can of course use standard JUnit, Hamcrest or AssertJ assertions at any point in a Screenplay test. But more recent versions of Serenity Screenplay provide an alternative approach, which many developers find easier to use and faster to…

Read More

Reporting Manual Test Results in Serenity BDD

Posted by John Ferguson Smart

Serenity is primarily designed to report the results of automated acceptance tests. However, there are times when some tests need to be done manually. And it is useful to report these tests in the overall test reports, to get a broader picture of test coverage. To make this easier, Serenity with Cucumber provides some support…

Read More

Embedding Custom Data in Serenity Reports

Posted by John Ferguson Smart

Executable specification written in Gherkin are a great way both to document an application’s behaviour, and to demonstrate that it works. QA folk can use the generated living documentation to verify both that the feature does what the business expects of it, and that the feature actually works. Because of this, BDD living documentation plays…

Read More

Running parallel tests in Cucumber with Serenity BDD

Posted by John Ferguson Smart

Running parallel tests in Cucumber with Serenity BDD has always been tricky. Until now. People often ask me how to run their Cucumber/Serenity BDD test suites faster. Fast feedback is key to a smooth build pipeline and to an effective test suite. A quick-running test suite means we can know when something goes wrong, and…

Read More

Running individual scenarios in JBehave or Cucumber with Serenity BDD

Posted by John Ferguson Smart

When we are working with BDD test automation tools such as Cucumber and JBehave, it often comes in handy to run an individual scenario in isolation. In this article, we look at how to do this using Serenity BDD. JBehave In JBehave, you need to use tags to identify the scenario you want to run….

Read More

Running Cucumber with Serenity feature files directly from IntelliJ

Posted by John Ferguson Smart

IntelliJ provides excellent integrated support for Cucumber feature files. You can even run features simply by right-clicking on the feature file. But this won’t work when you are using Cucumber with Serenity, as Serenity needs to instrument the feature file before execution. Fortunately, this is easy to fix. Here’s how: Click on the feature file you…

Read More

Sharing state between steps in Serenity BDD

Posted by John Ferguson Smart

Whether you are using Cucumber, JBehave or just JUnit, Serenity BDD encourages a layered, structured approach to automation. The reason for this is simply that it makes the tests easier to understand and maintain, and faster to write in the medium term. But people often wonder what is the best approach to share information between…

Read More

Beyond Page Objects: liberate yourself from the chains of UI-think!

Posted by John Ferguson Smart

So you have Page Objects in your test automation suite? That’s great! But it’s not enough! Page Objects are a great start, but you need to go further if you want truly sustainable, high quality test automation. The Page Objects origin story Page Objects are a popular automated web testing pattern first implemented for Selenium by Simon…

Read More

A short guide on how to configure ChromeDriver in Serenity BDD

Posted by John Ferguson Smart

Serenity BDD is an open source library that makes it easier to write high quality, maintainable automated acceptance tests. Serenity BDD has strong WebDriver integration, and manages the WebDriver instances for you. You almost never need to create or close your own WebDriver instance. Chrome gives WebDriver developers a great deal of control, with many…

Read More

User-centric and task-driven: a better way to automate

Posted by John Ferguson Smart

Too often, our acceptance tests end up as sequences of “click”s and “select”s running against a web application. This makes our tests hard to understand and hard to maintain. User-centric, task-driven test automation shows us a better way. When we learn something new, it is easy to get stuck in a low-level, details-focused way of…

Read More

© 2019 John Ferguson Smart