CN114238065A - Test processing method, device, equipment and readable storage medium - Google Patents

Test processing method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN114238065A
CN114238065A CN202010941736.4A CN202010941736A CN114238065A CN 114238065 A CN114238065 A CN 114238065A CN 202010941736 A CN202010941736 A CN 202010941736A CN 114238065 A CN114238065 A CN 114238065A
Authority
CN
China
Prior art keywords
data
interface
test
output data
configuration information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010941736.4A
Other languages
Chinese (zh)
Other versions
CN114238065B (en
Inventor
王镇航
吴海英
吴鹏
蒋宁
吴亚雄
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mashang Consumer Finance Co Ltd
Original Assignee
Mashang Consumer Finance 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 Mashang Consumer Finance Co Ltd filed Critical Mashang Consumer Finance Co Ltd
Priority to CN202010941736.4A priority Critical patent/CN114238065B/en
Publication of CN114238065A publication Critical patent/CN114238065A/en
Application granted granted Critical
Publication of CN114238065B publication Critical patent/CN114238065B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/3684Test management for test design, e.g. generating new test cases
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a test processing method, a test processing device, test processing equipment and a readable storage medium, and relates to the technical field of data testing to improve the test efficiency. The method comprises the following steps: receiving a Mock request of a client; determining an interface to be called and a data processing strategy according to the Mock request; acquiring target output data from the interface to be called; processing the target output data according to the data processing strategy; wherein the data processing policy comprises at least one of: and returning the target output data to the client, and sending a message queue MQ message, wherein the MQ message is used for calling a test interface for the next test and/or transferring test data stream. The embodiment of the invention can improve the testing efficiency.

Description

Test processing method, device, equipment and readable storage medium
Technical Field
The present invention relates to the field of data testing technologies, and in particular, to a test processing method, an apparatus, a device, and a readable storage medium.
Background
And the Mock (simulation) realizes the test of the superior module through the information returned by the simulation interface. The inventors have found that the test using the existing Mock format is less efficient. For example, in the prior art, the Mock program returns a fixed return value. In the process of Mock business flow circulation, if a client needs to access each interface, a tester needs to manually modify configuration and then restart the configuration for testing, and the like.
Disclosure of Invention
The embodiment of the invention provides a test processing method, a test processing device, test processing equipment and a readable storage medium, and aims to improve test efficiency.
In a first aspect, an embodiment of the present invention provides a test processing method, applied to a server, including:
receiving a Mock request of a client;
determining an interface to be called and a data processing strategy according to the Mock request;
acquiring target output data from the interface to be called;
processing the target output data according to the data processing strategy;
wherein the data processing policy comprises at least one of:
and returning the target output data to the client, and sending an MQ (Message Queue) Message, wherein the MQ Message is used for calling a test interface for the next test and/or transferring test data streams.
In a second aspect, an embodiment of the present invention further provides a test processing method, applied to a client, including:
sending a Mock request to a server;
receiving target output data sent by the server;
the target output data is sent when the server determines to return the target output data according to a data processing strategy;
wherein, the sending the Mock request to the server includes:
and automatically triggering to send a Mock request to the server according to a preset triggering condition.
In a third aspect, an embodiment of the present invention provides a test processing apparatus, which is applied to a server, and includes:
the first receiving module is used for receiving a Mock request of a client;
the first determining module is used for determining an interface to be called and a data processing strategy according to the Mock request;
the first acquisition module is used for acquiring target output data from the interface to be called;
the first processing module is used for processing the target output data according to the data processing strategy;
wherein the data processing policy comprises at least one of:
and returning the target output data to the client, and sending MQ messages, wherein the MQ messages are used for calling a test interface for the next test and/or transferring test data streams.
In a fourth aspect, an embodiment of the present invention provides a test processing apparatus, which is applied to a client, and includes:
the first sending module is used for sending a Mock request to the server;
the first receiving module is used for receiving target output data sent by the server;
the target output data is sent when the server determines to return the target output data according to a data processing strategy;
wherein, the sending the Mock request to the server includes:
and automatically triggering to send a Mock request to the server according to a preset triggering condition.
In a fifth aspect, an embodiment of the present invention further provides an electronic device, including: a memory, a processor and a program stored on the memory and executable on the processor, the processor implementing the steps in the test processing method as described above when executing the program.
In a sixth aspect, the embodiment of the present invention further provides a readable storage medium, where a program is stored on the readable storage medium, and when the program is executed by a processor, the program implements the steps in the test processing method described above.
In the embodiment of the invention, after a Mock request of a client is received, an interface to be called and a data processing strategy are determined according to the Mock request, target output data are obtained from the interface to be called, and then the target output data are processed according to the data processing strategy. Because the data processing strategy at least comprises returning target output data, sending MQ messages and the like, the scheme of the embodiment of the invention can return values of different called interfaces, and can realize data circulation between service flows or next test in the mode of MQ messages and the like. Therefore, the scheme of the embodiment of the invention can improve the testing efficiency.
Drawings
FIG. 1 is a system architecture diagram of an embodiment of the present invention;
FIG. 2 is a diagram of a technical implementation architecture of an embodiment of the present invention;
FIG. 3 is a flowchart of a test processing method according to an embodiment of the present invention;
FIG. 4 is a second flowchart of a test processing method according to an embodiment of the present invention;
FIG. 5 is a third flowchart of a test processing method according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a test processing apparatus according to an embodiment of the present invention;
fig. 7 is a second schematic structural diagram of a test processing apparatus according to an embodiment of the present invention.
Detailed Description
The term "and/or" in the embodiments of the present invention describes an association relationship of associated objects, and indicates that three relationships may exist, for example, a and/or B may indicate: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
In the embodiments of the present application, the term "plurality" means two or more, and other terms are similar thereto.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a system architecture diagram of an embodiment of the present invention. With reference to fig. 1, the architecture of the embodiment of the present invention may include: the interface Mock and the use case management are two parts.
The interface Mock may include: a server Mock and a client Mock.
1. The server Mock mainly comprises: (1) the Mock data return route decision device, (2) the service data stream is converted/checked, and the protocol type is routed. Further, the Mock data return route decision device may comprise: the routing parameter capturing module, the routing parameter decision module and the case post-message sending decision module are used for carrying out the decision; the service data circulation/verification comprises a request service data join capturing and circulation module. The protocol type routing is mainly used for various protocols suitable for the architecture, such as an http protocol and the like, and can convert data of different protocol types.
(1) The function of each module in the Mock data return route decision device is as follows during testing:
a routing parameter capturing module: receiving a Mock request of a client, wherein the Mock request can comprise: environment information, test information (tester information, test set information, etc.), traffic parameters, routing information, etc. The routing parameter capture module extracts the routing information in the Mock request.
A routing parameter decision module: and determining an interface to be called according to the extracted routing information.
A case post message sending decision module: and (4) deciding a data processing strategy, namely determining a processing mode of the acquired output value, such as returning to the client, updating the test set, sending MQ messages and the like.
(2) The functions of the modules in the service data transfer/verification during testing are as follows:
the request service data join-in capturing and circulation module: and capturing the service parameters in the Mock request, and storing or updating the test set.
2. The client Mock comprises: (1) and (2) the Mock data return route decision device and (2) the service data stream is rotated/checked.
(1) The Mock data return route decision device can comprise: and manually triggering the Mock module and automatically triggering the Mock module through the interface.
Manually triggering the Mock module through an interface: the method is used for sending a request to the server side in a manner of manual triggering by a tester, and calling other interfaces.
Automatically triggering the Mock module: the method is mainly used for automatically triggering the next Mock request according to the interface calling sequence and the captured interface return value.
(2) The business data circulation/verification comprises a requested business data capturing and verifying module which is used for extracting and storing the returned data from the data returned by other clients.
And secondly, case management mainly comprises configuration management and is used for realizing the configuration of the system. The method mainly comprises the following steps: environment/test set configuration, use case/interface configuration.
1. The environment/test set configuration includes: the system comprises an environment configuration module and a test set configuration module.
An environment configuration module: configuration for a test environment;
a test set configuration module: the configuration for the test set can configure different test sets for different testers or test requirements.
2. The use case/interface configuration comprises: (1) the device comprises an interface path configuration module, (2) an interface/use case input parameter configuration module, (3) an interface/use case return value configuration module and (4) an interface asynchronous call configuration module.
(1) An interface path configuration module: the method comprises the steps of corresponding an interface path in the Mock request to a corresponding interface, namely determining an interface to be called;
(2) the interface/use case parameter configuration module: the method is used for configuring specific parameters and the like which need to be captured from the Mock request;
(3) interface/use case return value configuration module: for configuring specific parameters, MQ information and the like which need to be returned;
(4) the interface asynchronously calls the configuration module: for configuring whether to send MQ messages, perform message updates, etc.
The Mock data return route decision device of the server Mock is used for executing corresponding test processing according to the configuration of the environment configuration module on the test environment, the configuration of the test set by the test set configuration module and the configuration of the interface determined by the interface path configuration module; for example, after receiving a Mock request from a client, a routing parameter capturing module of the server Mock extracts routing information in the Mock request. And the routing parameter decision module determines an interface to be called according to the acquired routing information, the preset interface access parameter configuration information and the interface path configuration information preset by the interface path configuration module. And the case post message sending decision module determines a data processing strategy according to the test information and the service parameters in the Mock request, the test environment configuration information preset by the environment configuration module and the test set configuration information preset by the test set configuration module. The service data circulation/check of the server Mock is used for executing corresponding test processing according to the acquisition configuration of the interface/use case import parameter configuration module on the parameters, the return configuration of the interface/use case return value configuration module on the parameters and the processing configuration of the interface asynchronous call configuration module on the MQ information and the like; for example, in the process of acquiring target output data, the request service data entry parameter capturing and transferring module extracts a target input parameter from the service parameter according to the service parameter and interface entry parameter configuration information preset by the interface/use case entry parameter configuration module, updates a test set by using the target input parameter and preset test set configuration information, the request service data entry parameter capturing and transferring module acquires output data to be processed from the interface to be called, acquires target output data according to the output data to be processed and the test set, and after acquiring the target output data, if the test set needs to be updated according to the interface exit parameter configuration information preset by the interface/use case return value configuration module, the request service data entry parameter capturing and transferring module updates data in the test set by using the output data to be processed, and acquiring the target output data by using the updated data in the test set, and if the data to be processed needs to be acquired from an external system, calling the external system according to the configuration of the interface asynchronous calling configuration module, and processing the data to be processed (for example, updating the data in the test set) according to the interface return value configuration information of the interface/use case return value configuration module. The protocol type path of the server Mock is used for executing corresponding test processing according to the acquisition configuration of the interface/use case parameter configuration module on the parameters, the return configuration of the interface/use case return value configuration module on the parameters and the processing configuration of the interface asynchronous call configuration module on the MQ information and the like; for example, after receiving a service request and extracting corresponding parameters according to an interface/use case entry configuration module, the service request is converted into data of a protocol type supported by the system according to the protocol type used by the service request, or for data returned to a client, the data required to be returned to the client is obtained according to an interface/use case return value configuration module and then is converted into data of a protocol type supported by the client, or for data interaction with an external system, the data of the external system is converted into data of a supported protocol type, or the data of the system is converted into data of a protocol type supported by the external system.
As shown in FIG. 2, an architectural diagram is implemented for the techniques of an embodiment of the present invention. Referring to fig. 2, the design architecture of the embodiment of the present invention can be divided into: (1) a business layer, (2) a decision layer, and (3) a persistence layer, etc.
(1) The business layer mainly realizes the functions of case management and automatic regression in the system shown in FIG. 1. The case management is mainly used for managing the test cases, and the automatic regression function is mainly used for determining which test cases are started according to modes such as configuration and the like so as to perform the automatic regression test.
(2) The decision layer mainly corresponds to the function of the server Mock in fig. 1, and may include a use case traversar, a use case adapter, a use case type adapter, a server Mock decision adapter, and the like. The use case traversing device is used for grabbing data of all client users needing to be called according to the decision of the server Mock decision adapter and calling the data in sequence; the case adapter is used for determining the used test case according to the request of the client; the case type adapter is used for enabling the client side case to enter an automatic regression process; the server Mock decision adapter is used for making a decision according to the configuration of the use case and deciding a return mode of a return value, such as forwarding the actual service and returning, synchronously returning, asynchronously returning and initiating an MQ message.
(3) The persistence layer is mainly used for storing test sets and use cases.
With reference to fig. 1 and 2, the flow of the test process using the above system may include the following steps:
1) and starting the system, reading the key configuration data, and initializing the system according to the configuration data.
2) And after receiving a mock request of the client, the system determines an interface to be called and a data processing strategy according to the initialized interface comparison, and enters a corresponding interface mock logic.
3) And after the logic matching of the interface mock is successful, acquiring interface parameters and circulating, and matching the acquired data with the interface with the import parameter configuration. And after the matching is successful, simulating the service flow.
4) And processing data according to the simulation of the business process and the data processing strategy.
The simulation of the business process may include data stream conversion, data transmission, and data update. All interfaces configured to a business process share a test set. After the interface matching is successful, whether the input parameters are written into the test set, whether MQ messages are sent according to the configuration, whether new data are automatically generated and the like are determined according to the data processing strategy to process the data.
5) And returning a data processing result.
In this step, the return value is matched to the data in the test set. And if the part of the return value is updated according to the configuration requirement, updating the data in the test set and returning the updated return value. In this way, the value in the argument in the previous interface call or MQ notification can be returned in the return value of the interface or the next interface, thereby achieving the result of mock traffic flow.
Referring to fig. 3, fig. 3 is a flowchart of a test processing method provided by the embodiment of the present invention, and is applied to a server. As shown in fig. 3, the method comprises the following steps:
step 301, receiving a Mock request of a client.
In the embodiment of the present invention, the Mock request of the client may include the following contents: routing information, test information, service parameters, etc. Wherein the routing information may represent information of an interface desired to be invoked. The test information may include tester information, test set information, and the like. The service parameters refer to parameters related to specific test contents, such as subscriber information, application sheet number, quota and the like.
When the test is needed, the client sends a Mock request to the server, and correspondingly, the server receives the Mock request sent by the client.
Specifically, referring to fig. 1, in this step, in an embodiment, the Mock request of the client may be received by the routing parameter capture module of the Mock data return route decision device of the server. The Mock request of the client can be manually triggered by a Mock data return route decision device through an interface or automatically triggered by a Mock module to automatically trigger the Mock request.
And step 302, determining an interface to be called and a data processing strategy according to the Mock request.
Because different services may involve different interfaces, even the same service may also be provided with a plurality of interfaces to implement the whole function, in the embodiment of the present invention, in order to further improve the testing efficiency and accurately process the Mock request of the client, in this step, the interface to be invoked may be determined according to the routing information, the interface entry configuration information, and the interface path configuration information. When determining the data processing policy, the data processing policy may be determined according to the test information and the service parameter. Wherein the data processing policy comprises at least one of: and returning the target output data to the client, and sending MQ messages, wherein the MQ messages are used for calling a test interface for the next test and/or transferring test data streams. In a specific application process, a data processing strategy can be determined according to the test information, the service parameters, the preset test environment configuration information and the preset test set configuration information.
It should be noted that the "next test" in the present embodiment refers to one sub-test step in the comprehensive test of at least two associated processes performed on the application service, for example, if the application service includes five associated processes, the comprehensive test refers to performing a continuous one-time test on at least two of the five associated processes. Further, for example, for the loan application service, the method generally includes querying personal information, querying credit according to the personal information, querying the loan amount according to the credit assessment result, and returning a final approval result to the user according to the queried loan amount, so that the comprehensive test at least includes two connected continuous sub-test steps of querying credit according to the personal information and querying the loan amount according to the credit assessment result, and as an illustration, the "next test" described in this embodiment refers to the sub-test step of querying the loan amount according to the credit assessment result.
Wherein returning the target output data to the client means returning final data to the client. The source of this data is primarily the test set. The data in the test set mainly comes from the service parameters, the data returned from each interface in the service flow process and the data from the external system.
In general, if a Mock is actually used, if a Mock request of a client is received, a return value needs to be output to the client correspondingly. However, it is also possible to involve the invocation of multiple interfaces and the flow of data before returning a value to the client. Therefore, according to different Mock requests and test requirements, the embodiment can also determine to implement the call and data flow of the interface between each interface, and the call and data flow of the interface can be implemented by sending MQ messages. And data in the test set can be correspondingly updated through the data returned by each interface.
Specifically, as shown in fig. 1, in this step, after receiving a Mock request from a client, a routing parameter capture module of a server Mock extracts routing information in the Mock request. And a routing parameter decision module of the server determines an interface to be called according to the routing information, the interface access parameter configuration information and the interface path configuration information in the obtained Mock request, wherein the routing information and the interface have a corresponding relationship, and each interface is correspondingly provided with corresponding interface access parameter configuration information. And the use case post message sending decision module of the server side determines a data processing strategy according to the test information and the service parameters in the Mock request of the client side, the preset test environment configuration information and the preset test set configuration information. The preset test environment configuration information and the preset test set configuration information are configured in advance by environment/test set configuration, case/interface configuration and a plurality of sub-modules in configuration management of case management. The data processing policy may, in some embodiments, be to return a data processing return value to the client, to send MQ information during the testing for use in a next test of the test, or to update the test set based on the data processing return value.
In this embodiment, when the routing parameter decision module of the server receives the Mock request and extracts parameters such as user information, application order number, amount and the like related to specific test content according to the interface/use case parameter configuration module, the protocol type routing of the server converts the Mock request into data of a protocol type supported by the system of the test according to the protocol type used by the Mock request.
And 303, acquiring target output data from the interface to be called.
Specifically, in this step, a target input parameter is extracted from the service parameter according to the service parameter and preset interface parameter configuration information. And then, updating the test set by using the target input parameters and preset test set configuration information. And then, acquiring output data to be processed from the interface to be called, and acquiring target output data according to the output data to be processed and the test set.
And determining whether the data in the test set needs to be updated according to preset interface parameter configuration information in the process of acquiring target output data according to the output data to be processed and the test set. And if the data in the test set needs to be updated, updating the data in the test set by using the output data to be processed, and acquiring the target output data by using the updated data in the test set. For example, a certain key value is configured in the test set, and the output data to be processed has a specific parameter value of the key, then the test set needs to be updated according to the returned parameter.
And configuring which parameters are required to be obtained from the Mock request of the client for different test sets according to the interface access configuration information and the test set configuration information. Therefore, it is necessary to extract target input parameters from the business parameters and use the target input parameters to update the corresponding parameter values in the test set. If no other interface needs to be called, the output value can be returned directly according to the parameter value in the test set. If the calling of the interface is involved, the data in the parameter set is updated according to the data obtained from other interfaces and returned to the client.
Specifically, with reference to fig. 1, in this step, the target output data is obtained through the service data transfer/verification request service data entry parameter capturing and transfer module of the server. In the process of obtaining target output data, a request service data parameter access capturing and circulation module extracts target input parameters configured by an interface/use parameter access configuration module from service parameters according to the service parameters in the Mock request and interface parameter access configuration information. And then, updating the test set by using the target input parameters and preset test set configuration information. Further, the service request data entry parameter capturing and circulation module of the server side acquires output data to be processed from the interface to be called, and acquires target output data according to the output data to be processed and the test set. After the target output data is obtained, if the interface parameter configuration information determined by the interface/use case return value configuration module needs to update the test set, the service request data parameter acquisition and circulation module of the server updates the data in the test set by using the output data to be processed, and obtains the target output data by using the updated data in the test set. And 304, processing the target output data according to the data processing strategy.
Specifically, in this step, if the data processing policy includes returning the target output data to the client, the target output data is obtained from the test set and sent to the client.
And if the data processing strategy comprises the step of sending MQ information, determining a first interface for carrying out the next test according to preset interface asynchronous calling configuration information. The first interface may refer to any one of interfaces that need to be called. Thereafter, an MQ message is sent to the first interface, including the target output data in the MQ message. In addition to sending MQ messages to the first interface, in embodiments of the present invention, first data may also be obtained from the first interface, and then the data in the test set may be updated based on the first data.
As shown in fig. 1, it should be particularly noted that, when the data processing policy includes sending an MQ message, and determining a first interface for performing a next test according to preset interface asynchronous call configuration information, the requested service data capturing and checking module for performing service data streaming/checking of the client under the next test is used to extract returned data from data returned by the current client and store the data to perform the next test.
In addition, in order to make the data in the test set more accurate, in the embodiment of the present invention, the data to be processed may be further acquired from an external system, and the data to be processed is processed according to the interface return value configuration information, for example, the data in the test set is updated.
Specifically, in this step, the server may process the acquired target output data according to a decision of a use case post message sending decision module of use case management. If the target output data needs to be returned to the client, the communication with the client is triggered by using a case post message sending decision module so as to output the target output data to the client; if MQ messages need to be sent, the MQ messages are triggered and sent through the use case post-message sending decision module.
Specifically, in this embodiment, when or for target output data that needs to be returned to the client, the target output data that needs to be returned to the client is obtained by the interface/use case return value configuration module and then converted into data of a protocol type supported by the client. Or, in some embodiments, for data used for data interaction with an external system, converting the data of the external system into data of a protocol type supported by the system of the test; similarly, in some embodiments, the present application may also convert the data of the present system into data of a protocol type supported by the external system.
In the embodiment of the invention, after a Mock request of a client is received, an interface to be called and a data processing strategy are determined according to the Mock request, target output data are obtained from the interface to be called, and then the target output data are processed according to the data processing strategy. Because the data processing strategy at least comprises returning target output data, sending MQ messages and the like, the scheme of the embodiment of the invention can return values of different called interfaces, and can realize data circulation between service flows or next test in the mode of MQ messages and the like. Therefore, the scheme of the embodiment of the invention can improve the testing efficiency.
In addition, in order to further improve the testing efficiency, in the embodiment of the present invention, at least one of the following information may be configured in advance: the method comprises the following steps of testing environment configuration information, testing set configuration information, interface path configuration information, interface entry parameter configuration information, interface return value configuration information and interface asynchronous calling configuration information.
Specifically, as shown in fig. 1, before the test processing method according to the embodiment of the present invention is executed, the pre-configuration of the corresponding parameters may be performed through each module of the case management.
Referring to fig. 4, fig. 4 is a flowchart of a test processing method provided by the embodiment of the present invention, and is applied to a client. As shown in fig. 4, the method comprises the following steps:
step 401, sending a Mock request to a server.
In the embodiment of the present invention, the sending of the Mock request to the server may also be automatically triggered according to a preset triggering condition. The preset trigger condition may be, for example, an order of calling the interfaces.
Referring to fig. 1, in this embodiment, a Mock request of a client may be manually triggered by a Mock module through an interface of a Mock data return route decision device of the client, or automatically triggered by the Mock module to automatically trigger the Mock request.
Wherein, the Mock request of the client may include: the following contents are provided: routing information, test information, traffic parameters, etc.
Referring to fig. 1 again, at the server, after receiving the Mock request from the client, the routing parameter capturing module of the server Mock extracts the routing information in the Mock request. And a routing parameter decision module of the server determines an interface to be called according to the routing information, the interface access parameter configuration information and the interface path configuration information in the obtained Mock request, wherein the routing information and the interface have a corresponding relationship, and each interface is correspondingly provided with corresponding interface access parameter configuration information. And the use case post message sending decision module of the server side determines a data processing strategy according to the test information and the service parameters in the Mock request of the client side, the preset test environment configuration information and the preset test set configuration information. The preset test environment configuration information and the preset test set configuration information are configured in advance by environment/test set configuration, case/interface configuration and a plurality of sub-modules in configuration management of case management. The data processing policy may, in some embodiments, be to return a data processing return value to the client, to send MQ information during the testing for use in a next test of the test, or to update the test set based on the data processing return value.
In this embodiment, when the routing parameter decision module of the server receives the Mock request and extracts parameters such as user information, application order number, amount and the like related to specific test content according to the interface/use case parameter configuration module, the protocol type routing of the server converts the Mock request into data of a protocol type supported by the system of the test according to the protocol type used by the Mock request. And 402, receiving target output data sent by the server. And the target output data is sent when the server determines to return the target output data according to the data processing strategy.
As shown in fig. 1, in this step, after receiving the Mock request, the server obtains the target output data through the service data transfer/verification request service data join-capture and transfer module of the server. In the process of obtaining target output data, a request service data parameter access capturing and circulation module extracts target input parameters configured by an interface/use parameter access configuration module from service parameters according to the service parameters in the Mock request and interface parameter access configuration information. And then, updating the test set by using the target input parameters and preset test set configuration information. Further, the service request data entry parameter capturing and circulation module of the server side acquires output data to be processed from the interface to be called, and acquires target output data according to the output data to be processed and the test set. After the target output data is obtained, if the interface parameter configuration information determined by the interface/use case return value configuration module needs to update the test set, the service request data parameter acquisition and circulation module of the server updates the data in the test set by using the output data to be processed, and obtains the target output data by using the updated data in the test set.
In addition, in the embodiment of the present invention, the client may further obtain data from other clients, and store the data.
In the embodiment of the invention, after a Mock request of a client is received, an interface to be called and a data processing strategy are determined according to the Mock request, target output data are obtained from the interface to be called, and then the target output data are processed according to the data processing strategy. Because the data processing strategy at least comprises returning target output data, sending MQ messages and the like, the scheme of the embodiment of the invention can return values of different called interfaces, and can realize data circulation between service flows or next test in the mode of MQ messages and the like. Therefore, the scheme of the embodiment of the invention can improve the testing efficiency.
Taking the Mock credit granting business process as an example, the test process at least comprises two business steps of submitting credit granting and inquiring a credit granting result. Wherein, the configuration is as follows: configuring some interface in the trust process can trigger MQ message and modify the state field of some service. Suppose that the credit granting business process has two MQ sending messages, which are triggered after 5 seconds and 10 seconds of submitting the request of the client, and respectively send the MQ messages, and the carried states are A and N respectively.
With reference to fig. 5, the test processing method according to the embodiment of the present invention may include:
step 501, receiving a Mock request of a client, where the Mock request may include a credit granting application parameter, such as a user name, an application order number, and the like. Assume that this state is I.
Step 502, the system captures and circulates data according to the routing information, the interface access parameter configuration information and the interface path configuration information in the Mock request, and meanwhile, the captured data is covered on other interfaces needing to be continuously called and return values of the continuously called interfaces are obtained.
Step 503, if receiving the query request temporarily initiated by the client, outputting a return value to the client, where the state is I.
And step 504, after receiving the Mock request 5s from the client, sending the MQ message, and simultaneously carrying the state A and the acquired global parameters.
And 505, if receiving a query request temporarily initiated by the client, outputting a return value to the client, wherein the state is A.
Step 506, after receiving the Mock request 10s from the client, sending an MQ message, carrying the state N and the obtained global parameters.
And 507, if a Mock request of the client is received, outputting a return value to the client, wherein the state is N.
Suppose that it is the loan amount in the user's personal data that is to be queried. If the user's credit line is 20000 when applying for loan, however, the simulated credit line is 10000 when Mock approves, and the credit line is configured as business flow data. Then, the returned value of 20000 is output for the first query before approval. Since the circulation is performed, the output return value is 10000 when the second query is performed after the approval. If the credit line is 5000, the output return value will be 5000 at the third inquiry after considering the credit line and examining and approving.
In summary, the scheme of the embodiment of the invention can simulate the service, thereby avoiding excessive dependence on the surrounding application environment in the test. The system can support the sending of MQ messages, thereby solving the problem that the calling party can not receive the MQ messages in the existing mock process. In addition, by using the scheme of the embodiment of the invention, a plurality of Mock tests can be simultaneously operated and are mutually independent through the application of the same configuration to different environments, thereby saving the hardware resources of the test environment. Especially for the business in the financial field, because the uniqueness of the business has strong dependence on the business process, the scheme of the embodiment of the invention can solve the configuration of the business process mock, thereby effectively improving the testing capability and the research and development docking efficiency of the financial business.
The embodiment of the invention also provides a test processing device which is applied to the server side. Referring to fig. 6, fig. 6 is a structural diagram of a test processing apparatus according to an embodiment of the present invention. Because the principle of the test processing device for solving the problems is similar to the test processing method in the embodiment of the present invention, the implementation of the test processing device can refer to the implementation of the method, and repeated details are not repeated.
As shown in fig. 6, the test processing apparatus 600 includes: a first receiving module 601, configured to receive a Mock request of a client; a first determining module 602, configured to determine, according to the Mock request, an interface to be called and a data processing policy; a first obtaining module 603, configured to obtain target output data from the interface to be called; a first processing module 604, configured to process the target output data according to the data processing policy; wherein the data processing policy comprises at least one of: and returning the target output data to the client, and sending MQ messages, wherein the MQ messages are used for calling a test interface for the next test and/or transferring test data streams.
Optionally, the Mock request includes routing information, test information, and service parameters; the first determining module may include: the first determining submodule is used for determining an interface to be called according to the routing information, the interface access parameter configuration information and the interface path configuration information; and the second determining submodule is used for determining a data processing strategy according to the test information and the service parameters.
Optionally, the second determining submodule is configured to determine the data processing policy according to the test information, the service parameter, preset test environment configuration information, and preset test set configuration information.
Optionally, the Mock request includes a service parameter; the first obtaining module may include:
the first extraction submodule is used for extracting a target input parameter from the service parameter according to the service parameter and preset interface parameter configuration information; the first updating submodule is used for updating the test set by using the target input parameters and preset test set configuration information; the first obtaining submodule is used for obtaining output data to be processed from the interface to be called; and the second obtaining submodule is used for obtaining target output data according to the output data to be processed and the test set.
Optionally, the second obtaining sub-module may include:
the determining unit is used for determining whether the data in the test set needs to be updated according to the preset interface parameter configuration information; the updating unit is used for updating the data in the test set by using the output data to be processed if the data in the test set is determined to be required to be updated; and the acquisition unit is used for acquiring the target output data by using the updated data in the test set.
Optionally, the first processing module is configured to, if the data processing policy includes returning target output data, obtain the target output data from the test set, and send the target output data to the client.
Optionally, the first processing module includes: the first determining submodule is used for determining a first interface for carrying out the next test according to preset interface asynchronous calling configuration information if the data processing strategy comprises the step of sending MQ information; and the first sending submodule is used for sending an MQ message to the first interface, and the MQ message comprises the target output data.
Optionally, the first processing module further includes: the first obtaining submodule is used for obtaining first data from the first interface; and the first updating submodule is used for updating the data in the test set according to the first data.
Optionally, the apparatus may further include: the third acquisition module is used for acquiring data to be processed from an external system; and the second processing module is used for processing the data to be processed according to the interface return value configuration information.
Optionally, the apparatus further comprises: a configuration module, configured to pre-configure at least one of the following information:
the method comprises the following steps of testing environment configuration information, testing set configuration information, interface path configuration information, interface entry parameter configuration information, interface return value configuration information and interface asynchronous calling configuration information.
The apparatus provided in the embodiment of the present invention may implement the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
The embodiment of the invention also provides a test processing device which is applied to the client. Referring to fig. 7, fig. 7 is a structural diagram of a test processing apparatus according to an embodiment of the present invention. Because the principle of the test processing device for solving the problems is similar to the test processing method in the embodiment of the present invention, the implementation of the test processing device can refer to the implementation of the method, and repeated details are not repeated.
As shown in fig. 7, the test processing apparatus 700 includes: a first sending module 701, configured to send a Mock request to a server; a first receiving module 702, configured to receive target output data sent by the server; and the target output data is sent when the server determines to return the target output data according to the data processing strategy.
Optionally, the first sending module 701 is configured to automatically trigger sending of a Mock request to the server according to a preset trigger condition.
Optionally, the apparatus may further include: and the acquisition module is used for acquiring data from other clients and storing the data.
The apparatus provided in the embodiment of the present invention may implement the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
An embodiment of the present invention further provides an electronic device, including: a memory, a processor, and a program stored on the memory and executable on the processor. Wherein, the processor is used for reading the program in the memory to realize the process of any one of the method embodiments.
The embodiment of the present invention further provides a readable storage medium, where a program is stored on the readable storage medium, and when the program is executed by a processor, the program implements each process of the above-mentioned test processing method embodiment, and can achieve the same technical effect, and in order to avoid repetition, the detailed description is omitted here. The readable storage medium may be any available medium or data storage device that can be accessed by a processor, including but not limited to magnetic memory (e.g., floppy disk, hard disk, magnetic tape, magneto-optical disk (MO), etc.), optical memory (e.g., CD, DVD, BD, HVD, etc.), and semiconductor memory (e.g., ROM, EPROM, EEPROM, nonvolatile memory (NAND FLASH), Solid State Disk (SSD)), etc.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. With such an understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. A test processing method is applied to a server side, and is characterized by comprising the following steps:
receiving a Mock request of a client;
determining an interface to be called and a data processing strategy according to the Mock request;
acquiring target output data from the interface to be called;
processing the target output data according to the data processing strategy;
wherein the data processing policy comprises at least one of:
and returning the target output data to the client, and sending a message queue MQ message, wherein the MQ message is used for calling a test interface for the next test and/or transferring test data stream.
2. The method according to claim 1, wherein the determining an interface to be called and a data processing policy according to the Mock request specifically comprises:
determining an interface to be called according to the routing information, the interface access parameter configuration information and the interface path configuration information in the Mock request;
and determining a data processing strategy according to the test information and the service parameters in the Mock request, the preset test environment configuration information and the preset test set configuration information.
3. The method of claim 1, wherein the Mock request comprises a traffic parameter; the acquiring of the target output data from the interface to be called specifically includes:
extracting target input parameters from the service parameters according to the service parameters and preset interface access parameter configuration information;
updating the test set by using the target input parameters and preset test set configuration information;
acquiring output data to be processed from the interface to be called;
and acquiring target output data according to the output data to be processed and the test set.
4. The method of claim 3, wherein obtaining target output data from the output data to be processed and the test set comprises:
determining whether the data in the test set needs to be updated or not according to preset interface parameter configuration information;
if the data in the test set needs to be updated, updating the data in the test set by using the output data to be processed;
and acquiring the target output data by using the updated data in the test set.
5. The method of claim 1, wherein processing the target output data according to the data processing policy comprises:
if the data processing strategy comprises the step of sending MQ information, determining a first interface for carrying out the next test according to preset interface asynchronous calling configuration information;
sending an MQ message to the first interface, the MQ message including the target output data for further testing.
6. The method of claim 1, wherein after the processing the target output data according to the data processing policy, the method further comprises:
acquiring data to be processed from an external system;
and processing the data to be processed according to the interface return value configuration information.
7. The method of claim 1, wherein prior to receiving the client's simulated Mock request, the method further comprises:
at least one of the following information is pre-configured:
the method comprises the following steps of testing environment configuration information, testing set configuration information, interface path configuration information, interface entry parameter configuration information, interface return value configuration information and interface asynchronous calling configuration information.
8. A test processing method is applied to a client side, and is characterized by comprising the following steps:
sending a Mock request to a server;
receiving target output data sent by the server;
the target output data is sent when the server determines to return the target output data according to a data processing strategy;
wherein, the sending the Mock request to the server includes:
and automatically triggering to send a Mock request to the server according to a preset triggering condition.
9. An electronic device, comprising: a memory, a processor, and a program stored on the memory and executable on the processor; -wherein the processor, for reading the program implementation in the memory, comprises the steps in the test processing method of any of claims 1 to 7; or implementing steps comprising in a test processing method according to claim 8.
10. A readable storage medium storing a program which, when executed by a processor, implements steps comprising the test processing method of any one of claims 1 to 7; or implementing steps comprising in a test processing method according to claim 8.
CN202010941736.4A 2020-09-09 2020-09-09 Test processing method, device, equipment and readable storage medium Active CN114238065B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010941736.4A CN114238065B (en) 2020-09-09 2020-09-09 Test processing method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010941736.4A CN114238065B (en) 2020-09-09 2020-09-09 Test processing method, device, equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN114238065A true CN114238065A (en) 2022-03-25
CN114238065B CN114238065B (en) 2024-07-12

Family

ID=80742669

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010941736.4A Active CN114238065B (en) 2020-09-09 2020-09-09 Test processing method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN114238065B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115695219A (en) * 2022-10-28 2023-02-03 河北幸福消费金融股份有限公司 Mock platform management system, method, device and storage medium
CN116303062A (en) * 2023-03-27 2023-06-23 广州钛动科技股份有限公司 Service interface testing method and device, terminal equipment and readable storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090299680A1 (en) * 2008-05-29 2009-12-03 Electronic Data Systems Corporation System and method for message-queue-based server testing
CN109597754A (en) * 2018-10-22 2019-04-09 中国平安财产保险股份有限公司 Operation flow interface test method, device, computer equipment and storage medium
CN110727580A (en) * 2019-09-03 2020-01-24 深圳壹账通智能科技有限公司 Response data generation method, full-flow interface data processing method and related equipment
CN110851364A (en) * 2019-11-12 2020-02-28 深圳市前海随手数据服务有限公司 Software testing method, system and related equipment
CN110912856A (en) * 2018-09-14 2020-03-24 千寻位置网络有限公司 Non-invasive mock payment method and system, payment server and mock server
US20200183822A1 (en) * 2017-01-20 2020-06-11 Intuit Inc. Mock server for testing
CN111290941A (en) * 2018-12-10 2020-06-16 北京京东尚科信息技术有限公司 Method and device for testing multiple interfaces, computing equipment and medium
CN111400178A (en) * 2020-03-13 2020-07-10 深圳前海环融联易信息科技服务有限公司 Automatic interface number making method and device, computer equipment and storage medium
CN111427766A (en) * 2020-02-20 2020-07-17 北京齐尔布莱特科技有限公司 Request processing method and device and proxy server
CN111522727A (en) * 2019-02-01 2020-08-11 阿里巴巴集团控股有限公司 Simulation object test method, device and system
CN111597120A (en) * 2020-05-26 2020-08-28 中国工商银行股份有限公司 Interface test apparatus, method, electronic device, and computer-readable storage medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090299680A1 (en) * 2008-05-29 2009-12-03 Electronic Data Systems Corporation System and method for message-queue-based server testing
US20200183822A1 (en) * 2017-01-20 2020-06-11 Intuit Inc. Mock server for testing
CN110912856A (en) * 2018-09-14 2020-03-24 千寻位置网络有限公司 Non-invasive mock payment method and system, payment server and mock server
CN109597754A (en) * 2018-10-22 2019-04-09 中国平安财产保险股份有限公司 Operation flow interface test method, device, computer equipment and storage medium
CN111290941A (en) * 2018-12-10 2020-06-16 北京京东尚科信息技术有限公司 Method and device for testing multiple interfaces, computing equipment and medium
CN111522727A (en) * 2019-02-01 2020-08-11 阿里巴巴集团控股有限公司 Simulation object test method, device and system
CN110727580A (en) * 2019-09-03 2020-01-24 深圳壹账通智能科技有限公司 Response data generation method, full-flow interface data processing method and related equipment
CN110851364A (en) * 2019-11-12 2020-02-28 深圳市前海随手数据服务有限公司 Software testing method, system and related equipment
CN111427766A (en) * 2020-02-20 2020-07-17 北京齐尔布莱特科技有限公司 Request processing method and device and proxy server
CN111400178A (en) * 2020-03-13 2020-07-10 深圳前海环融联易信息科技服务有限公司 Automatic interface number making method and device, computer equipment and storage medium
CN111597120A (en) * 2020-05-26 2020-08-28 中国工商银行股份有限公司 Interface test apparatus, method, electronic device, and computer-readable storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
ANDREA ARCURI: "RESTful API Automated Test Case Generation", 《2017 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE QUALITY, RELIABILITY AND SECURITY (QRS)》, 14 August 2017 (2017-08-14), pages 9 - 20 *
何舒: "API接口自动化测试系统设计及实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》, 15 March 2019 (2019-03-15), pages 138 - 506 *
张江: "某种软件API自动化测试工具的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》, 15 February 2012 (2012-02-15), pages 138 - 1331 *
张珊33: "接口测试-mock测试", pages 1 - 5, Retrieved from the Internet <URL:https://www.cnblogs.com/zhangshan33/p/11978910.html> *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115695219A (en) * 2022-10-28 2023-02-03 河北幸福消费金融股份有限公司 Mock platform management system, method, device and storage medium
CN116303062A (en) * 2023-03-27 2023-06-23 广州钛动科技股份有限公司 Service interface testing method and device, terminal equipment and readable storage medium
CN116303062B (en) * 2023-03-27 2023-12-19 广州钛动科技股份有限公司 Service interface testing method and device, terminal equipment and readable storage medium

Also Published As

Publication number Publication date
CN114238065B (en) 2024-07-12

Similar Documents

Publication Publication Date Title
CN109922158A (en) Data processing method, device, medium and electronic equipment based on micro services
CN108881228A (en) Cloud registration activation method, device, equipment and storage medium
CN111858083B (en) Remote service calling method and device, electronic equipment and storage medium
CN110677383B (en) Firewall wall opening method and device, storage medium and computer equipment
CN107547213B (en) Method and device for identifying business rules
CN111200523B (en) Method, device, equipment and storage medium for configuring middle platform system
CN111026672A (en) Test method, terminal equipment and mock server
CN114238065A (en) Test processing method, device, equipment and readable storage medium
CN109639719A (en) A kind of auth method and device based on temporary identifier
KR100738040B1 (en) Method for providing application Program Interface in open mobile business supporting system
CN112202744B (en) Multi-system data communication method and device
US7937696B2 (en) Method, system and program product for adapting software applications for client devices
CN112788518B (en) Location service processing method and related equipment
CN114745449A (en) Message processing method and device, storage medium and electronic equipment
CN113541981B (en) Member management method and system for network slice
US20190166255A1 (en) Dynamically Generated Call Triggers
CN114675876B (en) Service processing method and device, electronic equipment and storage medium
CN116700705A (en) Service system docking method and system based on configuration
CN110351345A (en) Method and device for service request processing
CN113132928B (en) Charging method and device for video short message service
CN113691575B (en) Communication method, device and system
CN117135580A (en) 5G message universal access system and method
CN116418711A (en) Service gateway testing method, equipment, storage medium and product
KR100834569B1 (en) Open service verification apparatus and method
CN112261051B (en) User registration method, device and system

Legal Events

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