A testing method, device and storage medium for a routing component

By using gateway modules and target service modules in the microservice architecture to simulate business scenarios, test the forwarding function of routing components, the problem of low testing efficiency in the existing technology is solved, and fast and efficient routing component testing is achieved.

CN113986745BActive Publication Date: 2025-02-18BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111290906.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-02
Publication Date
2025-02-18
Estimated Expiration
2041-11-02

AI Technical Summary

Technical Problem

The prior art is less efficient when testing routing components, and requires a lot of time to complete project application development and joint debugging testing.

Method used

By introducing gateway modules and target service modules into the microservice architecture, using simulated request messages and response messages, the business scenarios are directly simulated between the gateway modules and target service modules, and the forwarding function of the routing component is tested.

Benefits of technology

The time period for testing routing components is shortened, testing is improved, and testing is carried out without waiting for project application development to be completed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113986745B_ABST
    Figure CN113986745B_ABST
Patent Text Reader

Abstract

The present application provides a testing method, device and storage medium for a routing component, which relates to the field of software testing technology, can shorten the time period for testing routing components, and improve the testing efficiency. The method includes: a gateway module receives a simulation request message, the simulation request message includes a first identifier, and the first identifier corresponds to a target business module. The gateway module calls the routing component to determine the target business module based on the first identifier. The gateway module sends a simulation request message to the target business module. The target business module generates a simulation response message based on the simulation request message, and the simulation response message is used to indicate whether the call to the routing component is successful.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to a testing method, device and storage medium for a routing component. Background Art

[0002] As software functions become increasingly rich, developers need to call software development kits (SDKs) to implement relevant functional requirements during software development. For example, in the context of enterprise architecture reform, microservice architecture is widely used. Multiple project applications can be deployed in the microservice architecture, and then the routing component, as the basic SDK component, can be integrated into each developed project application.

[0003] Currently, after the development of the routing component is completed, the routing component needs to be integrated into multiple developed project applications, and the functions of the routing component need to be tested through joint debugging between multiple project applications. However, the current testing method has a low efficiency in testing routing components because it takes a lot of time to develop project applications. Summary of the invention

[0004] The present application provides a testing method, device and storage medium for a routing component, which can shorten the time for testing the routing component and improve the efficiency of testing the routing component.

[0005] In order to achieve the above objectives, this application adopts the following technical solutions:

[0006] In the first aspect, the present application provides a testing method for a routing component, which is applied to a microservice architecture, wherein the microservice architecture is deployed with a gateway module and a business module, wherein the gateway module is integrated with a routing component, and the routing component is used to forward messages. In the method, the gateway module receives a simulated request message, wherein the simulated request message includes a first identifier, and the first identifier corresponds to a target business module. The gateway module calls the routing component to determine the target business module based on the first identifier. The gateway module sends a simulated request message to the target business module. The target business module generates a simulated response message based on the simulated request message, and the simulated response message is used to indicate whether the call to the routing component is successful.

[0007] Based on the above technical solution, the gateway module is integrated with a routing component. The gateway module receives a simulated request message, and the simulated request message includes a first identifier, and the first identifier corresponds to the target business module. Afterwards, the gateway module calls the routing component to determine the target business module based on the first identifier, and sends a simulated request message to the target business module. The target business module generates a simulated response message based on the simulated request message, and the simulated response message is used to indicate whether the call to the routing component is successful. In this way, without the need to complete the project application development, the business scenario can be simulated through the gateway module and the target business module to test whether the routing component forwards the simulated request message successfully in the business scenario, thereby shortening the test time cycle and improving the test efficiency.

[0008] Moreover, compared with the multi-layer processing logic in the project application, this solution has less processing logic, which can simplify the process of testing routing components and further improve the efficiency of testing routing components.

[0009] In a possible design, the microservice architecture also includes a global routing module, and the global routing module is configured with configuration information, and the configuration information includes a correspondence between a first identifier and a first address, and the first address is the address of a target business module. The gateway module calls the routing component and sends the first identifier to the global routing module. The gateway module receives the first address from the global routing module, and the first address is the address of the target business module. The first address is obtained by the global routing module according to the first identifier and the configuration information. The gateway module determines the target business module according to the first address.

[0010] In a possible design, the target service module includes a consumer module, the consumer module is integrated with a routing component, and the consumer module is used to generate the target service. The gateway module sends a simulated request message to the consumer module.

[0011] In a possible design, the target business module also includes a service module, and the service module is used to process the target business. The configuration information also includes a correspondence between a first identifier and a second identifier, and the second identifier is used to identify the service module. The consumer module sends the first identifier to the global routing module. The global routing module determines the second identifier based on the first identifier and the correspondence between the first identifier and the second identifier. The global routing module sends the second identifier to the consumer module. The consumer module sends a simulated request message to the service module based on the second identifier, and the simulated request message is used to indicate the processing of the target business.

[0012] In one possible design, the service module processes the target business according to the simulated request message and obtains a simulated response message.

[0013] In a second aspect, the present application provides a testing device for a routing component, which is applied to a microservice architecture, wherein a gateway module and a business module are deployed in the microservice architecture, wherein the gateway module is integrated with a routing component, and the routing component is used to forward messages. The device includes: a receiving unit, a processing unit, and a sending unit.

[0014] The receiving unit is used to receive a simulation request message through a gateway module, the simulation request message includes a first identifier, and the first identifier corresponds to a target business module. The processing unit is used to call a routing component to determine a target business module according to the first identifier through the gateway module. The sending unit is used to send the simulation request message to the target business module through the gateway module. The processing unit is also used to generate a simulation response message through the target business module according to the simulation request message, and the simulation response message is used to indicate whether the calling of the routing component is successful.

[0015] In a possible design, the microservice architecture also includes a global routing module, and the global routing module is configured with configuration information, and the configuration information includes a correspondence between a first identifier and a first address, and the first address is the address of a target business module. The sending unit is also used to call the routing component through the gateway module and send the first identifier to the global routing module. The receiving unit is also used to receive the first address from the global routing module through the gateway module, and the first address is the address of the target business module, and the first address is obtained by the global routing module according to the first identifier and the configuration information. The processing unit is also used to determine the target business module according to the first address through the gateway module.

[0016] In a possible design, the target service module includes a consumer module, the consumer module is integrated with a routing component, and the consumer module is used to generate the target service. The sending unit is also used to send a simulation request message to the consumer module through the gateway module.

[0017] In a possible design, the target business module also includes a service module, and the service module is used to process the target business. The configuration information also includes a correspondence between a first identifier and a second identifier, and the second identifier is used to identify the service module. The sending unit is also used to send the first identifier to the global routing module through the consumer module. The processing unit is also used to determine the second identifier through the global routing module based on the first identifier and the correspondence between the first identifier and the second identifier. The sending unit is also used to send the second identifier to the consumer module through the global routing module. The sending unit is also used to send a simulated request message to the service module through the consumer module based on the second identifier, and the simulated request message is used to indicate the processing of the target business.

[0018] In one possible design, the processing unit is also used to process the target business according to the simulated request message through the service module to obtain a simulated response message.

[0019] In a third aspect, the present application provides a testing device for a routing component, the device comprising: a processor and a memory; the processor and the memory are coupled; the memory is used to store one or more programs, the one or more programs comprising computer execution instructions, and when the testing device for the routing component is running, the processor executes the computer execution instructions stored in the memory to implement the testing method for the routing component as described in the first aspect and any possible implementation of the first aspect.

[0020] In a fourth aspect, the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a computer, the computer executes the testing method of the routing component described in the above-mentioned first aspect and any possible implementation of the first aspect.

[0021] In a fifth aspect, the present application provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run a computer program or instructions to implement a testing method for a routing component as described in the first aspect and any possible implementation of the first aspect.

[0022] In the above scheme, the technical problems that can be solved and the technical effects achieved by the testing device, computer equipment, computer storage medium or chip of the routing component can refer to the technical problems and technical effects solved by the above first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 A flowchart of a method for testing a routing component provided in an embodiment of the present application;

[0024] Figure 2 A flowchart of another method for testing a routing component provided in an embodiment of the present application;

[0025] Figure 3 A schematic diagram of the structure of a testing device for a routing component provided in an embodiment of the present application;

[0026] Figure 4 A schematic diagram of the structure of another testing device for a routing component provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0028] In this article, the character " / " generally indicates that the objects before and after are in an "or" relationship. For example, A / B can be understood as A or B.

[0029] The terms “first” and “second” in the description and claims of the present application are used to distinguish different objects rather than to describe a specific order of the objects.

[0030] In addition, the terms "including" and "having" and any variations thereof mentioned in the description of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not limited to the listed steps or modules, but may optionally include other steps or modules that are not listed, or may optionally include other steps or modules that are inherent to these processes, methods, products or devices.

[0031] In addition, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present concepts in a specific way.

[0032] To facilitate understanding, the terms involved in the embodiments of the present application are first introduced below.

[0033] 1. Microservice architecture.

[0034] Microservice architecture is a new technology for deploying applications and services in the cloud. Microservices can run in their own programs and interact with the Application Programming Interface (API) through lightweight devices. The key is that the service can run in its own program. This is how we can distinguish service exposure from microservice architecture (distributing an API in an existing system). In microservice architecture, you only need to add the required functionality to a specific service without affecting the overall process architecture.

[0035] The above is an introduction to the terms involved in the embodiments of the present application, which will not be repeated below.

[0036] The embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0037] In some embodiments, the microservice architecture is deployed with a gateway module and a business module, wherein the gateway module is used to receive external request messages, and the business module is used to generate and process the business corresponding to the request message. The gateway module is integrated with a routing component, and the routing component can forward the request message.

[0038] It should be noted that different business modules can process different businesses. The embodiments of the present application do not limit the business. For example, the business can be an account opening business. For another example, the business can be a deposit business. For another example, the business can be a withdrawal business.

[0039] like Figure 1 As shown, a method for testing a routing component provided in an embodiment of the present application includes:

[0040] S101. The gateway module receives a simulation request message.

[0041] The simulation request message includes a first identifier, and the first identifier corresponds to the target service module.

[0042] In one possible design, the target service is used to process the target service.

[0043] Exemplarily, if the first identifier is "01", the corresponding target service module is service module A. If the first identifier is "02", the corresponding target service module is service module B.

[0044] Optionally, the simulation request message may be a Hypertext Transfer Protocol (HTTP) message.

[0045] Optionally, the first identifier is used to indicate the target service.

[0046] As a possible implementation, a simulation request message is generated by a preset simulation tool, wherein the simulation tool is used to generate the simulation request message. Afterwards, the simulation request message from the simulation tool is received by the gateway module.

[0047] It should be noted that the embodiment of the present application does not limit the simulation tool. For example, the simulation tool may be a postman tool.

[0048] S102: The gateway module calls the routing component to determine the target business module according to the first identifier.

[0049] In one possible design, the microservice architecture also includes a global routing module, and the global routing module is configured with configuration information. The configuration information includes a correspondence between a first identifier and a first address, and the first address is an address of a target business module.

[0050] Exemplarily, as shown in Table 1, it shows the corresponding relationship between the identifier in the configuration information and the routing address.

[0051] Table 1

[0052]

[0053]

[0054] That is, when the first identifier is 001, the first address is address a. When the first identifier is 002, the first address is address b. When the first identifier is 003, the first address is address c.

[0055] Optionally, one routing address may correspond to multiple identifiers. For example, when the identifiers are "001", "002" and "003", the corresponding routing addresses may all be address a.

[0056] It should be noted that different routing addresses correspond to different service modules. For example, address a corresponds to service module a, and address b corresponds to service module b.

[0057] In a possible implementation, the gateway module may call the routing component to send a first identifier to the global routing module. Afterwards, the global routing module may determine the first address based on the first identifier and the configuration information. Next, the gateway module receives the first address from the global routing module, the first address being the address of the target business module, and the first address is obtained by the global routing module based on the first identifier and the configuration information. Then, the gateway module determines the target business module based on the first address.

[0058] For example, if the first identifier is 002, the gateway module calls the routing component to send "002" to the global routing module. Afterwards, the global routing module determines that the first address is "address b" according to the configuration information shown in Table 1 and "002". Afterwards, the gateway module can determine that the target business module is business module b according to address b.

[0059] It is understandable that the global routing module is configured with configuration information. Thus, when the gateway module obtains the first address corresponding to the first identifier, it indicates that the gateway module can interact with the global routing through the routing component, and the routing component, the gateway module and the global routing component are all operating normally.

[0060] S103: The gateway module sends a simulation request message to the target service module.

[0061] In a possible implementation, the gateway module may call the routing component to send a simulation request message to the target service module according to the first address. The target service module may receive the routing component from the gateway module.

[0062] In some embodiments, the service module includes a consumer module, the consumer module is integrated with a routing component, and the consumer module is used to generate a target service.

[0063] In an embodiment of the present application, the gateway module may send a simulation request message to the consumer module. Afterwards, the consumer module may receive the simulation request message. Optionally, the consumer module may generate a target service according to the first identifier.

[0064] Exemplarily, if the first identifier corresponds to an account opening service, the consumer module may generate a target service.

[0065] S104: The target service module generates a simulated response message according to the simulated request message.

[0066] The simulated response message is used to indicate whether the calling of the routing component is successful.

[0067] Optionally, the simulation response message includes a first identifier or a second identifier, the first identifier is used to indicate that the calling of the routing component is successful, and the second identifier is used to indicate that the calling of the routing component fails.

[0068] In a possible implementation, if the target business module successfully calls the routing component, the target business module generates a first identifier. If the target business module fails to call the routing component, the target business module generates a second identifier.

[0069] For example, if the target service is an account opening service and the account opening is successful, it means that the routing component is operating normally, and a "true" flag (i.e., the first flag) can be generated. If the account opening fails, it means that there is a problem with the routing component (for example, the simulated request message is not forwarded successfully, resulting in service failure), and a "fail" flag (i.e., the second flag) is generated.

[0070] It is understandable that by generating the first identifier or the second identifier, developers can understand the test results and thus improve the business module and routing component.

[0071] Based on the above technical solution, the gateway module is integrated with a routing component. The gateway module receives a simulated request message, and the simulated request message includes a first identifier, and the first identifier corresponds to the target business module. Afterwards, the gateway module calls the routing component to determine the target business module based on the first identifier, and sends a simulated request message to the target business module. The target business module generates a simulated response message based on the simulated request message, and the simulated response message is used to indicate whether the call to the routing component is successful. In this way, without the need to complete the project application development, the business scenario can be simulated through the gateway module and the target business module to test whether the routing component forwards the simulated request message successfully in the business scenario, thereby shortening the test time cycle and improving the test efficiency.

[0072] In some embodiments, the target business module further includes a service module, the service module is used to process the target business, the configuration information further includes a correspondence between the first identifier and the second identifier, and the second identifier is used to identify the service module.

[0073] Exemplarily, as shown in Table 2, it shows the corresponding relationship between the first identifier and the second identifier in the configuration information.

[0074] Table 2

[0075] First logo Second mark 001 Service 002 Service 003 Service

[0076] That is, when the first identifier is 001, the second identifier is service a. When the first identifier is 002, the second identifier is service b. When the first identifier is 003, the second identifier is service c. Service a corresponds to service module a, service b corresponds to service module b, and service c corresponds to service module c.

[0077] In an embodiment of the present application, before the target business module generates a simulated response message according to the simulated request message, the consumer module sends a first identifier to the global routing module. The global routing module determines the second identifier according to the first identifier and the correspondence between the first identifier and the second identifier. Afterwards, the global routing module sends the second identifier to the consumer module. The consumer module sends a simulated request message to the service module according to the second identifier. Afterwards, the service module can receive the simulated request message from the consumer module.

[0078] Exemplarily, if the first identifier is "002", the corresponding second identifier is service b. Then the consumer module can send a simulation request message to the service module corresponding to service b (such as service module b).

[0079] It is understandable that the configuration information in the global routing module also includes the correspondence between the first identifier and the second identifier, and the second identifier is used to identify the service module. In this way, after the consumer module sends the first identifier to the global routing module through the routing component, the global routing module determines the second identifier based on the first identifier, the correspondence between the first identifier and the second identifier, and sends the second identifier to the consumer module. Then, the consumer module can send a simulated request message to the service module based on the second identifier, so that the service module processes the target business. In this way, the ability of the routing component to forward messages can be tested in the business without waiting for the project development to be completed, which improves the efficiency of testing the routing component.

[0080] In some embodiments, the target service module generates a simulated response message according to the simulated request message, including: the service module processes the target service according to the simulated request message to obtain a simulated response message.

[0081] For example, if the target business is an account opening business (such as user A opening an account), and the routing component functions normally, the consumer module can send a simulated request message to the corresponding service module through the routing component. The service module can create an account for user A based on the simulated request message and generate a first identifier. For another example, if the routing component functions abnormally, causing the service module to fail to process the target business (such as the consumer module fails to send a simulated request message through the routing component, etc.), a second identifier is generated.

[0082] It is understandable that the service module is used to process the target business. The service module processes the target business according to the simulated request message and generates a simulated response message, so that the developer can know the result of testing the routing component.

[0083] It should be noted that the gateway module, target business module (including consumer module and service module) and global routing module in the embodiment of the present application are script codes written by developers, or codes generated by automatic script generation software. The embodiment of the present application does not limit this.

[0084] In an embodiment of the present application, the complexity of the gateway module, the target business module (including the consumer module and the service module) and the global routing module is less than a preset complexity threshold.

[0085] It should be noted that in the embodiment of the present application, complexity is used to characterize the complexity of a module. The complexity of a module is determined by the compilation length of the module, the duration of compiling the module, the condition (or index) of the module, and the logic of the module.

[0086] For example, if the length of module a is 10, there are 2 conditions in module a, and the time to compile the module is 10 seconds. If the length of the project application is 3000, there are 300 conditions in the project application, and the time to compile the project is 20 days, then the complexity of the module is less than the complexity of the project application, and the complexity of the module is less than the complexity of the project application.

[0087] It is understandable that the complexity of modules (such as gateway modules and target business modules) is lower than the complexity of project applications. In other words, the time spent on developing modules is less. In this way, by testing routing components through modules, the efficiency of testing routing components can be improved.

[0088] The following describes the embodiments of the present application in conjunction with specific examples. Figure 2As shown, the gateway module and the consumer module are integrated with a routing component. The Postman tool can generate a simulated request message and send a simulated request message (including identification a) to the gateway. Afterwards, the gateway module can call the routing component to send identification a to the global routing module, and the global routing module determines that the address corresponding to identification a is the b00 unit address, and feeds back the b00 unit address to the gateway module. Then, the gateway module sends a simulated request message to the consumer module within the b00 unit address. The consumer module calls the routing component to send identification a to the global routing module, and the global routing module determines that the service module with unit number 001 corresponding to identification a is fed back to the consumer module. Then, the consumer module sends a simulated request message to the service module with unit number 001. Afterwards, the service module generates a simulated response message according to the simulated request message.

[0089] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of a computer device. It is understandable that, in order to realize the above functions, the computer device includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the test method steps of the routing components of each example described in the embodiment disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0090] The embodiment of the present application also provides a testing device for a routing component. The testing device for the routing component can be a computer device, a CPU in the above-mentioned computer device, a processing module in the above-mentioned computer device for determining the test of the routing component, or a client in the above-mentioned computer device for testing the routing component.

[0091] The embodiment of the present application can divide the test of the routing component into functional modules or functional units according to the above method example. For example, each functional module or functional unit can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules or functional units. Among them, the division of modules or units in the embodiment of the present application is schematic, which is only a logical function division, and there may be other division methods in actual implementation.

[0092] like Figure 3 FIG. 1 is a schematic diagram of a test device for a routing component provided in an embodiment of the present application. The test device for a routing component is used to perform Figure 1 or Figure 2 The testing method of the routing component shown in the figure. The testing device of the routing component may include a receiving unit 301 , a processing unit 302 and a sending unit 303 .

[0093] The receiving unit 301 is used to receive a simulation request message through a gateway module, the simulation request message includes a first identifier, and the first identifier corresponds to a target business module. The processing unit 302 is used to call a routing component to determine a target business module according to the first identifier through the gateway module. The sending unit 303 is used to send a simulation request message to the target business module through the gateway module. The processing unit 302 is also used to generate a simulation response message according to the simulation request message through the target business module, and the simulation response message is used to indicate whether the calling of the routing component is successful.

[0094] Optionally, the microservice architecture also includes a global routing module, and the global routing module is configured with configuration information, and the configuration information includes a correspondence between a first identifier and a first address, and the first address is the address of a target business module. The sending unit 303 is also used to call the routing component through the gateway module and send the first identifier to the global routing module. The receiving unit 301 is also used to receive the first address from the global routing module through the gateway module, and the first address is the address of the target business module. The first address is obtained by the global routing module according to the first identifier and the configuration information. The processing unit 302 is also used to determine the target business module according to the first address through the gateway module.

[0095] Optionally, the target service module includes a consumer module, the consumer module is integrated with a routing component, and the consumer module is used to generate the target service. The sending unit 303 is further used to send a simulation request message to the consumer module through the gateway module.

[0096] Optionally, the target business module also includes a service module, and the service module is used to process the target business. The configuration information also includes a correspondence between a first identifier and a second identifier, and the second identifier is used to identify the service module. The sending unit 303 is also used to send the first identifier to the global routing module through the consumer module. The processing unit 302 is also used to determine the second identifier through the global routing module according to the first identifier and the correspondence between the first identifier and the second identifier. The sending unit 303 is also used to send the second identifier to the consumer module through the global routing module. The sending unit 303 is also used to send a simulated request message to the service module through the consumer module according to the second identifier, and the simulated request message is used to indicate the processing of the target business.

[0097] Optionally, the processing unit 302 is further configured to process the target service according to the simulated request message through the service module to obtain a simulated response message.

[0098] Figure 4Another possible structure of the test device of the routing component involved in the above-mentioned embodiment is shown. The test device of the routing component includes: a processor 401 and a communication interface 402. The processor 401 is used to control and manage the actions of the device, for example, to execute the various steps in the method flow shown in the above-mentioned method embodiment, and / or to execute other processes of the technology described in this document. The communication interface 402 is used to support the communication between the test device of the routing component and other network entities. The test device of the routing component may also include a memory 403 and a bus 404, and the memory 403 is used to store the program code and data of the device.

[0099] Among them, the above-mentioned processor 401 can implement or execute various exemplary logic blocks, units and circuits described in conjunction with the disclosure of the present invention. The processor can be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, units and circuits described in conjunction with the disclosure of the present invention. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of DSP and microprocessors, etc.

[0100] The memory 403 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above types of memory.

[0101] The bus 404 may be an Extended Industry Standard Architecture (EISA) bus, etc. The bus 404 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0102] In actual implementation, the receiving unit 301 and the sending unit 303 can be composed of Figure 4 The communication interface 402 shown in FIG. 1 is implemented by the processing unit 302. Figure 4 The processor 401 shown calls the program code in the memory 403 to implement. The specific execution process can be referred to Figure 1 or Figure 2 The description of the test method part of the routing component shown is not repeated here.

[0103] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0104] An embodiment of the present application provides a computer program product including instructions. When the computer program product is run on a computer, the computer is enabled to execute the testing method of the routing component in the above method embodiment.

[0105] An embodiment of the present application also provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a computer, the computer executes the testing method of the routing component in the method flow shown in the above method embodiment.

[0106] Among them, the computer readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a register, a hard disk, 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 above, or any other form of computer readable storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application-specific integrated circuit (ASIC). In the embodiments of the present application, a computer-readable storage medium may be any tangible medium that contains or stores a program, which may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0107] Since the testing device of the routing component, the computer-readable storage medium, and the computer program product in the embodiments of the present invention can be applied to the above method, the technical effects that can be obtained can also refer to the above method embodiments, and the embodiments of the present invention will not be repeated here.

[0108] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for testing a routing component, characterized in that: Applied to a microservice architecture, the microservice architecture is deployed with a gateway module, a business module, and a global routing module, the gateway module is integrated with a routing component, and the routing component is used to forward messages; The complexity of the gateway module, the service module, and the global routing module are all less than a preset complexity threshold; the method comprises: The gateway module receives a simulation request message, the simulation request message includes a first identifier, and the first identifier corresponds to a target business module; the global routing module is configured with configuration information, and the configuration information includes a correspondence between the first identifier and a first address, and the first address is an address of the target business module; The gateway module calls the routing component and sends the first identifier to the global routing module; The gateway module receives the first address from the global routing module, where the first address is the address of the target service module, and the first address is obtained by the global routing module according to the first identifier and the configuration information; The gateway module determines the target service module according to the first address, wherein the target service module includes a consumer module, the consumer module is integrated with the routing component, and the consumer module is used to generate the target service; The gateway module sends the simulation request message to the consumer module; The target service module generates a simulation response message according to the simulation request message, and the simulation response message is used to indicate whether the calling of the routing component is successful.

2. The method according to claim 1, characterized in that The target business module further includes a service module, and the service module is used to process the target business. The configuration information further includes a correspondence between the first identifier and a second identifier, and the second identifier is used to identify the service module. Before the target service module generates a simulated response message according to the simulated request message, the method further includes: The consumer module sends the first identifier to the global routing module; The global routing module determines the second identifier according to the first identifier and a correspondence between the first identifier and the second identifier; The global routing module sends the second identifier to the consumer module; The consumer module sends the simulation request message to the service module according to the second identifier, where the simulation request message is used to instruct processing of a target service.

3. The method according to claim 2, characterized in that The target service module generates a simulated response message according to the simulated request message, including: The service module processes the target service according to the simulated request message to obtain the simulated response message.

4. A testing device for a routing component, characterized in that: Applied to a microservice architecture, the microservice architecture is deployed with a gateway module, a business module, and a global routing module, the gateway module is integrated with a routing component, and the routing component is used to forward messages; the device includes: a receiving unit, configured to receive a simulation request message through the gateway module, wherein the simulation request message includes a first identifier, and the first identifier corresponds to a target service module; the global routing module is configured with configuration information, and the configuration information includes a correspondence between the first identifier and a first address, and the first address is an address of the target service module; A sending unit, configured to call the routing component through the gateway module and send the first identifier to the global routing module; The receiving unit is further used for the gateway module to receive the first address from the global routing module, where the first address is the address of the target service module, and the first address is obtained by the global routing module according to the first identifier and the configuration information; A processing unit, configured for the gateway module to determine the target service module according to the first address, wherein the target service module includes a consumer module, the consumer module is integrated with the routing component, and the consumer module is used to generate the target service; The sending unit is also used for the gateway module to send the simulation request message to the consumer module; The processing unit is further used to generate a simulation response message according to the simulation request message through the target business module, and the simulation response message is used to indicate whether the calling of the routing component is successful.

5. The device according to claim 4, characterized in that The target business module further includes a service module, and the service module is used to process the target business. The configuration information further includes a correspondence between the first identifier and a second identifier, and the second identifier is used to identify the service module. The sending unit is further used to send the first identifier to the global routing module through the consumer module; The processing unit is further configured to determine the second identifier according to the first identifier and a correspondence between the first identifier and the second identifier through the global routing module; The sending unit is further used to send the second identifier to the consumer module through the global routing module; The sending unit is further used to send the simulation request message to the service module through the consumer module according to the second identifier, and the simulation request message is used to instruct processing of the target business.

6. The device according to claim 5, characterized in that The processing unit is further used to process the target service according to the simulated request message through the service module to obtain the simulated response message.

7. A testing device for a routing component, characterized in that: include: Processor and memory; The processor is coupled to the memory; The memory is used to store one or more programs, which include computer-executable instructions. When the test device of the routing component is running, the processor executes the computer-executable instructions stored in the memory to enable the test device of the routing component to perform the method as described in any one of claims 1-3.

8. A computer-readable storage medium having instructions stored therein, characterized in that: When a computer executes the instruction, the computer performs the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Service integration test method, device and system

    CN112905486A

  • Micro-service processing method and device based on routing, computer equipment and medium

    CN112965700A