Nowadays web applications are more and more sophisticated, and projects cannot afford long manual testing cycle. Because of applications complexity, record and play testing tools are not sufficient. These tools produce scripts that are time consuming for maintaining them each time the applications changes. For this reason, we try to use tools and techniques that produce easy maintainable test suites.

We use Serenity, an open-source reporting framework, as one of these tools to help us write better-structured and maintainable automated acceptance tests. Serenity uses Java coding standards and practices for a good code quality. You may say that the framework forces you to write clean code.

Using Serenity has the added benefit of generating meaningful test reports after each test run. These reports extract step names from method names, emphasizing the importance of clear language when writing test code to produce explicit test reports. These reports not only provide test results but also detail the tested features as a key deliverable.


There is more than one way of writing your tests. Serenity supports 4 project archetypes. This means you can write your tests as pure jUnit tests or you can use jBehave or Cucumber.

When we talk about Serenity, we should mention one of its main core concepts, Behavior Driven Development. If you desire a more BDD approach to testing and the newly added screenplay mode, that makes tests look like, well you guessed it, a screenplay where you have actors and scenarios. Teams use this approach in projects to understand features needed for building through conversations and examples.

Let’s take for example a website that sells tires. One important feature would be sorting tires by their dimensions:

“To help customers to find the tires they are looking for

As a seller

I want customers to be able to sort the tires by dimensions”

Serenity also fully utilizes Page Object patterns, inherited from Selenium practices. Page Objects are used to interact with a particular web page. They are defined based on how they are grouped in the web page, bringing order, structure and reusability of mapped objects. Serenity also provides shortcuts to interact with the page, all you need to do is writing the WebDriver code that interacts with the pages.

In addition to Page Objects, Serenity includes the Step Library, which adds an abstraction layer to our acceptance tests. This approach makes the test easier to understand and maintain.



 Article written by Calin Marchis