Having worked with Selenium and TestNg for almost 2 years, I'm wondering if folks have different suggestions in terms of frameworks. Some of the problems I'm seeing in my testing infrastructure is growing huge page object classes (~1500 lines of code) and duplication across Page Objects because of the different entry points, different ways of being able to do the same thing. We've resort to doing inheritance, but it's getting a bit awkward and funny looking. Plus, we're also seeing redundancy in the test code for instance some tests would share the same navigation path but they diverge in pages until the end. Recently, we're getting buttons moved to another page and etc, so I had to redirect the navigation paths in 4 different tests. As we increase in the number of tests, the number of tests I need to fix will increase as well. I didn't build the current infrastructure, but I feel really "trapped" with the way things are going. Any suggestions?
Asked
Active
Viewed 430 times
1
-
3Can't answer anything without code. If you are asking about a general idea, then that's opinion based. In short, you need to structure your page objects using polymorphism and inheritance. Similar question [here](http://stackoverflow.com/q/21225462/1177636). – Yi Zeng Mar 12 '14 at 04:28
-
If you are using inheritance then don't you have your methods which are required across pageobjects, in base page class? That will reduce redundancy. – Abhijeet Vaikar Mar 12 '14 at 06:33