CN107026773A - Automatic correlation method for interface automatic test - Google Patents

Automatic correlation method for interface automatic test Download PDF

Info

Publication number
CN107026773A
CN107026773A CN201710343838.4A CN201710343838A CN107026773A CN 107026773 A CN107026773 A CN 107026773A CN 201710343838 A CN201710343838 A CN 201710343838A CN 107026773 A CN107026773 A CN 107026773A
Authority
CN
China
Prior art keywords
interface
data
module
request
variable
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710343838.4A
Other languages
Chinese (zh)
Other versions
CN107026773B (en
Inventor
严金勇
师洛蓓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN201710343838.4A priority Critical patent/CN107026773B/en
Publication of CN107026773A publication Critical patent/CN107026773A/en
Application granted granted Critical
Publication of CN107026773B publication Critical patent/CN107026773B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0807Network architectures or network communication protocols for network security for authentication of entities using tickets, e.g. Kerberos

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a kind of automatic correlation method for interface automatic test, including data module, relating module and request module, the data module is used for the interface testing data for providing each interface, the relating module is used to parse interface testing data generation associated with, association judgement and association process that data module is transmitted, and the request module is used to be responsible for Processing Interface request and responded.The pattern that the present invention is separated using data with business, interface testing personnel only need to get out interface testing data, it is possible to realize the auto-associating of interface.Also, the test data easy care of the present invention, it is low to code Capability Requirement, the difficulty of interface automatic test is significantly reduced, operating efficiency is improved.

Description

Automatic correlation method for interface automatic test
Technical field
The present invention relates to automatic test field, more particularly to a kind of automatic correlation for interface automatic test Method.
Background technology
With cloud computing, the development of big data, the form that what many manufacturers externally provided be all based on service exist, it is necessary to Ensure validity, reliability of service etc. by interface testing, therefore interface automatic test arises at the historic moment.In existing interface In automatic test scheme, it is most of be all to set of system method, not for how to realize interface auto-associating to Go out a solution, cause to bring difficulty in interface automatic test is carried out.
No longer it is simple single interface testing in the implementation of interface automatic test, existing needs association between interface, Such as:
1), the input of an interface needs the certain field of the returned packet of another interface or certain part to be used as ginseng Number, and the parameter returned is dynamic change.
2), with the reinforcement to software security, many services are all based on token authentication mechanisms and obtained, it is necessary to first access Take after corresponding token, corresponding API could be accessed by holding the token and required parameter of response.
For above scene, most of at present take realized by way of code code, and this undoubtedly gives interface testing Personnel add difficulty, and spend the substantial amounts of time for writing code, debugging code.
The content of the invention
Part, is used for interface automatic test it is an object of the invention to provide one kind in view of the shortcomings of the prior art Automatic correlation method, the pattern separated based on data-driven and using data with business given birth to automatically according to interface testing data Into associated with, the auto-associating of interface is realized;Interface testing personnel only need to get out test data, it is not necessary to any coding Achieve that, significantly reduce the difficulty of interface testing.
The purpose of the present invention is achieved through the following technical solutions:
A kind of automatic correlation method for interface automatic test, including data module, relating module and request module, The data module is used for the interface testing data for providing each interface, and the relating module is transmitted across for parsing data module Interface testing data generation associated with, association judgement and the association process come, the request module are used to be responsible for Processing Interface Request and response, its automatic correlation method are as follows:
Each interface in the interface testing data of each interface, the data module is got out in A, the data module Comprising an interface testing data, the particular content of the interface testing data includes request data and associated data, described Request data includes address, parameter, response message, message body;
If the request data of the interface needs to associate other interfaces, by the partial data of the request data of the interface Value is set to variable name;
If the data in the response message of the interface provide parameter for other interfaces, in the associated data of the interface It is set to variable name and acquisition modes;
The interface testing data generation associated with that B, relating module parsing data module are transmitted, associated with In have recorded association in need interface;Total interface is divided into two class interfaces, and first kind interface needs each interface associated The variable name of association;Value of the associated variable of Equations of The Second Kind interface from which interface and the associated variable is from the acquisition in response Mode;
C, the request module parse associated with according to the interface A currently performed, the relating module, judge association text It whether there is the interface in part;
If there is the interface in D, associated with, show that the interface needs association;
E, which variable of the interface conjunctionn is judged in associated with;
F, which associated interface judgment variable comes from associated with, and obtains the acquisition modes of the value of the variable;
G, request module perform associated interface request, and it is the change to handle response according to the acquisition modes of the associated variable value Measure assignment;
H, replace according to the value of associated variable value in interface A request datas to dependent variable;
Whether I, judgment variable, which associate, is finished, and step J, otherwise, repeat step F to H are performed if association is finished;
J, the request module perform interface A requests;Then the request module processing response.
The present invention compared with the prior art, with advantages below and beneficial effect:
The pattern that the present invention is separated using data with business, interface testing personnel only need to get out interface testing number According to, it is possible to realize the auto-associating of interface.Also, the test data easy care of the present invention, it is low to code Capability Requirement, greatly Ground reduces the difficulty of interface automatic test, improves operating efficiency.
Brief description of the drawings
Fig. 1 is flowage structure schematic block diagram of the invention.
Embodiment
The present invention is described in further detail with reference to embodiment:
Embodiment one
As shown in figure 1, a kind of automatic correlation method for interface automatic test, including data module, relating module And request module, interface testing data of the data module for providing each interface, the relating module is for parsing number Interface testing data generation associated with, association judgement and the association process come according to module transfer, the request module is used for It is responsible for Processing Interface request and responds, its automatic correlation method is as follows:
Each interface in the interface testing data of each interface, the data module is got out in A, the data module Comprising an interface testing data, the particular content of the interface testing data includes request data and associated data, described Request data includes address, parameter, response message, message body;
If the request data of the interface needs to associate other interfaces, by the partial data of the request data of the interface Value is set to variable name;
If the data in the response message of the interface provide parameter for other interfaces, in the associated data of the interface It is set to variable name and acquisition modes;The acquisition modes according to how from response obtain data depending on, can be by just Then expression is obtained, right boundary is obtained, jsonpath is obtained etc.;This value sentenced from the json Receive message nodes of response is Example, then the JsonPath of the incoming corresponding node of acquisition modes, such as " $ .data.openId ";
The interface testing data generation associated with that B, relating module parsing data module are transmitted, associated with In have recorded association in need interface;Total interface is divided into two class interfaces, and first kind interface needs each interface associated The variable name of association;Value of the associated variable of Equations of The Second Kind interface from which interface and the associated variable is from the acquisition in response Mode;
C, the request module parse associated with according to the interface A currently performed, the relating module, judge association text It whether there is the interface in part;
If there is the interface in D, associated with, show that the interface needs association;
E, which variable of the interface conjunctionn is judged in associated with;
F, which associated interface judgment variable comes from associated with, and obtains the acquisition modes of the value of the variable;
G, request module perform associated interface request, and it is the change to handle response according to the acquisition modes of the associated variable value Measure assignment;
H, replace according to the value of associated variable value in interface A request datas to dependent variable;
Whether I, judgment variable, which associate, is finished, and step J, otherwise, repeat step F to H are performed if association is finished;
J, the request module perform interface A requests;Then the request module processing response.
Embodiment two
As shown in figure 1, a kind of automatic correlation method for interface automatic test, including data module, relating module And request module, interface testing data of the data module for providing each interface, the relating module is for parsing number Interface testing data generation associated with, association judgement and the association process come according to module transfer, the request module is used for It is responsible for Processing Interface request and responds, its automatic correlation method is as follows:
Interface testing data are got out in step 1, the data module, interface data can be the number of a json form According to as follows:
1.1st, every interface message contains request data (headers, url, method, body), interface name (name) and information (tests) is asserted, if wherein the request data of the interface is in need to associate other interfaces, in request The value for needing the data associated is set into " { { variable name } } " in data, if the response message of the interface provides pass for other interfaces Join data, then " setVariable (" variable name ", acquisition modes be set in associated data) ";
If the 1.2, containing the data of two interfaces in json files, one is " User logs in " interface, and another is " Obtaining all information of user, " interface, " obtaining all information of user " interface conjunctionn " is obtained in " User logs in " interface performing All information of user " need to first carry out " User logs in before interface " interface, which is obtained after token, and taking token could access " obtains All information " interfaces of user;
1.3rd, the token such as in " all information of acquisition user " interface body needs to associate " User logs in " interface, then exists Token is set in body for " token ":\"{{token}}";Token is passed through in " User logs in " interface response message What jsonpath was obtained, then " User logs in " interface assert be set in information setVariable (" token ", jsonData.data.token);
All need are have recorded in step 2, relating module parsing interface testing data generation associated with, associated with The interface to be associated, total interface includes two parts:The variable name for each interface conjunctionn that a portion associates for needs;Separately A part is value of the associated variable from which interface and the associated variable from the acquisition modes in response;The json lattice of generation The associated with of formula is as follows:
2.1st, the associated with of generation, node pre_val represents which interface needs association and the change of the interface conjunctionn Name is measured, and is existed in the form of JSONObject;Node environment_val represents which interface the variable of association comes from And the acquisition acquisition modes of the value of variable;
If the 2.2, " obtain user all information " interface needs the variable associated is token, token comes from that " user steps on Record " interface and token is obtained by jsonpath from response message;
Step 3, the request module parse associated with according to the interface A currently performed, judge in associated with whether In the presence of the interface;
3.1st, " obtaining all information of user " interface such as being performed, by jsonpath, " $ .pre_val., which obtain user, to be owned Information " judges that associated with whether there is the interface;
If there is the interface in step 4, associated with, show that the interface needs association;
Step 5, which variable of the interface conjunctionn is judged in associated with;
5.1st, as by jsonpath " .pre_val. obtain user all information " obtain interface association in need The variable associated the need for variable, acquisition is token;
Step 6, which associated interface judgment variable comes from associated with, and obtains the acquisition side of the value of the variable Formula;
6.1st, such as by jsonpath " $ .environment_val.token.test_case_name " judge token come From in " User logs in " interface, judge that token is by jsonpath " $ .environment_val.token.val_value " Obtained by jsonpath " $ .data.token " from json response messages.
Step 7, request module perform associated interface request, and are according to the processing response of the acquisition modes of the associated variable value The variable assignments;
7.1st, such as perform " user logs in " interface, and by jsonpath " $ .data.token " from response message in Hold, and value is assigned to token;
Step 8, replace according to the value of associated variable value in interface A request datas to dependent variable;
8.1st, judge that " { { token } } " is located in the body of " obtaining all information of user " interface, and by body " { { token } " replaces with the value of token in step 7;
Whether step 9, judgment variable have associated, and step 10 are performed if having associated, otherwise repeat step six to eight;
Step 10, request module perform interface A requests;
10.1st, " obtaining all information of user " interface is performed;
Step 11, request module processing response;
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention Any modifications, equivalent substitutions and improvements made within refreshing and principle etc., should be included in the scope of the protection.

Claims (1)

1. a kind of automatic correlation method for interface automatic test, it is characterised in that:Including data module, relating module and Request module, the data module is used for the interface testing data for providing each interface, and the relating module is used to parse data Interface testing data generation associated with, association judgement and association process that module transfer comes, the request module are used to bear Blame Processing Interface request and respond, its automatic correlation method is as follows:
The each interface being ready in A, the data module in the interface testing data of each interface, the data module is included One interface testing data, the particular content of the interface testing data includes request data and associated data, the request Data include address, parameter, response message, message body;
If the request data of the interface needs to associate other interfaces, the value of the partial data of the request data of the interface is set It is set to variable name;
If the data in the response message of the interface provide parameter for other interfaces, set in the associated data of the interface For variable name and acquisition modes;
Remember in the interface testing data generation associated with that B, relating module parsing data module are transmitted, associated with Recorded association in need interface;Total interface is divided into two class interfaces, and first kind interface needs each interface conjunctionn associated Variable name;Value of the associated variable of Equations of The Second Kind interface from which interface and the associated variable is from the acquisition side in response Formula;
C, the request module parse associated with, judged in associated with according to the interface A currently performed, the relating module With the presence or absence of the interface;
If there is the interface in D, associated with, show that the interface needs association;
E, which variable of the interface conjunctionn is judged in associated with;
F, which associated interface judgment variable comes from associated with, and obtains the acquisition modes of the value of the variable;
G, request module perform associated interface request, and it is that the variable is assigned to handle response according to the acquisition modes of the associated variable value Value;
H, replace according to the value of associated variable value in interface A request datas to dependent variable;
Whether I, judgment variable, which associate, is finished, and step J, otherwise, repeat step F to H are performed if association is finished;
J, the request module perform interface A requests;Then the request module processing response.
CN201710343838.4A 2017-05-16 2017-05-16 Automatic association method for interface automation test Active CN107026773B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710343838.4A CN107026773B (en) 2017-05-16 2017-05-16 Automatic association method for interface automation test

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710343838.4A CN107026773B (en) 2017-05-16 2017-05-16 Automatic association method for interface automation test

Publications (2)

Publication Number Publication Date
CN107026773A true CN107026773A (en) 2017-08-08
CN107026773B CN107026773B (en) 2020-03-17

Family

ID=59529724

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710343838.4A Active CN107026773B (en) 2017-05-16 2017-05-16 Automatic association method for interface automation test

Country Status (1)

Country Link
CN (1) CN107026773B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108108305A (en) * 2018-01-02 2018-06-01 中国银行股份有限公司 A kind of environment availability testing method and system
CN108563539A (en) * 2018-03-21 2018-09-21 广州视源电子科技股份有限公司 Interface test method, server, readable storage medium storing program for executing and system
CN109992499A (en) * 2017-12-29 2019-07-09 北京奇虎科技有限公司 Interface test method, device and computer readable storage medium
CN110166469A (en) * 2019-05-28 2019-08-23 深圳市六度人和科技有限公司 A kind of method for authenticating, device and storage device
CN110990280A (en) * 2019-12-03 2020-04-10 中国工商银行股份有限公司 Automatic test data generation system and method
CN111324526A (en) * 2018-12-14 2020-06-23 北京金山云网络技术有限公司 Interface test system, method and server

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101330329A (en) * 2008-07-29 2008-12-24 中兴通讯股份有限公司 Self-adapting testing method and system
US20150058826A1 (en) * 2013-08-26 2015-02-26 The Trustees Of Columbia University In The City Of New York Systems and methods for efficiently and effectively detecting mobile app bugs
CN104615534A (en) * 2015-01-28 2015-05-13 广州酷狗计算机科技有限公司 Interface test method and device
CN104866422A (en) * 2015-05-20 2015-08-26 中国互联网络信息中心 Web Service automatic test system and method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101330329A (en) * 2008-07-29 2008-12-24 中兴通讯股份有限公司 Self-adapting testing method and system
US20150058826A1 (en) * 2013-08-26 2015-02-26 The Trustees Of Columbia University In The City Of New York Systems and methods for efficiently and effectively detecting mobile app bugs
CN104615534A (en) * 2015-01-28 2015-05-13 广州酷狗计算机科技有限公司 Interface test method and device
CN104866422A (en) * 2015-05-20 2015-08-26 中国互联网络信息中心 Web Service automatic test system and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
候可佳等: "《基于接口语义契约的WEB服务测试数据生成》", 《软件学报》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109992499A (en) * 2017-12-29 2019-07-09 北京奇虎科技有限公司 Interface test method, device and computer readable storage medium
CN108108305A (en) * 2018-01-02 2018-06-01 中国银行股份有限公司 A kind of environment availability testing method and system
CN108563539A (en) * 2018-03-21 2018-09-21 广州视源电子科技股份有限公司 Interface test method, server, readable storage medium storing program for executing and system
CN111324526A (en) * 2018-12-14 2020-06-23 北京金山云网络技术有限公司 Interface test system, method and server
CN111324526B (en) * 2018-12-14 2024-04-26 北京金山云网络技术有限公司 Interface test system, method and server
CN110166469A (en) * 2019-05-28 2019-08-23 深圳市六度人和科技有限公司 A kind of method for authenticating, device and storage device
CN110166469B (en) * 2019-05-28 2022-03-15 深圳市六度人和科技有限公司 Authentication method, device and storage device
CN110990280A (en) * 2019-12-03 2020-04-10 中国工商银行股份有限公司 Automatic test data generation system and method
CN110990280B (en) * 2019-12-03 2023-09-12 中国工商银行股份有限公司 Automatic test data generation system and method

Also Published As

Publication number Publication date
CN107026773B (en) 2020-03-17

Similar Documents

Publication Publication Date Title
CN107026773A (en) Automatic correlation method for interface automatic test
CN106354634A (en) Interface testing method and device
CN103888490B (en) A kind of man-machine knowledge method for distinguishing of full automatic WEB client side
CN109960944A (en) A kind of data desensitization method, server, terminal and computer readable storage medium
CN105825066B (en) A kind of electronic health record generation method and device
CN104156313A (en) Method for automatically generating Web service testing case
CN106682036A (en) Data exchange system and exchange method thereof
CN108897687A (en) A kind of API automated testing method and system based on data-driven
CN110427331A (en) The method for automatically generating performance test script based on interface testing tool
CN108427731A (en) Processing method, device, terminal device and the medium of page code
CN108076017A (en) The protocol analysis method and device of a kind of data packet
CN107704369A (en) A kind of recording method of Operation Log, electronic equipment, storage medium, system
CN104750463B (en) A kind of developing plug method and system
CN104598619A (en) Service compositional verification method based on constraint solver
CN109933331A (en) Data transfer device and associated component between a kind of client-server
CN109299530A (en) A kind of emulation testing case generation method, system, storage medium and terminal
CN103810092A (en) Application system testing method and device
CN103812679B (en) A kind of massive logs statistical analysis system and method
CN104866422A (en) Web Service automatic test system and method
CN104598348B (en) A kind of method and system of the long-range external system interface performance of analysis in real time
Wenhui et al. Study on REST API test model supporting web service integration
CN112883088B (en) Data processing method, device, equipment and storage medium
CN107038022B (en) Deserialization method and deserialization device
CN110881030A (en) Logstack-based method and device for recording operation logs of web service administrator
CN105446867B (en) A kind of generation method and device of test data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant