Python-based interface Automation combat (i)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.