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

File configuration of interface automation script

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

What the editor shares with you today is the file configuration of the interface automation script. The editor thinks it is very practical, so I will share it for you as a reference. Let's follow the editor and have a look.

1. Structure-folder has

Conf: configuration fil

Test_result:log logs, html reports, screenshot image

Test_data: test case excel file

Test_case: test cases written in code, test_case1, test_case2

Common common code: operate excel, operate database, http request, operation log, send mail, read configuration file

Run module on the outermost

In the face of some business, you can add an API folder to store the module of the common business interface.

Second, the solution of the path

One of the things to note here is the file path. If you use the absolute path in the code, it is not conducive to code reuse. If you use the relative path, there may be holes in other files. Configuration files are recommended here.

Define a project_path.conf file in the conf folder that stores the folder path of the current project. In this way, someone else can get your code and just change the configuration of his local project path here, so that it can run.

Then write a project_path.py file. The steps implemented in this module are: os.path.realpath (file) to obtain the absolute path of the current file-> then use the os.path.split () method to split the path of the previous step to obtain the conf folder path-- > then use the os.path.join () method to splice to get the path of the path.conf configuration file-- > import the ReadConf.py module in the common folder to read the project path to the configuration file. This is half done, and then all the file paths used in the project can be spliced.

These are the details of the file configuration of the interface automation script. Have you gained anything after reading it? If you want to know more about it, you are welcome to follow the industry information!

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: 219

*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

Internet Technology

Wechat

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

12
Report