Automation Testing — Serenity BDD & Keyword-driven frameworks

Sanskruti Raut
5 min readJul 11, 2023

--

🔸Let’s start by addressing the basics first and then proceed towards the overview of the frameworks. I hope this article helps in understanding how automation testing works.

◼What is automation testing?

Automation testing is a technique where the user writes the scripts according to the functionality of the application, user stories, and other requirements and uses software tools to automate the process.

◼Advantages of automation testing over manual testing –

· The implementation of automation testing technologies reduce manual efforts in terms of executing repetitive tasks or while re-validation of test cases.

· Manual testing could be time-consuming, and hence automation should be preferred in cases where test execution is required to be faster.

· The initial investment in automation is heavier than manual, but once the scripts are ready the execution becomes much faster than manually testing it.

· Automation can serve as documentation for your software. The result files generated are an added advantage for creating reports for analysis.

◼Drawbacks of automation testing –

· It is not always possible to automate scenarios that will provide end-end coverage. Human intervention in such cases becomes crucial since we can think and evaluate much better for finding out bugs that could be out-of-the-scope.

· For heavily functional applications, it becomes challenging to write, run, and execute test cases. In such cases, the use of only one tool isn’t enough to execute end-to-end scenarios. This in turn makes it challenging to execute as well as identify tools that would make the process easier.

· Automation could be too much work than reward if the application/features are changed frequently. This can lead to added efforts that defy the purpose of automating.

◼Automation Testing Methodology –

Figure [1] shows the Automation Testing Methodology used.

1. Test Automation feasibility analysis — Firstly, we need to check whether the application can be automated or not. Various application has its limitation and thorough analysis should be done before deciding on whether to use automation.

2. Test tool acquisition — Once it’s decided to use automation, we can proceed ahead and decide on the software tools available. This depends on the technology used in building the application and the features involved in it. For example, Postman is ideal for API testing whereas Selenium-IDE should be used for UI-level testing.

3. Evaluation of frameworks — Every framework has its significance. Hence, we evaluate different frameworks and choose the one that is the best fit for the project. There are mainly three types of frameworks 1) Keyword-driven framework 2) Data-driven framework 3) Hybrid framework.

4. Test Planning, Design, and Development of Framework In this stage, we design scenarios, create test cases, and develop the framework by installing libraries, creating object repository, and common navigation files, etc.

5. Scripting Scripting involves sequential representation of the test cases which includes selecting options, ensuring all fields are present, checking for validations, etc.

6. Test execution and Management — Once scripting is completed, test execution of those scripts begins, and results are evaluated. As a result of the execution cycle, we proceed ahead to fail or pass the test cases. Here, project management tools such as JIRA and JAMA can be used.

7. Maintenance — The results could be compiled and documented for further analysis. This is important to avoid repeating mistakes and to plan better for other activities like regression testing or re-validations.

🔸We have pretty much covered the basics of automation testing. Now, understanding the two frameworks shouldn’t be difficult. Here, I’m giving you an overview of the two frameworks -

  1. Serenity BDD
  2. Keyword-driven framework

I’ve just touched the surface to understand the basic functionality of both frameworks.

Let’s begin!

Prerequisites to implement the frameworks:

  1. IDE — Eclipse, Intellij or any IDE
  2. JDK (Java Development Kit)
  3. Microsoft Excel
  4. Build Tool — Maven dependencies of TestNG, Selenium
  5. Drivers — Chrome driver
  6. Libraries — Serenity, Selenium WebDriver, etc.

◼Serenity BDD –

Serenity BDD is a behavior-driven framework. The methodology written below is an overview of how Serenity BDD works for testing.

Overview of the methodology —

It takes input from multiple Excel files. The first thing that opens is the crawler. The crawler scans each and every UI component and generates an output file. You can run tests on a variety of browsers by replacing browser URLs in the config file, which is an additional advantage for browser testing as well.

The workspace can be divided into two projects, namely —

  1. Portal Scripts
  2. Test Scripts

>Portal Scripts contains-

  1. PageObject file — This file is created for the respective screen which has the URLs, Getters and Setters, and specific programs written for accessing a particular UI element, or to perform some actions on UI elements like click action, etc.

2. PageData file — This file holds the Xpaths of the elements on the screen.

3. JSON file — This file contains the test data which will be used in the scripts

>Test Scripts contain–

This folder primarily contains the test scripts to be executed. The test scripts can be coded for —

  1. Verification Scripts
  2. Validation Scripts

The verification scripts check for the fields, buttons, etc. on the screens, and validation scripts check for the validation messages.

For instance, if there’s a field on the screen which needs incorrect data to be selected for the error message to be displayed, the data here is passed on from the JSON file, and the methods for verification and validation of the elements are written in PageObject file using the Xpaths in the PageData file.

Additionally, the important files to be configured include the Common Page Object file, Navigating User, POM file, and Object Repository files.

◼Keyword-driven framework–

The Keyword-driven framework is driven by keywords that are placed in an Excel sheet. The keywords used are described with a set of actions that it needs to do.

Components involved —

  1. Excel sheets — These contain the test data files and the scenario files.
  • Keyword file — This file contains Test Steps and Test Data. Test Steps describes the keyword and the actions it needs to perform and Test Data contains the Data that needs to be given in the elements on the screen.
  • Scenario file — This file is created according to the scenarios that need to be tested. So, here, Steps and iterations are mentioned to fetch it from the Test Data file.

2. Function Library — This contains the functions for the keywords described in the Excel file that will be executed when it is called accordingly.

3. Object Repository — Based on the Keyword, the object repository file contains the Xpaths of the elements on the screen.

🔸That’s it from my end. I hope it helps you understand the basics.

Happy Learning!

--

--

Sanskruti Raut
Sanskruti Raut

Written by Sanskruti Raut

Writing as a gateway to ideas towards reality | Analyst @ Deloitte USI | B. Tech - ECE from MITWPU, Pune.

No responses yet