Introducing SerenityJS

As an agile testing services company, sharing Agile testing practice is the key to success. Before starting this article, we would like to thank Jan Molak who introduced SerenityJS to us.

Let’s start with the definition:

Serenity/JS is a next generation acceptance testing JavaScript library.

Features of SerenityJS:

  • Screenplay pattern which helps you shift the focus of automated acceptance tests from low-level interactions with the system to thinking about who the users of your system are, what is that they want to achieve by their interaction with your system and how exactly they’re going to do it.
  • Comprehensive reporting capabilities
  • SOLID design principles.
  • It supports CucumberJS, Mocha Protractor, and Chai.
  •  
    We were surprised when we read about ScreenPlay pattern. Maybe we are late. However, this is the concept answered our question.

    The question is:

    How can a business person understand and verify the logic which is implemented inside a step definition?

    How the ScreenPlay pattern addresses the problem? The Screenplay Pattern is a user-centred model which allows you to write automated tests with the defined user roles and persona.

    It is impossible for you to understand ScreenPlay pattern without knowing what user roles and Persona is.

    User roles:
    A user role is a collection of defining attributes that characterize a population of users and their intended interactions with the system. Consider we are building an e-learning application. Before writing user stories, we need to brainstorm to identify, consolidate and condense user roles.

    Defined user roles for an e-learning application:

  • Instructor
  • Student
  • Admin
  •  
    Persona:
    A persona is an imaginary representation of a user role. Creating a persona requires more than just adding a name to a user role. A persona should be described sufficiently that everyone on the team feels like they know the persona.

    Persona Example:

    Introducing SerenityJS

    Anna works as an instructor, and she creates students, assigns assignments to her students, and views reports of students. Anna is good at teaching basics of computer.

    Reference: User Stories Applied

    We hope you are clear with User roles and Persona. Let’s see how these are represented in Gherkin and Step Definition using Serenity/JS.

    In the above feature, James is the persona.

    Create an actor in step definition

    James attempts to add todo item. Now anyone can understand your step definition. You can find more details in the following link Serenity/JS and do not miss to watch the introductory video of Serenity/JS.

    [Total: 12    Average: 5/5]