File configuration of interface automation script
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!