Reputation: 1398
I've read a few articles and examples but I'm still unsure about how to organize my test suites.
Let's say I'll be testing a company website, with a home page that has a menu taking the user to pages like "about", "products", "contact us".
This is what I've come up with so far to structure my project, but I'm not sure it's the best way in terms of scalability and maintainability:
/src/test/robotframework/acceptance
contains a GeneralResources.robot file and one folder per website page.
GeneralResources.robot
file contains a "Settings" section with Library references that will be used by all tests (e.g.: Selenium2Library)
/home
folder contains 4 files:
__init__.robot
with Test Setup and Test Teardown for all the home page tests.Resources.robot
with global variables (like ${home_url} or ${home_title}) and higher level keywords that the home page tests will use.PageObjects.robot
with variables that store locators for all the objects that will be tested in the home page (e.g.: main logo, main menu, page footer, etc.).tests.robot
with all tests I will perform in the home page. The Settings section invokes the other files (except for init which is automatically detected) like this:Resource Resources.robot
Resource PageObjects.robot
Resource ../GeneralResources.robot
/about
folder will also contain 4 files, organized the same way as the /home folder./products
folder will also contain 4 files, organized the same way as the /home folder./contactus
folder will also contain 4 files, organized the same way as the /home folder.I'm not exactly sure this is the right way to go, as 4 files per page seem like quite an overhead. I'd like to know if I'm overlooking something, or if maybe some of the files I'm using should be merged into one.
Upvotes: 2
Views: 2266
Reputation: 6971
The Page Object model is a good way of abstracting the application UI from your test logic on a per-page basis.
In the event that your application is structured in separate elements that are reused across several pages then the per-page approach may be less effective.
For an application I work with the ID generation is predictable that the abstraction I chose mirrors the structure of the application and thus per-page I just re-use the basic building blocks that represent the application functionality.
Upvotes: 1