понедельник, 16 апреля 2018 г.

AQA: Selenium + Java: Page Object Model



What it is? 
Page Object is a Design Pattern for enhancing test maintenance and reducing code duplication.
A page object is an object-oriented class that serves as an interface to a page of your AUT.
The tests then use the methods of this page object class whenever they need to interact with the UI of that page.

The benefit is?
- if the UI changes for the page, the tests themselves don’t need to change, only the
code within the page object needs to change;
- Subsequently all changes to support that new UI are located in one place;
- enchancing test maintenance;
- reducing code duplication;
- There is a clean separation between test code and page specific code such as locators (or their use if you’re using a UI Map) and layout;
- There is a single repository for the services or operations offered by the page rather than having these services scattered throughout the tests;

- In both cases this allows any modifications required due to UI changes to all be made in one place;

Summary: 
- The public methods represent the services that the page offers
- Try not to expose the internals of the page
- Generally don't make assertions
- Methods return other PageObjects
- Need not represent an entire page
- Different results for the same action are modelled as different methods

Links: 
- docs.seleniumhq.org;
- git - PageObjects;
- git - PageFactory;
- Михаил Поляруш - video:
- page-object-model;
- Introduction to Page Object Model Framework;
- Simple Page Object Model example;
- Оптимизация теста с помощью Page Object. Часть 1. Создание классов с описанием веб-страниц;
- Оптимизация теста с помощью Page Object. Часть 2. Создание теста;
- Применение Property файлов в автотестах на Java;
- Использование паттерна Page Object;
- Подготовка Page Object Model - пример на автоматизации ФБ;

Комментариев нет:

Отправить комментарий

SEO: Эксперимент: как Яндекс и Google учитывают ключевые слова в URL

Эксперимент: как Яндекс и Google учитывают ключевые слова в URL Эксперимент: как Яндекс и Google учитывают ключевые слова в URL Дата пу...