-
Notifications
You must be signed in to change notification settings - Fork 23
Home
Very basically, the page object pattern is a pattern where each page in your app is modeled by a class in your test project. These page representations handle all interaction with the corresponding page in the app, which simplifies test methods down to just calling methods on page representations.
One of the main reasons we recommend this pattern is that it’s intuitive and easy to implement. You don't need to rely on any libraries and the few supporting files that we provide can easily be edited to fit your specific needs.
Beyond it's simplicity, this pattern also makes test methods much easier to read at a glance and the separation of responsibility between test methods and page objects makes maintaining the suite much easier in the long run.
This pattern also makes it fairly easy to do cross-platform tests as long as the apps' pages are similar across platforms.
Always. Always use the page object pattern unless you are only going to write one or two quick tests that you don't plan on keeping.
Cross-platform test suites work best for apps where Android and iOS versions have a similar flow and UI. If the UI or app flow is markedly different, you might be better off keeping your Android and iOS test suites separate. You should still use the page object pattern though!
Even if you aren't interested in using the page object pattern, we have some suggestions that are important for anybody writing UI tests.