[python+selenium builds an automation framework] a design idea in framework design--POM

POM, Chinese: Page Object Model, POM is a very popular automated testing model in recent years, or an idea, POM is not a framework, but an idea for solving problems.

The purpose of using POM: In order to solve the frequent UI changes in the front end, the cost of test automation script maintenance is increasing.

POM idea: separate page elements, business logic and test scripts into two different class files. Class A only writes page element positioning and encapsulation of business logic code operations, and class B only writes test scripts.

Don't care about element positioning, just write the code that calls class A to cover different test scenarios. If the front-end page changes, you only need to modify the element positioning of class A, without modifying the test script code in class B.

POM mainly has the following advantages:

1. Separate the web ui object repository from the test script, and separate the business code from the test script.

2. Each page corresponds to a page class, and the elements of the page are written into this page class.

3. The page class mainly includes the element positioning of the page, and the method of encapsulating the business operation code related to these elements.

4. Code reuse, thereby reducing the amount of test script code.

5. The level is clear, and it supports the development of multiple automated scripts, such as which pages each person writes, without affecting others.

6. It is recommended that both page classes and business logic methods have meaningful names, so that others can quickly write and maintain scripts.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324947216&siteId=291194637