CN116594867A - Interface testing method, system, device and electronic equipment - Google Patents

Interface testing method, system, device and electronic equipment Download PDF

Info

Publication number
CN116594867A
CN116594867A CN202310450898.1A CN202310450898A CN116594867A CN 116594867 A CN116594867 A CN 116594867A CN 202310450898 A CN202310450898 A CN 202310450898A CN 116594867 A CN116594867 A CN 116594867A
Authority
CN
China
Prior art keywords
interface
information
parameter data
tested
request 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
CN202310450898.1A
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202310450898.1A priority Critical patent/CN116594867A/en
Publication of CN116594867A publication Critical patent/CN116594867A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses an interface testing method, a system, a device, an electronic device and a computer readable storage medium, wherein the method comprises the following steps: generating first request information in response to monitoring a scene name input event of an interface to be tested; the first request information is sent to the server side, so that the server side can call interface information of an interface to be tested from the database; receiving interface information sent by a server; rendering interface parameter data input interfaces according to the interface information; generating second request information in response to monitoring the interface parameter data input event; and sending the second request information to the server so that the server tests the interface to be tested. The method is more flexible without depending on interface documents, does not have the condition that interface information is not matched with environment configuration, does not need a tester to have too professional interface test knowledge, reduces test threshold and learning cost, and solves the problems of poor test flexibility, high labor cost and high error rate in the prior art.

Description

Interface testing method, system, device and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to an interface testing method, system, device, electronic apparatus, and computer readable storage medium.
Background
With the development of computer technology, more and more business projects are involved in business applications, and in order to accelerate the development speed of business applications and reduce the development cost of business applications, an API interface (Application Programming Interface ) has become an indispensable means in the development of business applications. The service application uses an API interface, and often needs to test the function of the API interface.
Currently, API interface testing is performed by using a Postman application program, and a tester manually inputs test request information into the Postman application program according to an interface document of an interface to be tested, and the Postman application program tests the interface to be tested according to the test request information. However, the method is completely dependent on the interface document, and if a tester lacks the interface document, the test cannot be completed, so that the flexibility is lacking. And the test request information is manually input into the Postman application program by a tester, which clearly increases labor cost and error rate.
Therefore, how to provide an API interface testing method that does not depend on the interface document, and can reduce the labor cost and improve the testing accuracy is a technical problem to be solved.
Disclosure of Invention
The application provides an interface testing method, an interface testing system, an interface testing device, an electronic device and a computer readable storage medium, which are used for solving the technical problems of poor testing flexibility, high labor cost and high error rate caused by relying on interface documents and manually inputting request information by a tester in the conventional interface testing method.
In a first aspect, an embodiment of the present application provides an interface testing method, where the method includes:
generating first request information in response to monitoring a scene name input event of an interface to be tested, wherein the first request information carries the scene name;
the first request information is sent to a server side, so that the server side can call the interface information of the interface to be tested from a database according to the scene name;
receiving the interface information sent by the server;
rendering an interface parameter data input interface according to the interface information;
generating second request information in response to monitoring an interface parameter data input event on the interface parameter data input interface, wherein the second request information carries the interface parameter data;
and sending the second request information to the server side so that the server side tests the interface to be tested according to the interface parameter data and the interface information.
In a second aspect, an embodiment of the present application provides an interface testing method, where the method includes:
receiving first request information sent by a user side, wherein the first request information is generated by the user side in response to the detection of a scene name input event of an interface to be tested, and the first request information carries the scene name;
according to the scene name, the interface information of the interface to be tested is called from a database;
the interface information is sent to the user side, so that the user side renders an interface parameter data input interface according to the interface information;
receiving second request information sent by the user side, wherein the second request information is generated by the user side in response to the detection of an interface parameter data input event on the interface parameter data input interface, and the second request information carries the interface parameter data;
and testing the interface to be tested according to the interface parameter data and the interface information.
In a third aspect, an embodiment of the present application provides an interface test system, including: a user end and a service end; wherein, the liquid crystal display device comprises a liquid crystal display device,
the client comprises: the system comprises a first information generation module, a first information transmission module, an information receiving module, a rendering module, a second information generation module and a second information transmission module;
The first information generation module is used for responding to the monitored scene name input event of the interface to be tested and generating first request information carrying the scene name;
the first information sending module sends the first request information to the server so that the server can call the interface information of the interface to be tested from a database according to the scene name;
the information receiving module receives the interface information sent by the server;
the rendering module renders interface parameter data input interfaces according to the interface information;
the second information generation module is used for responding to the detected interface parameter data input event on the interface parameter data input interface to generate second request information, wherein the second request information carries the interface parameter data;
and the second information sending module sends the second request information to the server side so that the server side tests the interface to be tested according to the interface parameter data and the interface information.
The server side comprises: the system comprises a first information receiving module, an information calling module, an information sending module, a second information receiving module and a testing module;
The first information receiving module is used for receiving first request information sent by the user side, wherein the first request information is generated by the user side in response to the detection of a scene name input event of an interface to be tested, and the first request information carries the scene name;
the information calling module is used for calling the interface information of the interface to be tested from a database according to the scene name;
the information sending module sends the interface information to the user side so that the user side renders interface parameter data according to the interface information to input an interface;
the second information receiving module receives second request information sent by the user terminal, wherein the second request information is generated by the user terminal in response to the detection of an interface parameter data input event on the interface parameter data input interface, and the second request information carries the interface parameter data;
and the test module tests the interface to be tested according to the interface parameter data and the interface information.
In a fourth aspect, an embodiment of the present application provides an interface testing apparatus, including: the system comprises a first request information generating unit, a first request information transmitting unit, an interface information receiving unit, a rendering unit, a second request information generating unit and a second request information transmitting unit;
The first request information generating unit is used for responding to the monitored scene name input event of the interface to be tested to generate first request information, wherein the first request information carries the scene name;
the first request information sending unit is used for sending the first request information to a server side so that the server side can call the interface information of the interface to be tested from a database according to the scene name;
the interface information receiving unit is used for receiving the interface information sent by the server;
the rendering unit is used for rendering interface parameter data input interfaces according to the interface information;
the second request information generating unit is used for responding to the detection of the interface parameter data input event on the interface parameter data input interface to generate second request information, and the second request information carries the interface parameter data;
the second request information sending unit is configured to send the second request information to the server, so that the server tests the interface to be tested according to the interface parameter data and the interface information.
In a fifth aspect, an embodiment of the present application provides an interface testing apparatus, including: the system comprises a first request information receiving unit, an interface information calling unit, an interface information sending unit, a second request information receiving unit and an interface testing unit;
The first request information receiving unit is used for receiving first request information sent by a user terminal, wherein the first request information is generated by the user terminal in response to the detection of a scene name input event of an interface to be tested, and the first request information carries the scene name;
the interface information calling unit is used for calling the interface information of the interface to be tested from a database according to the scene name;
the interface information sending unit is used for sending the interface information to the user side so that the user side renders interface parameter data according to the interface information to input an interface;
the second request information receiving unit is configured to receive second request information sent by the user side, where the second request information is generated by the user side in response to monitoring an interface parameter data input event on the interface parameter data input interface, and the second request information carries the interface parameter data;
and the interface testing unit is used for testing the interface to be tested according to the interface parameter data and the interface information.
In a sixth aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
The memory is used for storing one or more computer instructions;
the processor is configured to execute the one or more computer instructions to implement the method described above.
In a seventh aspect, embodiments of the present application provide a computer readable storage medium having stored thereon one or more computer instructions which, when executed by a processor, perform the above-described method.
Compared with the prior art, the interface testing method provided by the application has the advantages that the user side sends the first request information carrying the scene name of the interface to be tested to the server side, so that the server side can call the corresponding interface information from the database according to the scene name; the interface information is further sent to the user side through the server side, so that the user side renders an interface parameter data input interface according to the interface information; and further sending second request information carrying interface parameter data to a server through the user side, so that the server can test the interface to be tested according to the interface parameter data and the interface information.
The interface testing method has the following advantages:
first, the first request information is generated by the user side in response to the detection of a scene name input event of the interface to be tested, the user side sends the first request information carrying the scene name to the server side, and the server side can call the interface information of the interface to be tested from the database. Therefore, the interface information of the interface to be tested does not need to be manually input, namely, even if a tester lacks an interface document of the interface to be tested, the server can automatically call the interface information of the interface to be tested only by inputting the scene name of the interface to be tested. Therefore, the interface testing method is independent of interface documents and is more flexible.
And secondly, the server side can call the corresponding interface information from the database according to the scene name of the interface to be tested. Because the interface information is automatically called through the server and is not manually input, the situation that the interface information is not matched with the environment configuration can not occur.
Thirdly, after receiving the interface information sent by the server, the user end can render the interface parameter data input interface according to the interface information, and the second request information is generated by the user end in response to the monitoring of the interface parameter data input event on the interface parameter data input interface. Therefore, the tester only needs to input the interface parameter data in the interface parameter data input interface, and does not relate to the input of the interface information. Therefore, the manual testing cost and the error rate are reduced, and the testing efficiency and the accuracy are improved. And the tester only needs to input the interface parameter data in the interface parameter data input interface, so that the tester does not need to have too professional interface test knowledge, and the test threshold and the learning cost are reduced.
In summary, the interface testing method provided by the application solves the technical problems of poor testing flexibility, high cost and high error rate caused by the dependence on the interface document and the manual input of the request information by the tester in the prior art.
Drawings
FIG. 1 is an application system diagram of an interface testing method according to an embodiment of the present application;
FIG. 2 is a flow chart of an interface testing method according to a first embodiment of the present application;
FIG. 3 is a schematic diagram of a scene name input event according to a first embodiment of the present application;
FIG. 4 is a schematic diagram of yet another scene name entry event provided by the first embodiment of the present application;
FIG. 5 is a schematic diagram of an interface parameter data input interface provided by a first embodiment of the present application;
FIG. 6 is a schematic diagram of an interface parameter data input event according to a first embodiment of the present application;
FIG. 7 is a schematic diagram of yet another interface parameter data entry event provided by the first embodiment of the present application;
FIG. 8 is a schematic diagram of test results provided by the first embodiment of the present application;
FIG. 9 is a flowchart of an interface testing method according to a second embodiment of the present application;
FIG. 10 is a schematic diagram of an interface testing system according to a third embodiment of the present application;
FIG. 11 is a flow chart of a CMS based interface testing method provided by a third embodiment of the present application;
fig. 12 is a signaling flow diagram of a CMS-based interface testing method provided by a third embodiment of the application;
FIG. 13 is a schematic structural diagram of an interface testing device according to a fourth embodiment of the present application;
FIG. 14 is a schematic structural diagram of an interface testing device according to a fifth embodiment of the present application;
fig. 15 is a schematic structural diagram of an electronic device according to a sixth embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. The present application may be embodied in many other forms than those herein described, and those skilled in the art will readily appreciate that the present application may be similarly embodied without departing from the spirit or essential characteristics thereof, and therefore the present application is not limited to the specific embodiments disclosed below.
In order to facilitate understanding of the interface testing method according to the embodiment of the present application, the following describes terms related to the embodiment of the present application:
an API interface (Application Programming Interface ), which refers to a number of predefined functions, is intended to provide an application with the ability for a developer to access a set of routines based on certain software or hardware without having to access source code or understand the details of the internal operating mechanisms. An API interface may also be understood as a set of rules and protocols that allow communication between applications such that different applications may interact through the API interface. By using the API interface, a developer enables an application program to be developed by the developer to have a function of accessing another application program, and the developer does not need to know the working principle of the other application program. By using the API interface, the sharing function among different application programs is realized, the development speed of the application programs is improved, and the development period of the application programs is shortened. An API interface typically includes interface documents, call style, parameter descriptions, and the like. And the developer calls an API interface according to the documents to realize the access and the operation of the target application program. Common API interfaces include a network API interface, an operating system API interface, and the like.
API interface test, also called interface test, is a means for detecting API interface function, and is mainly used for testing interface function by simulating application scene of upper layer application or upper layer calling interface of system by means of unit test technology.
Postman, an API interface development tool, can be used to develop, test and document API interfaces. Postman allows users to construct HTTP (hypertext transfer protocol) requests, including GET, POST, PUT, DELETE, etc. request types, and may add request parameters, request headers, authentication information, request bodies, etc. The user can debug, test and verify HTTP requests in Postman and view the response results. Postman may also be used to create API documents, including request and response examples, API endpoints and parameter descriptions, etc., and export them into HTML (Hyper Text Markup Language ), markdown (lightweight markup language), PDF (Portable Document Format ), etc., formats for sharing with.
The CMS system (Content Management System ) is a software application for creating, modifying and publishing digital content. Such a system may assist a user in creating, editing, and managing content without programming knowledge, e.g., creating web pages, articles, pictures, videos, and so forth. The CMS system typically has a background management interface that allows administrators and editors to add, edit, and publish content, and also provides functionality such as user management, rights management, website statistics, search engine optimization, and the like. Common CMS systems include WordPress, joomla, drupal, magento, etc. These CMS systems are widely used in the creation and management of various types of web sites such as personal blogs, enterprise web sites, e-commerce web sites, and the like.
The MySQL database is an open-source relational database management system and has the characteristics of supporting multiple users, multithreading, multiple storage engines and the like, and is a database based on a client/server model. Instead of placing all the data in one large repository, mySQL database keeps the data in different tables, increasing the data reading speed and increasing the flexibility of data storage.
With the development of computer technology, more and more business projects are involved in business applications, and in order to accelerate the development speed of business applications and reduce the development cost of business applications, an API (application program interface) has become an indispensable means in the development of business applications. The service application uses an API interface, and often needs to test the function of the API interface.
Currently, API interface testing is performed by using a Postman application program, and a tester manually inputs request information in the Postman application program according to an interface document of an interface to be tested, and the Postman application program tests the interface to be tested according to the test request information. The method comprises the following specific steps:
First, a tester opens a Postman application program at a user end, and creates a new test request of an API interface to be tested. The tester may select the request type, such as GET, POST, PUT or DELETE, and add the necessary information in the request header.
Second, the tester inputs the end points of the API interface (e.g., https:// API. Sample. Com/users) within the test request page according to the URL (Universal Resource Locator, uniform resource locator) in the interface document of the API interface. If the request requires a request parameter or a request body, the tester adds relevant information in the corresponding part.
Third, if the request requires authentication information, the tester adds related information in the request header or request parameters.
Fourth, the tester clicks the send button to send the complete request information to the server, and the server tests the API to be tested.
Fifth, the server sends the response result to the user, and the tester can check the response result of the request in Postman, including the status code, the response header and the response body. If the request fails, the tester may look at the error message in the response result and adjust and retry the request based on the error message. If the request is successful, the tester may perform more tests and debugging as needed, for example: specific information is looked up in the response body, the request is saved as a collection for future use, etc.
Sixth, if the tester needs to create an interface document, the "generate document" function of Postman can be used to automatically generate the interface document and export it into a format of HTML, markdown, PDF, etc., and the tester can view information of API endpoints, request parameters, response examples, etc. in the interface document.
As can be seen from the above procedure, testing an API interface using a Postman application has the following problems:
first, completely depending on the interface document, if the tester lacks the interface document, the tester cannot fill in the request page with the request information such as the API endpoint, the request parameter, the request body, the authentication information, etc., and the test cannot be performed. Therefore, this method has a problem of depending on interface documents, and lacks flexibility.
Secondly, the input of the request information relies on manual input by the tester, which undoubtedly increases the labor cost and error rate of the test, and the API interface test using the Postman application is not a fully automated test since all the request information passes through the manual input. Therefore, the method has the problems of high labor cost, high error rate and incapability of realizing complete automation.
Third, when using the Postman application to test an API interface, a tester is required to fill in various kinds of request information, and it takes some time for a beginner without interface development and test experience to learn basic concepts such as request header, request body, and the like. Therefore, the method has the problems of high admission threshold and high learning cost.
In addition, due to the nature of the Postman application, there are other problems when testing API interfaces using the Postman application, such as: the test can be performed only for the API endpoint, the real user behavior cannot be simulated, the performance and scalability of the API interface cannot be tested, and the following are: incorrect environmental configuration or mismatch with interface documents may occur, resulting in inaccurate or non-viable test results, etc.
In view of the above, the present application provides an interface testing method, which sends first request information carrying a scene name of an interface to be tested to a server through a user side, so that the server can call corresponding interface information from a database according to the scene name; the interface information is further sent to the user side through the server side, so that the user side renders an interface parameter data input interface according to the interface information; and further sending second request information carrying interface parameter data to a server through the user side, so that the server can test the interface to be tested according to the interface parameter data and the interface information. The method is more flexible without depending on interface documents, does not have the condition that interface information is not matched with environment configuration, does not need a tester to have too professional interface test knowledge, and reduces test threshold and learning cost.
The interface testing method, system, device, electronic apparatus and computer readable storage medium according to the present application are described in further detail below with reference to the specific embodiments and the accompanying drawings.
Fig. 1 is an application system diagram of an interface testing method according to an embodiment of the present application. As shown in fig. 1, the system includes a user terminal 110 and a server terminal 120. The client 110 and the server 120 are different nodes of the application system, and may be any device such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant (Personal Digital Assistant, PDA), etc., and the client 110 and the server 120 are in communication connection. The interface testing method provided by the embodiment of the application is realized through information interaction between the user terminal 110 and the server terminal 120.
The first embodiment of the application provides an interface testing method which is applied to a user side in an interface testing system.
Fig. 2 is a flowchart of an interface testing method provided in the present embodiment. The interface testing method provided in this embodiment is described in detail below with reference to fig. 2. The examples referred to in the following description are for explaining the technical solution of the present application and are not intended to be limiting in practical use.
As shown in fig. 2, the interface testing method provided in this embodiment includes the following steps S210 to S260:
step S210, in response to monitoring a scene name input event of an interface to be tested, generating first request information, wherein the first request information carries the scene name.
The scene can be understood as an application scene of the API interface, and the scene name is the name of the application scene of the API interface, so that each API interface is distinguished by the application scene, and a developer can quickly find a corresponding API interface according to a service item to be realized in the process of developing service application. Such as: when the scene name of the API interface for providing the map is defined as a map calling scene, when a developer needs to call the API interface capable of providing the map in a plate for presenting the map in developing the public travel service application, the API interface can be quickly found through the scene name of the map calling scene. For another example: when the scene name of the API interface for online payment is defined as an online payment calling scene, and when a developer needs to call the API interface capable of providing online payment in a payment plate during developing online shopping service application, the API interface can be quickly found through the scene name of the online payment calling scene. For another example: when the scene name of the API interface for recommending the commodity is defined as a commodity recommending and calling scene, and when a developer needs to call the API interface capable of providing commodity recommendation in a plate for presenting the commodity in the process of developing the online shopping service application, the API interface can be quickly found through the scene name of the commodity recommending and calling scene.
Each API interface has a corresponding scene name, and when a tester needs to test the interface to be tested, the interface to be tested can be quickly positioned by inputting the scene name corresponding to the interface to be tested.
In an optional implementation manner, the scene name input event of the interface to be tested may be understood as an input operation of inputting a scene name on an interface test page provided by a user side by a tester, and may also be understood as a combined operation including the above input operation and a confirmation operation of confirming that the scene name is input correctly.
Fig. 3 is a schematic diagram of a scene name input event according to the present embodiment.
As shown in fig. 3, the interface test page 300 provided by the user side has a scene name input box 310 and a "confirm" button 320. The tester inputs the scene name of the commodity recommendation call scene in the scene name input box 310 on the interface test page 300, and clicks the confirm button 320, that is, an input event of the scene name is formed.
After the user side monitors the scene name input event, first request information is generated, and the first request information can be understood as an information acquisition request carrying the scene name.
In an optional implementation manner provided in this embodiment, before executing the foregoing steps, the method further includes creating an interface information table, which may specifically include the following steps S201 to S203:
step S201, an initial interface information table is established.
The initial interface information table may be understood as a table created by an interface manager and only specifying the content to be input in the table, that is, an empty table containing a header, and the function of the table is to define the content and format of the API interface information to be input later. Typically, the header in the initial interface information table includes a scene name, a request address, a request template, and the like.
In a specific implementation, the field structure of the initial interface information table is as follows:
an initial interface information table as shown in table 1 may be formed:
table 1 initial interface information table
Step S202, a scene name and interface information corresponding to a plurality of standby interfaces are input into the initial interface information table to form an interface information table, and each row in the interface information table records the scene name and the interface information corresponding to one standby interface.
After the initial interface information table is established, the interface manager or the information inputter can correspondingly input the related information of the API interface into the initial interface information table according to the specified content and format in the initial interface information table to form the interface information table. If the initial interface information table comprises an interface code, a scene name, a request address and a request template, the code, the scene name, the request address and the request template of the standby interface are required to be correspondingly input to the corresponding positions in the initial interface information table.
In general, a developer of a service application will typically have usage rights for a plurality of API interfaces, and in this embodiment, the API interface for which the developer has usage rights is defined as a standby interface. In a specific implementation manner, an interface manager or an information inputter can input relevant information of the standby interface into an initial interface information table through an information configuration page provided by a user side, and perform periodic update to continuously input relevant information of the newly-introduced standby interface into the interface information table.
In general, the related information of the API interface in the initial interface information table includes at least a scene name of the API interface and interface information of the API interface, where the interface information includes a request address and a request template. After information is entered, relevant information of one API interface corresponds to one row in an interface information table.
Taking an API interface for providing a map, an API interface for providing online payment, and an API interface for providing commodity recommendation as examples, the related information of the three standby interfaces is entered into an initial interface information table to form an interface information table as shown in table 2.
Table 2 interface information table
The request address refers to an interface address of an API interface, and the interface call is generally implemented by using the HTTP protocol. The request template refers to a field for specifying interface parameter information of an API interface and its characteristic attribute, and the interface parameter information may be understood as a name of an interface parameter, such as: the recommended number, role ID, channel, etc., and the characteristic attributes define the type of interface parameters, whether filling is necessary, etc. The different API interfaces typically have their corresponding request templates, such as: interface parameters such as a departure position, a target position and the like are required to be included in a request template of an API interface for providing the map; interface parameters such as payment amount, merchant name and the like are required to be included in a request template of an API interface for providing online payment; interface parameters such as recommended user numbers, recommended quantity and the like are required to be included in a request template of an API interface for providing commodity recommendation.
Step S203, the interface information table is sent to the server, so that the server stores the interface information table in the database.
In general, related information of an API interface is configured by an interface manager or an information inputter through information configuration pages provided by a user side to input an interface information table, and after the interface information table is created, the user side sends the information table to a server side, and the server side further stores the information table in a database. In one particular implementation, the database may be a MySQL database.
All standby interfaces with use rights of a developer are recorded in an interface information table, and the interface to be tested is any one of the plurality of standby interfaces.
In an optional implementation manner, the scenario name input event of the interface to be tested may be further understood as selecting a scenario name corresponding to the interface to be tested from a plurality of scenario names corresponding to the plurality of standby interfaces.
Fig. 4 is a schematic diagram of yet another scene name input event provided in the present embodiment.
As shown in fig. 4, the interface test page 400 provided by the user has a scene name input box 410 and a "confirm" button 420. The scene name input box 410 includes a menu identifier 411, when the tester clicks the menu identifier 411 in the scene name input box 410 on the interface test page 400, a drop-down menu 412 appears, and the drop-down menu 412 displays the scene names corresponding to all the standby interfaces recorded in the interface information table, for example: "map call scene", "online payment call scene", "commodity recommendation call scene", etc. When the tester clicks on a scene name, for example, clicks on "commodity recommendation call scene", and clicks on "confirm" button 420, an input event of a scene name is formed.
In the implementation mode, manual input of the scene name of the API by a tester is avoided, so that not only is the input efficiency of the scene name improved, but also the false input of the scene name is avoided.
Step S220, the first request information is sent to a server, so that the server invokes the interface information of the interface to be tested from a database according to the scene name.
The first request information is generated by the user side in response to the detection of a scene name input event of an interface to be tested on an interface test page provided by the user side, and is an interface information acquisition request carrying a scene name.
Specifically, the user side sends the first request information to the server side, and the server side starts the operation of calling the interface information of the interface to be tested from the database according to the scene name carried in the first request information.
In an alternative implementation, the interface information and the scene name of the interface to be tested are stored in an interface information table as shown in table 2, one row in the interface information table records the scene name and the interface information of a standby interface, and the interface information table is stored in a database, so that the server side retrieves the interface information from the database, and in fact, the server side retrieves the interface information recorded in the same row as the scene name from the interface information table.
Taking the interface information table shown in table 2 as an example, if the tester inputs the scene name of the "map call scene" on the interface test page provided by the user side, the user side sends an interface information acquisition request including the "map call scene" to the server side, and the server side immediately starts the call of the interface information, specifically: the interface information recorded in a row with the map call scene is called from an interface information table shown in table 2 according to the scene name of the map call scene, and the interface information comprises a request address < https:// api. Sample. Com/map/users > and a request template < request_template_1>.
Because the interface information is called from the database by the server according to the scene name of the interface to be tested and is not manually input, the situation that the interface information is not matched with the environment configuration can not occur.
Step S230, receiving the interface information sent by the server.
The server side invokes interface information of the interface to be tested from the database according to the scene name of the interface to be tested, and then sends the interface information to the user side.
In an alternative implementation, the interface information includes at least an interface address of the interface to be tested and a request template.
The interface address refers to a call address of an API interface, and other service applications can call the service application corresponding to the API interface through the interface address, and the interface call is generally realized by using an HTTP protocol. Such as: and the interface address of the API interface for providing the map is https:// API. Sample. Com/map/users, so that a developer can only realize the call of the map service application corresponding to the API interface when writing the interface address in the pre-developed public travel service application.
The request template refers to a field for specifying interface parameter information and characteristic attributes of an API interface, wherein the request template comprises a name, an input prompt, an input type and an input requirement of at least one interface parameter corresponding to the interface to be tested. That is, an API interface may include a plurality of interface parameters that collectively define the API interface, and the names, input prompts, input types, and input requirements corresponding to all of the interface parameters are written together, that is, the request template that constitutes the API interface. The request template only comprises parameter information of the interface parameters and does not comprise specific parameter data of the interface parameters. Such as: for the API interface of the commodity recommendation calling scene, the request template comprises parameter information of interface parameters of the recommendation quantity: name < recommended number >, input hint < default is 6>, input type < int >, input requirement < unnecessary fill >, but parameter data <2> that does not include "recommended number" interface parameters.
Taking an API interface of "commodity recommendation call scenario" as an example, in a specific implementation manner, a json format is used to specify a request template of the API interface, and a field structure is as follows:
from the above, it can be seen that: the API interface of the commodity recommendation calling scene comprises three interface parameters, namely: num, roleId, channel, the request template is edited with parameter information corresponding to the three interface parameters, which includes: name, "input prompt" tips, "input type" type, "and input requirement" required, "wherein the input requirement mainly specifies whether the parameter data corresponding to the interface parameter is necessary to be filled.
In an optional implementation manner, after the server side invokes interface information of the interface to be tested from the database according to the scene name of the interface to be tested, a request template in the interface information is sent to the user side, so that the user side receives the request template sent by the server side.
And step S240, rendering an interface parameter data input interface according to the interface information.
After receiving the interface information sent by the server, the user side can render an interface parameter data input interface, wherein the interface parameter data input interface is an interface rendered by the user side according to the parameter information of the interface parameters in the request template through a JS (JavaScript programming language) front-end technology and the like, and comprises a plurality of interface parameter data input boxes. Specifically, the number of the interface parameter data input boxes in the interface parameter data input interface is the same as the number of the interface parameters in the request template. The interface parameter data input interface is usually presented on an interface test page provided by a user terminal in the form of a bullet frame, and a tester can input parameter data corresponding to the interface parameters in the interface parameter data input frame on the interface parameter data input interface.
In an alternative implementation, according to the input type of each interface parameter included in the request template, an interface parameter data input box of a corresponding type may be rendered in the interface parameter data input interface, such as: drop down boxes, single boxes, multiple boxes, text entry boxes, and the like.
The following description will take an API interface of "commodity recommendation call scenario" as an example:
fig. 5 is a schematic diagram of an interface parameter data input interface provided in this embodiment.
As shown in fig. 5, the user side renders an interface parameter data input interface 510 of the interface in the interface test page 500 according to a request template of the API interface sent by the server side, where the interface parameter data input interface includes a scene name prompt box 511 (an interface corresponding to the API interface for prompting the tester that the interface parameter data input interface is a "commodity recommendation call scene"), an interface parameter data input box 512 corresponding to the "recommended number" interface parameter, an interface parameter data input box 513 corresponding to the "role id" interface parameter, and an interface parameter data input box 514 corresponding to the "channel" interface parameter. According to different types of interface parameters, the types of rendered interface parameter data input boxes are also different, for example: the interface parameter data input box 512 may be a drop down box, the interface parameter data input box 513 may be a text input box, the interface parameter data input box 514 may be a single selection box, etc. In addition, the interface parameter data input interface 510 includes a confirm button 515 for indicating that the interface parameter data is correctly input, and a reset button 516 for indicating that the interface parameter data is incorrectly input and needs to be re-input.
According to the method, the interface parameter data input interface comprising the interface parameter data input boxes of different types is dynamically generated according to the interface information, so that a user can more conveniently input and verify parameter data, the possibility of inputting error parameter data by a tester is reduced, and the accuracy of automatic test is improved.
Step S250, in response to detecting the interface parameter data input event on the interface parameter data input interface, generating second request information, where the second request information carries the interface parameter data.
The interface parameter data input event can be understood as an operation that a tester inputs parameter data corresponding to an interface parameter in an interface parameter data interface, and a confirmation operation that the parameter data is correctly input after the parameter data input operation is completed.
Fig. 6 is a schematic diagram of an interface parameter data input event according to the present embodiment.
As shown in fig. 6, the interface test page 600 provided by the user side includes an interface parameter data input interface 610, which includes a scene name prompt box 611 (an interface corresponding to an API interface for prompting a tester that the interface parameter data input interface is a "commodity recommendation call scene"), an interface parameter data input box 612 corresponding to an "recommended number" of interface parameters, an interface parameter data input box 613 corresponding to a "role id" interface parameter, an interface parameter data input box 614 corresponding to a "channel" interface parameter, a confirm button 615, and a reset button 616. The tester inputs interface parameter data <2> corresponding to the interface parameter of the recommended number in the interface parameter data input box 612 on the interface parameter data input interface 610, inputs interface parameter data < abc > corresponding to the interface parameter of the character id in the interface parameter data input box 613, inputs interface parameter data < XIAOMI > corresponding to the interface parameter of the channel in the interface parameter data input box 614, and clicks the confirm button 615, thus forming an interface parameter data input event.
When a tester inputs interface parameter data on an interface parameter data input interface, the tester needs to input the interface parameter data of a corresponding type according to the type of each interface parameter data input box. If the data of a certain interface parameter input by the tester does not accord with the input type of the interface parameter defined in the request template, the data type input error of the tester can be directly prompted after the data of the interface parameter is input (for example, prompt information of data type error is displayed after the data input box of the interface parameter), or the data type input error of the tester can be prompted after the tester finishes inputting the data of all the interface parameters and clicks the confirm button (for example, the data type input error of the interface parameter is displayed in the bullet box in a bullet box form to prompt the tester to modify the error data of the interface parameter), and the specific implementation form is not repeated here.
After the user side monitors the interface parameter data input event, second request information is generated, and the second request information can be understood as a test request carrying the interface parameter data.
Step S260, sending the second request information to the server, so that the server tests the interface to be tested according to the interface parameter data and the interface information.
The second request information carries interface parameter data, the user side sends the second request information to the server side, and the server side obtains the interface parameter data of the interface to be tested. In step S220, the server side has called the interface information of the interface to be tested from the database according to the scene name of the interface to be tested, where the interface information includes the interface address of the interface to be tested and the interface parameter information of the interface to be tested. Therefore, after the server receives the second request information sent by the user terminal, the server terminal obtains the interface address, the interface parameter information and the interface parameter data of the interface to be tested at the same time.
The server end combines the interface address, the interface parameter information and the interface parameter data of the interface to be tested to test the interface to be tested. Specifically, the server side generates a test script according to the interface address, the interface parameter information and the interface parameter data of the interface to be tested, and tests the interface to be tested according to the test script.
In an optional implementation manner provided in this embodiment, the interface parameter includes a concurrency parameter. The concurrency parameters are parameters for limiting the number of requests which can be processed by the API interface at the same time, and the concurrency parameters are added in the request template, namely, the parameters are equivalent to simulating the real user behaviors of a plurality of users for simultaneously accessing the API interface, so that the performance and the scalability of the API interface can be tested. The performance refers to the capability of the API interface to process high concurrency, and the scalability refers to the capability of the API interface to automatically perform capacity expansion or capacity contraction operation according to the load degree of the service project.
And the request template of the interface to be tested comprises the concurrency parameters, and then the concurrency parameter data input frame corresponding to the concurrency parameters can be rendered in the interface parameter data input interface. And the tester inputs concurrent parameter data in the concurrent parameter data input box, and the second request information carries the concurrent parameter data. And the server side can perform concurrent test on the interface to be tested according to the concurrent parameter data, wherein the concurrent quantity of the concurrent test is related to the concurrent parameter data.
Typically concurrency parameters may include the number of threads, which may be understood as the number of users, and the number of loops, which may be understood as the number of repetitions per thread. The number of concurrent tests is related to the number of threads and the number of cycles, and in one specific implementation, if the number of threads is 100, the number of cycles is 2, i.e., the number of concurrent tests is 200.
The following description will take an API interface of "commodity recommendation call scenario" as an example:
fig. 7 is a schematic diagram of yet another interface parameter data input event provided in this embodiment.
As shown in fig. 7, the request template includes parameter information of the "server id" interface parameter, parameter information of the "role id" interface parameter, parameter information of the "thread number" interface parameter, and parameter information of the "cycle number" interface parameter. The server sends the request template of the API interface to the client, and the client renders the interface parameter data input interface 710 on the interface test page 700 according to the request template. The scene name prompt box 711 (an interface corresponding to an API interface for prompting a tester that the interface parameter data input interface is a "commodity recommendation call scene"), an interface parameter data input box 712 corresponding to a "server id" interface parameter, an interface parameter data input box 713 corresponding to a "role id" interface parameter, an interface parameter data input box 714 corresponding to a "thread number" interface parameter, an interface parameter data input box 715 corresponding to a "cycle number" interface parameter, a confirm button 716 for indicating that the interface parameter data is correctly input, and a reset button 717 for indicating that the interface parameter data is incorrectly input and needs to be re-input.
The tester inputs interface parameter data < xyz > corresponding to the "server id" interface parameter in the interface parameter data input box 712, inputs interface parameter data < abc > corresponding to the "character id" interface parameter in the interface parameter data input box 713, inputs interface parameter data <100> corresponding to the "thread number" interface parameter in the interface parameter data input box 714, inputs interface parameter data <2> corresponding to the "cycle number" interface parameter in the interface parameter data input box 715, clicks the confirm button 716, and the user side generates test request information carrying the interface parameter data and sends the test request information to the server side. The server side can carry out 100 concurrent tests on the API interface at the same time according to the interface parameter data <100> corresponding to the interface parameter of the thread number and the interface parameter data <2> corresponding to the interface parameter of the circulation number, and repeat the concurrent tests twice.
Through the concurrent test on the API interface, the performance and the scalability of the API interface can be effectively judged, and in the prior art, the postman cannot complete the concurrent test, simulate the condition that a plurality of users access the API at the same time, and test the performance and the scalability of the API interface. Therefore, the method provided by the embodiment also solves the problem that concurrent testing cannot be performed in the prior art.
The steps S210 to S260 provide an automated interface testing method, and in an alternative implementation, the method may further include the steps of:
step S270, in response to receiving the result information sent by the server, rendering the test result according to the result information.
After the server tests the interface to be tested, the server automatically acquires the test result, the server can send result information corresponding to the test result to the user, and the user can render the test result according to the result information.
In an alternative implementation, the test result rendered by the user side may be presented below the interface parameter data input interface, prompting the tester that the test result is obtained based on the interface parameter data.
The rendering test results are illustrated on the basis of the interface parameter data input interface shown in fig. 6:
fig. 8 is a schematic diagram of the test result provided in the present embodiment.
As shown in fig. 8, a tester inputs interface parameter data <2> corresponding to "recommended number" of interface parameters, interface parameter data < abc > corresponding to "role id" of interface parameters, and interface parameter data < XIAOMI > corresponding to "channel" of interface parameters respectively on an interface parameter data input interface 810, a server tests an API interface of "commodity recommendation call scene" according to the above interface parameter data, the server sends result information of the test result to a user, the user renders the test result according to the result information, and the test result is displayed below the interface parameter data input interface 810 in the form of a test result interface 820. The test results interface 820 includes a first recommendation 821 and a second recommendation 822.
Of course, the server may also automatically analyze the information such as the interface performance, response time, error rate, etc. of the interface to be tested according to the obtained test result, and send the analyzed result information to the user terminal, and the user terminal renders the test result including the analysis result according to the result information.
The first embodiment provides an optional interface testing method, and it should be noted that, the examples in the first embodiment are only for explaining the method of the present application, and are not limited to practical use, and the interface testing method provided by the present application includes, but is not limited to, the method described in the first embodiment.
The second embodiment of the application provides an interface testing method which is applied to a server side in an interface testing system.
Fig. 9 is a flowchart of an interface testing method provided in the present embodiment. The interface testing method provided in this embodiment is described in detail below with reference to fig. 9. The examples referred to in the following description are for explaining the technical solution of the present application and are not intended to be limiting in practical use.
As shown in fig. 9, the interface testing method provided in this embodiment includes the following steps S910 to S950:
step S910, receiving first request information sent by a user terminal, where the first request information is generated by the user terminal in response to monitoring a scene name input event of an interface to be tested, and the first request information carries the scene name.
After the user side responds to the event of monitoring the scene name input of the tester on the interface test page, the first request information carrying the scene name can be generated, the first request information is sent to the server side, and the server side can receive the first request information.
The details of the first embodiment of the present application will be described in detail herein, and will not be described in detail herein.
Step S920, according to the scene name, the interface information of the interface to be tested is called from a database.
After the user terminal sends the first request information to the server terminal, the server terminal can start the operation of calling the interface information of the interface to be tested from the database according to the scene name carried in the first request information. Specifically, the server side retrieves interface information recorded in the same line as the scene name from an interface information table stored in the database.
The details of the first embodiment of the present application will be described in detail herein, and will not be described in detail herein.
Step S930, sending the interface information to the user side, so that the user side renders an interface parameter data input interface according to the interface information.
The server side invokes interface information of the interface to be tested from the database according to the scene name of the interface to be tested, and then sends the interface information to the user side. After receiving the interface information, the user side renders an interface parameter data input interface on an interface test page according to the interface information through a JS front-end technology and the like.
Specifically, the interface parameter data input interface is rendered according to a request template in the interface information, the name, the input prompt, the input type, the input requirement and the like of at least one interface parameter corresponding to the interface to be tested are edited in the request template, and the user side can dynamically render different types of interface parameter data input frames in the interface parameter data input interface according to the input types of different interface parameters. The tester does not need to manually input interface parameter information, and can more conveniently input and verify interface parameter data. Reducing the manual input content of the tester reduces the possibility of input errors of the tester, thereby improving the accuracy of the automated test.
The details of the first embodiment of the present application will be described in detail herein, and will not be described in detail herein.
Step S940, receiving second request information sent by the ue, where the second request information is generated by the ue in response to monitoring an interface parameter data input event on the interface parameter data input interface, and the second request information carries the interface parameter data.
The user side responds to the detection of the interface parameter data input event of the tester on the interface parameter data input interface, and then generates second request information carrying the interface parameter data, and sends the second request information to the server side, and the server side can receive the second request information.
The details of the first embodiment of the present application will be described in detail herein, and will not be described in detail herein.
Step S950, testing the interface to be tested according to the interface parameter data and the interface information.
The second request information carries interface parameter data, the user side sends the second request information to the server side, and the server side obtains the interface parameter data on the basis of having interface information such as interface address, interface parameter information and the like corresponding to the interface to be tested. The server tests the interface to be tested according to the interface parameter data, the interface parameter information, the interface address and the like of the interface to be tested.
In an alternative implementation manner, the server side testing the interface to be tested according to the interface parameter data and the interface information may include the following steps S951 to S952:
and step S951, generating a test script according to the interface parameter data and the interface information.
The test script (Testing script) may refer to a series of instructions for a particular test that may be executed by an automated test tool.
In the method provided by the embodiment, the server side can automatically generate the test instruction aiming at the interface to be tested according to the interface address, the interface parameter information and the interface parameter data of the interface to be tested.
Step S952, testing the interface to be tested according to the test script.
And the server runs the test instruction in the test script and automatically tests the interface to be tested.
The details of the first embodiment of the present application will be described in detail herein, and will not be described in detail herein.
The steps S910 to S950 provide an automated interface testing method, and in an alternative implementation, the method may further include the following steps:
step S960, obtaining result information.
The result information may be information directly obtained after the server tests the interface to be tested, or may be information including an analysis result obtained after the server analyzes and processes the directly obtained information.
In an alternative implementation manner, the result information is information including analysis results, and the method for obtaining the result information includes the following steps S961 to S962:
step S961, obtaining original result information, where the original result information is test data generated after the interface to be tested is tested.
Step S962, analyzing the original result information to form the result information.
Analyzing the original result information comprises analyzing the performance of the interface to be tested, analyzing the response time of the interface to be tested, analyzing the calling error rate of the result to be tested and the like.
Step S970, sending the result information to the ue, so that the ue renders a test result according to the result information.
In an alternative implementation, the test result rendered by the user side may be presented below the interface parameter data input interface, prompting the tester that the test result is obtained based on the interface parameter data.
The second embodiment provides an optional interface testing method, and it should be noted that, the examples in the second embodiment are only for explaining the method of the present application, and are not limited to practical use, and the interface testing method provided by the present application includes, but is not limited to, the method of the second embodiment.
A third embodiment of the present application provides an interface testing system, and fig. 10 is a schematic structural diagram of the interface testing system provided in this embodiment.
As shown in fig. 10, the interface test system provided in this embodiment includes: a client 1010 and a server 1020; wherein, the liquid crystal display device comprises a liquid crystal display device,
the client 1010 includes: a first information generating module 1011, a first information transmitting module 1012, an information receiving module 1013, a rendering module 1014, a second information generating module 1015, and a second information transmitting module 1016;
the first information generating module 1011 generates first request information in response to monitoring a scene name input event of an interface to be tested, where the first request information carries the scene name;
the first information sending module 1012 sends the first request information to the server, so that the server invokes the interface information of the interface to be tested from the database according to the scene name;
The information receiving module 1013 receives the interface information sent by the server;
the rendering module 1014 renders an interface parameter data input interface according to the interface information;
the second information generating module 1015 generates second request information in response to monitoring the interface parameter data input event on the interface parameter data input interface, where the second request information carries the interface parameter data;
the second information sending module 1016 sends the second request information to the server, so that the server tests the interface to be tested according to the interface parameter data and the interface information.
The server 1020 includes: a first information receiving module 1021, an information retrieving module 1022, an information transmitting module 1023, a second information receiving module 1024, and a testing module 1025;
the first information receiving module 1021 receives first request information sent by the user terminal, where the first request information is generated by the user terminal in response to monitoring a scene name input event of an interface to be tested, and the first request information carries the scene name;
the information retrieving module 1022 retrieves interface information of the interface to be tested from a database according to the scene name;
The information sending module 1023 sends the interface information to the user side, so that the user side renders an interface parameter data input interface according to the interface information;
the second information receiving module 1024 receives second request information sent by the user terminal, where the second request information is generated by the user terminal in response to monitoring an interface parameter data input event on the interface parameter data input interface, and the second request information carries the interface parameter data;
the test module 1025 tests the interface to be tested according to the interface parameter data and the interface information.
In an optional implementation manner provided in this embodiment, the interface test system is a content management system.
The content management system (Content Management System, CMS) is a software application for creating, modifying and publishing digital content. The system has the functions of reading database configuration, dynamically rendering interface parameter information, automatically testing and simulating a real user in the aspect of interface testing. The system comprises a CMS front end and a CMS back end, wherein the CMS front end is a user end, a tester can execute operations such as inputting scene names, inputting interface parameter data and the like on the CMS front end, the CMS back end is a service end, and the testing of an interface to be tested is executed through information interaction with the CMS front end.
The following describes the testing flow and information interaction process of the interface testing method based on the CMS respectively:
fig. 11 is a flowchart of a CMS-based interface testing method according to the present embodiment.
As shown in fig. 11, the CMS-based interface testing method involves a CMS front end, a CMS back end, a database, and a third party service four nodes. The specific method comprises the following steps:
step 1101, an interface manager or an information inputter enters a configuration page through the front end of the CMS, and inputs related information of the standby interface into an original interface information table to form an interface information table.
In step S1102, the CMS front end sends the interface information table to the CMS back end, and the CMS back end operates the database to store the interface information table in the database.
In step S1103, the tester enters the test page through the front end of the CMS, and inputs or selects a test scenario corresponding to the interface to be tested in the test page.
In step S1104, the CMS front end sends an interface information acquisition request including the test scenario to the CMS back end, so that the CMS back end operates the database, and invokes interface information corresponding to the interface to be tested from the database.
In step S1105, the database returns the interface information to the CMS backend.
In step S1106, the CMS back end sends the interface information to the CMS front end, and the CMS front end renders the interface parameter data input interface according to the interface information.
In step S1107, the tester inputs the interface parameter data on the interface parameter data input interface through the CMS front end.
In step S1108, the CMS front end sends a test request including the interface parameter data to the CMS back end, so that the CMS back end sends a request for calling the interface to be tested to the third party service.
In step S1109, the third party service transmits the response data of the interface to be tested to the CMS backend.
In step S1110, the CMS backend generates test data based on the response data, and sends the test data to the CMS front end.
Step S1111, the CMS front end renders the test result according to the test data.
Fig. 12 is a signaling flow chart of the CMS-based interface testing method provided in this embodiment.
As shown in fig. 12, the CMS-based interface testing method provided in this embodiment includes the following steps:
in step S1201, the CMS front end generates the first request information carrying the scene name of the interface to be tested in response to the input event of the scene name of the interface to be tested by the tester on the test page.
In step S1202, the CMS front end sends the first request information to the CMS back end.
In step S1203, the CMS back end retrieves, from the database, the interface information corresponding to the interface to be tested according to the scene name in response to receiving the first request information.
In step S1204, the CMS backend sends the interface information to the CMS front end.
In step S1205, the CMS front end renders an interface parameter data input interface on the test page according to the interface information in response to receiving the interface information.
In step S1206, the CMS front end generates the second request information carrying the interface parameter data in response to the input event of the interface parameter data by the tester on the interface parameter data input interface.
In step S1207, the CMS front end sends the second request information to the CMS back end.
In step S1208, the CMS back end tests the interface to be tested according to the interface information and the interface parameter data in response to receiving the second request information.
In step S1209, the CMS back end sends the result information corresponding to the obtained test result to the CMS front end.
In step S1210, the CMS front end renders the test result on the test page according to the result information in response to receiving the result information.
The fourth embodiment of the application provides an interface testing device, which is applied to a user side. Fig. 13 is a schematic structural diagram of an interface testing device according to the present embodiment.
As shown in fig. 13, the interface testing device provided in this embodiment includes: the first request information generating unit 1310, the first request information transmitting unit 1320, the interface information receiving unit 1330, the rendering unit 1340, the second request information generating unit 1350, and the second request information transmitting unit 1360.
The first request information generating unit 1310 is configured to generate first request information in response to monitoring a scene name input event of an interface to be tested, where the first request information carries the scene name.
Optionally, before the step of generating the first request information in response to monitoring the scene name input event of the interface to be tested, the method is further configured to:
establishing an initial interface information table;
recording scene names and interface information corresponding to a plurality of standby interfaces into the initial interface information table to form an interface information table, wherein each row in the interface information table records the scene name and the interface information corresponding to one standby interface;
and sending the interface information table to the server so that the server stores the interface information table in the database.
Optionally, the interface to be tested is any interface in the plurality of standby interfaces, and the scene name input event of the interface to be tested includes:
and selecting the scene name corresponding to the interface to be tested from a plurality of scene names corresponding to the plurality of standby interfaces.
The first request information sending unit 1320 is configured to send the first request information to a server, so that the server invokes interface information of the interface to be tested from a database according to the scene name.
Optionally, the server side invokes interface information of the interface to be tested from a database according to the scene name, including:
and the server side invokes the interface information recorded in the same row with the scene name from the interface information table.
The interface information receiving unit 1330 is configured to receive the interface information sent by the server.
The rendering unit 1340 is configured to render an interface parameter data input interface according to the interface information.
The second request information generating unit 1350 is configured to generate second request information in response to monitoring an interface parameter data input event on the interface parameter data input interface, where the second request information carries the interface parameter data.
Optionally, the interface information at least includes an interface address of the interface to be tested and a request template; the request template comprises a name, an input prompt, an input type and an input requirement of at least one interface parameter corresponding to the interface to be tested;
the receiving the interface information sent by the server side includes:
receiving the request template sent by the server;
The rendering interface parameter data input interface according to the interface information comprises:
rendering interface parameter data input boxes of corresponding types in the interface parameter data input interface according to the input type of each interface parameter included in the request template, wherein the number of the interface parameter data input boxes in the interface parameter data input interface is the same as the number of the interface parameters in the request template;
the interface parameter data input event on the interface parameter data input interface comprises:
and inputting the corresponding type of the interface parameter data according to the type of each interface parameter data input box on the interface parameter data input interface.
Optionally, the interface parameter includes a concurrency parameter;
rendering an interface parameter data input box of a corresponding type in the interface parameter data input interface according to the input type of each interface parameter included in the request template, including:
rendering a concurrent parameter data input box corresponding to the concurrent parameter in the interface parameter data input interface;
the inputting the interface parameter data of the corresponding type according to the type of each data input box on the interface parameter data input interface comprises the following steps:
And inputting the concurrent parameter data in the concurrent parameter data input box.
The second request information sending unit 1360 is configured to send the second request information to the server, so that the server tests the interface to be tested according to the interface parameter data and the interface information.
Optionally, the second request information carries the concurrency parameter data;
the server tests the interface to be tested according to the interface parameter data and the interface information, and the method comprises the following steps:
and the server side performs concurrent testing on the interface to be tested according to the concurrent parameter data, wherein the concurrent number of the concurrent testing is related to the concurrent parameter data.
Optionally, the apparatus further comprises a result rendering unit for:
and responding to the received result information sent by the server, and rendering a test result according to the result information.
The fifth embodiment of the application provides an interface testing device, which is applied to a server. Fig. 14 is a schematic structural diagram of an interface testing device according to the present embodiment.
As shown in fig. 14, the interface testing device provided in this embodiment includes: a first request information receiving unit 1410, an interface information retrieving unit 1420, an interface information transmitting unit 1430, a second request information receiving unit 1440, and an interface testing unit 1450.
The first request information receiving unit 1410 is configured to receive first request information sent by a user side, where the first request information is generated by the user side in response to monitoring a scene name input event of an interface to be tested, and the first request information carries the scene name.
The interface information retrieving unit 1420 is configured to retrieve, from a database, the interface information of the interface to be tested according to the scene name.
The interface information sending unit 1430 is configured to send the interface information to the user side, so that the user side renders interface parameter data according to the interface information and inputs the interface.
The second request information receiving unit 1440 is configured to receive second request information sent by the user side, where the second request information is generated by the user side in response to monitoring an interface parameter data input event on the interface parameter data input interface, and the second request information carries the interface parameter data.
The interface testing unit 1450 is configured to test the interface to be tested according to the interface parameter data and the interface information.
Optionally, the testing the interface to be tested according to the interface parameter data and the interface information includes:
Generating a test script according to the interface parameter data and the interface information;
and testing the interface to be tested according to the test script.
Optionally, the device further includes a result information sending unit, configured to:
obtaining result information;
and sending the result information to the user side so that the user side renders a test result according to the result information.
Optionally, the obtaining the result information includes:
acquiring original result information, wherein the original result information is test data generated after the interface to be tested is tested;
and analyzing the original result information to form the result information.
A sixth embodiment of the present application provides an electronic device, and fig. 15 is a schematic structural diagram of the electronic device provided in the present embodiment.
As shown in fig. 15, the electronic device provided in this embodiment includes: a memory 1510, a processor 1520;
the memory 1510 is used for storing computer instructions for executing the interface test method;
the processor 1520 is configured to execute the computer instructions stored in the memory 1510 to perform the following operations:
generating first request information in response to monitoring a scene name input event of an interface to be tested, wherein the first request information carries the scene name;
The first request information is sent to a server side, so that the server side can call the interface information of the interface to be tested from a database according to the scene name;
receiving the interface information sent by the server;
rendering an interface parameter data input interface according to the interface information;
generating second request information in response to monitoring an interface parameter data input event on the interface parameter data input interface, wherein the second request information carries the interface parameter data;
and sending the second request information to the server side so that the server side tests the interface to be tested according to the interface parameter data and the interface information.
Optionally, the following operations are also performed:
and responding to the received result information sent by the server, and rendering a test result according to the result information.
Optionally, before the step of generating the first request information in response to the monitoring of the scene name input event of the interface to be tested, the following operations are further performed:
establishing an initial interface information table;
recording scene names and interface information corresponding to a plurality of standby interfaces into the initial interface information table to form an interface information table, wherein each row in the interface information table records the scene name and the interface information corresponding to one standby interface;
And sending the interface information table to the server so that the server stores the interface information table in the database.
Optionally, the interface to be tested is any interface in the plurality of standby interfaces, and the scene name input event of the interface to be tested includes:
and selecting the scene name corresponding to the interface to be tested from a plurality of scene names corresponding to the plurality of standby interfaces.
Optionally, the server side invokes interface information of the interface to be tested from a database according to the scene name, including:
and the server side invokes the interface information recorded in the same row with the scene name from the interface information table.
Optionally, the interface information at least includes an interface address of the interface to be tested and a request template; the request template comprises a name, an input prompt, an input type and an input requirement of at least one interface parameter corresponding to the interface to be tested;
the receiving the interface information sent by the server side includes:
receiving the request template sent by the server;
the rendering interface parameter data input interface according to the interface information comprises:
Rendering interface parameter data input boxes of corresponding types in the interface parameter data input interface according to the input type of each interface parameter included in the request template, wherein the number of the interface parameter data input boxes in the interface parameter data input interface is the same as the number of the interface parameters in the request template;
the interface parameter data input event on the interface parameter data input interface comprises:
and inputting the corresponding type of the interface parameter data according to the type of each interface parameter data input box on the interface parameter data input interface.
Optionally, the interface parameter includes a concurrency parameter;
rendering an interface parameter data input box of a corresponding type in the interface parameter data input interface according to the input type of each interface parameter included in the request template, including:
rendering a concurrent parameter data input box corresponding to the concurrent parameter in the interface parameter data input interface;
the inputting the interface parameter data of the corresponding type according to the type of each data input box on the interface parameter data input interface comprises the following steps:
And inputting the concurrent parameter data in the concurrent parameter data input box.
Optionally, the second request information carries the concurrency parameter data;
the server tests the interface to be tested according to the interface parameter data and the interface information, and the method comprises the following steps:
and the server side performs concurrent testing on the interface to be tested according to the concurrent parameter data, wherein the concurrent number of the concurrent testing is related to the concurrent parameter data.
Or, the following operations are performed:
receiving first request information sent by a user side, wherein the first request information is generated by the user side in response to the detection of a scene name input event of an interface to be tested, and the first request information carries the scene name;
according to the scene name, the interface information of the interface to be tested is called from a database;
the interface information is sent to the user side, so that the user side renders an interface parameter data input interface according to the interface information;
receiving second request information sent by the user side, wherein the second request information is generated by the user side in response to the detection of an interface parameter data input event on the interface parameter data input interface, and the second request information carries the interface parameter data;
And testing the interface to be tested according to the interface parameter data and the interface information.
Optionally, the following operations are also performed:
obtaining result information;
and sending the result information to the user side so that the user side renders a test result according to the result information.
Optionally, the obtaining the result information includes:
acquiring original result information, wherein the original result information is test data generated after the interface to be tested is tested;
and analyzing the original result information to form the result information.
Optionally, the testing the interface to be tested according to the interface parameter data and the interface information includes:
generating a test script according to the interface parameter data and the interface information;
and testing the interface to be tested according to the test script.
A seventh embodiment of the application provides a computer readable storage medium comprising computer instructions which, when executed by a processor, are adapted to carry out the method of the embodiments of the application.
It is noted that the relational terms such as "first," "second," and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Furthermore, the terms "comprise," "have," "include," and other similar terms, are intended to be inclusive and open-ended in that any one or more items following any one of the terms described above, neither of which indicates that the one or more items have been enumerated, as an exhaustive list, or limited to only those one or more items so enumerated.
As used herein, unless expressly stated otherwise, the term "or" includes all possible combinations, except where not possible. For example, if expressed as a database may include a or B, then unless specifically stated or not possible, the database may include a, or B, or a and B. In a second example, if expressed as a database might include A, B or C, the database may include database A, or B, or C, or A and B, or A and C, or B and C, or A and B and C, unless otherwise specifically stated or not viable.
It is noted that the above-described embodiments may be implemented by hardware or software (program code), or a combination of hardware and software. If implemented by software, it may be stored in the computer-readable medium described above. The software, when executed by a processor, may perform the methods disclosed above. The computing units and other functional units described in this disclosure may be implemented by hardware or software, or a combination of hardware and software. Those of ordinary skill in the art will also appreciate that the above-described modules/units may be combined into one module/unit, and each of the above-described modules/units may be further divided into a plurality of sub-modules/sub-units.
In the foregoing detailed description, embodiments have been described with reference to numerous specific details that may vary from implementation to implementation. Certain adaptations and modifications of the described embodiments can be made. Other embodiments will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. The specification and examples are for illustrative purposes only, with the true scope and nature of the application being indicated by the following claims. The order of steps shown in the figures is also for illustrative purposes only and is not meant to be limited to any particular step, order. Accordingly, those skilled in the art will recognize that the steps may be performed in a different order when performing the same method.
In the drawings and detailed description of the application, exemplary embodiments are disclosed. Many variations and modifications may be made to these embodiments. Accordingly, although specific terms are employed, they are used in a generic and descriptive sense only and not for purposes of limitation.

Claims (18)

1. An interface testing method, the method comprising:
generating first request information in response to monitoring a scene name input event of an interface to be tested, wherein the first request information carries the scene name;
The first request information is sent to a server side, so that the server side can call the interface information of the interface to be tested from a database according to the scene name;
receiving the interface information sent by the server;
rendering an interface parameter data input interface according to the interface information;
generating second request information in response to monitoring an interface parameter data input event on the interface parameter data input interface, wherein the second request information carries the interface parameter data;
and sending the second request information to the server side so that the server side tests the interface to be tested according to the interface parameter data and the interface information.
2. The method according to claim 1, wherein the method further comprises:
and responding to the received result information sent by the server, and rendering a test result according to the result information.
3. The method of claim 1, wherein prior to the step of generating the first request information in response to monitoring a scene name input event of the interface to be tested, the method further comprises:
establishing an initial interface information table;
Recording scene names and interface information corresponding to a plurality of standby interfaces into the initial interface information table to form an interface information table, wherein each row in the interface information table records the scene name and the interface information corresponding to one standby interface;
and sending the interface information table to the server so that the server stores the interface information table in the database.
4. A method according to claim 3, wherein the interface to be tested is any one of the plurality of backup interfaces, and the scene name input event of the interface to be tested comprises:
and selecting the scene name corresponding to the interface to be tested from a plurality of scene names corresponding to the plurality of standby interfaces.
5. The method of claim 3, wherein the server retrieving interface information of the interface to be tested from a database according to the scene name comprises:
and the server side invokes the interface information recorded in the same row with the scene name from the interface information table.
6. The method according to claim 1, wherein the interface information comprises at least an interface address of the interface to be tested and a request template; the request template comprises a name, an input prompt, an input type and an input requirement of at least one interface parameter corresponding to the interface to be tested;
The receiving the interface information sent by the server side includes:
receiving the request template sent by the server;
the rendering interface parameter data input interface according to the interface information comprises:
rendering interface parameter data input boxes of corresponding types in the interface parameter data input interface according to the input type of each interface parameter included in the request template, wherein the number of the interface parameter data input boxes in the interface parameter data input interface is the same as the number of the interface parameters in the request template;
the interface parameter data input event on the interface parameter data input interface comprises:
and inputting the corresponding type of the interface parameter data according to the type of each interface parameter data input box on the interface parameter data input interface.
7. The method of claim 6, wherein the interface parameters include concurrency parameters;
rendering an interface parameter data input box of a corresponding type in the interface parameter data input interface according to the input type of each interface parameter included in the request template, including:
Rendering a concurrent parameter data input box corresponding to the concurrent parameter in the interface parameter data input interface;
the inputting the interface parameter data of the corresponding type according to the type of each data input box on the interface parameter data input interface comprises the following steps:
and inputting the concurrent parameter data in the concurrent parameter data input box.
8. The method of claim 7, wherein the second request information carries the concurrency parameter data;
the server tests the interface to be tested according to the interface parameter data and the interface information, and the method comprises the following steps:
and the server side performs concurrent testing on the interface to be tested according to the concurrent parameter data, wherein the concurrent number of the concurrent testing is related to the concurrent parameter data.
9. An interface testing method, the method comprising:
receiving first request information sent by a user side, wherein the first request information is generated by the user side in response to the detection of a scene name input event of an interface to be tested, and the first request information carries the scene name;
according to the scene name, the interface information of the interface to be tested is called from a database;
The interface information is sent to the user side, so that the user side renders an interface parameter data input interface according to the interface information;
receiving second request information sent by the user side, wherein the second request information is generated by the user side in response to the detection of an interface parameter data input event on the interface parameter data input interface, and the second request information carries the interface parameter data;
and testing the interface to be tested according to the interface parameter data and the interface information.
10. The method according to claim 9, wherein the method further comprises:
obtaining result information;
and sending the result information to the user side so that the user side renders a test result according to the result information.
11. The method of claim 10, wherein the obtaining result information comprises:
acquiring original result information, wherein the original result information is test data generated after the interface to be tested is tested;
and analyzing the original result information to form the result information.
12. The method according to claim 9, wherein the testing the interface to be tested according to the interface parameter data and the interface information comprises:
Generating a test script according to the interface parameter data and the interface information;
and testing the interface to be tested according to the test script.
13. An interface testing system, the system comprising: a user end and a service end; wherein, the liquid crystal display device comprises a liquid crystal display device,
the client comprises: the system comprises a first information generation module, a first information transmission module, an information receiving module, a rendering module, a second information generation module and a second information transmission module;
the first information generation module is used for responding to the monitored scene name input event of the interface to be tested and generating first request information carrying the scene name;
the first information sending module sends the first request information to the server so that the server can call the interface information of the interface to be tested from a database according to the scene name;
the information receiving module receives the interface information sent by the server;
the rendering module renders interface parameter data input interfaces according to the interface information;
the second information generation module is used for responding to the detected interface parameter data input event on the interface parameter data input interface to generate second request information, wherein the second request information carries the interface parameter data;
The second information sending module sends the second request information to the server so that the server tests the interface to be tested according to the interface parameter data and the interface information;
the server side comprises: the system comprises a first information receiving module, an information calling module, an information sending module, a second information receiving module and a testing module;
the first information receiving module is used for receiving first request information sent by the user side, wherein the first request information is generated by the user side in response to the detection of a scene name input event of an interface to be tested, and the first request information carries the scene name;
the information calling module is used for calling the interface information of the interface to be tested from a database according to the scene name;
the information sending module sends the interface information to the user side so that the user side renders interface parameter data according to the interface information to input an interface;
the second information receiving module receives second request information sent by the user terminal, wherein the second request information is generated by the user terminal in response to the detection of an interface parameter data input event on the interface parameter data input interface, and the second request information carries the interface parameter data;
And the test module tests the interface to be tested according to the interface parameter data and the interface information.
14. The system of claim 13, wherein the interface test system is a content management system.
15. An interface testing apparatus, the apparatus comprising: the system comprises a first request information generating unit, a first request information transmitting unit, an interface information receiving unit, a rendering unit, a second request information generating unit and a second request information transmitting unit;
the first request information generating unit is used for responding to the monitored scene name input event of the interface to be tested to generate first request information, wherein the first request information carries the scene name;
the first request information sending unit is used for sending the first request information to a server side so that the server side can call the interface information of the interface to be tested from a database according to the scene name;
the interface information receiving unit is used for receiving the interface information sent by the server;
the rendering unit is used for rendering interface parameter data input interfaces according to the interface information;
The second request information generating unit is used for responding to the detection of the interface parameter data input event on the interface parameter data input interface to generate second request information, and the second request information carries the interface parameter data;
the second request information sending unit is configured to send the second request information to the server, so that the server tests the interface to be tested according to the interface parameter data and the interface information.
16. An interface testing apparatus, the apparatus comprising: the system comprises a first request information receiving unit, an interface information calling unit, an interface information sending unit, a second request information receiving unit and an interface testing unit;
the first request information receiving unit is used for receiving first request information sent by a user terminal, wherein the first request information is generated by the user terminal in response to the detection of a scene name input event of an interface to be tested, and the first request information carries the scene name;
the interface information calling unit is used for calling the interface information of the interface to be tested from a database according to the scene name;
The interface information sending unit is used for sending the interface information to the user side so that the user side renders interface parameter data according to the interface information to input an interface;
the second request information receiving unit is configured to receive second request information sent by the user side, where the second request information is generated by the user side in response to monitoring an interface parameter data input event on the interface parameter data input interface, and the second request information carries the interface parameter data;
and the interface testing unit is used for testing the interface to be tested according to the interface parameter data and the interface information.
17. An electronic device, comprising: a memory, a processor;
the memory is used for storing one or more computer instructions;
the processor being configured to execute the one or more computer instructions to implement the method of any of claims 1-8, or claims 9-12.
18. A computer readable storage medium having stored thereon one or more computer instructions which, when executed by a processor, perform the method of any of claims 1-8, or claims 9-12.
CN202310450898.1A 2023-04-19 2023-04-19 Interface testing method, system, device and electronic equipment Pending CN116594867A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310450898.1A CN116594867A (en) 2023-04-19 2023-04-19 Interface testing method, system, device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310450898.1A CN116594867A (en) 2023-04-19 2023-04-19 Interface testing method, system, device and electronic equipment

Publications (1)

Publication Number Publication Date
CN116594867A true CN116594867A (en) 2023-08-15

Family

ID=87599880

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310450898.1A Pending CN116594867A (en) 2023-04-19 2023-04-19 Interface testing method, system, device and electronic equipment

Country Status (1)

Country Link
CN (1) CN116594867A (en)

Similar Documents

Publication Publication Date Title
US9203720B2 (en) Monitoring the health of web page analytics code
CN111061526B (en) Automatic test method, device, computer equipment and storage medium
US9003423B1 (en) Dynamic browser compatibility checker
CN110825618B (en) Method and related device for generating test case
CN108628748B (en) Automatic test management method and automatic test management system
CN106657192B (en) Method and equipment for presenting service calling information
US10169037B2 (en) Identifying equivalent JavaScript events
CN110263070A (en) Event report method and device
CN110928763A (en) Test method, test device, storage medium and computer equipment
WO2021129335A1 (en) Operation monitoring method and apparatus, operation analysis method and apparatus
CN111767229A (en) Performance test method, device and equipment
CN113760763A (en) Software testing method, device, server and system
JP2004178263A (en) Web server, web server with function of java servlet, and computer program
CN103885878A (en) Method and device for generating browser testing script
CN111258904A (en) Webpage element testing method and related device
CN110543429A (en) Test case debugging method and device and storage medium
CN112817817B (en) Buried point information query method, buried point information query device, computer equipment and storage medium
US9104573B1 (en) Providing relevant diagnostic information using ontology rules
JP4681673B1 (en) Operation verification apparatus, operation verification method, and operation verification program
JP2019101889A (en) Test execution device and program
CN116594867A (en) Interface testing method, system, device and electronic equipment
Kumar et al. A brief investigation on web usage mining tools (WUM)
WO2020088087A1 (en) Method and device for testing application program interface (api)
CN114371866A (en) Version reconfiguration test method, device and equipment of service system
CN112597036B (en) Universal baffle plate testing method and device

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