docs: Content SEO updates (#2990)

* update yaml frontmatter format

* update abstract document

* update abstract factory

* use the new pattern template

* acyclic visitor seo

* adapter seo

* ambassador seo

* acl seo

* aaa seo

* async method invocation seo

* balking seo

* bridge seo

* builder seo

* business delegate and bytecode seo

* caching seo

* callback seo

* chain seo

* update headings

* circuit breaker seo

* client session + collecting parameter seo

* collection pipeline seo

* combinator SEO

* command seo

* cqrs seo

* commander seo

* component seo

* composite seo

* composite entity seo

* composite view seo

* context object seo

* converter seo

* crtp seo

* currying seo

* dao seo

* data bus seo

* data locality seo

* data mapper seo

* dto seo

* decorator seo

* delegation seo

* di seo

* dirty flag seo

* domain model seo

* double buffer seo

* double checked locking seo

* double dispatch seo

* dynamic proxy seo

* event aggregator seo

* event-based asynchronous seo

* eda seo

* event queue seo

* event sourcing seo

* execute around seo

* extension objects seo

* facade seo

* factory seo

* factory kit seo

* factory method seo

* fanout/fanin seo

* feature toggle seo

* filterer seo

* fluent interface seo

* flux seo

* flyweight seo

* front controller seo

* function composition seo

* game loop seo

* gateway seo

* guarded suspension seo

* half-sync/half-async seo

* health check seo

* hexagonal seo

* identity map seo

* intercepting filter seo

* interpreter seo

* iterator seo

* layers seo

* lazy loading seo

* leader election seo

* leader/followers seo

* lockable object seo

* rename and add seo for marker interface

* master-worker seo

* mediator seo

* memento seo

* metadata mapping seo

* microservice aggregator seo

* api gw seo

* microservices log aggregration seo

* mvc seo

* mvi seo

* mvp seo

* mvvm seo

* monad seo

* monitor seo

* monostate seo

* multiton seo

* mute idiom seo

* naked objects & notification seo

* null object seo

* object mother seo

* object pool seo

* observer seo

* optimistic locking seo

* page controller seo

* page object seo

* parameter object seo

* partial response seo

* pipeline seo

* poison pill seo

* presentation model seo

* private class data seo

* producer-consumer seo

* promise seo

* property seo

* prototype seo

* proxy seo

* queue-based load leveling seo

* reactor seo

* registry seo

* repository seo

* RAII seo

* retry seo

* role object seo

* saga seo

* separated interface seo

* serialized entity seo

* serialized lob seo

* servant seo

* server session seo

* service layer seo

* service locator seo

* service to worker seo

* sharding seo

* single table inheritance seo

* singleton seo

* spatial partition seo

* special case seo

* specification seo

* state seo

* step builder seo

* strangler seo

* strategy seo

* subclass sandbox seo

* table module seo

* template method seo

* throttling seo

* tolerant reader seo

* trampoline seo

* transaction script seo

* twin seo

* type object seo

* unit of work seo

* update method seo

* value object seo

* version number seo

* virtual proxy seo

* visitor seo

* seo enhancements

* seo improvements

* SEO enhancements

* SEO improvements

* SEO additions

* SEO improvements

* more SEO improvements

* rename hexagonal + SEO improvements

* SEO improvements

* more SEO stuff

* SEO improvements

* SEO optimizations

* SEO enhancements

* enchance SEO

* improve SEO

* SEO improvements

* update headers
This commit is contained in:
Ilkka Seppälä
2024-06-08 19:54:44 +03:00
committed by GitHub
parent cb946c0cdc
commit 6cd2d0353a
219 changed files with 3308 additions and 2819 deletions
+20 -18
View File
@@ -1,25 +1,27 @@
---
title: Page Object
title: "Page Object Pattern in Java: Streamlining UI Testing for Better Maintainability"
shortTitle: Page Object
description: "Explore the Page Object design pattern for Java. Learn how to implement, use, and optimize this pattern for better code maintainability and test automation in Java applications."
category: Testing
language: en
tag:
- Abstraction
- Code simplification
- Decoupling
- Encapsulation
- Testing
- Web development
- Abstraction
- Code simplification
- Decoupling
- Encapsulation
- Testing
- Web development
---
## Also known as
* Page Object Model (POM)
## Intent
## Intent of Page Object Design Pattern
The Page Object pattern aims to create a model of the UI elements of a web page to improve the maintainability and readability of test automation code.
The Page Object pattern in Java aims to create a model of the UI elements of a web page to improve the maintainability and readability of test automation code.
## Explanation
## Detailed Explanation of Page Object Pattern with Real-World Examples
Real-world example
@@ -29,7 +31,7 @@ Real-world example
In plain words
> The Page Object design pattern creates an abstraction layer for web pages, encapsulating their elements and interactions to simplify and maintain automated testing scripts.
> The Page Object design pattern creates an abstraction layer for web pages, encapsulating their elements and interactions to simplify and maintain automated UI testing scripts.
selenium.dev says
@@ -37,7 +39,7 @@ selenium.dev says
>
> Page Object is a Design Pattern that has become popular in test automation 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 that if the UI changes for the page, the tests themselves dont 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.
**Programmatic example**
## Programmatic Example of Page Object Pattern in Java
The Page Object design pattern is a popular design pattern in test automation. It helps in 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 Application Under Test (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 that if the UI changes for the page, the tests themselves dont 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.
@@ -81,22 +83,22 @@ In this example, the `LoginPage` class represents the login page of a web applic
This Page Object can be used in test scripts to interact with the login page without exposing the details of the page structure in the test code, promoting maintainability and reusability.
## Applicability
## When to Use the Page Object Pattern in Java
Use the Page Object pattern when
* Automating tests for web applications.
* Automating UI tests for web applications.
* You want to separate the UI actions from the test logic.
* Enhancing test code readability and reducing duplication.
* Simplifying maintenance when the web UI changes.
## Known Uses
## Real-World Applications of Page Object Pattern in Java
* Selenium WebDriver tests for web applications.
* Automated UI testing frameworks in Java.
* Popular test automation frameworks like TestNG and JUnit.
## Consequences
## Benefits and Trade-offs of Page Object Pattern
Benefits:
@@ -110,13 +112,13 @@ Trade-offs:
* Initial Setup: Requires extra effort to design and implement page objects.
* Complexity: Overuse may lead to a complex structure with many page objects and methods.
## Related Patterns
## Related Java Design Patterns
* [Decorator](https://java-design-patterns.com/patterns/decorator/): Can be used alongside Page Objects to add additional responsibilities to objects dynamically.
* [Facade](https://java-design-patterns.com/patterns/facade/): Both provide a simplified interface to a complex subsystem. Page Object abstracts the complexities of the UI.
* [Proxy](https://java-design-patterns.com/patterns/proxy/): Acts as a surrogate or placeholder, which can also be used for lazy initialization of page objects.
## Credits
## References and Credits
* [Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation](https://amzn.to/4bjhTSK)
* [Selenium Design Patterns and Best Practices](https://amzn.to/4aofYv8)