Disclosure of Invention
The technical problem to be solved by the embodiment of the application is to provide a testing method, a device, a storage medium and equipment, which can test data of various protocol types in a target testing tool and improve the testing efficiency.
In one aspect, the embodiment of the application provides a testing method, which includes:
displaying at least two protocol test plug-ins in a test page corresponding to the target test tool, wherein the at least two protocol test plug-ins are used for testing data of different protocol types;
Responding to a selection operation aiming at least two protocol test plugins, determining the protocol test plugins determined by the selection operation as target protocol test plugins, and acquiring data to be tested associated with the target protocol plugins;
And testing the data to be tested according to the target protocol test plug-in, and generating a test result corresponding to the data to be tested.
Wherein the target test tool comprises a plug-in manager, the method further comprising:
acquiring functional logic data packets respectively corresponding to at least two protocol test plug-ins;
According to the plug-in data type corresponding to the plug-in standard interface in the plug-in manager, converting the functional logic data packet into a standard data packet meeting the plug-in data type;
And importing the standard data packet into a plug-in manager, and generating a target test tool comprising at least two protocol test plug-ins according to the plug-in manager comprising the standard data packet.
Wherein the obtaining the data to be tested associated with the target protocol plugin includes:
Responding to the test data editing operation in the test page, and displaying the original test data in the target test tool;
responding to the modification operation aiming at the original test data, and updating the original test data into modified original test data;
And storing the modified original test data in the target test tool, and determining the modified original test data as data to be tested.
Wherein obtaining data to be tested associated with the target protocol plugin includes:
acquiring a target standard data packet associated with a target protocol plug-in a target test tool;
Analyzing the target standard data packet to obtain a request parameter field and a request parameter value range in the target standard data packet;
Generating target request parameters associated with the request parameter fields in the request parameter value range;
and correcting the target request parameters according to the historical test data corresponding to the target protocol plug-in, and determining the corrected target request parameters as to-be-tested data associated with the target protocol plug-in.
The method comprises the steps of testing data to be tested according to the target protocol test plug-in, generating a test result corresponding to the data to be tested, and comprising the following steps:
coding the data to be tested to generate a test packet corresponding to the test data;
acquiring a network address corresponding to a tested object, and sending a test packet to the network address corresponding to the tested object so that the tested object generates a feedback data packet corresponding to the test packet according to the test packet;
And receiving a feedback data packet returned by the tested object, decoding the feedback data packet, and generating a test result corresponding to the data to be tested.
Wherein, the method further comprises the following steps:
Responding to a trigger operation of adding an entry to a plug-in a test page, and acquiring a new protocol type determined by the trigger operation;
Acquiring a new protocol test plug-in corresponding to the new protocol type, and performing data conversion on a new plug-in data packet corresponding to the new protocol test plug-in according to the data type corresponding to the standard interface in the plug-in manager to generate a new standard data packet;
And importing the newly-added standard data packet into a plug-in manager of the target test tool, and adding the newly-added protocol test plug-in successfully imported into the plug-in manager into a protocol test plug-in list, wherein the protocol test plug-in list comprises the protocol test plug-ins accessed in the target test tool.
The method comprises the steps of importing a standard data packet into a plug-in manager, generating a target test tool comprising at least two protocol test plug-ins according to the plug-in manager comprising the standard data packet, and comprising the following steps:
Packaging the standard data packet into the plug-in standard interface in the plug-in manager;
And acquiring parameter declaration information corresponding to at least two protocol test plugins respectively, calling a plugin registration function, and registering a standard data packet containing the parameter declaration information in a plugin manager to obtain a target test tool.
In one aspect, an embodiment of the present application provides a testing apparatus, including:
The display module is used for displaying at least two protocol test plug-ins in a test page corresponding to the target test tool, wherein the at least two protocol test plug-ins are used for testing data of different protocol types;
The first acquisition module is used for responding to the selection operation of at least two protocol test plugins, determining the protocol test plugins determined by the selection operation as target protocol test plugins, and acquiring to-be-tested data associated with the target protocol plugins;
the test processing module is used for testing the data to be tested according to the target protocol test plug-in, and generating a test result corresponding to the data to be tested.
Wherein the target test tool comprises a plug-in manager, the apparatus further comprising:
the second acquisition module is used for acquiring functional logic data packets corresponding to at least two protocol test plug-ins respectively;
The conversion module is used for converting the functional logic data packet into a standard data packet meeting the plug-in data type according to the plug-in data type corresponding to the plug-in standard interface in the plug-in manager;
The first generation module is used for importing the standard data packet into the plug-in manager, and generating a target test tool comprising at least two protocol test plug-ins according to the plug-in manager comprising the standard data packet.
Wherein, the first acquisition module includes:
the display unit is used for responding to the test data editing operation in the test page and displaying the original test data in the target test tool;
The updating unit is used for responding to the modification operation aiming at the original test data and updating the original test data into modified original test data;
the first determining unit is used for storing the modified original test data in the target test tool and determining the modified original test data as data to be tested.
Wherein, the first acquisition module further includes:
the first acquisition unit is used for acquiring a target standard data packet associated with the target protocol plug-in the target test tool;
The analysis unit is used for analyzing the target standard data packet to obtain a request parameter field and a request parameter value range in the target standard data packet;
a first generation unit, configured to generate a target request parameter associated with the request parameter field within a request parameter value range;
And the correction unit is used for correcting the target request parameters according to the historical test data corresponding to the target protocol plug-in, and determining the corrected target request parameters as to-be-tested data associated with the target protocol plug-in.
Wherein, above-mentioned test processing module includes:
The second generating unit is used for carrying out coding processing on the data to be tested and generating a test packet corresponding to the test data;
The sending unit is used for obtaining the network address corresponding to the tested object, and sending the test packet to the network address corresponding to the tested object so that the tested object generates a feedback data packet corresponding to the test packet according to the test packet;
and the third generating unit is used for receiving the feedback data packet returned by the tested object, decoding the feedback data packet and generating a test result corresponding to the data to be tested.
Wherein, the device further includes:
the third acquisition module is used for responding to the trigger operation of adding an entry to the plug-in the test page and acquiring the newly added protocol type determined by the trigger operation;
The second generation module is used for acquiring a new protocol test plug-in corresponding to the new protocol type, and carrying out data conversion on a new plug-in data packet corresponding to the new protocol test plug-in according to the data type corresponding to the standard interface in the plug-in manager to generate a new standard data packet;
The adding module is used for importing the newly-added standard data packet into a plug-in manager of the target test tool, and adding the newly-added protocol test plug-in successfully imported into the plug-in manager to a protocol test plug-in list, wherein the protocol test plug-in list comprises the protocol test plug-ins accessed in the target test tool.
Wherein, the first generating module includes:
The packaging unit is used for packaging the standard data packet into a plug-in standard interface in the plug-in manager;
the registration unit is used for acquiring parameter declaration information corresponding to at least two protocol test plug-ins respectively, calling a plug-in registration function, and registering a standard data packet containing the parameter declaration information in a plug-in manager to obtain a target test tool.
In one aspect, the application provides a computer device comprising a processor and a memory;
wherein the memory is used for storing a computer program, and the processor is used for calling the computer program to execute the following steps:
displaying at least two protocol test plug-ins in a test page corresponding to the target test tool, wherein the at least two protocol test plug-ins are used for testing data of different protocol types;
Responding to a selection operation aiming at least two protocol test plugins, determining the protocol test plugins determined by the selection operation as target protocol test plugins, and acquiring data to be tested associated with the target protocol plugins;
And testing the data to be tested according to the target protocol test plug-in, and generating a test result corresponding to the data to be tested.
In one aspect, embodiments of the present application provide a computer readable storage medium storing a computer program comprising program instructions which, when executed by a processor, perform the steps of:
displaying at least two protocol test plug-ins in a test page corresponding to the target test tool, wherein the at least two protocol test plug-ins are used for testing data of different protocol types;
Responding to a selection operation aiming at least two protocol test plugins, determining the protocol test plugins determined by the selection operation as target protocol test plugins, and acquiring data to be tested associated with the target protocol plugins;
And testing the data to be tested according to the target protocol test plug-in, and generating a test result corresponding to the data to be tested.
In the embodiment of the application, at least two protocol test plug-ins are displayed in a test page corresponding to a target test tool, the at least two protocol test plug-ins are used for testing data of different protocol types, the protocol test plug-ins determined by the selection operation are determined to be the target protocol test plug-ins in response to the selection operation of the at least two protocol test plug-ins, and the data to be tested associated with the target protocol plug-ins are acquired. And testing the data to be tested according to the target protocol test plug-in, and generating a test result corresponding to the data to be tested. Therefore, the target test tool provided by the embodiment of the application can test the data of multiple protocol types, namely, the target protocol test plug-in can be selected from the test page corresponding to the target test tool to test the corresponding data to be tested, and a plurality of test tools of different protocol types are not required to be switched, so that the convenience of service developers is provided. The application can test the data with different protocol types in the target test tool, thereby improving the test efficiency.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a test system according to an embodiment of the application. As shown in fig. 1, the test system may comprise a server 10 and a cluster of user terminals. The cluster of user terminals may comprise one or more user terminals, the number of which will not be limited here. As shown in fig. 1, specifically, the user terminal 100a, the user terminal 100b, the user terminal 100c, the user terminal 100n may be included. As shown in fig. 1, user terminals 100a, 100b, 100c, 100n may each be in network connection with the above-described server 10, so that each user terminal may interact with the server 10 via the network connection.
Each user terminal in the user terminal cluster can comprise an intelligent terminal with a service data processing function, such as an intelligent mobile phone, a tablet personal computer, a notebook personal computer, a desktop personal computer, wearable equipment, an intelligent home, a head-mounted equipment and the like. It should be appreciated that each user terminal in the cluster of user terminals shown in fig. 1 may be provided with a target application (i.e. application client) that, when running in each user terminal, may interact with the server 10 shown in fig. 1, respectively, as described above.
As shown in fig. 1, the server 10 may be configured to perform test processing on data to be tested according to a target protocol test plug-in, and generate a test result corresponding to the data to be tested. The server 10 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligence platforms.
For easy understanding, the embodiment of the present application may select one user terminal from the plurality of user terminals shown in fig. 1 as the target user terminal. For example, the embodiment of the present application may use the user terminal 100a shown in fig. 1 as a target user terminal, and the target user terminal may integrate a target application (i.e., an application client) having the service data processing function. At this time, the target user terminal may implement data interaction between the service data platform corresponding to the application client and the server 10. If the target user terminal can display at least two protocol test plugins in the test page corresponding to the target test tool, respond to the selection operation of the at least two protocol test plugins, determine the protocol test plugins determined by the selection operation as target protocol test plugins, acquire the data to be tested associated with the target protocol plugins, send the target protocol test plugins and the data to be tested to the server 10, and the server 10 can perform test processing on the data to be tested according to the target protocol test plugins, generate test results corresponding to the data to be tested, and send the test results to the target user terminal.
Referring to fig. 2, fig. 2 is a flow chart of a testing method according to an embodiment of the application. The method may be performed by a computer device, which may be a server (e.g. server 11 in fig. 1 described above), or a user terminal (e.g. any one of the user terminals in the user terminal cluster of fig. 1 described above), or a system of servers and user terminals, as the application is not limited in this respect. As shown in fig. 2, the test method may include steps S101-S103.
S101, displaying at least two protocol test plug-ins in a test page corresponding to a target test tool.
Specifically, when a service developer needs to test a target object, the service developer needs to judge whether the target object meets corresponding functionality and safety, at this time, the service developer can start a target test tool to test the target object, when the test result of the target object has no problem, the target object can be determined to meet the functionality and safety, and when the test result of the target object has the problem, the target object can be determined to not meet the functionality and safety. When a service developer starts a target test tool in a computer device, the computer device can respond to the starting operation of the target test tool to display a test page corresponding to the target test tool in a terminal screen of the computer device. The target test tool may include at least two protocol test plug-ins, and different protocol test plug-ins may be used to test data of different protocol types, i.e. the target test tool has a function of testing data corresponding to at least two protocol types respectively. In other words, at least two protocol test plug-ins can be displayed in the test side of the target test tool, so that a service developer can select a required protocol test plug-in a test page corresponding to the target test tool, and further, the test efficiency can be improved.
The protocol test plug-in may refer to an interface test tool, such as an interface test tool corresponding to Grpc protocol type (a communication protocol for client and server communication), an interface test tool corresponding to Trpc protocol type (a remote call protocol), an interface test tool corresponding to Qza protocol type (a communication protocol), and so on. The interface testing tool corresponding to the Grpc protocol type is a high-performance and general open source RPC (an inter-process communication of remote call type) framework, the interface testing tool corresponding to the Trpc protocol type is a Trpc general client interface testing tool, and can perform testing by reading user input in command line parameters, and also can perform testing and result assertion by reading corresponding test data in JSON format (a data exchange format). The interface test tool corresponding to Qza protocol type is similar to the interface test tool corresponding to Trpc protocol type, and can initiate test on the service of Qza protocol by reading user input in command line, and can also read the corresponding test data in JSON format to test and assert result. It should be noted that, the target test tool in the embodiment of the present application may further include other test tools, such as a mock tool (a test tool created by using a virtual object for testing), a data generation tool, and so on, so long as the plug-in data type corresponding to the standard interface in the plug-in manager in the embodiment of the present application is implemented, the target test tool may be accessed and used in the target test tool, and the applicability of the target test tool may be improved.
S102, responding to the selection operation of at least two protocol test plugins, determining the protocol test plugins determined by the selection operation as target protocol test plugins, and acquiring to-be-tested data associated with the target protocol plugins.
Specifically, when the user selects a required protocol test plug-in from at least two protocol test plug-ins displayed on a test page corresponding to the target test tool, the computer device may respond to a selection operation for the at least two protocol test plug-ins, determine the protocol test plug-in determined by the selection operation corresponding to the user as the target protocol test plug-in, and acquire to-be-tested data associated with the target protocol test plug-in. The data to be tested may be original test data of the target test tool, or may be test data randomly generated in the target test tool, or may be test data obtained by modifying and adjusting the original test data or the test data randomly generated according to actual requirements.
Optionally, when the data to be tested is original test data of the target test tool, after determining the protocol test plug-in determined by the selection operation corresponding to the user as the target protocol test plug-in, calling a target standard data packet corresponding to the target test plug-in from the target test tool. At least two protocol test plug-ins in the access target test tool are provided with corresponding standard data packets (namely functional logic data packets) for realizing that the target protocol test plug-ins test the associated test data. Analyzing the target standard data packet to obtain the existing test case in the target standard data packet, and directly determining the existing test case as the data to be tested associated with the target protocol plug-in.
Optionally, when the data to be tested is test data randomly generated in the target test tool (i.e., test data automatically generated in the target test tool), the computing device may obtain a target standard data packet associated with the target protocol plug-in the target test tool, and parse the target standard data packet to obtain a request parameter field and a request parameter value range in the target standard data packet. Generating target request parameters associated with request parameter fields in the request parameter value range, correcting the target request parameters according to historical test data corresponding to the target protocol plug-in, and determining the corrected target request parameters as to-be-tested data associated with the target protocol plug-in.
Specifically, after the protocol test plug-in determined by the selection operation corresponding to the user is determined as the target protocol test plug-in, the target standard data packet associated with the target protocol plug-in may be obtained from the target test tool. The computer device may parse the target standard data packet to obtain interface information in the standard data packet corresponding to the target protocol test plug-in, where the interface information includes related information of the request parameter, such as a request parameter field (i.e. a request parameter identifier) and request parameter value range information. And generating target request parameters associated with the request parameter fields in the request parameter value range, namely randomly generating the target request parameters associated with the request parameter fields in the request parameter value range corresponding to each request parameter field. Meanwhile, the target request parameters can be corrected and supplemented according to the historical test data corresponding to the target protocol test plug-in (the historical test data can be understood as the data which is subjected to test processing in the target protocol plug-in), the corrected and supplemented target request parameters are determined to be the data to be tested which are associated with the target protocol plug-in, and the accuracy of the target request parameters can be provided. Because the request parameter fields are more and complex, the time and the labor are wasted when the service developer fills one by one, and the user does not know what needs to be filled sometimes, the data to be tested corresponding to the target protocol test plug-in can be automatically generated in the target test tool, the time spent by the service developer in testing is saved, and the test efficiency is improved.
S103, testing the data to be tested according to the target protocol testing plug-in, and generating a testing result corresponding to the data to be tested.
Specifically, after determining the target protocol test plug-in and acquiring the data to be tested associated with the target protocol test plug-in, the computer device may call the target protocol test plug-in the target test tool, perform test processing on the data to be tested, and generate a test result corresponding to the data to be tested. The target protocol test plug-in may be a protocol test plug-in used for processing the data to be tested in at least two protocol test plug-ins. In the embodiment of the application, the target protocol test plug-in is determined in the target test tool, the data to be tested associated with the target protocol test plug-in is subjected to test processing, and the test result corresponding to the data to be tested is generated without being converted into the protocol test tools corresponding to different protocol types, so that the test efficiency is improved.
Optionally, the computer device may also store standard data packets corresponding to each protocol test plug-in to the cloud server, and store address information of the cloud server in the local database. When the target test tool needs to call the standard data packet corresponding to the target protocol test plug-in, the standard data packet corresponding to the target protocol test plug-in can be obtained through the address information of the corresponding cloud server. Optionally, the computer device may store standard data packets corresponding to each protocol test plug-in to a local database, and when the target protocol test plug-in the target test tool is called to test the data to be tested, the standard data packet corresponding to the target protocol test plug-in may be called from the local database, and the data to be tested is tested according to the standard data packet corresponding to the target protocol test plug-in. For example, when the service developer is in the development stage and is not convenient to upload the standard data corresponding to each protocol test plug-in into the cloud server, the standard data packet corresponding to each protocol test plug-in can be stored in the local database of the computer device.
Optionally, the specific process of performing test processing on the data to be tested may include that the computer device may call a target protocol test tool in the target test tool, and perform coding processing on the data to be tested in the target protocol test plug-in, so as to generate a test packet corresponding to the test data. The method comprises the steps of obtaining a network address corresponding to a tested object, sending a test packet to the network address corresponding to the tested object, enabling the tested object to generate a feedback data packet corresponding to the test packet according to the test packet, receiving the feedback data packet returned by the tested object, decoding the feedback data packet, and generating a test result corresponding to data to be tested.
Specifically, when the computer device calls the standard data packet corresponding to the target protocol test plug-in to test the data to be tested, the computer device can perform coding processing on the data to be tested to generate a test packet corresponding to the data to be tested. The method comprises the steps of obtaining a network address corresponding to a tested object, sending a test packet to the network address corresponding to the tested object, analyzing the test packet in the network address to obtain data to be tested contained in the test packet, testing the tested object according to the data to be tested to generate test result data corresponding to the tested object, packaging the test result data in the network address to obtain a feedback data packet, and returning the feedback data packet to the computer equipment by the tested object. And after receiving the feedback data packet returned by the tested object, the computer equipment can decode the feedback data packet to generate a test result corresponding to the data to be tested. The tested object is an object to be tested, for example, when an interface test corresponding to the switch of the lighting lamp is performed, the corresponding lighting lamp is the tested object.
Specifically, a specific test process of calling a target protocol test plug-in to perform test processing on data to be tested may refer to fig. 3, as shown in fig. 3, fig. 3 is a schematic diagram of calling the target protocol test plug-in to perform test, as shown in fig. 3, where the target protocol test plug-in includes an parsing module, an encoding module, a decoding module, an assertion checking module, an output module, and so on. The analysis module is used for analyzing the protocol file (namely, standard data packet) corresponding to the target protocol test plug-in, and can analyze the interface information (including interface name, request parameter structure body, response structure body and the like) in the protocol file. After obtaining the interface information in the protocol file, a fixed template may be used to automatically organize the interface information in the protocol file into test codes, such as Json (JavaScript Object Notation, json object numbered musical notation, a computer programming language) code, python (a computer programming language) code, and golang (a static strong type, compiled language) code, that is, test code information is automatically generated. Meanwhile, the data to be tested is analyzed to obtain test case information, wherein the test case information comprises a case name, a tested interface name, test request data, an assertion rule and the like. The encoding module is used for encoding the request parameter data of the test case in the data to be tested, and encapsulating the request parameter data by combining with the test code information such as the request target address, the interface name and the like to obtain a test packet corresponding to the data to be tested, and sending the test packet to the tested object, so that the tested object tests according to the test packet to obtain a feedback data packet. The decoding module is used for decoding the feedback data packet returned by the tested object to obtain specific response data. The assertion check is used for performing assertion check on the feedback data packet returned by the tested object, namely checking the data in the feedback data packet, and generating a test result. The output module is used for outputting the obtained test result and outputting a request body or a response body. After determining the target protocol test plug-in corresponding to the target protocol type, calling a standard data packet corresponding to the target protocol test plug-in, namely a functional logic data packet corresponding to the target protocol test plug-in and data to be tested. Analyzing the standard data packet and the data to be tested corresponding to the target protocol test plug-in, then utilizing the coding module to code, analyzing the test packet obtained after the coding, and sending the test packet to the tested object so that the tested object generates a feedback data packet according to the test packet. After receiving a feedback data packet returned by a tested object, decoding the feedback data packet by using a decoding module, and performing assertion verification on the decoded feedback data packet by using an assertion verification module to obtain a test result and a request body or a response body, and finally outputting the obtained test result (success or unsuccessful) and the request body or the response body by an output module.
Specifically, as shown in fig. 4, fig. 4 is a schematic diagram of a test page corresponding to a target test tool according to an embodiment of the present application, and as shown in fig. 4, after the target test tool is started, a protocol test tool corresponding to various protocol types currently accessing the target test tool is displayed on the left side of the test page corresponding to the target test tool, and a plug-in add-in of a new protocol test plug-in is added. The right side provides a protocol test plug-in corresponding to the corresponding protocol type and the protocol test tool is added into the protocol test plug-in of the target test tool, namely, each protocol test tool is connected into the protocol test plug-in which can be used in the target test tool, such as the protocol test plug-in 1 of the target test tool is added into the protocol test plug-in 1 of the target test tool. The right side also provides the command line parameters corresponding to the protocol test plug-in 1, and the command line parameters corresponding to the protocol test plug-in 1 can be defined by oneself when the protocol test plug-in 1 registers in the target test tool. And a window for searching the specific parameters in the command line parameters is also arranged, and the required specific parameters can be searched by inputting the parameter identification information in the window. When the configuration needs to be added, the corresponding configuration information can be acquired through the configuration interface. The add configuration operation can be completed by clicking the send tab, or the remove configuration tab can be clicked to remove the configuration that needs to be removed.
In the embodiment of the application, at least two protocol test plug-ins are displayed in a test page corresponding to a target test tool, the protocol test plug-ins determined by the selection operation are determined to be the target protocol test plug-ins in response to the selection operation of the at least two protocol test plug-ins, and the data to be tested associated with the target protocol plug-ins are acquired. And testing the data to be tested according to the target protocol test plug-in, and generating a test result corresponding to the data to be tested. Therefore, the target test tool can be used for testing the data of multiple protocol types, namely, the corresponding protocol test plug-in is called in the target test tool to test the data of the corresponding protocol type, a plurality of test tools of different protocol types are not required to be switched, and convenience of service developers is provided. The application can test the data of different protocol types, improves the test efficiency and improves the accuracy of the test result. In addition, the embodiment of the application provides the test page corresponding to the target test tool by carrying out visual processing on the target test tool, and the service developer can test to obtain a test result by carrying out testing on the test page corresponding to the target test tool and only filling the response value in the corresponding parameter, thereby avoiding low-level errors such as parameter deletion, name error and the like and improving the accuracy and efficiency of the testing. Meanwhile, under the condition of more parameters, the cost of data testing is increased because the input of the parameters becomes service development, and the service developer can frequently generate errors due to the fact that specific command parameter instructions are not memorized, so that the test result obtained by testing is accurate and lower.
Further, as shown in fig. 5, fig. 5 is a flowchart of a method for obtaining data to be tested according to an embodiment of the present application, and the embodiment of the present application is further described in step S101 in the embodiment corresponding to fig. 2. As shown in fig. 5, the acquisition process of the data to be tested can be realized by the following steps S21 to S23.
S21, responding to the test data editing operation in the test page, and displaying the original test data in the target test tool.
Specifically, when the data to be tested is the modified original test data, the service developer may edit the original test data in the target test tool or the data to be tested corresponding to the target protocol test plug-in automatically generated by the target test tool, that is, trigger the operation of editing the original test data in the test page corresponding to the target test tool. The computer device in this embodiment may respond to the test data editing operation in the target test tool, and display the original test data in the target test tool on the test page, so that the service developer modifies the original test data to be modified.
S22, in response to the modification operation for the original test data, the original test data is updated to the modified original test data.
S23, storing the modified original test data in the target test tool, and determining the modified original test data as data to be tested.
After the computer device displays the original test data in the target test tool on the test page, the service developer can edit the original test data and change the numerical value corresponding to the original test data. After the service developer finishes changing the original test data and clicks the save touch key, the computer device in the embodiment of the application can respond to the modification operation aiming at the original test data and update the original test data into the modified original test data. And storing the modified original test data in the target test tool, and determining the modified original data as the data to be tested. If the specific response value can be filled in the corresponding parameter in the test page corresponding to the target test tool, the data to be tested can be obtained. After the data to be detected corresponding to the target protocol test plug-in is automatically generated in the target test tool, the service developer can also modify the automatically generated data to be tested corresponding to the target protocol test plug-in according to specific requirements.
Optionally, when the data to be tested is the test data obtained by editing the data to be tested corresponding to the target protocol test plug-in automatically generated in the target test tool by the user, when the computer device receives an editing instruction for editing the original test data (i.e., the data to be tested automatically generated in advance) corresponding to the target protocol test plug-in by the service developer, the service developer responds to the editing operation of the data to be tested automatically generated corresponding to the target protocol test plug-in, and can modify the original test data (i.e., the data to be tested automatically generated in advance) in the test page corresponding to the target test tool according to the actual requirement, and the modified original test data is used as the data to be tested.
Fig. 6 is a schematic diagram of a method for obtaining data to be tested according to an embodiment of the present application, as shown in fig. 6, after a service developer selects original test data, i.e., a target parameter c4, that is required to be modified by a target protocol test plug-in a target test tool, it may be determined whether the target parameter c4 may be edited, as shown in fig. 6, where the target parameter c4 may be edited. Then clicking the edit touch key corresponding to the target parameter c4 to see the specific parameter information in the target parameter c4, editing the specific parameter information, and clicking the storage for storage after editing. If the specific parameter of the target parameter c4 shows that the name of the test instance in the current protocol test plug-in is called "call" and the protocol type is "Trpc (an inter-process communication protocol)", the running cost is "5000", etc. In the test page corresponding to the target test tool, the value to be modified can be filled in the specific parameter information, the test result can be obtained by clicking and sending, the target test tool can display the obtained test result in the corresponding window so as to be convenient for a service developer to check, and meanwhile, the computer equipment can store the test case obtained after the service developer edits the original data so as to be convenient for subsequent use. The test is carried out on the test page corresponding to the target test tool, and the test result can be obtained by only filling the response value in the corresponding parameter, so that low-level errors such as parameter deletion, name input error and the like are avoided, and the accuracy and the efficiency of the test are improved. Meanwhile, under the condition of more parameters, the cost of data testing is increased because the input of the parameters becomes service development, and the service developer can frequently generate errors due to the fact that specific command parameter instructions are not memorized, so that the test result obtained by testing is accurate and lower.
In the embodiment of the application, the original test data in the target test tool can be displayed by responding to the test data editing operation in the target test tool, and the original test data is updated to the modified original test data by responding to the modification operation aiming at the original test data. The modified original test data is stored in the target test tool, the modified original test data is determined to be the data to be tested, so that service developers can modify the original test data in the target test tool in a test page corresponding to the target test tool to obtain the data to be tested, the test data is not required to be rewritten, and the convenience and the efficiency of data testing can be improved.
As shown in fig. 7, fig. 7 is a schematic diagram of a test method provided in an embodiment of the present application, where the method may be performed by a computer device, and the method may be performed by a computer device, where the computer device may be a server (e.g. the server 11 in fig. 1) or a user terminal (e.g. any user terminal in the user terminal cluster in fig. 1) or a system formed by the server and the user terminal, which is not limited in this application. As shown in fig. 7, the testing method includes steps S201-206.
S201, obtaining functional logic data packets corresponding to at least two protocol test plug-ins respectively.
Specifically, the computer device may obtain functional logic data packets corresponding to at least two protocol test plugins, where the functional logic data packets include code information required by the protocol test plugins to perform data testing, that is, protocol files corresponding to each protocol test plugin.
S202, according to the plug-in data type corresponding to the plug-in standard interface in the plug-in manager, converting the functional logic data packet into a standard data packet meeting the plug-in data type.
Specifically, after the computer device obtains the functional logic data packets corresponding to at least two protocol test plugins respectively, the functional logic data packets can be converted into standard data packets meeting the plugin data types according to plugin data types corresponding to plugin standard interfaces in the plugin manager. A set of plug-in standard interfaces are defined in the plug-in manager, and functional logic data packets respectively corresponding to a plurality of protocol test plug-ins are converted into standard data packets meeting the plug-in data types corresponding to the plug-in standard interfaces through plug-in data types corresponding to the plug-in standard interfaces.
S203, importing the standard data packet into a plug-in manager, and generating a target test tool comprising at least two protocol test plug-ins according to the plug-in manager comprising the standard data packet.
Specifically, after the computer device obtains the standard data packets corresponding to each protocol test plug-in, the standard data packets corresponding to each protocol test plug-in may be imported into the plug-in manager, so as to generate a target test tool including at least two protocol test plug-ins. The target test tool can be used for testing data of multiple protocol types, so that a service developer can test the data of multiple protocol types on one test tool without switching test tools of multiple different protocol types, and convenience of the service developer is provided.
Fig. 8 is a schematic diagram of generating a target test tool according to an embodiment of the present application, where, as shown in fig. 8, the target test tool mainly includes three parts, namely a functional component architecture, a protocol test plug-in with multiple protocol types, and a test page. The functional component architecture abstracts a plug-in manager, the plug-in manager defines a set of standard plug-in interfaces, and each protocol test plug-in can be registered and accessed into the plug-in manager after realizing the standard plug-in interfaces, so that the target test tool has the test capability of each protocol test plug-in. Meanwhile, a web server (webserver) is also established in the functional component architecture, and an access path (namely an http interface) corresponding to each protocol test plug-in the target test tool is provided to interact with the test page at the front end, namely the corresponding protocol test plug-in can be called through the access path corresponding to each protocol test plug-in the test page. The access paths corresponding to the at least two protocol types respectively may be an http (HyperText Transfer Protocol ) interface, the http interface is based on a TCP (Transmission Control Protocol ) protocol, when the target protocol type is determined, a connection channel to a server in the target test tool is established through the TCP, and the target protocol test plug-in the target test tool can test the data to be tested through the http interface. The test page (i.e., web interface) is the front end of the target test tool, and communicates with the back end of the target test tool through access paths corresponding to the respective protocol test plug-ins provided by the target test tool. The user can visually select each protocol test plug-in the test page, load standard data packets corresponding to each protocol test plug-in, edit original test data in the target test tool, send test requests, check test results and the like. Different protocol test plug-ins may perform decoding/encoding, packetizing/depacketizing, asserting, etc. tests on the data to be tested of the associated protocol type. Therefore, the target test tool can test data of multiple protocol types, namely, various protocol types are called to test the associated protocol test plug-ins, and the data of different protocol types are tested without switching different protocol test tools, so that the test efficiency and convenience are improved. And the newly added protocol test tool in the target test tool can be accessed into the target test tool only by realizing a defined plug-in standard interface, so that the access cost is reduced to a great extent, and the test convenience of service developers is improved.
Optionally, in the process of generating the target test tool including at least two protocol test plugins, the computer device may encapsulate the standard data packet into a plugin standard interface in a plugin manager, obtain parameter declaration information corresponding to the at least two protocol test plugins respectively, call a plugin registration function, and register the standard data packet including the parameter declaration information in the plugin manager to obtain the target test tool.
Specifically, a plug-in standard interface is defined in the plug-in manager, and a plurality of protocol test plug-ins convert corresponding functional logic data packets into standard data packets meeting the plug-in data types according to plug-in data types corresponding to the plug-in standard interface, and package the standard data packets into the plug-in standard interface in the plug-in manager. And simultaneously acquiring parameter declaration information corresponding to each of at least two protocol test plugins, such as parameters required by each protocol test plugin, whether the required parameters are necessary (can be defined by IsRequired functions) and whether the required parameters can be edited (can be defined by NeedLoad functions). And calling a plug-in registration function to register the standard data packet containing the parameter declaration information, namely registering each protocol test plug-in to obtain the target test tool. In this way, the parameter information corresponding to each of the at least two protocol test plug-ins can be displayed in the test page corresponding to the target test tool, so that the user can check the parameters in each protocol test plug-in, and the convenience of the service developer in carrying out data test is improved.
When registering standard data packets containing parameter declaration information, a plug-in standard interface corresponding to each protocol test plug-in a plurality of protocol test plug-ins can be created according to plug-in basic classes in target test data, the corresponding standard data packets are instantiated by the plug-in standard interface corresponding to each protocol test plug-in, a protocol test plug-in instance (namely, an object corresponding to the protocol test plug-in) corresponding to the corresponding plug-in standard interface is obtained, and parameter declaration information required in each protocol test plug-in instance is defined. And registering the protocol test plug-in instance defining the parameter declaration information in the plug-in manager to obtain the target test tool. When each protocol test plug-in at least two protocol test plug-ins realizes the protocol test plug-in instance of the corresponding plug-in standard interface, the reading path of the configuration file corresponding to each protocol test plug-in can be added to a specific test processing logic layer, so that the corresponding configuration file is obtained through the reading path in the specific test processing logic layer to perform data test when the data test is performed, and parameter declaration information required by each protocol test plug-in to realize the data test is defined. When the configuration file of the protocol test plug-in needs to be read, this can be achieved by WithConfig functions (an add-on configuration function). Specifically, the run function (a function providing a message loop function for the test page thread) can be used to convert the corresponding functional logic data packet into a standard data packet meeting the standard interfaces of the plug-ins corresponding to the protocol test tools. If the assignment result needs to be corrected in the process of implementing the standard data packet corresponding to each protocol test plug-in through the run function, the assignment result can be implemented through GETSTRING functions (a function for obtaining the value of the current designated column of the object) and GetByte functions (a function for converting the character string into bytes). When a test page corresponding to a target test tool is generated through a network server, defining that parameter names of all protocol test plug-ins to be displayed in the test page are consistent with parameter names in standard data packets corresponding to all protocol test plug-ins.
Fig. 9 is a schematic diagram of a method for importing a standard data packet into a plugin manager according to an embodiment of the present application, where, as shown in fig. 9, when a standard data packet including parameter declaration information is registered into a plugin manager, after an initialization function (init function) is called through a go runtime mechanism to perform initialization processing, a registration (Register) function is further called, according to a plugin standard interface defined by the plugin manager, each protocol test plugin instance is registered into the plugin manager of the plugin manager, so as to obtain a global storage manager storing a plurality of protocol test plugins, and according to a network server, a visualization process is performed on a logic function in the global storage manager to generate a target test tool, so that multiple service processing of the target test tool, such as obtaining all protocol test plugins, running and obtaining test results, etc. services, can be implemented.
Fig. 10 is a schematic structural diagram of a functional component architecture according to an embodiment of the present application, where, as shown in fig. 10, the functional component architecture includes an API (application programming interface) interface layer, a logic layer, a plug-in abstraction layer, and a plug-in implementation layer. The API interface layer in the functional component architecture is provided with an acquisition interface and a modification interface which are respectively corresponding to the protocol test plug-ins, and the acquisition operation and the modification operation can be carried out on the configuration in each protocol test plug-in through the acquisition interface and the modification interface. The API interface layer is also provided with an acquisition interface and a modification interface for data in the standard data packet corresponding to each protocol test plug-in, and the data in each protocol test plug-in can be acquired and modified through the data acquisition interface and the modification interface. The API interface layer is also provided with a calling interface corresponding to each protocol test plug-in, a parameter acquisition interface corresponding to each protocol test plug-in, and an interface interacting with the front-end static resource. The logic layer in the functional component architecture is to implement service logic processing of each interface in the API interface layer. And the plug-in abstraction layer in the functional component architecture stores standard data packets corresponding to the protocol test plug-ins, and performs configuration and file (namely, the standard data packets corresponding to the protocol test plug-ins) management and storage. The plug-in implementation layer in the functional component architecture is used for defining plug-in standard interfaces corresponding to each protocol test plug-in and registration of each protocol test plug-in. And if the plug-in standard interface corresponding to the protocol test plug-in A, the plug-in standard interface corresponding to the protocol test plug-in B, the plug-in standard interface corresponding to the protocol test plug-in C and the plug-in standard interface corresponding to the protocol test plug-in D are defined.
Optionally, after the target test tool is generated, a new protocol test plug-in may be further added in the target test tool, for example, a plug-in adding entry is set in a visual test page corresponding to the target test tool, and when the service developer performs a trigger operation on the plug-in adding entry, the computer device may respond to the trigger operation on the plug-in adding entry in the test page, and obtain the new protocol type determined by the trigger operation. And acquiring a new protocol test plug-in corresponding to the new protocol type, and performing data conversion on a new plug-in data packet corresponding to the new protocol test plug-in according to the data type corresponding to the standard interface in the plug-in manager to generate a new standard data packet. And importing the newly-added standard data packet into a plug-in manager of the target test tool, and adding the newly-added protocol test plug-in successfully imported into the plug-in manager into a protocol test plug-in list, wherein the protocol test plug-in list comprises the protocol test plug-ins accessed in the target test tool.
If the service developer needs to add a new protocol test plug-in the target test tool, a plug-in addition entry corresponding to the target test tool can be triggered. The computer equipment in the embodiment of the application can respond to the trigger operation of adding the entry to the plug-in the target test tool and acquire the newly added protocol type determined by the trigger operation. And acquiring a new protocol test plug-in corresponding to the new protocol type, and performing data conversion on a new plug-in data packet corresponding to the new protocol test plug-in according to the data type corresponding to the standard interface in the plug-in manager to generate a new standard data packet. And importing the newly-added standard data packet into a plug-in manager of the target test tool, and adding the newly-added protocol test plug-in successfully imported into the plug-in manager into a protocol test plug-in list, wherein the protocol test plug-in list comprises the protocol test plug-ins accessed in the target test tool. After the triggering operation of adding an entry to the plug-in the target test tool is responded, displaying an interface shown in fig. 4, and the service developer can add the new protocol test plug-in corresponding to the new protocol type at the plug-in adding entry on the right side of the interface shown in fig. 4.
Optionally, the service developer wants to check which protocol test plug-ins are currently added in the target test tool, and can trigger the plug-in information acquisition interface in the test page corresponding to the target test tool. The computer equipment in the embodiment of the application can respond to the triggering operation aiming at the plug-in information in the target test tool to acquire at least two protocol test plug-ins in the current access target test tool, acquire the parameter information, the protocol type information and the like corresponding to the at least two protocol test plug-ins in the current access target test tool respectively, and display the at least two protocol test plug-ins in the current access target test tool and the corresponding parameter information and the protocol type information respectively, so that service developers can clearly know that the current target test tool has the test capability of the protocol test plug-ins of the protocol types.
Optionally, the service developer wants to obtain a target protocol test plug-in corresponding to the target protocol type, where the target protocol test plug-in refers to a test that the service developer wants to use the target protocol test plug-in to perform data. The target protocol test plug-in determined by the trigger operation of the plug-in acquisition portal can be acquired in response to the trigger operation of the plug-in acquisition portal for the target test tool, for example, the user can input the target protocol test plug-in the protocol test plug-in search window on the test page. After the target protocol test plug-in is determined, parameter information corresponding to the target protocol test plug-in is displayed in a test page corresponding to the target test tool, and after data to be tested are obtained, the target protocol test plug-in is called to test the data to be tested.
Fig. 11 is a schematic diagram of a method for performing data testing by using a target testing tool according to an embodiment of the present application, where, as shown in fig. 11, the target testing tool includes a plug-in library, and the plug-in library is used for managing a plurality of protocol testing plug-ins. The plug-in library is provided with a plug-in external interface, and the plug-in external interface comprises a function abstract interface and a management interface. The function abstract interface comprises a configuration file setting interface through which configuration files can be added or modified, a character result obtaining interface and a subsection result obtaining interface, and a plug-in function logic data interface is operated. The management interface comprises a plug-in registration interface, a plug-in acquisition interface and a plug-in addition interface. Each protocol test plug-in (such as a protocol test plug-in A, a protocol test plug-in B, a protocol test plug-in C and a protocol test plug-in D) realizes a function abstract interface in a plug-in library, and after registering in a plug-in manager, a target test tool can be used for each protocol plug-in. When the standard data packet corresponding to each protocol test plug-in is imported into the plug-in manager, the storage address corresponding to the standard data packet corresponding to each protocol test plug-in can be imported. And packaging (namely encapsulating) the functional logic data packets corresponding to each protocol test plug-in into corresponding protocol test plug-in instances through go (a computer programming language), and registering the protocol test plug-in instances corresponding to each protocol test plug-in into a plug-in manager for storage. The functional logic data packets corresponding to the protocol test plug-ins are respectively packaged into standard data packets corresponding to go data types, and then are imported into a plug-in library in the plug-in manager (import) to generate a target test tool. The method can also be invoked by encapsulating at least two protocol test plug-ins into corresponding binary data packets and loading the corresponding binary data packets into a memory. The target test tool comprises various protocol test plug-in examples and external interfaces provided for service developers, wherein the external interfaces provided for the service developers comprise all plug-in information interfaces, plug-in interfaces added, plug-in interfaces obtained, plug-in parameter injection interfaces and configuration injection interfaces, and the external interfaces can be displayed on test pages corresponding to the target test tool so that the service developers can check protocol test plug-in information or add new protocol test plug-ins. If the protocol test plug-in currently added into the target test tool can be checked according to the obtained plug-in information interfaces, a new protocol test plug-in is added into the target test tool according to the added plug-in interface, so that the target test tool has the data test capability of the new protocol test plug-in. And searching the required protocol test plug-in according to the plug-in interface, calling the required protocol test plug-in to perform data test, and injecting parameters and configuration files according to the plug-in parameter injection interface and the configuration injection interface. Meanwhile, the target test tool is provided with a service layer, and the service layer can obtain the details of the plug-in, and obtain the plug-in parameters (namely the data to be tested), determine the target protocol test plug-in instance and the configuration file of the target protocol test plug-in according to the obtained plug-in details, and operate (call the target protocol test plug-in to perform the data to be tested) to obtain the test result. The target test tool according to the embodiment of the present application is not limited to access of the protocol test tool, but may also access to a mock test (a test method created by using a virtual object for testing) tool, a data generation tool, and other data processing tools.
S204, displaying at least two protocol test plug-ins in the test page corresponding to the target test tool, wherein the at least two protocol test plug-ins are used for testing data of different protocol types.
S205, responding to the selection operation of at least two protocol test plugins, determining the protocol test plugins determined by the selection operation as target protocol test plugins, and acquiring to-be-tested data associated with the target protocol plugins.
S206, testing the data to be tested according to the target protocol test plug-in, and generating a test result corresponding to the data to be tested.
The specific implementation of steps S204 to S206 in the embodiment of the present application may refer to the description in the embodiment corresponding to fig. 2, and the embodiment of the present application will not be described here.
In the embodiment of the application, at least two protocol test plug-ins are displayed in a test page corresponding to a target test tool, the protocol test plug-ins determined by the selection operation are determined to be the target protocol test plug-ins in response to the selection operation of the at least two protocol test plug-ins, and the data to be tested associated with the target protocol plug-ins are acquired. And testing the data to be tested according to the target protocol test plug-in, and generating a test result corresponding to the data to be tested. Therefore, the target test tool can be used for testing the data of multiple protocol types, namely, the corresponding protocol test plug-in is called in the target test tool to test the data of the corresponding protocol type, a plurality of test tools of different protocol types are not required to be switched, and convenience of service developers is provided. The application can test the data of different protocol types, improves the test efficiency and improves the accuracy of the test result. In addition, the embodiment of the application provides the test page corresponding to the target test tool by carrying out visual processing on the target test tool, and the service developer can test to obtain a test result by carrying out testing on the test page corresponding to the target test tool and only filling the response value in the corresponding parameter, thereby avoiding low-level errors such as parameter deletion, name error and the like and improving the accuracy and efficiency of the testing. Meanwhile, under the condition of more parameters, the cost of data testing is increased because the input of the parameters becomes service development, and the service developer can frequently generate errors due to the fact that specific command parameter instructions are not memorized, so that the test result obtained by testing is accurate and lower.
Referring to fig. 12, fig. 12 is a schematic structural diagram of a testing device according to an embodiment of the application. The test device may be a computer program (including program code) running in a computer apparatus, for example, the test device is an application software, and the test device may be used to perform the corresponding steps in the test method provided by the embodiment of the present application. As shown in fig. 12, the test apparatus may include a display module 11, a first acquisition module 12, a test processing module 13, a second acquisition module 14, a conversion module 15, a first generation module 16, a third acquisition module 17, a second generation module 18, and an addition module 19.
And the display module 11 is used for displaying at least two protocol test plug-ins in the test page corresponding to the target test tool, wherein the at least two protocol test plug-ins are used for testing data of different protocol types.
The first obtaining module 12 is configured to respond to a selection operation for at least two protocol test plugins, determine a protocol test plugin determined by the selection operation as a target protocol test plugin, and obtain data to be tested associated with the target protocol plugin.
And the test processing module 13 is used for testing the data to be tested according to the target protocol test plug-in, and generating a test result corresponding to the data to be tested.
Wherein the target test tool comprises a plug-in manager, the apparatus further comprising:
a second obtaining module 14, configured to obtain functional logic data packets corresponding to at least two protocol test plugins respectively;
The conversion module 15 is configured to convert the functional logic data packet into a standard data packet that meets the plug-in data type according to the plug-in data type corresponding to the plug-in standard interface in the plug-in manager;
A first generating module 16, configured to import the standard data packet into the plug-in manager, and generate a target test tool including at least two protocol test plug-ins according to the plug-in manager including the standard data packet.
Wherein, the first obtaining module 12 includes:
a display unit 1201 for displaying original test data in the target test tool in response to the test data editing operation in the test page;
an updating unit 1202, configured to respond to a modification operation for the original test data, and update the original test data to modified original test data;
The first determining unit 1203 is configured to store the modified original test data in the target test tool, and determine the modified original test data as data to be tested.
Wherein the first acquisition module 12 further comprises:
a first obtaining unit 1204, configured to obtain, in a target test tool, a target standard data packet associated with a target protocol plug-in;
The parsing unit 1205 is configured to parse the target standard data packet to obtain a request parameter field and a request parameter value range in the target standard data packet;
A first generating unit 1206, configured to generate a target request parameter associated with the request parameter field within the request parameter value range;
And a correction unit 1207, configured to correct the target request parameter according to the historical test data corresponding to the target protocol plug-in, and determine the corrected target request parameter as the data to be tested associated with the target protocol plug-in.
Wherein, the test processing module 13 includes:
A second generating unit 1301, configured to perform encoding processing on data to be tested, and generate a test packet corresponding to the test data;
A sending unit 1302, configured to obtain a network address corresponding to a tested object, send a test packet to the network address corresponding to the tested object, so that the tested object generates a feedback data packet corresponding to the test packet according to the test packet;
The third generating unit 1303 is configured to receive a feedback data packet returned by the tested object, decode the feedback data packet, and generate a test result corresponding to the data to be tested.
Wherein, the device further includes:
A third obtaining module 17, configured to respond to a trigger operation for adding an entry to a plug-in a test page, and obtain a new added protocol type determined by the trigger operation;
The second generating module 18 is configured to obtain a new protocol test plug-in corresponding to a new protocol type, and perform data conversion on a new plug-in data packet corresponding to the new protocol test plug-in according to a data type corresponding to a standard interface in the plug-in manager, so as to generate a new standard data packet;
The adding module 19 is configured to import the new standard data packet into a plug-in manager of the target test tool, and add the new protocol test plug-in successfully imported into the plug-in manager to a protocol test plug-in list, where the protocol test plug-in list includes the protocol test plug-ins accessed in the target test tool.
Wherein, the first generating module 16 includes:
An encapsulation unit 1601, configured to encapsulate the standard data packet into a plug-in standard interface in the plug-in manager;
The registration unit 1602 is configured to obtain parameter declaration information corresponding to at least two protocol test plugins, call a plugin registration function, and register, in a plugin manager, a standard data packet containing the parameter declaration information to obtain a target test tool.
Specific implementation of the embodiments of the present application may refer to the descriptions in the embodiments corresponding to fig. 2 or fig. 7, and the embodiments of the present application are not further described herein.
According to one embodiment of the application, the steps involved in the test method shown in fig. 2 or fig. 7 may be performed by the various modules in the test apparatus shown in fig. 12. For example, step S101 shown in fig. 2 may be performed by the display module 11 in fig. 12, step S102 shown in fig. 2 may be performed by the first acquisition module 12 in fig. 12, step S103 shown in fig. 2 may be performed by the test processing module 13 in fig. 12, and so on.
According to an embodiment of the present application, each module in the testing apparatus shown in fig. 12 may be combined into one or several units separately or all, or some (some) of the units may be further split into a plurality of sub-units with smaller functions, so that the same operation may be implemented without affecting the implementation of the technical effects of the embodiment of the present application. The above modules are divided based on logic functions, and in practical applications, the functions of one module may be implemented by a plurality of units, or the functions of a plurality of modules may be implemented by one unit. In other embodiments of the application, the testing device may also comprise other units, and in practical applications, these functions may also be implemented with the assistance of other units, and may be implemented by cooperation of a plurality of units.
According to an embodiment of the present application, a test apparatus as shown in fig. 12 may be constructed by running a computer program (including program code) capable of executing the steps involved in the respective methods as shown in fig. 2 or fig. 7 on a general-purpose computer device such as a computer including a processing element such as a Central Processing Unit (CPU), a random access storage medium (RAM), a read only storage medium (ROM), and the like, and a storage element, and a test method of the embodiment of the present application is implemented. The computer program may be recorded on, for example, a computer-readable recording medium, and loaded into and executed by the computing device via the computer-readable recording medium.
In the embodiment of the application, at least two protocol test plug-ins are displayed in a test page corresponding to a target test tool, the protocol test plug-ins determined by the selection operation are determined to be the target protocol test plug-ins in response to the selection operation of the at least two protocol test plug-ins, and the data to be tested associated with the target protocol plug-ins are acquired. And testing the data to be tested according to the target protocol test plug-in, and generating a test result corresponding to the data to be tested. Therefore, the target test tool can be used for testing the data of multiple protocol types, namely, the corresponding protocol test plug-in is called in the target test tool to test the data of the corresponding protocol type, a plurality of test tools of different protocol types are not required to be switched, and convenience of service developers is provided. The application can test the data of different protocol types, improves the test efficiency and improves the accuracy of the test result. In addition, the embodiment of the application provides the test page corresponding to the target test tool by carrying out visual processing on the target test tool, and the service developer can test to obtain a test result by carrying out testing on the test page corresponding to the target test tool and only filling the response value in the corresponding parameter, thereby avoiding low-level errors such as parameter deletion, name error and the like and improving the accuracy and efficiency of the testing. Meanwhile, under the condition of more parameters, the cost of data testing is increased because the input of the parameters becomes service development, and the service developer can frequently generate errors due to the fact that specific command parameter instructions are not memorized, so that the test result obtained by testing is accurate and lower.
Referring to fig. 13, fig. 13 is a schematic structural diagram of a computer device according to an embodiment of the application. As shown in fig. 13, the computer device 1000 may include a processor 1001, a network interface 1004, and a memory 1005, and further, the computer device 1000 may include a user interface 1003, and at least one communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display (Display), a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface, among others. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a nonvolatile memory (non-volatile memory), such as at least one magnetic disk memory. The memory 1005 may also optionally be at least one storage device located remotely from the processor 1001. As shown in fig. 13, an operating system, a network communication module, a user interface module, and a device control application program may be included in the memory 1005, which is one type of computer-readable storage medium.
In the computer device 1000 shown in fig. 13, the network interface 1004 may provide network communication functions, while the user interface 1003 is mainly used as an interface for providing input to a user, and the processor 1001 may be used to invoke a device control application program stored in the memory 1005 to realize:
Alternatively, the processor 1001 may be configured to invoke a device control application program stored in the memory 1005 to implement:
displaying at least two protocol test plug-ins in a test page corresponding to the target test tool, wherein the at least two protocol test plug-ins are used for testing data of different protocol types;
Responding to a selection operation aiming at least two protocol test plugins, determining the protocol test plugins determined by the selection operation as target protocol test plugins, and acquiring data to be tested associated with the target protocol plugins;
And testing the data to be tested according to the target protocol test plug-in, and generating a test result corresponding to the data to be tested.
Alternatively, the processor 1001 may be configured to invoke a device control application program stored in the memory 1005 to implement:
acquiring functional logic data packets respectively corresponding to at least two protocol test plug-ins;
According to the plug-in data type corresponding to the plug-in standard interface in the plug-in manager, converting the functional logic data packet into a standard data packet meeting the plug-in data type;
And importing the standard data packet into a plug-in manager, and generating a target test tool comprising at least two protocol test plug-ins according to the plug-in manager comprising the standard data packet.
Alternatively, the processor 1001 may be configured to invoke a device control application program stored in the memory 1005 to implement:
Responding to the test data editing operation in the test page, and displaying the original test data in the target test tool;
responding to the modification operation aiming at the original test data, and updating the original test data into modified original test data;
And storing the modified original test data in the target test tool, and determining the modified original test data as data to be tested.
Alternatively, the processor 1001 may be configured to invoke a device control application program stored in the memory 1005 to implement:
acquiring a target standard data packet associated with a target protocol plug-in a target test tool;
Analyzing the target standard data packet to obtain a request parameter field and a request parameter value range in the target standard data packet;
Generating target request parameters associated with the request parameter fields in the request parameter value range;
and correcting the target request parameters according to the historical test data corresponding to the target protocol plug-in, and determining the corrected target request parameters as to-be-tested data associated with the target protocol plug-in.
Alternatively, the processor 1001 may be configured to invoke a device control application program stored in the memory 1005 to implement:
coding the data to be tested to generate a test packet corresponding to the test data;
acquiring a network address corresponding to a tested object, and sending a test packet to the network address corresponding to the tested object so that the tested object generates a feedback data packet corresponding to the test packet according to the test packet;
And receiving a feedback data packet returned by the tested object, decoding the feedback data packet, and generating a test result corresponding to the data to be tested.
Alternatively, the processor 1001 may be configured to invoke a device control application program stored in the memory 1005 to implement:
Responding to a trigger operation of adding an entry to a plug-in a test page, and acquiring a new protocol type determined by the trigger operation;
Acquiring a new protocol test plug-in corresponding to the new protocol type, and performing data conversion on a new plug-in data packet corresponding to the new protocol test plug-in according to the data type corresponding to the standard interface in the plug-in manager to generate a new standard data packet;
And importing the newly-added standard data packet into a plug-in manager of the target test tool, and adding the newly-added protocol test plug-in successfully imported into the plug-in manager into a protocol test plug-in list, wherein the protocol test plug-in list comprises the protocol test plug-ins accessed in the target test tool.
Alternatively, the processor 1001 may be configured to invoke a device control application program stored in the memory 1005 to implement:
Packaging the standard data packet into a plug-in standard interface in a plug-in manager;
And acquiring parameter declaration information corresponding to at least two protocol test plugins respectively, calling a plugin registration function, and registering a standard data packet containing the parameter declaration information in a plugin manager to obtain a target test tool.
Specific implementation of the embodiments of the present application may refer to the descriptions in the embodiments corresponding to fig. 2 or fig. 7, and the embodiments of the present application are not further described herein.
It should be understood that the computer device 1000 described in the embodiment of the present application may perform the description of the testing method described above in the embodiment corresponding to fig. 2 or fig. 7, and may also perform the description of the testing apparatus described above in the embodiment corresponding to fig. 12, which is not repeated herein. In addition, the description of the beneficial effects of the same method is omitted.
According to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device can execute the test method in the embodiment corresponding to fig. 2 or fig. 7, which is not described herein. In addition, the description of the beneficial effects of the same method is omitted.
As an example, the program instructions described above may be deployed to be executed on one computer device or on multiple computer devices at one site or on multiple computer devices distributed across multiple sites and interconnected by a communication network, where the multiple computer devices distributed across multiple sites and interconnected by a communication network may constitute a blockchain network.
Those skilled in the art will appreciate that implementing all or part of the above-described methods may be accomplished by way of computer programs, which may be stored on a computer-readable storage medium, and which, when executed, may comprise the steps of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), or the like.
The foregoing disclosure is illustrative of the present application and is not to be construed as limiting the scope of the application, which is defined by the appended claims.