Simple touch on test automation frameworks

RoopabyRoopa Adivappa on April 1st 2022

Most of the automation tests engineers do use one set of frameworks to maintain their code for reusability and for easy maintenance.  These automation scripts are mainly used for Regression testing, Smoke testing and end-to-end testing.  Also used when a repeatable task needs to be achieved for a number of times.  One of the well known frameworks is Page Object Model also known as POM framework.  POM in addition with Behaviour Driven Development model, also known as BDD is a perfect combination for UI automation.

Why POM?

To keep a clean separation between test and page specific methods.  Each page will be having web elements and their access methods.  When web element locators are changing then it is easy to locate and change accordingly in the specific page as it uses object repository. 

Complete flow of POM with BDD

POM with BDD framework can be implemented with different tools like Selenium WebDriver or Playwright, Junit, TestNG, Maven, Cucumber etc.

End to end

Directory structure in POM framework

Directory view

src/main/pages - contains all the methods for the web pages.

src/main/utils - contains all the reusable methods.

src/tests - contains Test code.

target - contains Output generated.

Pom.xml – contains all the Maven dependencies for the project.

POM with BDD

Page Object Model with BDD design pattern helps to bring both technical and business/ non-technical users together.  Cucumber supports BDD design pattern for automation testing.  POM with BDD solution offers to write the acceptance criteria in Gherkin language, which is a simple Given, When & Then format; helps to meet the acceptance criteria. 

Written test

Cucumber Runner Class

The Runner class gives an option to execute scenarios according the tags provided in scenario and feature level.  Cucumber hooks and tags will greatly help in selecting the required group of tests. Without touching the automation code can be executed for the required set of tests.

Example: @smoke, @Regression,@EndToEnd, @All-tests etc.

Reporting

At the end we can generate beautiful graphical Cucumber reports.

Cucumber reports

Advantages of POM with BDD

  1. Easy to understand the flow of code and easy to maintain
  2. Easy to get the test coverage
  3. Reusability
  4. Easy to work in collaboration
  5. It brings technical and business users together
  6. It can be used for Selenium or Playwright etc
  7. Tests can be logically grouped and executed
  8. Cucumber Reports can be automatically generated
  9. It can be integrated with CI/CD pipeline.