Consider this approach to data driven tests when the integrity of the html code is also being verified against known (or at least last known) good values. Last known because the html element or its attributes can change at any time, however, using this approach, you'll be alerted of changes by your test scripts on the first test run after the change. This method is especially useful in scenarios such as the one depicted here: test page objects have been defined and implemented and now must be maintained. Meaning that when things change on the page the object will have to be updated. See diagram at the end of the post.
- Assign each web page a unique id
- Since a page can have multiple objects, page objects also have unique id
- During test setup, load all the test data into variables from your scripts
- When the page objects are instantiated it loads the locators it needs for the test execution from the database
- Ease of maintenance
- If your locators change, your page objects dont have to change
- When locators change update the db with new locators
- Programming skills not needed to maintain the locator store
- A person can be trained to use browser developer tools to determine new xpath
- New xpath can then be easily entered into db by non technical person using db web forms access
- Notification whenever html changes are made to documents
- But the number one benefit, IMHO, by far is the resuction in test software maintenance costs
We welcome comments, feedback and questions!