3

When developing multi-platform test framework (e.g. mobile-focused) there can be several ways to use PageObject pattern. For instance, platforms can be separated at least:

  • at the level of locators & methods (i.e. 1 element will have several locators)
  • at the level of whole pages/screens (i.e. 1 abstract page will have several implementation)
  • ... (your suggestion may be here)


How do you think: What's the advantages of each one? Is there the best one to use?

2
  • 1
    You can create class for page and page-locator. For example Login page locator will have separate class and login page method will be in separate class. so it will something like data and element will have diff. class. Commented Jun 12, 2015 at 11:06
  • 1
    When you say "multi-platform", do you mean web browsers on different mobile devices, or different native apps?
    – user246
    Commented Aug 16, 2015 at 14:31

1 Answer 1

1

I am not expert on responsive design for mobile devices, but AFAIK most differences should be different CSS styling for the same HTML, using same locators for all page formats.

But you have a valid point that some CSS might i.e. hide navigation for small screen into button (requiring extra click to expand it if present).

Approach which I would consider (we are not there yet, but getting closer): Each pageobject has method to perform activities, which would behave the same for the pageobject user (hiding the differences between platforms). If activity needs special handling, in ideal world this should be detected by presence of extra button on some platforms, and click it if needed to implement the behavior.

Let's see opinion of experts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.