2. The programme
For the above API, when doing interface testing, the test cases need to be up to 10 +, this time in a data-driven way to write the common content of the configuration file may be more appropriate.
Here consider the API, parameters, and expected results preprint in the formatted CSV, using the CSV component to read the URL, parameters, and expected results from the CSV, requests component initiates the request, compare the response result with the expected result, and then write the result to the result CSV.
Processes such as
3. Implement
(1) Before the code, install the following several components:
(2) Data.csv (This example selects some use cases)
(3) Reader_csv function code example
(4) Example of Request_url function (2 methods with GET request and POST request)
(5) Assert_result Function Example
(6) Write_csv Function Example
(7) Test_interface1 Function Example
8result_1523956055.csv (the test results in this example are ignored)
4. Summary
Requires 0 basic primer books, Python core programming and other information in the group: 125240963 files to download their own
Senior programmers use Python for data-driven interface automation testing!