Recently contacted with the interface automation, after about one months, the use of the company's projects, with the help of building an Interface Automation framework (this framework is to achieve a complete separation of the script and data). The whole process, the most important thing is to realize the idea, the idea has, the realization is still not difficult.
The first one is to record the general idea of building a framework.
1. First, the entire framework should contain content
Simple generalization: Execute test cases, generate test reports
2. How to implement test case execution
In this framework, you use Excel to manage test cases, so the core of the framework is to get the data needed in an Excel table (or get the data needed to perform each interface test)
The entire framework is as follows:
Features for each module:
The function of the 1.compare module is to achieve the comparison between the expected result and the returned result to see if the actual result is the same as the expected result
2.datadepend module is to determine whether there is data dependency, and the data dependent on the conditions of dependent data acquisition
3.config.ini is a configuration file that can place connection information for a database, login information for a mailbox, and so on
The 4.data.json file places the request data, and of course the request data can be placed in an Excel table.
The function of the 5.excelColNum module is to define the columns of Excel tables that manage test cases as constants
Both the 6.get_case module and the Operateexcel module are actually operations on Excel.
7.operateJson module is to get the data in the Data.json file
8.readConfig module is to get the information inside the configuration file Config.ini
9.test_case.xls, this is the test case.
The 10.requestMethord module makes a judgment and encapsulation of the request mode.
The 11.run_case module is the entrance to the entire program.
The template for the test case is roughly the same and can be adjusted as needed
The first article describes these, the specific implementation in the following pages in detail.
Python-based interface Automation combat (i)