Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the automated testing framework of Python + selenium

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Today, I will talk to you about Python + selenium automated testing framework, which may not be well understood by many people. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Automated testing framework

The project automation testing framework is designed with 4 layers.

1. Basic layer (universal layer)

Basic layer:

Encapsulate general-purpose, highly repetitive code here. To write general code.

If you want the other three layers, you can call it directly.

For example:

Code for reading test data, code for reading configuration information, code for screenshots, code for locating elements, etc.

two。 Function layer (page layer)

Function layer:

Pages encapsulates the page. Encapsulate the page into classes. Class contains: properties and methods

Define the interface elements on the page as attributes of the class

Encapsulate the location and operation of the interface element into the method of the class

3. Business layer

Business layer:

Integrate pages, test data, etc., to form a complete business function.

4. Use case layer

Use case layer:

Encapsulate the use cases of the corresponding business functions. Put it into the test suite for batch execution and generate the test report.

There are many use cases for each business function.

The project project corresponding to the 4-tier framework

OAProject

Config folder directory: used to store files related to configuration information such as: url.csv db.csv

Data folder directory: used to store test data files. For example: login_test_data.csv

Pictures folder directory: used to store screenshot files. For example: xxxx.png

Reports folder directory: used to store test report files. For example: xxxx.html

Files folder directory: you can have it if you have the ability to upload attachments automatically. It is used to store the uploaded attachment file.

Src package: package: used to manage all py files in the oa project

Common package: holds common, common code. Corresponding to: the first layer: basic, universal layer

Such as:

Read test data in CSV documents

Pages package: store the page code; correspond to: layer 2: functional page layer

Business package: the one that stores the business layer code. Corresponding: layer 3: business layer

Test_case package: store the code that assembles the test cases; corresponding: layer 4: use case layer

Test_run package: stores the code in which the test suite has generated test reports; corresponding to: layer 4: use case layer

Where:

You can continue to create packages according to functional modules in the pages business test_case package. For example: XTBG ggxx and so on

After reading the above, do you have any further understanding of the Python + selenium automated testing framework? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report