Floella
Floella

Reputation: 1398

Robot Framework: am I implementing the Page Object Pattern the right way?

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.

Resource Resources.robot

Resource PageObjects.robot

Resource ../GeneralResources.robot

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

Answers (1)

A. Kootstra
A. Kootstra

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

Related Questions