BDD with Specflow and Page Object

Hi everyone, this my first article about automation test. I working with automation test in C# and applications WPF. In this post will consider that you already installed the SpecFlow and SpecRun, okay?

Rosberg Guedes
2 min readJun 17, 2018

The idea of the Page Object Model (POM) in UI Automation framework development is that Pages are represented by classes. Public methods will representation the behavior of these classes. The features have the paper similar the of control in MVC.
To better understand, I like to split the POM in a similar way to MVC.
What does that mean?

  • The access page to the elements becomes responsible for the View.
  • The data construction classes are in your MODEL. All methods and behaviors of the pages are in your MODEL because of the logic visualization the components must be separated from the DOMAIN.
  • The features are responsible from the do building Steps. In Steps, the data connections are made between the View layer and the Model layer.
Page Object

As you can see, a feature contains a steps. The steps report the views. The Singleton pattern is intended to ensure that a class has only one instance of the class and that it provides a global access point. Already the behavior of the pages are encapsulated in another layer, to ensure a good organization and maintenance of the code.

Conclusion

This scenario is the best choice for automated testing because it gives the programmer a clear view of your steps. Another advantage is that when there is some change in the UI of your main project you will not need to write a new test.

See you later.

--

--

Rosberg Guedes
Rosberg Guedes

Written by Rosberg Guedes

Content Manager | Produtor de Conteúdo no @paginatech_ acesse www.paginatech.com.br

No responses yet