CN116795684A - Automatic test method, device, terminal equipment and medium of interface - Google Patents

Automatic test method, device, terminal equipment and medium of interface Download PDF

Info

Publication number
CN116795684A
CN116795684A CN202310146275.5A CN202310146275A CN116795684A CN 116795684 A CN116795684 A CN 116795684A CN 202310146275 A CN202310146275 A CN 202310146275A CN 116795684 A CN116795684 A CN 116795684A
Authority
CN
China
Prior art keywords
interface
request
test
tested
configuration information
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.)
Pending
Application number
CN202310146275.5A
Other languages
Chinese (zh)
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.)
Shenzhen Coocaa Network Technology Co Ltd
Original Assignee
Shenzhen Coocaa Network Technology 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 Shenzhen Coocaa Network Technology Co Ltd filed Critical Shenzhen Coocaa Network Technology Co Ltd
Priority to CN202310146275.5A priority Critical patent/CN116795684A/en
Publication of CN116795684A publication Critical patent/CN116795684A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The present application is applicable to the field of interface testing technologies, and in particular, to an automatic interface testing method, device, terminal equipment, and medium. According to the method, a test request sent by a front end is obtained, interface configuration information, address configuration information and verification rule information corresponding to the interface to be tested are determined from a corresponding database according to configuration parameters of the interface to be tested in the test request, the interface configuration information and the address configuration information are assembled, an assembly result is determined to be an interface request address corresponding to the interface to be tested, the interface to be tested is requested by using the interface request address, a feedback message fed back by the interface to be tested is obtained, the feedback message and the verification rule information are subjected to comparative analysis, the comparative analysis result is stored and displayed, the test request sent by the front end is subjected to the rear end, corresponding test information is obtained by calling the database, and the test information is assembled, tested, verified and the like automatically, so that the test efficiency is improved, and the test result can be effectively given.

Description

Automatic test method, device, terminal equipment and medium of interface
Technical Field
The present application is applicable to the field of interface testing technologies, and in particular, to an automatic interface testing method, device, terminal equipment, and medium.
Background
The interface test is a test for testing interfaces between components of a system, and is mainly used for testing interfaces between the system and other external systems and interfaces between all sub-modules in the system. And checking the correctness, the integrity and the rationality of the interface under different parameter scenes by checking the response message returned by the requested interface. Currently, in the test industry, verification of an answer message of an interface test is generally limited to verification of a response code, and cannot be tested in batch at a time. Therefore, how to separate the front end and the rear end of the interface test and make the rear end perform an automatic test to improve the test efficiency is a problem to be solved.
Disclosure of Invention
In view of this, the embodiments of the present application provide an automatic testing method, apparatus, terminal device and medium for an interface, so as to solve the problem of how to separate front and rear ends of an interface test, and enable the rear end to perform an automatic test, so as to improve testing efficiency.
In a first aspect, an embodiment of the present application provides an automated testing method for an interface, where the automated testing method includes:
acquiring a test request sent by a front end, and determining interface configuration information, address configuration information and verification rule information corresponding to an interface to be tested from a corresponding database according to configuration parameters of the interface to be tested in the test request;
assembling the interface configuration information and the address configuration information, and determining an assembling result as an interface request address corresponding to the interface to be tested;
requesting the interface to be tested by using the interface request address, acquiring a feedback message fed back by the interface to be tested, comparing the feedback message with the verification rule information, and determining a comparison analysis result;
if the comparison analysis result is that the verification is not passed, the comparison analysis result is stored, and when the detail trigger item displayed on the page at the front end is triggered by a user, the comparison analysis result is displayed.
In a second aspect, an embodiment of the present application provides an automated testing apparatus for an interface, the automated testing apparatus including:
the request acquisition module is used for acquiring a test request sent by a front end, and determining interface configuration information, address configuration information and verification rule information corresponding to the interface to be tested from a corresponding database according to configuration parameters of the interface to be tested in the test request;
the information assembly module is used for assembling the interface configuration information and the address configuration information, and determining an assembly result as an interface request address corresponding to the interface to be tested;
the comparison analysis module is used for requesting the interface to be tested by using the interface request address, acquiring a feedback message fed back by the interface to be tested, comparing and analyzing the feedback message with the check rule information, and determining a comparison analysis result;
and the test result processing module is used for storing the comparison analysis result if the comparison analysis result is that the verification is not passed, and displaying the comparison analysis result when the detail triggering item displayed on the page at the front end is triggered by a user.
In a third aspect, an embodiment of the present application provides a terminal device, where the terminal device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and where the processor implements the automated test method of an interface according to the first aspect when the processor executes the computer program.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program which, when executed by a processor, implements the automated test method of an interface according to the first aspect.
Compared with the prior art, the embodiment of the application has the beneficial effects that: according to the method, a test request sent by a front end is obtained, interface configuration information, address configuration information and check rule information corresponding to an interface to be tested are determined from a corresponding database according to configuration parameters of the interface to be tested in the test request, the interface configuration information and the address configuration information are assembled, an assembly result is determined to be an interface request address corresponding to the interface to be tested, the interface request address is used for requesting the interface to be tested, a feedback message fed back by the interface to be tested is obtained, the feedback message and the check rule information are subjected to comparison analysis, a comparison analysis result is determined, if the comparison analysis result is not passed, the comparison analysis result is saved, and when a detail trigger item displayed on a page of the front end is triggered by a user, the test request sent by the front end is displayed by the rear end, the corresponding test information is obtained by calling the database, and the test information is automatically assembled, tested, checked and the like, so that the test efficiency is improved, and the test result can be effectively given.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic view of an application environment of an automated testing method for an interface according to a first embodiment of the present application;
fig. 2 is a flow chart of an automated testing method for an interface according to a second embodiment of the present application;
FIG. 3 is a schematic structural diagram of an automated testing apparatus for an interface according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of a terminal device according to a fourth embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
It should be understood that the sequence numbers of the steps in the following embodiments do not mean the order of execution, and the execution order of the processes should be determined by the functions and the internal logic, and should not be construed as limiting the implementation process of the embodiments of the present application.
In order to illustrate the technical scheme of the application, the following description is made by specific examples.
The method for automatically testing the interface provided by the embodiment of the application can be applied to an application environment as shown in fig. 1, wherein the front end and the back end are communicated. The front end includes, but is not limited to, smart televisions, palm top computers, desktop computers, notebook computers, ultra-mobile personal computer (UMPC), netbooks, cloud terminal devices, personal digital assistants (personal digital assistant, PDA), and the like. The backend may be implemented with a stand-alone server or a server cluster made up of multiple servers.
Referring to fig. 2, a flow chart of an automatic testing method for an interface according to a second embodiment of the present application is provided, where the automatic testing method is applied to the back end, and a user configures the back end accordingly, that is, configures interface parameters to be tested, test rule parameters, test case parameters, and the like, where the parameter information can find corresponding original data in a database connected to the back end, so that the back end can obtain test data corresponding to a request sent after the front end is configured. As shown in fig. 2, the automated test method may include the steps of:
step S201, a testing request sent by a front end is obtained, and interface configuration information, address configuration information and verification rule information corresponding to the interface to be tested are determined from a corresponding database according to configuration parameters of the interface to be tested in the testing request.
In the application, the front end and the back end are interacted, and the front end is an interaction interface established for interface testers, so that the front end can perform the functions of domain name configuration, message header configuration, interface parameter configuration, test case configuration, check rule configuration, interface test set configuration and the like when in use.
The domain name configuration comprises a domain name and a domain name uniform resource locator (Uniform Resoure Locator, URL), and can be used for uniformly managing interface request domain names under different services and different environments. For example: http:// xxx. Com, http:// IP address: port number, etc., according to actual use, after configuration is completed, the data is saved into database.
The header configuration includes a header name and header content (which may be in json format). The header content, for example:
{
Accept:"application/json,text/*",
Accept-Charset:"utf-8",
Content-Type:"application/x-www-form-urlencoded;charset=utf-8",
MAC:"fca386cb156b",
Resolution:"1920x1080"
}
according to the actual use environment, the configuration is finished and then stored in a database, and the message header content comprises a receiving identification number (Identity Document, ID), an address ID and the like, so as to provide the sending and receiving functions of the message for the interface to be tested obtained by subsequent configuration.
After the domain name configuration and the message header, corresponding domain name and message header name can be directly selected in the subsequent interface test set configuration, and corresponding domain name URL and message header content can be called, so that quick batch configuration is realized.
The interface configuration includes an interface name, a request path, a request method, a request parameter, and a request body. And according to the actual use condition, storing the configuration into a database after the configuration is completed. For example:
request path: v3/product/xxxxx;
the request method comprises the following steps: GET, POST;
request parameters: json format, e.g., { "data" { "user_id": "xxx", "movie_id": "xxx", "auth_type": "0", "node_type": "}, default to { } if no parameters are required;
request body: json format, such as { "express": "xxx", "orderSn": "xxx" }, uses the volume parameters only when the request method is POST, and defaults to { } if no parameters are needed.
The interface test cases comprise interface test case names and interface names (which can be configured in a front-end interactive interface by using a pull-down selection mode), and the configured test cases are stored in a database and are used for subsequent configuration of the interface test sets.
The configuration of the verification rule comprises a verification template, a tester visually edits a field to be verified of the current interface, such as a field name, a field type, a field value, a field enumeration value and a field length, through a JSON-schema-editor plug-in on a front-end interaction page, the edited content is automatically generated into a JSON string to be used as the verification template, and the JSON string is saved into a database after the configuration is completed according to actual use conditions.
Interface test set configuration includes test set name, domain name (which may be configured in a front-end interactive interface using a drop-down selection mode), message header (which may be configured in a front-end interactive interface using a drop-down selection mode), test case (which may be configured in a front-end interactive interface using a drop-down selection mode, optionally multiple). After the interface test set is configured, one test set comprises one or more test cases, and a corresponding test request is generated based on the test cases and sent to the back end.
After the back end receives the test request, the configuration parameters in the interface to be tested are obtained, after the configuration parameters are obtained from the content, the interface configuration information, the address configuration information, the check rule information and the like can be correspondingly matched from the database, and for interface test, the interface configuration information, the address configuration information and the check rule information can form a preliminary complete test on the interface.
Optionally, after obtaining the test request sent by the front end, the method further includes:
analyzing the test request, and determining N test case parameters and address configuration parameters, wherein N is an integer greater than zero;
according to the configuration parameters of the interface to be tested in the test request, determining interface configuration information, address configuration information and check rule information of the corresponding interface to be tested from the corresponding database comprises:
according to the N test case parameters, N test cases are determined from the corresponding database, wherein any one test case corresponds to an interface to be tested;
extracting interface configuration information and check rule information of a corresponding interface to be tested from each test case;
and determining address configuration information of interfaces to be tested corresponding to all the test cases from the corresponding database according to the address configuration parameters.
For the case that the test request includes one or more test cases, for each test case, the matching needs to be performed from the database to the corresponding data, for example, the test case parameters are matched to the test cases, so that interface configuration information and verification rule information are extracted, and for example, the address configuration parameters are matched to the address configuration information.
Step S202, assembling interface configuration information and address configuration information, and determining an assembling result as an interface request address corresponding to the interface to be tested.
In the application, after obtaining interface configuration information and address configuration information, the back end assembles the information to obtain the request address of the interface so as to send a request to the interface corresponding to the request address.
If the test request corresponds to a plurality of test cases, each test case corresponds to an interface request address of the test case.
Optionally, the address configuration information includes a domain name and a message header, and the interface configuration information includes a request path, a request method, a request parameter and a request body;
assembling the interface configuration information and the address configuration information, and determining that the assembling result is the interface request address corresponding to the interface to be tested comprises the following steps:
sequentially splicing the domain name, the message header, the request path, the request method, the request parameters and the request body to obtain a splicing result as an assembly result;
and determining the assembly result as an interface request address corresponding to the interface to be tested.
The domain name and the message header are spliced with the interface configuration information during assembly to obtain an interface request address, and when a request is triggered according to the interface request address, a feedback message fed back by the interface can be obtained.
Optionally, splicing the domain name, the message header, the request path, the request method, the request parameter and the request body in sequence to obtain a splicing result as an assembly result, wherein the splicing result comprises:
detecting whether the request method is a POST method;
if the request method is detected to be a POST method, the domain name, the message header, the request path, the request method, the request parameters and the request body are spliced in sequence, and the splicing result is an assembly result; or alternatively
If the request method is detected not to be the POST method, the domain name, the message header, the request path, the request method and the request parameters are spliced in sequence, and the splicing result is obtained as an assembly result.
In the assembly process, the request method can be GET, POST, etc., so that it is also necessary to detect the request method, and if the request method is not POST, it is unnecessary to use a request body in assembly.
Step S203, an interface request address is used for requesting an interface to be tested, a feedback message fed back by the interface to be tested is obtained, the feedback message and the check rule information are compared and analyzed, and a comparison analysis result is determined.
In the application, the corresponding interface to be tested sends a request, a feedback message fed back by the interface to be tested is obtained, and the feedback message is checked by using the check rule information to judge whether the test is abnormal or not.
Optionally, if the feedback message is in JSON format, comparing the feedback message with the verification rule information, and determining that the comparison analysis result includes:
performing code conversion on the feedback message to obtain a JSON object;
extracting a JSON string in the check rule information, and comparing and matching the JSON object with the JSON string;
if the abnormality cannot be captured, determining that the comparison analysis result is that the feedback message passes the verification, and if the abnormality is captured, determining that the comparison analysis result is that the feedback message does not pass the verification.
The feedback message is converted into a JSON object corresponding to the check rule formed by the JSON string in the step S201, the JSON object is compared with the JSON string, try catch is performed, that is, error processing is performed, the execution rule is to execute codes in try, if the anomaly is thrown out, the catch is captured by catch and executed, if no anomaly catch is generated, the catch is ignored, but no anomaly is generated, the last execution is performed, and if the anomaly is captured, it is determined that the feedback message check is not passed.
And step S204, if the comparison analysis result is that the verification is not passed, the comparison analysis result is stored, and when the detail trigger item displayed on the front-end page is triggered by the user, the comparison analysis result is displayed.
In the application, a corresponding display interface is also provided for displaying the test result, namely, the test result is stored and displayed, after the verification is completed, the state of the test result is stored, for example, 0 represents that the test result is not passed, 1 represents that the test result is passed, if the test result is not passed, the abnormal information is stored, and if the test result is passed, the default null value is stored.
Optionally, after comparing and matching the JSON object with the JSON string, the method further includes:
if the abnormality is captured, the abnormality information is written into the comparison analysis result.
The test report displayed on the page comprises a test report name, an execution mode (manual, timed task), a test type, a test result, test details and execution time. Wherein the test results, when triggered, exhibit comparative analysis results, i.e., test details.
According to the embodiment of the application, a test request sent by a front end is obtained, interface configuration information, address configuration information and verification rule information corresponding to the interface to be tested are determined from a corresponding database according to configuration parameters of the interface to be tested in the test request, the interface configuration information and the address configuration information are assembled, an assembly result is determined to be an interface request address corresponding to the interface to be tested, the interface request address is used for requesting the interface to be tested, a feedback message fed back by the interface to be tested is obtained, the feedback message and the verification rule information are subjected to comparative analysis, a comparative analysis result is determined, if the comparative analysis result is not passed, the comparative analysis result is saved, and when a detail trigger item displayed on a page at the front end is triggered by a user, the test request sent by the front end is displayed, the corresponding test information is obtained by calling the database, the test information is assembled, tested, verified and the like automatically, the test result can be effectively given.
Fig. 3 shows a block diagram of an automated testing apparatus for an interface according to a third embodiment of the present application, where the automated testing apparatus for an interface is applied to the back end, and a user configures the front end by configuring interface parameters to be tested, test rule parameters, test case parameters, and the like, accordingly, the parameter information can find corresponding original data in a database connected to the back end, so that the back end can obtain test data corresponding to a request sent after the front end is configured. For convenience of explanation, only portions relevant to the embodiments of the present application are shown.
Referring to fig. 3, the automated test equipment includes:
the request acquisition module 31 is configured to acquire a test request sent by the front end, and determine interface configuration information, address configuration information and verification rule information corresponding to the interface to be tested from a corresponding database according to configuration parameters of the interface to be tested in the test request;
the information assembling module 32 is configured to assemble the interface configuration information and the address configuration information, and determine that the assembling result is the interface request address corresponding to the interface to be tested;
the contrast analysis module 33 is configured to request the interface to be tested using the interface request address, obtain a feedback message fed back by the interface to be tested, perform contrast analysis on the feedback message and the verification rule information, and determine a contrast analysis result;
and the test result processing module 34 is configured to store the comparison analysis result if the comparison analysis result is that the verification is not passed, and display the comparison analysis result when the detail trigger item displayed on the front page is triggered by the user.
Optionally, the automated testing apparatus further comprises:
the request analysis module is used for analyzing the test request after acquiring the test request sent by the front end, determining N test case parameters and address configuration parameters, wherein N is an integer greater than zero;
the request acquisition module comprises:
the test case determining unit is used for determining N test cases from the corresponding database according to the N test case parameters, wherein any one test case corresponds to an interface to be tested;
the test information determining unit is used for extracting interface configuration information and check rule information of the corresponding interface to be tested from each test case;
and the address information determining unit is used for determining the address configuration information of the interfaces to be tested corresponding to all the test cases from the corresponding database according to the address configuration parameters.
Optionally, the address configuration information includes a domain name and a message header, and the interface configuration information includes a request path, a request method, a request parameter and a request body;
assembling the interface configuration information and the address configuration information, and determining that the assembling result is the interface request address corresponding to the interface to be tested comprises the following steps:
sequentially splicing the domain name, the message header, the request path, the request method, the request parameters and the request body to obtain a splicing result as an assembly result;
and determining the assembly result as an interface request address corresponding to the interface to be tested.
Optionally, splicing the domain name, the message header, the request path, the request method, the request parameter and the request body in sequence to obtain a splicing result as an assembly result, wherein the splicing result comprises:
detecting whether the request method is a POST method;
if the request method is detected to be a POST method, the domain name, the message header, the request path, the request method, the request parameters and the request body are spliced in sequence, and the splicing result is an assembly result; or alternatively
If the request method is detected not to be the POST method, the domain name, the message header, the request path, the request method and the request parameters are spliced in sequence, and the splicing result is obtained as an assembly result.
Optionally, if the feedback message is in JSON format, comparing the feedback message with the verification rule information, and determining that the comparison analysis result includes:
performing code conversion on the feedback message to obtain a JSON object;
extracting a JSON string in the check rule information, and comparing and matching the JSON object with the JSON string;
if the abnormality cannot be captured, determining that the comparison analysis result is that the feedback message passes the verification, and if the abnormality is captured, determining that the comparison analysis result is that the feedback message does not pass the verification.
Optionally, after comparing and matching the JSON object with the JSON string, the method further includes:
if the abnormality is captured, the abnormality information is written into the comparison analysis result.
It should be noted that, because the content of information interaction and execution process between the modules and the embodiment of the method of the present application are based on the same concept, specific functions and technical effects thereof may be referred to in the method embodiment section, and details thereof are not repeated herein.
Fig. 4 is a schematic structural diagram of a terminal device according to a fourth embodiment of the present application. As shown in fig. 4, the terminal device of this embodiment includes: at least one processor (only one shown in fig. 4), a memory, and a computer program stored in the memory and executable on the at least one processor, the processor executing the computer program to perform the steps of the automated test method embodiments of any of the various interfaces described above.
The terminal device may include, but is not limited to, a processor, a memory. It will be appreciated by those skilled in the art that fig. 4 is merely an example of a terminal device and is not limiting of the terminal device, and that the terminal device may comprise more or less components than shown, or may combine some components, or different components, e.g. may further comprise a network interface, a display screen, input means, etc.
The processor may be a CPU, but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory includes a readable storage medium, an internal memory, etc., where the internal memory may be a memory of the terminal device, and the internal memory provides an environment for the operation of an operating system and computer readable instructions in the readable storage medium. The readable storage medium may be a hard disk of the terminal device, and in other embodiments may be an external storage device of the terminal device, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card), etc. that are provided on the terminal device. Further, the memory may also include both an internal storage unit of the terminal device and an external storage device. The memory is used to store an operating system, application programs, boot loader (BootLoader), data, and other programs such as program codes of computer programs, and the like. The memory may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above device may refer to the corresponding process in the foregoing method embodiment, which is not described herein again. The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above-described embodiment, and may be implemented by a computer program to instruct related hardware, and the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of the method embodiment described above. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, executable files or in some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code, a recording medium, a computer Memory, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The present application may also be implemented by a computer program product for implementing all or part of the steps of the method embodiments described above, when the computer program product is run on a terminal device, causing the terminal device to execute the steps of the method embodiments described above.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (10)

1. An automated testing method of an interface, the automated testing method comprising:
acquiring a test request sent by a front end, and determining interface configuration information, address configuration information and verification rule information corresponding to an interface to be tested from a corresponding database according to configuration parameters of the interface to be tested in the test request;
assembling the interface configuration information and the address configuration information, and determining an assembling result as an interface request address corresponding to the interface to be tested;
requesting the interface to be tested by using the interface request address, acquiring a feedback message fed back by the interface to be tested, comparing the feedback message with the verification rule information, and determining a comparison analysis result;
if the comparison analysis result is that the verification is not passed, the comparison analysis result is stored, and when the detail trigger item displayed on the page at the front end is triggered by a user, the comparison analysis result is displayed.
2. The automated test method of claim 1, further comprising, after obtaining the test request sent by the front end:
analyzing the test request, and determining N test case parameters and address configuration parameters, wherein N is an integer greater than zero;
according to the configuration parameters of the interface to be tested in the test request, determining interface configuration information, address configuration information and check rule information corresponding to the interface to be tested from a corresponding database comprises:
according to the N test case parameters, N test cases are determined from a corresponding database, wherein any one test case corresponds to an interface to be tested;
extracting interface configuration information and check rule information of a corresponding interface to be tested from each test case;
and determining address configuration information of interfaces to be tested corresponding to all test cases from a corresponding database according to the address configuration parameters.
3. The automated test method of claim 1, wherein the address configuration information comprises a domain name and a header, and the interface configuration information comprises a request path, a request method, a request parameter, and a request body;
assembling the interface configuration information and the address configuration information, wherein determining that the assembling result is the interface request address corresponding to the interface to be tested comprises the following steps:
sequentially splicing the domain name, the message header, the request path, the request method, the request parameters and the request body to obtain a splicing result as an assembly result;
and determining an assembling result as an interface request address corresponding to the interface to be tested.
4. The automated testing method of claim 3, wherein sequentially concatenating the domain name, the header, the request path, the request method, the request parameter, and the request body to obtain a concatenation result as an assembly result comprises:
detecting whether the request method is a POST method;
if the request method is detected to be a POST method, the domain name, the message header, the request path, the request method, the request parameter and the request body are spliced in sequence, and a splicing result is obtained as an assembly result; or alternatively
If the request method is detected not to be a POST method, the domain name, the message header, the request path, the request method and the request parameter are spliced in sequence, and the splicing result is an assembly result.
5. The automated testing method of any of claims 1 to 4, wherein if the feedback message is in JSON format, comparing the feedback message with the verification rule information, and determining a comparison result includes:
performing code conversion on the feedback message to obtain a JSON object;
extracting a JSON string in the check rule information, and comparing and matching the JSON object with the JSON string;
if the abnormality cannot be captured, determining that the comparison analysis result is that the feedback message passes the verification, and if the abnormality is captured, determining that the comparison analysis result is that the feedback message does not pass the verification.
6. The automated testing method of claim 5, further comprising, after comparing the JSON object to the JSON string:
if the abnormality is captured, the abnormality information is written into the comparison analysis result.
7. An automated testing apparatus for an interface, the automated testing apparatus comprising:
the request acquisition module is used for acquiring a test request sent by a front end, and determining interface configuration information, address configuration information and verification rule information corresponding to the interface to be tested from a corresponding database according to configuration parameters of the interface to be tested in the test request;
the information assembly module is used for assembling the interface configuration information and the address configuration information, and determining an assembly result as an interface request address corresponding to the interface to be tested;
the comparison analysis module is used for requesting the interface to be tested by using the interface request address, acquiring a feedback message fed back by the interface to be tested, comparing and analyzing the feedback message with the check rule information, and determining a comparison analysis result;
and the test result processing module is used for storing the comparison analysis result if the comparison analysis result is that the verification is not passed, and displaying the comparison analysis result when the detail triggering item displayed on the page at the front end is triggered by a user.
8. The automated test equipment of claim 7, further comprising:
the request analysis module is used for analyzing the test request after acquiring the test request sent by the front end, determining N test case parameters and address configuration parameters, wherein N is an integer greater than zero;
the request acquisition module includes:
the test case determining unit is used for determining N test cases from the corresponding database according to the N test case parameters, wherein any one test case corresponds to an interface to be tested;
the test information determining unit is used for extracting interface configuration information and check rule information of the corresponding interface to be tested from each test case;
and the address information determining unit is used for determining the address configuration information of the interfaces to be tested corresponding to all the test cases from the corresponding database according to the address configuration parameters.
9. A terminal device, characterized in that it comprises a processor, a memory and a computer program stored in the memory and executable on the processor, which processor, when executing the computer program, implements the automated test method according to any of claims 1 to 6.
10. A computer readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the automated test method according to any one of claims 1 to 6.
CN202310146275.5A 2023-02-07 2023-02-07 Automatic test method, device, terminal equipment and medium of interface Pending CN116795684A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310146275.5A CN116795684A (en) 2023-02-07 2023-02-07 Automatic test method, device, terminal equipment and medium of interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310146275.5A CN116795684A (en) 2023-02-07 2023-02-07 Automatic test method, device, terminal equipment and medium of interface

Publications (1)

Publication Number Publication Date
CN116795684A true CN116795684A (en) 2023-09-22

Family

ID=88048737

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310146275.5A Pending CN116795684A (en) 2023-02-07 2023-02-07 Automatic test method, device, terminal equipment and medium of interface

Country Status (1)

Country Link
CN (1) CN116795684A (en)

Similar Documents

Publication Publication Date Title
CN111597120B (en) Interface test apparatus, method, electronic device, and computer-readable storage medium
CN113240258A (en) Industrial asset detection method, equipment and device
CN108009085B (en) Channel package testing method
CN111858698B (en) Data checking method, data checking device and terminal equipment
CN109614327B (en) Method and apparatus for outputting information
CN111309635A (en) Test case generation method, device, server and storage medium
CN111221727A (en) Test method, test device, electronic equipment and computer readable medium
CN115186274A (en) IAST-based security test method and device
CN112131127B (en) Interface testing method, device and system and electronic equipment
CN112948224B (en) Data processing method, device, terminal and storage medium
CN116431522A (en) Automatic test method and system for low-code object storage gateway
CN116738091A (en) Page monitoring method and device, electronic equipment and storage medium
CN116795684A (en) Automatic test method, device, terminal equipment and medium of interface
CN112882707B (en) Rendering method and device, storage medium and electronic equipment
CN110618943B (en) Security service test method and device, electronic equipment and readable storage medium
CN109039813B (en) Method, system and equipment for detecting internet access
CN115203178A (en) Data quality inspection method and device, electronic equipment and storage medium
CN111242256B (en) Information verification method, device and terminal
CN110532186B (en) Method, device, electronic equipment and storage medium for testing by using verification code
CN113128848A (en) Data quality monitoring method for full-service index, electronic equipment and storage medium
CN112181816A (en) Interface testing method and device based on scene, computer equipment and medium
CN111737129A (en) Service control method, service control device, computer readable medium and electronic equipment
CN113094268B (en) Test method, test device, test equipment and test medium
CN111813691B (en) Test problem investigation method, device, electronic equipment and medium
CN113986603B (en) Method and device for determining page loading abnormity reason and storage medium

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