A testing method, device, equipment and storage medium
By obtaining and refactoring the initial message package into a test message package by itself and issuing it according to the strategy, the problem of low testing efficiency in the existing technology is solved, and a more efficient test process and more accurate test results are achieved.
Patent Information
- Application Number
- CN202210377077.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-11
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2042-04-11
AI Technical Summary
In the testing of decoupled scenarios, the prior art needs to rely on message middleware to push test message packets, resulting in inefficient testing and inability to independently meet the needs of target test scenarios.
By obtaining the initial message packet, refactoring it into a test message packet, and issuing it to the service end under test according to the message consumption strategy, releasing the dependence on the message middleware.
Improve testing efficiency, ensure that the test message package meets the needs of the target test scenario, reduces dependence on the upstream business side, and improves the flexibility and accuracy of testing.
Smart Images

Figure CN114691517B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a testing method, apparatus, device, and storage medium in the field of Internet communication technology. Background Art
[0002] The system architecture of medium and large-scale Internet companies is becoming increasingly complex. As a result, message middleware is being used to achieve asynchronous decoupling between business modules within the system architecture. Currently, in decoupling scenario testing, the following two solutions are mainly used to push test message packages:
[0003] 1. Apply for multiple message middleware resources, and have the message middleware push the test message package to the business end under test;
[0004] 2. The business end under test deassembles the test message package from the consumer interface and calls the test message package independently. Summary of the Invention
[0005] The present disclosure provides a more efficient testing method, apparatus, device, and storage medium.
[0006] According to one aspect of the present disclosure, a testing method is provided, including: obtaining an initial message packet, the initial message packet containing test data required for a target test scenario; reconstructing the initial message packet to obtain a test message packet; obtaining a message consumption policy corresponding to the test message packet; and sending the test message packet to a service end under test according to the message consumption policy.
[0007] According to another aspect of the present disclosure, a testing device is provided, including: a first acquisition module, used to obtain an initial message packet, the initial message packet containing test data required for the target test scenario; a reconstruction module, used to reconstruct the initial message packet to obtain a test message packet; a second acquisition module, used to obtain a message consumption policy corresponding to the test message packet; and a sending module, used to send the test message packet to the business end under test according to the message consumption policy.
[0008] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in the present disclosure.
[0009] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure.
[0010] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, which implements the method described in the present disclosure when executed by a processor.
[0011] The present disclosure provides a testing method, apparatus, device and storage medium, which, when testing a business end under test, can customize and send test message packages according to the requirements of the target test scenario. There is no need to communicate with the upstream business end and passively wait for the upstream business end to provide the test message package. Therefore, the dependence on the message middleware can be eliminated, and the testing efficiency can be improved.
[0012] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings are used to better understand the present invention and do not constitute a limitation of the present invention.
[0014] Figure 1 is a flow chart of a testing method according to the first embodiment of the present disclosure;
[0015] Figure 2 is an application scenario diagram of a testing method according to the first embodiment of the present disclosure;
[0016] Figure 3 is a flow chart of a testing method according to the second embodiment of the present disclosure;
[0017] Figure 4 is a flowchart of a testing method according to the fourth embodiment of the present disclosure;
[0018] Figure 5 is a flowchart of a testing method according to the sixth embodiment of the present disclosure;
[0019] Figure 6 is a structural schematic diagram of a testing device according to an eighth embodiment of the present disclosure;
[0020] Figure 7 The block diagram is a block diagram of an electronic device used to implement a testing method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0021] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0022] Figure 1 is a flow chart of a testing method according to the first embodiment of the present disclosure. Figure 1 As shown, the method mainly includes:
[0023] Step S101: obtaining an initial message packet, where the initial message packet includes test data required for a target test scenario.
[0024] In this embodiment, it is first necessary to obtain the initial message package, which can be captured in the online log. The initial message package generally includes a message header and a message body. The message body will contain the test data required for the target test scenario. For example, in the order process business, the message body may contain user name, order status, order quantity, etc. Different target test scenarios may contain different data in the message body.
[0025] In one possible implementation, message packets generated by each business scenario are stored in the online log. Therefore, the initial message packet in the online log includes the test data required for various test scenarios, thereby avoiding the problem of missing certain scenarios during testing. Specifically, when capturing the initial message packet in the online log, the corresponding initial message packet can be captured based on the current target test scenario.
[0026] Step S102: reconstruct the initial message packet to obtain a test message packet.
[0027] In this embodiment, after obtaining the initial message packet, it is necessary to reconstruct the initial message packet. Specifically, the initial message packet is generated in a business scenario, and the business data contained therein may not cover all the test data required by the target test scenario. Therefore, the initial message packet needs to be reconstructed. That is, the initial message packet is reconstructed based on the test data required by the target test scenario to obtain a test message packet.
[0028] In one possible implementation method, corresponding test data can be generated according to different requirements of the target test scenario, and then all the test data can be stored. After obtaining the initial message packet, the initial message packet can be reconstructed using the stored test data, that is, the test data in the initial message packet can be replaced one by one with the stored test data, thereby obtaining multiple test message packets corresponding to the target test scenario.
[0029] Step S103: Obtain the message consumption policy corresponding to the test message package.
[0030] In this embodiment, after obtaining the test message package, it is also necessary to obtain the message consumption policy corresponding to the test message package. The message consumption policy is used to indicate the method of sending the test message package.
[0031] In one embodiment, the message consumption policy can be determined by the tester based on the target test scenario. For example, the tester determines the consumption address of the test message packet based on the address of the tested business end in the target test scenario; determines how to trigger the delivery of the test message packet based on the test process in the target test scenario; and determines how to handle the failure of the test message packet delivery based on the test requirements in the target test scenario. The content of the message consumption policy can be determined based on the target test scenario, and the tester can also set other related policies. Specifically, a user interface can be set for the tester to input the message consumption policy. When the test message package is issued, the message consumption policy entered by the tester can be directly obtained.
[0032] Step S104: Send a test message packet to the service end under test according to the message consumption policy.
[0033] In this embodiment, the test message packet is sent to the service end under test according to the acquired message consumption policy. Specifically, the service end under test can be the system, software or device under test, which is the downstream of the test environment.
[0034] In one possible implementation method, first obtain the consumption address of the test message package in the message consumption policy, that is, the address of the business end under test. If the message consumption policy indicates automatic triggering of the delivery of the message test package, the test message package is delivered to the business end under test according to the preset trigger frequency; if the message consumption policy indicates manual triggering of the test message package, when the tester's instructions are obtained, the test message package is delivered to the business end under test according to the consumption address of the test message package.
[0035] Figure 2 is an application scenario diagram of a testing method according to the first embodiment of the present disclosure, such as Figure 2 As shown, in a business scenario, the upstream and downstream production environments communicate through message middleware. At this time, if the downstream production environment needs to be tested, it is necessary to rely on the upstream production environment to provide a test message package. If the upstream production environment does not provide the test message package in time, it will cause delays in testing the downstream production environment and reduce testing efficiency.
[0036] Because online logs store interaction data between upstream and downstream production environments, they inevitably contain the test data required for the target test scenario. In the first embodiment of the present disclosure, the test platform provides a decoupled message service that captures and saves the initial message packets in the online logs. If the test environment downstream requires a test message packet, the test platform can construct the test message packet required by the test environment downstream based on the saved initial message packet, and then push the test message packet to the test environment downstream, i.e., the business end under test, according to the message consumption policy.
[0037] In the first embodiment of the present disclosure, an initial message packet is first obtained, then reconstructed to obtain a test message packet. The test message packet is then distributed according to the obtained message consumption policy. In this first embodiment of the present disclosure, the obtained initial message packet can be customized, thereby eliminating reliance on the message middleware in the test scenario, improving test efficiency, and ensuring that the test message packet meets the requirements of the target test scenario.
[0038] Figure 3 is a flow chart of a testing method according to the second embodiment of the present disclosure, such as Figure 3 As shown, step S101 mainly includes:
[0039] Step S201: Capture the initial message packet list of the consumption interface corresponding to the target test scenario in the online log.
[0040] Step S202: Deduplication is performed on the initial message packet list to obtain an initial message packet.
[0041] In this embodiment, since the online log stores a large number of message packets generated in business scenarios, many of the message packets are not the message packets required by the target test scenario. Therefore, when capturing the initial message packet, the initial message packet list of the consumption interface corresponding to the target test scenario can be captured. In different business scenarios, the consumption interface of the message packet is different. Therefore, when capturing the initial message packet, it is only necessary to capture the initial message packet of the consumption interface corresponding to the target test scenario to obtain the initial message packet list. Since there may be a large number of initial message packets in the online log, it is also necessary to deduplicate the obtained initial message packet list to obtain the deduplicated initial message packet.
[0042] In one embodiment, the initial message packet list can be deduplicated based on key fields in the initial message packets. For example, in an order process business, the key fields in the initial message packets may be date and order status. If the date and order status are the same in some initial message packets, these initial message packets can be deduplicated, and only one initial message packet can be retained, thereby reducing storage consumption.
[0043] In the second embodiment of the present disclosure, the initial message packet list of the consumer interface corresponding to the target test scenario is directly captured and deduplicated to obtain the initial message packet. In this embodiment, the efficiency of obtaining the initial message packet can be improved, and the deduplication operation on the initial message packet can reduce storage consumption.
[0044] In the third embodiment of the present disclosure, step S101 further includes: obtaining an initial message packet sent by the upstream business end in cooperation with the established offline environment middleware.
[0045] In this embodiment, although a large number of business scenario message packages are stored in the online log, they may not contain all the data required for the target test scenario. For example, in the order process business, it usually includes processes such as user ordering, payment, delivery and receipt. However, when the user is in the order process, the order may be interrupted, such as the user cancels the order after placing the order, or the user payment fails. The data corresponding to these situations may not exist in the online log or the quantity is small, which does not meet the test requirements. At this time, the upstream business end needs to cooperate in sending the corresponding initial message package.
[0046] In this embodiment, the offline environment middleware can first be used to obtain the initial message packet issued by the upstream business end. In one embodiment, after establishing a connection with the offline environment middleware, the upstream business end can be jointly debugged to construct the initial message packet required for the target test scenario. The offline environment middleware can then obtain the newly added initial message packet and store it, enriching the test scenario and facilitating future testing of similar test scenarios.
[0047] In the third embodiment of the present disclosure, based on the established offline environment middleware, the initial message packet sent by the upstream business end is obtained, which can ensure that all test data required for the target test scenario is obtained, enrich the test scenario, and ensure the accuracy of the test results.
[0048] Figure 4 FIG. 4 is a flow chart of a testing method according to the fourth embodiment of the present disclosure. Figure 4 As shown, step S102 mainly includes:
[0049] Step S401: parse the initial message packet to obtain the message body of the initial message packet.
[0050] In this embodiment, the message body of the initial message packet must first be parsed. Because the initial message packet is in a specific format, in order to obtain the test data therein, the initial message packet must be parsed to obtain the message body of the initial message packet. Specifically, the initial message packet can be parsed according to the encapsulation rules of the initial message packet. This disclosure does not limit the method for parsing the initial message packet.
[0051] In one possible implementation, the message body of an initial message packet of an order process business may be:
[0052]
[0053] It can be seen that in this message body, the value of the order number order_id is 123, and the value of the order status status is express, which means express delivery.
[0054] Step S402: Replace the field values in the message body that need to be monitored in the target test scenario with corresponding variables to obtain a message body template.
[0055] In this embodiment, the data in the message body obtained by parsing is fixed, which makes it inconvenient to construct a test message package. Therefore, when the message body is parsed, the field values that need to be monitored in the target test scenario in the message body can be replaced with corresponding variables to obtain a message body template, so that the test message package can be constructed using the message body template.
[0056] In one possible implementation, for order process services, it is usually necessary to monitor the order number and order status to inform downstream parties to handle their respective services. Therefore, for the message body of the above order process services, the values of the order number order_id and order status status that need to be monitored can be replaced with corresponding variables. For example, use the ${order_id}$ replacement rule to replace 123, and use the ${status}$ rule to replace express. After the replacement is completed, the message body template obtained is:
[0057]
[0058] Among them, ${order_id}$ and ${status}$ are variables and can be replaced with different data to facilitate the subsequent construction of test message packages according to the requirements of the target test scenario.
[0059] Step S403: Create a test data list according to the target test scenario and variables.
[0060] In this embodiment, after obtaining the message body template, it is also necessary to create a test data list according to the target test scenario and variables. The test data list contains the test data required for various target test scenarios.
[0061] In one possible implementation, if the values of the order number order_id and order status status that need to be monitored in the order process business are replaced with the corresponding variables ${order_id}$ and ${status}$, a test data list can be created based on the requirements of the target test scenario and the different values of the variables.
[0062] For example, for the target test scenario corresponding to the order process business, the test data list created can be:
[0063] Messaging Services order_id status Order status shipped 123 pay Order status shipped 123 express Order status shipped 123 signed Order status shipped 123456 express Order status shipped 123456 cancel
[0064] Among them, the possible values of ${order_id}$ are 123 and 123456, and the possible values of ${status}$ are pay, express, signed, and cancel. Of course, ${order_id}$ and ${status}$ can also have other values required by the target test scenario.
[0065] Step S404: construct a test message package according to the message body template and the test data list.
[0066] In this embodiment, a test message package can be constructed according to the message body template and the test data list.
[0067] In one embodiment, the test data in the test data list can be filled into the message body template one by one, and the filled message body template is packaged to obtain a test message package. For example, the test data order_id = 123 and status = pay are written into the previously obtained message body template to obtain a new message body:
[0068]
[0069] Then the new message body is packaged to obtain a test message package. Specifically, all test data in the test data list can be written into the message body template to obtain multiple test message packages, thereby enriching the test message package.
[0070] In the fourth embodiment of the present disclosure, the field values to be monitored in the message body of the initial message packet are replaced with corresponding variables to obtain a message body template. A test message packet is then constructed based on the message body template and the created test data list. In this embodiment, a test message packet can be constructed based on the requirements of the target test scenario. This customization ensures that the test message packet meets the requirements of the target test scenario. Furthermore, the constructed test message packet contains rich test data, ensuring test accuracy.
[0071] In the fifth embodiment of the present disclosure, the message consumption strategy may include: message consumption address, message triggering mode, message automatic consumption frequency and message delivery failure strategy; the message consumption address is used to indicate the address of the business end under test; the message triggering mode is used to indicate whether the triggering mode of the test message package is automatic triggering or manual triggering; the message automatic consumption frequency is used to indicate the delivery frequency of the test message package when the triggering mode of the test message package is automatic triggering; the message delivery failure strategy is used to indicate the processing strategy for the test message package when the delivery of the test message package fails.
[0072] In one feasible implementation, the tester can first determine the message consumption address based on the address of the tested business end in the target test scenario. If the test process needs to be analyzed in this target test scenario and the time of the analysis cannot be determined, the message triggering mode can be configured as manual triggering, that is, the tester can manually control the consumption frequency of the test message package; if the test time can be determined in this target test scenario, the message triggering mode can be configured as automatic triggering, and the automatic message consumption frequency can be set to an appropriate value to control the consumption frequency of the test message package; in order to facilitate the test process, the message delivery failure policy can be set to retry after the message delivery fails, and the number of retries can be set according to the actual situation. The message delivery failure policy can also be set to not retry after the message delivery fails.
[0073] In the fifth embodiment of the present disclosure, the message consumption policy may include: a message consumption address, a message triggering method, a message automatic consumption frequency, and a message delivery failure policy. This embodiment can determine the delivery method of the test message package based on actual conditions, simplifying the testing process and facilitating testing for testers.
[0074] Figure 5 is a flow chart of a testing method according to the sixth embodiment of the present disclosure, such as Figure 5 As shown, step S104 specifically includes:
[0075] Step S501: determine whether the message triggering mode is automatic triggering.
[0076] Step S502: The message triggering mode is automatic triggering, and the test message package is automatically sent to the tested service end according to the message automatic consumption frequency and the message consumption address.
[0077] Step S503: If the message triggering mode is not automatic triggering, a message triggering instruction is obtained.
[0078] Step S504: Send a test message packet to the service end under test according to the message trigger instruction and the message consumption address.
[0079] In this embodiment, it is first necessary to determine whether the message triggering mode in the message consumption policy is automatic triggering. If the message triggering mode is automatic triggering, the test message package is automatically sent to the business end under test based on the message automatic consumption frequency and the message consumption address; if the message triggering mode is not automatic triggering, the message triggering instruction is obtained, and then the test message package is sent to the business end under test based on the message triggering instruction and the message consumption address.
[0080] In one possible implementation method, if the message triggering mode is automatic triggering, the message automatic consumption frequency is obtained. The message automatic consumption frequency is the frequency of sending test message packages when automatically triggered. Then, according to the message automatic consumption frequency, the obtained multiple test message packages are sent one by one to the business end under test; if the message triggering mode is not automatic triggering, the tester needs to manually trigger the test message package, and after obtaining the message triggering instruction sent by the tester, the test message package is sent to the business end under test.
[0081] In the sixth embodiment of the present disclosure, a test message package is sent to the business end under test according to the message consumption strategy. The sending method of the test message package can be determined according to the message consumption strategy corresponding to the target test scenario, which simplifies the test process and makes it easier for testers to conduct tests.
[0082] In the seventh embodiment of the present disclosure, if the test message packet fails to be delivered, a processing operation corresponding to the message delivery failure policy is performed on the test message packet according to the message delivery failure policy.
[0083] In one possible implementation, if the message delivery failure policy is to retry twice after a message delivery failure, then after the test message packet fails to be delivered, the test message packet is re-delivered to the tested service end according to the message consumption policy. If the delivery still fails, the test message packet is continued to be delivered to the tested service end according to the message consumption policy. If the delivery still fails, no further retries are made. The message delivery failure policy may also be to not retry after a message delivery failure. Specifically, the message delivery failure policy may also be other processing policies, which are not limited in this disclosure.
[0084] In the seventh embodiment of the present disclosure, when the test message packet fails to be sent, the test message packet is processed according to the message sending failure strategy, and the processing of the test message packet after the message sending failure is taken into consideration, which is conducive to the smooth progress of the test.
[0085] Figure 6 is a structural diagram of a testing device according to the eighth embodiment of the present disclosure, such as Figure 6 As shown, the device specifically includes:
[0086] The first acquisition module 60 is used to obtain the initial message packet, which contains the test data required for the target test scenario; the reconstruction module 61 is used to reconstruct the initial message packet to obtain a test message packet; the second acquisition module 62 is used to obtain the message consumption policy corresponding to the test message packet; the sending module 63 is used to send the test message packet to the business end under test according to the message consumption policy.
[0087] In one embodiment, the first acquisition module 60 includes: a capture submodule for capturing the initial message packet list of the consumption interface corresponding to the target test scenario in the online log; a deduplication submodule for performing deduplication operations on the initial message packet list to obtain the initial message packet.
[0088] In one possible implementation, the first acquisition module 60 further includes: a third acquisition module, configured to acquire the initial message packet sent by the upstream business end in cooperation with the established offline environment middleware.
[0089] In one embodiment, the reconstruction module 61 includes: a parsing submodule, which is used to parse the initial message packet to obtain the message body of the initial message packet; a replacement submodule, which is used to replace the field values that need to be monitored in the target test scenario in the message body with corresponding variables to obtain a message body template; a creation submodule, which is used to create a test data list based on the target test scenario and variables; and a construction submodule, which is used to construct a test message packet based on the message body template and the test data list.
[0090] In one possible implementation method, the message consumption strategy includes: message consumption address, message triggering mode, message automatic consumption frequency and message delivery failure strategy; the message consumption address is used to indicate the address of the business end under test; the message triggering mode is used to indicate whether the triggering mode of the test message package is automatic triggering or manual triggering; the message automatic consumption frequency is used to indicate the delivery frequency of the test message package when the triggering mode of the test message package is automatic triggering; the message delivery failure strategy is used to indicate the processing strategy for the test message package when the delivery of the test message package fails.
[0091] In one embodiment, the sending module 63 includes: a judgment submodule, used to judge whether the message triggering mode is automatic triggering; a first sending submodule, used for automatically sending the test message package to the business end under test according to the message automatic consumption frequency and the message consumption address when the message triggering mode is automatic triggering; an acquisition submodule, used for obtaining the message triggering instruction when the message triggering mode is not automatic triggering; a second sending submodule, used for sending the test message package to the business end under test according to the message triggering instruction and the message consumption address.
[0092] In one possible implementation, the device further includes: a processing module configured to perform a processing operation corresponding to the message delivery failure policy on the test message packet if the test message packet fails to be delivered.
[0093] In the technical solutions disclosed herein, the acquisition, storage, and application of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0094] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0095] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0096] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. Various programs and data required for the operation of the device 700 can also be stored in the RAM 703. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0097] Various components in device 700 are connected to I / O interface 705, including an input unit 706, such as a keyboard, mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, optical disk, etc.; and a communication unit 709, such as a network card, modem, wireless communication transceiver, etc. The communication unit 709 allows device 700 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0098] The computing unit 701 can be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as a test method. For example, in some embodiments, a test method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of a test method described above can be performed. Alternatively, in other embodiments, the computing unit 701 can be configured to perform a test method by any other appropriate means (e.g., by means of firmware).
[0099] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0100] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0101] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0102] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0103] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0104] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.
[0105] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.
[0106] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.
Claims
1. A testing method comprising: Obtaining an initial message packet, wherein the initial message packet includes test data required for a target test scenario; Reconstructing the initial message packet to obtain a test message packet; Obtain the message consumption policy corresponding to the test message packet; According to the message consumption strategy, the test message packet is sent to the service end under test; The obtaining of the initial message packet includes: According to the offline environment middleware built, obtain the initial message packet sent by the upstream business end; The reconstructing of the initial message packet to obtain a test message packet includes: Parsing the initial message packet to obtain a message body of the initial message packet; Replace the field values that need to be monitored in the target test scenario in the message body with corresponding variables to obtain a message body template; Create a test data list based on the target test scenarios and variables; The test message package is constructed according to the message body template and the test data list.
2. The method according to claim 1, wherein The obtaining of the initial message packet includes: Capture the initial message packet list of the consumer interface corresponding to the target test scenario in the online log; A deduplication operation is performed on the initial message packet list to obtain the initial message packet.
3. The method according to any one of claims 1 to 2, wherein: The message consumption strategy includes: message consumption address, message triggering method, message automatic consumption frequency and message delivery failure strategy; The message consumption address is used to indicate the address of the tested service end; The message triggering mode is used to indicate whether the triggering mode of the test message packet is automatic triggering or manual triggering; The message automatic consumption frequency is used to indicate the sending frequency of the test message packet when the triggering mode of the test message packet is automatic triggering; The message delivery failure policy is used to indicate a processing policy for the test message packet when the test message packet fails to be delivered.
4. The method according to claim 3, wherein: The sending of the test message packet to the tested service end according to the message consumption policy includes: Determine whether the message triggering mode is automatic triggering; The message triggering mode is automatic triggering, and the test message packet is automatically sent to the tested service end according to the message automatic consumption frequency and message consumption address; The message triggering mode is not automatic triggering, and a message triggering instruction is obtained; According to the message trigger instruction and the message consumption address, the test message packet is sent to the service end under test.
5. The method according to claim 4, wherein The method further comprises: If the test message packet fails to be delivered, then according to the message delivery failure policy, a processing operation corresponding to the message delivery failure policy is performed on the test message packet.
6. A testing device comprising: A first acquisition module acquires an initial message packet, wherein the initial message packet includes test data required for a target test scenario; A reconstruction module, configured to reconstruct the initial message packet to obtain a test message packet; A second acquisition module is used to obtain the message consumption policy corresponding to the test message packet; A sending module, configured to send the test message packet to the service end under test according to the message consumption policy; The obtaining of the initial message packet includes: According to the offline environment middleware built, obtain the initial message packet sent by the upstream business end; The reconstructing of the initial message packet to obtain a test message packet includes: Parsing the initial message packet to obtain a message body of the initial message packet; Replace the field values that need to be monitored in the target test scenario in the message body with corresponding variables to obtain a message body template; Create a test data list based on the target test scenarios and variables; The test message package is constructed according to the message body template and the test data list.
7. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 5.
9. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Software testing method and device, electronic equipment and computer readable medium
CN111459819A
Test data processing method and device, electronic equipment and storage medium
CN111858506A
Test method and system of distributed system, and message production and consumption module
CN112217886A