DAY 6 - Industry Connect

What is design pattern? 

In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.

Uses of Design Patterns

Design patterns can speed up the development process by providing tested, proven development paradigms. Effective software design requires considering issues that may not become visible until later in the implementation. Reusing design patterns helps to prevent subtle issues that can cause major problems and improves code readability for coders and architects familiar with the patterns.

Often, people only understand how to apply certain software design techniques to certain problems. These techniques are difficult to apply to a broader range of problems. Design patterns provide general solutions, documented in a format that doesn't require specifics tied to a particular problem.

In addition, patterns allow developers to communicate using well-known, well understood names for software interactions. Common design patterns can be improved over time, making them more robust than ad-hoc designs.

Why do we need design pattern in our test suite? 

The Design patterns are defined as the best practices that a programmer must follow to amplify code reusability in a framework. The design pattern explains how to plan the test automation test ware to be useful and easy to maintain. Discard many test automation projects due to the frameworks' inability to cope with the growing codebases or test suites. Automation engineers should optimize their code to keep the maintenance cost low by using the best design procedures and code coverage of existing functionality for common or repeated operations.

The Advantages of Design Patterns in Automation Testing

  1. Design Patterns save time and effort
  2. It results in low maintenance cost
  3. Helps in code reusability
  4. It helps in enhancing reliability.
  5. Helping us to create a structured code that eases our process of automation.
  6. It helps in improving communication.


What are the different design patterns for automated tests? 



1. page object pattern

The classes and objects participating in this pattern are:

  • Page Object (SearchEngineMainPage)- Contains properties of all necessary web elements of the page. Also, there you can find all actions that can be performed (Search, Navigate). All validations can be placed here too.
  • UI Tests (SearchEngineTests) – This class contains a group of tests related to the above page; it can hold only a single instance of the page object.

What is page object model (or POM)? 

Page Object Model (POM) is a design pattern, popularly used in test automation that creates Object Repository for web UI elements. The advantage of the model is that it reduces code duplication and improves test maintenance.

Under this model, for each web page in the application, there should be a corresponding Page Class. This Page class will identify the WebElements of that web page and also contains Page methods which perform operations on those WebElements. Name of these methods should be given as per the task they are performing, i.e., if a loader is waiting for the payment gateway to appear, POM method name can be waitForPaymentScreenDisplay().

Page Object Model (POM) & Page Factory in Selenium: Complete Tutorial


What is "synchronization" problem in Selenium?

Successful test execution from cite
Test Execution resulting in ElementNotInteractableException from cite

评论

此博客中的热门博文

DAY 4 - Industry Connect

DAY 3 - Industry Connect