An interface testing method based on json configuration file
A technology for interface testing and configuration files, applied in software testing/debugging, software design, error detection/correction, etc., can solve the problems of JSON and testcase high coupling, inability to share, high space complexity of test class, etc., to reduce time complexity degree, reduce space complexity, and improve maintainability
Active Publication Date: 2022-06-03
SICHUAN CHANGHONG ELECTRIC CO LTD
View PDF8 Cites 0 Cited by
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
[0006] The purpose of the present invention is to provide a method for interface testing based on JSON configuration files, which is used to solve the high space complexity of test classes caused by the need to traverse the text test case set to obtain specific request parameters in the prior art when testing And define JSON as a parameter in the test class, resulting in high coupling between JSON and testcase, and the problem that the JSON object cannot be shared in other test classes of the test project
Method used
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View moreImage
Smart Image Click on the blue labels to locate them in the text.
Smart ImageViewing Examples
Examples
Experimental program
Comparison scheme
Effect test
Embodiment 1
[0029] An interface testing method based on a JSON configuration file, the method includes the following steps:
[0030] Step 1: Determine the fields that need to be parameterized in JSON according to functional requirements;
[0031] Step 2: Define JSON as a .json file of the test project, and save the parameterized data as a text table;
[0032] Step 3: Create a unittest test project and create a test class;
[0033] Step 4: On the basis of step 2, sink the parameterized data, parameterize JSON in the testcase, use the json.load method in the test class to load the JSON file to directly obtain a JSON object, and use the method of accessing the dictionary in the testcase Make specific parameterized assignments to JSON;
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More PUM
Login to View More Abstract
The invention discloses an interface testing method based on a JSON configuration file. The method includes step 1: determining the fields that need to be parameterized in JSON according to functional requirements; step 2: defining JSON as a .json file of a test project, parameterizing The data is saved as a text table; Step 3: Create a unittest test project and create a test class; Step 4: Based on Step 2, sink the parameterized data, parameterize JSON in the testcase, and use json in the test class. The load method loads the JSON file to directly obtain a JSON object, and uses the method of accessing the dictionary to assign specific parameters to the JSON in the testcase; Step 5: The testcase initiates a request through requests for interface testing, which solves the high space complexity of the test class and the The problem of high coupling between JSON and testcase.
Description
technical field [0001] The invention relates to the technical field of computer software, in particular to an interface testing method based on a JSON configuration file. Background technique [0002] In Internet projects, RESTful interfaces based on the http protocol are becoming more and more common. Such interfaces usually use JSON as the carrier for front-end and back-end data interaction. For automated testing of such interfaces, the unittest framework is usually used, and the methods of the requests library are used in testcases to simulate JSON-based front-end and back-end interactions. In testcase, in order to verify the correctness of the function, it is usually necessary to parameterize some fields of JSON. [0003] There are generally two ways to parameterize JSON for test cases. [0004] 1. Edit the entire JSON as part of the use case by means of text, each line of data in the text corresponds to a parameterized JSON, and test by reading the parameterized text ...
Claims
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More Application Information
Patent Timeline
Login to View More Patent Type & Authority Patents(China)
IPC IPC(8): G06F11/36G06F8/20
CPCG06F11/3684G06F8/24
Inventor 张文韬常清雪廖雷李林凤
Owner SICHUAN CHANGHONG ELECTRIC CO LTD


