Home > Software engineering >  Should I use a base page class or make a helper class?
Should I use a base page class or make a helper class?

Time:11-04

I am using the page object model to create selenium test cases. Currently all of my pages extend from a base class, which has all the functions like clicking an element or entering text. I don't have anything else here - should this be a superclass or should these functions just be moved to a helper class?

CodePudding user response:

In most of the projects people inherit BasePage class in all page objects as it is easier in terms of coding to just inherit all base page operations. In terms of OOP principles its not really a (is-a) relationship. It will be more cleaner if you have PageAction class or something similar (as you call it helper class) and use composition (has-a) instead of inheritance (is a).

  • Related