I am using Selenium WebDriver with Java to develop automated regression tests for a web application. Currently, I am following the Page Object Model design pattern and using the PageFactory @FindBy
annotation to declare all the web elements I interact with at the top of each page class and the TestNG @DataProvider
annotation to pass data input to my test methods.
While this does not pose an issue at the moment, some of the pages I will need to work with have upwards of a hundred objects on the page (e.g. form for user info), and I am worried that my current methodology could run into performance and readability issues as the test suite grows. I am still new to both Selenium and Java, but have a few questions regarding this:
Are there any performance concerns with declaring hundreds of WebElements at the beginning of each page class, rather than say, storing each element's locator info in an Excel datasheet and iterating over that? Or, more generally, what are the main differences between using POM as opposed to creating a function library?
As is, my test methods are looking like:
@Test(dataProvider="testData") public void test(String s1, String s2, ... )
Which can quickly become unreadable when passing in a lot of parameters. What alternatives are there for passing in multiple inputs to a test method?