The Selenium project that you are working on keeps growing.
Many tests have been added to it during the last 6 months.
There are also many new page classes, some of them quite big, with thousand of lines of code, hundreds of methods and many locators.
Big page classes are something that you do not want to have in your project for several reasons:
they are hard to maintain
they do too many things
there is high method coupling; methods depend on each other so they need to be executed in a specific order in the tests; change the order of executing the page methods and the test does not work any longer
Any page class has 3 sections:
locators
constructor (s)
page methods
We discussed in the previous post that moving the locators out of the page class is not a good solution. Doing this makes the page class a collection of methods. Also, there is only a limited reduction of the page class size that can be accomplished since the page methods are still present.
We are left with the option of moving page methods out of the page class.
But where should we move them?
Keep reading with a 7-day free trial
Subscribe to Selenium For Beginners to keep reading this post and get 7 days of free access to the full post archives.