A testing method, device, electronic device and storage medium

By simulated service registration and address query, the problem of unavailability between multiple services in the test environment is solved, and the testing efficiency and accuracy are improved.

CN113946502BActive Publication Date: 2025-03-04BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111044052.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-07
Publication Date
2025-03-04
Estimated Expiration
2041-09-07

AI Technical Summary

Technical Problem

In a test environment, mutual access between multiple services depends on the remote call protocol, resulting in multiple services that may pass through when users access, and unavailable services or service return data is unavailable, reducing testing efficiency.

Method used

Through simulation service registration and address query, the address information of the target simulation service is obtained and sent to the first service, so that it calls the target simulation service located on the simulation server, tests and processes the service data, and obtains the test result data.

Benefits of technology

This avoids the situation where the second service is unavailable or the return data is unavailable in the test, improves the testing efficiency, and ensures the accuracy of the test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113946502B_ABST
    Figure CN113946502B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a testing method, device, electronic device and storage medium, the method comprising: in response to the simulation service registration information sent by the simulation server, registering the service address of the simulation service, obtaining the simulation service information, receiving the address information acquisition request of the second service sent by the first service, and querying the target address information of the target simulation service corresponding to the second service from the simulation service address of the simulation service information. Sending the target address information to the first service so that the first service calls the target simulation service located on the simulation server based on the target address information, testing and processing the business data corresponding to the first service, and obtaining the test result data. This method can avoid the situation where the second service is unavailable or the data returned by the second service is unavailable during the test, thereby improving the test efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of service testing technology, and in particular to a testing method, device, electronic device, and storage medium. Background Art

[0002] The mutual access between various services on the server backend relies on the remote call protocol, and the scheduling between various services is coordinated uniformly through the scheduling server. During the execution of the service, the dependent services of the service are called to meet the user's access needs.

[0003] In related technologies, a user may visit multiple services during a single visit. In different test environments, some of these services may be unavailable, or the data returned by the services may be unavailable and not meet the test scenario, resulting in low test efficiency. Summary of the Invention

[0004] The present disclosure provides a testing method, device, and system to at least address the problem of low testing efficiency in related technologies. The technical solutions of the present disclosure are as follows:

[0005] According to a first aspect of an embodiment of the present disclosure, there is provided a testing method, the method comprising:

[0006] In response to the simulation service registration information sent by the simulation server, register the service address of the simulation service to obtain simulation service information, wherein the simulation service information includes a simulation service address corresponding to the simulation service, and the simulation service corresponds to the second service called by the first service during the test execution process;

[0007] In response to the address information acquisition request of the second service sent by the first service, querying the target address information of the target simulated service corresponding to the second service from the simulated service address of the simulated service information;

[0008] When the target address information is queried, the target address information is sent to the first service. The target address information is used to instruct the first service to call the target simulation service corresponding to the target address information located on the simulation server, and based on the target simulation service, the business data corresponding to the first service is tested and processed to obtain test result data.

[0009] As an optional embodiment, the simulated service registration information includes a simulated service address and a simulated service identifier, the simulated service identifier is generated based on the original service identifier of the second service, and the simulated service registration information sent by the simulation server in response to the simulated service registration information is registered for the simulated service, and the obtained simulated service information includes:

[0010] In response to the simulation service registration information, creating a correspondence between the simulation service address and the simulation service identifier;

[0011] The corresponding relationship is used as the simulation service information.

[0012] As an optional embodiment, the address information acquisition request includes a target original service identifier of the second service, and in response to the address information acquisition request for the second service sent by the first service, querying the target address information of the target simulated service corresponding to the second service from the simulated service address in the simulated service information includes:

[0013] Based on the target original service identifier, searching the simulated service information for a target simulated service identifier that matches the target original service identifier;

[0014] In the case where the target simulated service identifier is found, the target address information corresponding to the target simulated service identifier is acquired from the simulated service information based on the target simulated service identifier.

[0015] As an optional embodiment, the simulated service registration information includes a simulated service address, a service address identifier, and a simulated service identifier, wherein the service address identifier is a port identifier corresponding to the simulated service, and the simulated service registration information sent by the simulation server in response to the simulated service registration information is registered for the simulated service, and the obtained simulated service information includes:

[0016] In response to the simulation service registration information, creating a first correspondence between the simulation service address and the service address identifier;

[0017] Creating a second correspondence between the simulated service address and the simulated service identifier;

[0018] The first corresponding relationship and the second corresponding relationship are used as the simulation service information.

[0019] As an optional embodiment, the address information acquisition request includes a target original service identifier and a target service address identifier of the second service, the second service corresponds to multiple simulated services, and in response to the address information acquisition request for the second service sent by the first service, querying the target address information of the target simulated service corresponding to the second service from the simulated service address in the simulated service information includes:

[0020] Based on the target original service identifier, searching the simulated service information for a target simulated service identifier that matches the target original service identifier;

[0021] When the target simulation service identifier is found, obtaining address information of multiple simulation services corresponding to the target simulation service identifier from the simulation service information;

[0022] Determining, from the address information of the plurality of simulated services, address information that matches the target service address identifier;

[0023] The matched address information is used as the target address information.

[0024] According to a second aspect of an embodiment of the present disclosure, there is provided a testing method, the method comprising:

[0025] receiving a test request sent by the first service based on target address information, where the target address information is address information of a target simulated service corresponding to the second service queried from the simulated service information, the simulated service information including a simulated service address corresponding to the simulated service registered on the scheduling server, the simulated service corresponding to the second service called by the first service during the test execution process, and the test request carrying business data;

[0026] Calling the target simulation service corresponding to the target address information, performing test processing on the business data, and obtaining test result data;

[0027] The test result data is sent to the first service.

[0028] As an optional embodiment, the method further includes:

[0029] Obtaining service configuration identification information of the second service;

[0030] Based on the service configuration identification information, obtaining service configuration information corresponding to the second service;

[0031] Parsing the service configuration information to obtain parsing result information, wherein the parsing result information includes a target original service identifier of the second service;

[0032] Based on the target original service identifier, a target simulated service identifier of the simulated service corresponding to the second service is generated.

[0033] As an optional embodiment, the parsing result information further includes input parameter information and output parameter information corresponding to the second service, the input parameter information representing a data structure corresponding to the business data input to the second service, and the output parameter information representing a data structure corresponding to the execution result of the business data output by the second service. After obtaining the service configuration information corresponding to the second service based on the service configuration identification information, the method further includes:

[0034] The input parameter information and the output parameter information are added to the preset service template information to generate a template simulation service corresponding to the second service.

[0035] As an optional embodiment, the method further includes:

[0036] Determining at least one preset test scenario corresponding to the test requirement information;

[0037] generating, based on the template simulation service corresponding to the second service, at least one simulation service matching the number of the at least one preset test scenario;

[0038] Based on the at least one preset test scenario, test data configuration is performed on the at least one simulation service to obtain test configuration information for each simulation service.

[0039] As an optional embodiment, the calling of the target simulation service corresponding to the target address information to perform test processing on the business data, and obtaining the test result data includes:

[0040] Obtain target test configuration information corresponding to the target simulation service;

[0041] Based on the target test configuration information, the service data is tested and processed to obtain the test result data.

[0042] As an optional embodiment, after generating the simulation service corresponding to the second service, the method further includes:

[0043] Performing port allocation on the simulation service to obtain a port allocation result;

[0044] Obtaining a simulated service address of the simulated service according to the port allocation result and the network protocol address of the simulated service;

[0045] Using the simulated service address and the simulated service identifier as first simulated service registration information, and sending the first simulated service registration information to the scheduling server;

[0046] or;

[0047] Performing port allocation on the simulation service to obtain a port allocation result;

[0048] Obtaining a simulated service address of the simulated service according to the port allocation result and the network protocol address of the simulated service;

[0049] Generate a service address identifier corresponding to the port allocation result;

[0050] The simulated service address, the service address identifier and the simulated service identifier are used as second simulated service registration information, and the second simulated service registration information is sent to the scheduling server.

[0051] According to a third aspect of an embodiment of the present disclosure, there is provided a testing device, the device comprising:

[0052] a simulation service registration module configured to execute, in response to the simulation service registration information sent by the simulation server, registering a service address of the simulation service to obtain simulation service information, the simulation service information including a simulation service address corresponding to the simulation service, the simulation service corresponding to the second service called by the first service during the test execution process;

[0053] a target address query module configured to execute, in response to a request for obtaining address information of a second service sent by the first service, query target address information of a target simulated service corresponding to the second service from the simulated service address in the simulated service information;

[0054] The target address sending module is configured to send the target address information to the first service when the target address information is queried. The target address information is used to instruct the first service to call the target simulation service corresponding to the target address information located on the simulation server, and based on the target simulation service, test the business data corresponding to the first service to obtain test result data.

[0055] As an optional embodiment, the simulated service registration information includes at least a simulated service address and a simulated service identifier, the simulated service identifier is generated based on the original service identifier of the second service, and the simulated service registration module includes:

[0056] The corresponding relationship creating unit is configured to create a corresponding relationship between the simulated service address and the simulated service identifier in response to the simulated service registration information, and use the corresponding relationship as the simulated service information.

[0057] As an optional embodiment, the address information acquisition request includes a target original service identifier of the second service, and the target address query module includes:

[0058] a simulation service identifier query unit configured to query a target simulation service identifier that matches the target original service identifier from the simulation service information based on the target original service identifier;

[0059] The target address acquiring unit is configured to acquire target address information corresponding to the target simulated service identifier from the simulated service information based on the target simulated service identifier when the target simulated service identifier is found.

[0060] As an optional embodiment, the simulation service registration information includes a simulation service address, a service address identifier and a simulation service identifier, the service address identifier is a port identifier corresponding to the simulation service, and the simulation service registration module includes:

[0061] A first correspondence creating unit is configured to create a first correspondence between the simulated service address and the service address identifier in response to the simulated service registration information;

[0062] The second correspondence creating unit is configured to create a second correspondence between the simulated service address and the simulated service identifier, and use the first correspondence and the second correspondence as the simulated service information.

[0063] As an optional embodiment, the address information acquisition request includes a target original service identifier and a target service address identifier of the second service, the second service corresponds to multiple simulated services, and the target address query module includes:

[0064] a simulation service identifier query unit configured to query a target simulation service identifier that matches the target original service identifier from the simulation service information based on the target original service identifier;

[0065] An address information acquiring unit is configured to acquire, when the target simulated service identifier is found, address information of multiple simulated services corresponding to the simulated service identifier from the simulated service information;

[0066] An address identifier matching unit is configured to determine address information matching the target service address identifier from the address information of the multiple simulated services;

[0067] The target address determining unit is configured to use the matched address information as the target address information.

[0068] According to a fourth aspect of an embodiment of the present disclosure, there is provided a testing device, the device comprising:

[0069] a test request receiving module configured to execute and receive a test request sent by the first service based on target address information, wherein the target address information is address information of a target simulated service corresponding to the second service queried from the simulated service information, the simulated service information including a simulated service address corresponding to the simulated service registered on the scheduling server, the simulated service corresponding to the second service called by the first service during the test execution process, and the test request carries business data;

[0070] a simulation service calling module configured to execute and call a target simulation service corresponding to the target address information, perform test processing on the business data, and obtain test result data;

[0071] The test result sending module is configured to send the test result data to the first service.

[0072] As an optional embodiment, the device further includes:

[0073] A service configuration identification information acquisition module is configured to execute acquisition of the service configuration identification information of the second service;

[0074] a service configuration information acquisition module, configured to acquire service configuration information corresponding to the second service based on the service configuration identification information;

[0075] a parsing module configured to parse the service configuration information to obtain parsing result information, wherein the parsing result information includes a target original service identifier of the second service;

[0076] The simulation service identifier generation module is configured to generate a target simulation service identifier of the simulation service corresponding to the second service based on the target original service identifier.

[0077] As an optional embodiment, the parsing result information further includes input parameter information and output parameter information corresponding to the second service, the input parameter information represents a data structure corresponding to the business data input to the second service, and the output parameter information represents a data structure corresponding to the execution result of the business data output by the second service. After obtaining the service configuration information of the second service from the service development information, the apparatus further includes:

[0078] The simulation service generation module is configured to add the input parameter information and the output parameter information to the preset service template information to generate a template simulation service corresponding to the second service.

[0079] As an optional embodiment, the device further includes:

[0080] a test scenario determination module, configured to determine at least one preset test scenario corresponding to the test requirement information;

[0081] a test scenario matching module configured to execute a template simulation service based on the second service, and generate at least one simulation service matching the number of the at least one preset test scenario;

[0082] The test configuration information generating module is configured to perform test data configuration on the at least one simulation service based on the at least one preset test scenario, and obtain test configuration information for each simulation service.

[0083] As an optional embodiment, the simulation service calling module includes

[0084] A target test configuration information acquiring unit is configured to acquire target test configuration information corresponding to the target simulation service;

[0085] The test result data acquisition unit is configured to perform test processing on the business data based on the target test configuration information to obtain the test result data.

[0086] As an optional embodiment, the device further includes:

[0087] A first port allocation module is configured to perform port allocation on the simulation service and obtain a port allocation result;

[0088] A first address information acquisition module is configured to obtain a simulated service address of the simulated service according to the port allocation result and the network protocol address of the simulated service;

[0089] A first service registration information acquisition module is configured to use the simulated service address and the simulated service identifier as first simulated service registration information, and send the first simulated service registration information to the scheduling server;

[0090] or;

[0091] A second port allocation module is configured to perform port allocation on the simulation service and obtain a port allocation result;

[0092] A second address information acquisition module is configured to obtain a simulated service address of the simulated service according to the port allocation result and the network protocol address of the simulated service;

[0093] A service address identifier generating module is configured to generate a service address identifier corresponding to the port allocation result;

[0094] The second service registration information acquisition module is configured to use the simulated service address, the service address identifier and the simulated service identifier as second simulated service registration information, and send the second simulated service registration information to the scheduling server.

[0095] According to a fifth aspect of the embodiments of the present disclosure, there is provided an electronic device, including:

[0096] processor;

[0097] a memory for storing instructions executable by the processor;

[0098] The processor is configured to execute the instructions to implement a testing method as described above.

[0099] According to a sixth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform a testing method as described above.

[0100] According to a seventh aspect of an embodiment of the present disclosure, a computer program product is provided, comprising a computer program / instruction, which implements the above-mentioned testing method when executed by a processor.

[0101] The technical solutions provided by the embodiments of the present disclosure bring at least the following beneficial effects:

[0102] The method includes: in response to the simulation service registration information sent by the simulation server, registering the service address of the simulation service, obtaining the simulation service information, receiving the address information acquisition request of the second service sent by the first service, and querying the target address information of the target simulation service corresponding to the second service from the simulation service address in the simulation service information. The target address information is sent to the first service so that the first service calls the target simulation service located on the simulation server based on the target address information, performs test processing on the business data corresponding to the first service, and obtains test result data. This method can avoid the situation where the second service is unavailable or the data returned by the second service is unavailable during the test, thereby improving the test efficiency.

[0103] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0104] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute an improper limitation of the present disclosure.

[0105] Figure 1The figure is a schematic diagram of an application scenario of a testing method according to an exemplary embodiment.

[0106] Figure 2 The figure is an interactive flow chart of a testing method according to an exemplary embodiment.

[0107] Figure 3 The present invention is a flowchart of registering a simulation service based on first simulation service registration information in a testing method according to an exemplary embodiment.

[0108] Figure 4 The present invention is a flowchart of registering a simulation service based on second simulation service registration information in a testing method according to an exemplary embodiment.

[0109] Figure 5 The figure is a schematic diagram showing obtaining target address information based on a target original service identifier in a test method according to an exemplary embodiment.

[0110] Figure 6 The present invention is a flowchart of obtaining target address information based on a target original service identifier and a target service address identifier in a testing method according to an exemplary embodiment.

[0111] Figure 7 The present invention is a schematic diagram showing a method for obtaining target address information based on a target original service identifier and a target service address identifier in a test method according to an exemplary embodiment.

[0112] Figure 8 The present invention is a flowchart of generating a target simulation service identifier in a testing method according to an exemplary embodiment.

[0113] Figure 9 The present invention is a flowchart of generating a template simulation service in a testing method according to an exemplary embodiment.

[0114] Figure 10 The figure is a flowchart showing a testing method on a scheduling server side according to an exemplary embodiment.

[0115] Figure 11 The figure is a flowchart showing a testing method for simulating a server side according to an exemplary embodiment.

[0116] Figure 12 The figure is a block diagram showing a testing device on a scheduling server side according to an exemplary embodiment.

[0117] Figure 13 The figure is a block diagram showing a testing device for simulating a server side according to an exemplary embodiment.

[0118] Figure 14It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0119] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0120] It should be noted that the terms "first," "second," and the like in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure as detailed in the appended claims.

[0121] First, the following terms are explained:

[0122] A software development kit (SDK) is generally a collection of development tools used by software engineers to build application software for a specific software package, software framework, hardware platform, operating system, etc.

[0123] Maven is a Java project build system that can manage project builds, reports, and documentation through a short description of the project.

[0124] The gRPC service in the remote call service is a type of RPC service. It uses Protocol Buffer as the serialization format. Protocol Buffer is a serialization framework from Google. It is lighter and more efficient than Json. At the same time, it is designed based on the HTTP / 2 standard and brings features such as bidirectional streaming, flow control, header compression, and multiplexing requests on a single TCP connection.

[0125] Figure 1This is a schematic diagram of an application scenario of a testing method according to an exemplary embodiment. The application scenario includes: a scheduling server 110, a simulation server 120, a first service 130, and a target simulation service 140. The scheduling server 110 receives the simulation service registration information sent by the simulation server 120, registers the service address of the simulation service, and obtains the simulation service information. The scheduling server 110 receives the address information acquisition request for the second service sent by the first service 130. The address information acquisition request includes the target original service identifier of the second service. Based on the target original service identifier, the scheduling server 110 obtains the target address information of the target simulation service corresponding to the second service. The scheduling server 110 sends the target address information to the first service 130. Based on the target address information, the first service 130 sends a test request to the simulation server 120. The simulation server 120 calls the target simulation service 140, performs test processing on the business data carried in the test request, and obtains test result data. The simulation server 120 sends the test result data to the first service 130.

[0126] In the disclosed embodiments, the scheduling server 110 and the simulation server 120 may comprise a single standalone server, a distributed server, or a server cluster consisting of multiple servers. The scheduling server 110 and the simulation server 120 may include a network communication unit, a processor, and a memory. Specifically, the scheduling server 110 may provide target address information of a target simulation service, and the simulation server 120 may call the target simulation service for testing.

[0127] In the disclosed embodiment, first service 130 and second service 130 may be distributed services. A distributed service is a service that is divided into multiple business modules. The business modules are deployed on different machines, and the modules exchange data through interfaces. Target simulation service 140 is a simulation service corresponding to the second service and may be provided on simulation server 120.

[0128] Figure 2 is an interactive flow chart of a testing method according to an exemplary embodiment. Figure 2 As shown, the test method includes the following steps.

[0129] S210. The scheduling server registers the service address of the simulation service in response to the simulation service registration information sent by the simulation server, and obtains simulation service information. The simulation service information includes the simulation service address corresponding to the simulation service, and the simulation service corresponds to the second service called by the first service during the test execution.

[0130] As an optional embodiment, the second service is a dependent service of the first service. During the execution of the first service, the first service needs to call the second service. Correspondingly, during the execution of the test of the first service, the first service also needs to call the second service. In the related art, when the first service calls the second service, there is a situation where the second service is unavailable or the data output by the second service is unavailable. When the second service is unavailable or the data output by the second service is unavailable, it can be determined that the second service is the original service that does not meet the preset test conditions. The address information of the simulated service corresponding to the unavailable second service is stored on the scheduling server. The address information of the available second service is also stored on the scheduling server. When the second service is available, the scheduling server can send the address information of the available second service to the first service.

[0131] As an alternative embodiment, see Figure 3 Before the scheduling server receives the address information acquisition request of the second service sent by the first service, the scheduling server may register a simulation service corresponding to the second service on the scheduling server, so that when the first service calls the second service, it calls the simulation service corresponding to the second service. The method further includes:

[0132] S310 simulation server simulates the service port allocation, obtain the port allocation results;

[0133] S320 simulation server according to the port allocation results and the simulation service network protocol address, obtain the simulation service corresponding to the simulation service address;

[0134] S330. The simulation server uses the simulation service address and simulation service identifier as the first simulation service registration information and sends the first simulation service registration information to the scheduling server;

[0135] S340. The scheduling server creates a correspondence between the simulated service address and the simulated service identifier in response to the first simulated service registration information, and uses the correspondence as the simulated service information.

[0136] As an optional embodiment, after generating a simulation service corresponding to the second service on the simulation server, the simulation server can allocate a port to the simulation service, and the port allocated to the simulation service is the port allocation result. The simulation server can also allocate a thread to execute the simulation service to the simulation service, thereby starting the simulation service and obtaining the network protocol address (Internet Protocol Address, ip address) of the simulation service. The simulation server combines the port and network protocol address allocated to the simulation service to obtain the simulation service address of the simulation service, and can call the simulation service based on the simulation service address. When generating the simulation service on the simulation server, a simulation service identifier of the simulation service is also generated, so that a correspondence between the simulation service identifier and the simulation service can be established in the scheduling server. The simulation service identifier can be generated based on the original service identifier of the second service, and the simulation service identifier can be the name information of the simulation service. The simulation server sends the simulation service identifier and the simulation service address as the first simulation service registration information to the scheduling server.

[0137] When the dispatch server receives the first simulated service registration information, it responds to the first simulated service registration information sent by the simulation server and registers the service address of the simulated service, thereby obtaining the simulated service information and completing the registration of the simulated service corresponding to the first service. When registering the service address, a correspondence between the simulated service address and the simulated service identifier is created, and the correspondence is used as the simulated service information. Thus, when the dispatch server receives an address acquisition request for the second service sent by the first service, the address information of the simulated service can be obtained by querying the target address information corresponding to the target original service identifier in the simulated service information.

[0138] The simulation server sends the first simulation service registration information to the dispatch server, completing the registration of the simulation service. This allows for quick registration of the simulation service, facilitates user operation, and improves the user experience. Furthermore, the simulation server allocates a port to the simulation service, thereby ensuring the uniqueness of the simulation service's address information and facilitating address information querying.

[0139] As an alternative embodiment, see Figure 4 Before the scheduling server receives the address information acquisition request of the second service sent by the first service, the scheduling server may register a simulation service corresponding to the second service on the scheduling server, so that when the first service calls the second service, it calls the simulation service corresponding to the second service. The method further includes:

[0140] S410 simulation server simulates the service port allocation, obtain the port allocation results;

[0141] S420 simulation server according to the port allocation results and the network protocol address of the simulation service, obtain the simulation service address corresponding to the simulation service;

[0142] S430 simulation server generates a port allocation result corresponding to the service address identifier;

[0143] S440. The simulation server uses the simulation service address, service address identifier and simulation service identifier as the second simulation service registration information, and sends the second simulation service registration information to the scheduling server.

[0144] S450. The dispatch server creates a first correspondence between the simulated service address and the service address identifier in response to the second simulated service registration information;

[0145] S460. The scheduling server creates a second correspondence between the simulated service address and the simulated service identifier, and uses the first correspondence and the second correspondence as simulated service information.

[0146] As an optional embodiment, after generating a simulated service corresponding to the second service on the simulated server, the simulated server can allocate a port to the simulated service, and the port allocated to the simulated service is the port allocation result. In the case where there are multiple simulated services corresponding to the second service, each simulated service is allocated to a different port.

[0147] Because when the simulation server generates a simulation service, it also generates a simulation service identifier for the simulation service, and establishes a corresponding relationship between the simulation service identifier and the simulation service, and the simulation service identifier can be generated based on the original service identifier of the second service, there are cases where multiple simulation services have the same simulation service identifier. Therefore, when there are multiple corresponding simulation services for the second service, the simulation server can also determine the service address identifier corresponding to the port assigned to each simulation service. Through the service address identifier, the target simulation service can be determined from multiple simulation services when calling the simulation service. The service address identifier can be lane information.

[0148] The simulation server can also assign a thread to execute the simulation service to start the simulation service and obtain the IP address of the simulation service. The simulation server combines the port and IP address assigned to the simulation service to obtain the simulation service address of the simulation service and can call the simulation service based on the simulation service address. The simulation server sends the simulation service identifier, address identifier, and simulation service address as second simulation service registration information to the scheduling server.

[0149] When the dispatch server receives the second simulation service registration information, it responds to the second simulation service registration information sent by the simulation server and registers the service address of the simulation service, so that the simulation service information can be obtained, and the registration of the simulation service corresponding to the second service is completed. When registering the service address, a first correspondence between the simulation service address and the service address identifier is created, so that the simulation service corresponding to each service address identifier can correspond to the same simulation service address, and a second correspondence between the simulation service address and the simulation service identifier is created, so that each simulation service address can correspond to the simulation service identifier. When the dispatch server receives the address acquisition request for the second service sent by the first service, the address information of the simulation service can be obtained by querying the target address information corresponding to both the target original service identifier and the target service address identifier in the simulation service information.

[0150] The simulation server sends the second simulation service registration information to the dispatch server, allowing for quick registration of the simulation service. This facilitates user operation and improves the user experience. The simulation server also assigns a port to the simulation service and generates a service address identifier, ensuring the uniqueness of the simulation service's address information and facilitating address information querying.

[0151] S220. The scheduling server responds to the address information acquisition request of the second service sent by the first service, and queries the target address information of the target simulation service corresponding to the second service from the simulation service address in the simulation service information.

[0152] As an optional embodiment, if the dispatch server can query the target address information of the target simulated service corresponding to the second service from the simulated service information, the target address information of the target simulated service is sent to the first service. If the dispatch server cannot query the target address information of the target simulated service corresponding to the second service from the simulated service information, the dispatch server can directly query the address information of the second service and send the address information of the second service to the first service.

[0153] As an optional embodiment, the address information acquisition request includes the target original service identifier of the second service. The scheduling server responds to the address information acquisition request for the second service sent by the first service, and queries the target address information of the target simulated service corresponding to the second service from the simulated service address in the simulated service information, including:

[0154] The scheduling server searches the simulated service information for a target simulated service identifier that matches the target original service identifier based on the target original service identifier;

[0155] When the target simulation service identifier is found, the dispatch server obtains the target address information corresponding to the target simulation service identifier from the simulation service information based on the target simulation service identifier.

[0156] As an optional embodiment, when the second service is unavailable, the target address information of the simulated service corresponding to the second service can be obtained from the scheduling server. The simulated service identifier is generated based on the original service identifier of the corresponding original service. Therefore, the scheduling server can query the target simulated service identifier that matches the target original service identifier from the simulated service information, that is, query the simulated service identifier generated based on the target original service identifier, and use the simulated service identifier as the target simulated service identifier.

[0157] When the dispatch server finds the target simulation service identifier, it can obtain the address information corresponding to the target simulation service identifier from the simulation service information, and use the address information corresponding to the target simulation service identifier as the target address information of the target simulation service.

[0158] As an optional embodiment, Figure 5 As shown, service A is the first service, service B is the second service, and simulated service B0 is the target simulated service corresponding to the second service. Simulated service B can be pre-registered on the scheduling server. Service A sends the target original service identifier b to the scheduling server, and the scheduling server obtains the target address information b'0 corresponding to the target simulated service identifier b' that matches the target original service identifier b. Service A receives target address information b'0 and accesses simulated service B0 based on target address information b'0. It sends business data to simulated service B0 and receives test result data returned by simulated service B0.

[0159] In the case where the second service corresponds to a simulated service, the scheduling server obtains address information corresponding to the target simulated service identifier as target address information, thereby avoiding the problem of unavailability of the second service and improving test efficiency.

[0160] As an alternative embodiment, see Figure 6 The address information acquisition request also includes a target service address identifier. The second service corresponds to multiple simulation services. The scheduling server responds to the address information acquisition request for the second service sent by the first service, and queries the target address information of the target simulation service corresponding to the second service from the simulation service address in the simulation service information, including:

[0161] S610. The dispatch server searches for a target simulated service identifier that matches the target original service identifier from the simulated service information based on the target original service identifier;

[0162] S620. When the dispatch server finds the target simulation service identifier, it obtains the address information of multiple simulation services corresponding to the target simulation service identifier from the simulation service information;

[0163] S630. The dispatch server determines the address information that matches the target service address identifier from the address information of multiple simulated services;

[0164] S640. The scheduling server uses the matched address information as the target address information.

[0165] As an optional embodiment, Figure 7 As shown, when the second service is available but the data returned by the second service is not available, the target address information of the target simulation service corresponding to the second service can be obtained from the scheduling server. The target simulation service is preset with target test data configuration information. When the first service calls the target simulation service based on the target address information, the target simulation service can return the test result data based on the target test data configuration information.

[0166] The dispatch server can query the target simulated service identifier that matches the target original service identifier from the simulated service information based on the target original service identifier. In the case where the second service corresponds to multiple simulated services, the target simulated service identifier corresponds to multiple simulated services, and multiple address information corresponding to the target simulated service identifier can be obtained from the simulated service information, that is, the address information of the multiple simulated services corresponding to the target simulated service identifier.

[0167] The address information acquisition request also includes a target service address identifier, which indicates the address identifier of the simulation service corresponding to the test data configuration information corresponding to the current test scenario. This target service address identifier can be lane information. Lane information allows simulation services corresponding to different test scenarios to run on separate physical machines. The scheduling server determines, from the address information of multiple simulation services, the address information that matches the target service address identifier and uses the matching address information as the target address information of the target simulation service.

[0168] As an optional embodiment, Figure 7 As shown, service C is the first service, service D is the second service, and simulation service D2 is the target simulation service corresponding to the second service. Simulation service D2 can be pre-registered on the scheduling server. Service C sends the target original service identifier d and the target service address identifier d2 to the scheduling server. The scheduling server obtains multiple address information corresponding to the target simulation service identifier d' that matches the target original service identifier d, including address information d'1, address information d'2, and address information d'3. Address information d'2 that matches the target service address identifier d2 is determined from the multiple address information, and address information d'2 is sent to service A as the target address information. Service A receives the target address information d'2 and accesses simulation service D2 based on the target address information d'2, sends business data to simulation service D2, and receives test result data returned by simulation service D2.

[0169] In the case where the second service corresponds to multiple simulated services, the scheduling server obtains multiple address information corresponding to the target simulated service identifier, and obtains address information matching the target service address identifier from the multiple address information as the target address information, thereby avoiding the problem of unavailable data returned by the second service and improving testing efficiency.

[0170] S230. When the target address information is found, the scheduling server sends the target address information to the first service.

[0171] S240. The simulation server receives a test request sent by the first service based on the target address information, the test request carries business data;

[0172] As an optional embodiment, after receiving the target address information, the first service sends a test request based on the target address information to the simulation server to request that the target simulation service be invoked. The test request sent by the first service carries business data. After the simulation server invokes the target simulation service, the business data can be tested based on the target simulation service to obtain test result data.

[0173] S250 simulation server calls the target address information corresponding to the target simulation service, the business data is tested and processed to obtain the test result data;

[0174] As an optional embodiment, the target simulation service corresponding to the target address information is called to test the business data, and the test result data obtained includes:

[0175] The simulation server obtains the target test configuration information corresponding to the target simulation service;

[0176] The simulation server tests and processes the business data based on the target test configuration information to obtain test result data.

[0177] As an optional embodiment, the simulation server can pre-generate a target simulation service and target simulation service identifier corresponding to the second service, and establish a correspondence between the target simulation service identifier and the target test configuration information. The correspondence can be described by the metadata of the target simulation service.

[0178] The simulation server invokes the target simulation service corresponding to the target address information, obtains the target simulation service identifier of the target simulation service, and acquires the target simulation service's meta-information that matches the target simulation service identifier. The meta-information describes various types of data in the target simulation service, including test configuration information for the target simulation service and the target simulation service identifier. Based on the meta-information of the target simulation service, the simulation server obtains the target test configuration information corresponding to the target simulation service. The target test configuration information is configuration information for the return method of test data corresponding to the target simulation service. The simulation server can perform test processing on the business data based on the target test configuration information.

[0179] The target test configuration information is obtained based on the target test scenario configuration. Therefore, the test result data corresponding to the target test scenario can be obtained according to the return method of the execution result of the business data configured in the target test configuration information.

[0180] The simulation server can perform test processing based on the target test configuration information corresponding to the target simulation service, and return test result data corresponding to the target test scenario. It can be adapted to a variety of different test scenarios, thereby improving the diversity of the test.

[0181] S260. The simulation server sends test result data to the first service.

[0182] As an alternative embodiment, see Figure 8 , the method further comprises:

[0183] S810. The simulation server obtains the service configuration identification information of the second service;

[0184] S820. The simulation server obtains the service configuration information corresponding to the second service based on the service configuration identification information;

[0185] S830 simulation server parses the service configuration information to obtain the parsing result information, the parsing result information includes the target original service identifier of the second service;

[0186] S840. The simulation server generates a target simulation service identifier of the simulation service corresponding to the second service based on the target original service identifier.

[0187] As an optional embodiment, the simulation server obtains the service configuration identification information of the second service. The service configuration identification information can be the build identification of the project build system of the software development kit (SDK) to which the second service belongs. When the project build system is Maven, the build identification can include the project organization identification (groupId), project identification (artifactId) and version information (version). After the simulation service obtains the build identification, it downloads the SDK corresponding to the build identification. The simulation server obtains the service configuration information in the SDK. The service configuration information can be the service declaration information of the remote call service. The remote call service can be a gRPC service.

[0188] The simulation server parses the service declaration information of the remote call service, that is, parses the service declaration information of the gRPC service, and obtains the parsing result information, which includes the target original service identifier of the second service. The target original service identifier can be the original service name of the second service. The simulation server can generate a target simulation service identifier for the simulation service corresponding to the second service based on the target original service identifier. When the target original service identifier is the original service name of the second service, the target simulation service identifier is the simulation service name of the simulation service corresponding to the second service.

[0189] The simulation server can automatically parse the service configuration information and generate the parsing result information. The user selects the original service identifier from the parsing result information and generates the simulated service identifier, which can avoid problems caused by user input errors and improve the efficiency of generating the simulated service name.

[0190] As an optional embodiment, the parsing result information further includes input parameter information and output parameter information corresponding to the second service. After obtaining the service configuration information of the second service from the service development information, the method further includes:

[0191] The input parameter information and the output parameter information are added to the preset service template information to generate a template simulation service corresponding to the second service.

[0192] As an optional embodiment, preset service template information is obtained from a service template library, which can be a custom service instance factory. The service template information is a universal service proxy object that can serve as the simulated service entity required when starting a simulated service. When generating a simulated service corresponding to any original service that does not meet the test conditions, the service template information can be used as the simulated service entity.

[0193] The parsed result information obtained after parsing the service configuration information of the second service also includes input parameter information and output parameter information of the second service. The input parameter information represents the data structure corresponding to the business data input to the second service, and the output parameter information represents the data structure corresponding to the execution result of the business data output by the second service. The input parameter information and the output parameter information are added to the service template information, so that the input and output structures of the service template information after adding the input parameter information and the output parameter information are the same as those of the second service. Therefore, the second service can be simulated by using the service template information after adding the input parameter information and the output parameter information, thereby obtaining a template simulation service corresponding to the second service.

[0194] When generating a simulated service corresponding to any original service that does not meet the test conditions, the input and output parameter information of the original service that does not meet the test conditions can be obtained from the parsed result information obtained by parsing the service configuration information of the original service that does not meet the test conditions through reflection parsing. The input and output parameter information of the original service are then added to the service template information to obtain the template simulated service corresponding to the original service.

[0195] The simulation server can automatically parse the service configuration information and generate parsing result information. The user selects input parameter information and output parameter information from the parsing result information and combines it with the preset service template information to obtain a template simulation service. The template simulation service corresponding to the second service can be quickly constructed, thereby improving the efficiency of generating simulation services.

[0196] As an alternative embodiment, see Figure 9 , the method further comprises:

[0197] S910. The simulation server determines at least one preset test scenario corresponding to the test requirement information;

[0198] S920. The simulation server simulates the service according to the template corresponding to the second service, generating at least one simulation service that matches the number of preset test scenarios;

[0199] S930. The simulation server configures test data for at least one simulation service based on at least one preset test scenario to obtain test configuration information for each simulation service.

[0200] As an optional embodiment, test requirement information for the first service is obtained, and at least one corresponding preset test scenario is obtained based on the test requirement information. Based on the number of preset test scenarios, the template simulation service corresponding to the second service is copied to obtain at least one simulation service that matches the number of preset test scenarios. The preset test scenarios and simulation services are matched one-to-one, and test data is configured for the simulation service corresponding to each preset test scenario, thereby obtaining test configuration information for each simulation service.

[0201] As an optional embodiment, when configuring test data for a simulation service, the test data may be configured after allocating a port to the simulation service and starting the simulation service.

[0202] As an optional embodiment, the preset test scenarios may include one or more of a matching test scenario, a random test scenario, a paging test scenario, a proportional return test scenario, and a delayed return test scenario.

[0203] When the preset test scenario is a matching data test scenario, the simulation service can be configured to return the execution result that matches the business data as the test result data corresponding to the business data. Based on this configuration, the test configuration information for the simulation service is obtained. For example, when the simulation service receives business data x, it can return the execution result x that matches the business data x as the test result data corresponding to the business data x.

[0204] When the preset test scenario is a random data test scenario, the simulation service is configured to return any of the preset business data execution results as the test result data corresponding to the business data. Based on this configuration, the test configuration information for the simulation service is obtained. For example, the preset business data execution results include five execution results: A, B, C, D, and E. Upon receiving business data x, the simulation service is configured to return any of these five execution results: A, B, C, D, and E as the test result data corresponding to business data x.

[0205] When the preset test scenario is a paging data test scenario, the simulation service is set to return the next execution result of the execution result of each business data as the test result data corresponding to the currently received business data, and the test configuration information of the simulation service is obtained according to the setting. For example, the execution results of the preset business data include five execution results A, B, C, D and E. When the simulation service receives business data x1, it can return execution result A as the test result data corresponding to business data x1. When the simulation service receives business data x2, it can return execution result B as the test result data corresponding to business data x2. And so on. When the simulation service receives business data x5, it can return execution result E as the test result data corresponding to business data x5.

[0206] If the preset test scenario is a proportional return test scenario, the simulation service can be configured to return the execution result of the business data corresponding to the data ratio information based on the preset data ratio information as the test result data corresponding to the business data. The test configuration information of the simulation service is obtained based on this setting. For example, if the preset data ratio information is set to 50%, when the simulation service receives business data x, it can return the execution result 50%X as the test result data corresponding to business data x.

[0207] If the preset test scenario is a delayed return test scenario, the simulation service can be set to delay the return of the execution result of the business data based on the preset delay time. The test configuration information of the simulation service is obtained based on this setting. For example, if the preset delay time is set to t1, when the simulation service receives business data x, it can wait for t1 time before returning execution result X as the test result data corresponding to business data x.

[0208] Based on different preset test scenarios, test data is configured for multiple simulation services separately, so that the simulation services can cover more test scenarios, thereby improving the efficiency and accuracy of the test.

[0209] Figure 10 FIG. 1 is a flow chart showing a testing method according to an exemplary embodiment. Figure 10 As shown, the testing method is applied to the scheduling server, and the method includes the following steps.

[0210] S1010. In response to the simulation service registration information sent by the simulation server, the service address of the simulation service is registered to obtain simulation service information, the simulation service information includes the simulation service address corresponding to the simulation service, the simulation service corresponds to the first service in the execution of the test process called the second service;

[0211] S1020. In response to the first service sending the second service address information acquisition request, query the target address information of the target simulation service corresponding to the second service from the simulation service address of the simulation service information;

[0212] S1030. When the target address information is queried, the target address information is sent to the first service. The target address information is used to instruct the first service to call the target simulation service corresponding to the target address information located on the simulation server, and based on the target simulation service, the business data corresponding to the first service is tested and processed to obtain test result data.

[0213] As an optional embodiment, the scheduling server receives the simulation service registration information sent by the simulation server, registers the service address of the simulation service, and obtains the simulation service information. When the simulation service registration information includes the simulation service address and the simulation service identifier, a correspondence is created between the simulation service address and the simulation service identifier, and the correspondence is used as the simulation service information. When the simulation service registration information includes the simulation service address, the service address identifier, and the simulation service identifier, a first correspondence is created between the simulation service address and the service address identifier, and a second correspondence is created between the simulation service address and the simulation service identifier, and the first correspondence and the second correspondence are used as the simulation service information.

[0214] The second service is a dependent service of the first service. During the test execution of the first service, the first service needs to call the second service. The scheduling server receives the address information acquisition request for the second service sent by the first service. The address information acquisition request includes the target original service identifier of the second service. The simulation service identifier is generated based on the target original service identifier of the corresponding original service. Therefore, the scheduling server queries the simulation service information for the target simulation service identifier that matches the target original service identifier, and uses the address information corresponding to the target simulation service identifier as the target address information.

[0215] The address information acquisition request may also include a target service address identifier. In the case of multiple simulated services corresponding to the second service, the scheduling server queries the target simulated service identifier that matches the target original service identifier from the simulated service information. The target simulated service identifier corresponds to multiple address information. The scheduling server can determine the address information that matches the target service address identifier from the multiple address information and use the matching address information as the target address information.

[0216] If the target address information is found, the dispatch server can send the target address information to the first service. If the target simulated service identifier corresponding to the target original service identifier is not found, that is, there is no simulated service corresponding to the second service, the dispatch server can directly obtain the address information of the second service based on the target original service identifier and send the address information of the second service to the first service.

[0217] The scheduling server can query the target address information of the target simulation service corresponding to the second service based on the target original service identifier, so that the first service can access the target simulation service through the target address information, thereby avoiding the situation where the second service is unavailable or the data returned by the second service is unavailable during the test, thereby improving the test efficiency.

[0218] Figure 11 FIG. 1 is a flow chart showing a testing method according to an exemplary embodiment. Figure 11As shown, the testing method is applied to a simulation server, and the method includes the following steps.

[0219] S1110. Receive a test request sent by the first service based on the target address information, the target address information being the address information of the target simulation service corresponding to the second service queried from the simulation service information, and the test request carries business data;

[0220] S1120. Call the target simulation service corresponding to the target address information, test the business data, and obtain the test result data;

[0221] S1130. Send test result data to the first service.

[0222] As an optional embodiment, the simulation service information includes a simulation service address corresponding to the simulation service registered on the scheduling server, the simulation service corresponds to the second service called by the first service during the test execution, the second service is the service called by the first service during the test execution, and the simulation service corresponds to the second service called by the first service during the test execution. The second service may be the original service that does not meet the preset test conditions. The simulation service information represents the correspondence between the simulation service address and the simulation service identifier. The simulation server can pre-generate the target simulation service and the target simulation service identifier corresponding to the second service, and establish a correspondence between the target simulation service identifier and the target test configuration information, which can be described by the metadata of the target simulation service. The simulation server can receive a test request sent by the first service based on the target address information, and call the target simulation service corresponding to the target address information.

[0223] The simulation server can obtain the target simulation service identifier of the target simulation service and obtain the target simulation service's meta-information that matches the target simulation service identifier. The meta-information describes the various types of data in the target simulation service. Based on the target simulation service's meta-information, the simulation server obtains the target test configuration information corresponding to the target simulation service. The target test configuration information is the configuration information for how the test data corresponding to the target simulation service is returned.

[0224] When configuring test data, the simulation server can configure test data for at least one simulated service based on at least one preset test scenario, obtaining test configuration information corresponding to each simulated service. The number of preset test scenarios is the same as the number of simulated services. Therefore, the target test configuration information is obtained based on the target test scenario configuration. The simulation server can obtain test result data corresponding to the target test scenario based on the return method of the execution results of the business data configured in the target test configuration information.

[0225] The simulation server sends the test result data to the first service.

[0226] The simulation server can quickly build simulation services and configure test data for multiple simulation services based on different preset test scenarios. During testing, it obtains test result data corresponding to the target test scenario, which can cover more test scenarios and improve the accuracy and efficiency of the test.

[0227] The disclosed embodiment proposes a testing method, which includes: in response to the simulation service registration information sent by the simulation server, registering the service address of the simulation service, obtaining the simulation service information, receiving the address information acquisition request of the second service sent by the first service, and querying the target address information of the target simulation service corresponding to the second service from the simulation service address in the simulation service information. Sending the target address information to the first service so that the first service calls the target simulation service located on the simulation server based on the target address information, performing test processing on the business data corresponding to the first service, and obtaining test result data. This method can avoid the situation where the second service is unavailable or the data returned by the second service is unavailable during the test, thereby improving the test efficiency. The method can also quickly build a simulation service and set the test configuration information required for the target test scenario to improve the accuracy of the test.

[0228] Figure 12 FIG. 1 is a block diagram of a testing device according to an exemplary embodiment. Figure 12 , the device comprises:

[0229] The simulation service registration module 1210 is configured to execute, in response to the simulation service registration information sent by the simulation server, register the service address of the simulation service and obtain simulation service information, the simulation service information including the simulation service address corresponding to the simulation service, and the simulation service corresponding to the second service called by the first service during the test execution process;

[0230] The target address query module 1220 is configured to execute, in response to the second service address information acquisition request sent by the first service, query the target address information of the target simulated service corresponding to the second service from the simulated service address in the simulated service information;

[0231] The target address sending module 1230 is configured to send the target address information to the first service when the target address information is queried. The target address information is used to instruct the first service to call the target simulation service corresponding to the target address information located on the simulation server, and based on the target simulation service, test the business data corresponding to the first service to obtain test result data.

[0232] As an optional embodiment, the simulated service registration information includes at least a simulated service address and a simulated service identifier, where the simulated service identifier is generated based on the original service identifier of the second service. The simulated service registration module 1210 includes:

[0233] The corresponding relationship creating unit is configured to create a corresponding relationship between the simulated service address and the simulated service identifier in response to the simulated service registration information, and use the corresponding relationship as the simulated service information.

[0234] As an optional embodiment, the address information acquisition request includes the target original service identifier of the second service, and the target address query module 1220 includes:

[0235] The simulation service identifier query unit is configured to query the simulation service information for a target simulation service identifier that matches the target original service identifier based on the target original service identifier;

[0236] The target address acquiring unit is configured to acquire target address information corresponding to the target simulated service identifier from the simulated service information based on the target simulated service identifier when the target simulated service identifier is found.

[0237] As an optional embodiment, the simulation service registration information includes a simulation service address, a service address identifier, and a simulation service identifier. The service address identifier is a port identifier corresponding to the simulation service. The simulation service registration module 1210 includes:

[0238] A first correspondence creating unit is configured to create a first correspondence between a simulated service address and a service address identifier in response to the simulated service registration information;

[0239] The second correspondence creating unit is configured to create a second correspondence between the simulated service address and the simulated service identifier, and use the first correspondence and the second correspondence as simulated service information.

[0240] As an optional embodiment, the address information acquisition request includes a target original service identifier and a target service address identifier of the second service, the second service corresponds to multiple simulated services, and the target address query module 1220 includes:

[0241] The simulation service identifier query unit is configured to query the simulation service information for a target simulation service identifier that matches the target original service identifier based on the target original service identifier;

[0242] The address information acquiring unit is configured to acquire address information of multiple simulation services corresponding to the simulation service identifier from the simulation service information when the target simulation service identifier is found;

[0243] An address identifier matching unit is configured to determine address information matching the target service address identifier from address information of multiple simulated services;

[0244] The target address determining unit is configured to use the matched address information as the target address information.

[0245] Figure 13 FIG. 1 is a block diagram of a testing device according to an exemplary embodiment. Figure 13 , the device comprises:

[0246] The test request receiving module 1310 is configured to receive a test request sent by the first service based on target address information, where the target address information is address information of a target simulated service corresponding to the second service retrieved from the simulated service information, where the simulated service information includes a simulated service address corresponding to the simulated service registered on the scheduling server, where the simulated service corresponds to the second service called by the first service during the test execution process, and the test request carries business data.

[0247] The simulation service calling module 1320 is configured to execute the target simulation service corresponding to the calling target address information, perform test processing on the business data, and obtain test result data;

[0248] The test result sending module 1330 is configured to send the test result data to the first service.

[0249] As an optional embodiment, the device further includes:

[0250] A service configuration identification information acquisition module is configured to acquire service configuration identification information of a second service;

[0251] A service configuration information acquisition module is configured to acquire service configuration information corresponding to the second service based on the service configuration identification information;

[0252] a parsing module configured to parse the service configuration information to obtain parsing result information, wherein the parsing result information includes a target original service identifier of the second service;

[0253] The simulation service identifier generation module is configured to generate a target simulation service identifier of a simulation service corresponding to the second service based on the target original service identifier.

[0254] As an optional embodiment, the parsing result information further includes input parameter information and output parameter information corresponding to the second service, the input parameter information represents a data structure corresponding to the business data input to the second service, and the output parameter information represents a data structure corresponding to the execution result of the business data output by the second service. After obtaining the service configuration information of the second service from the service development information, the apparatus further includes:

[0255] The simulation service generation module is configured to add the input parameter information and the output parameter information to the preset service template information to generate a template simulation service corresponding to the second service.

[0256] As an optional embodiment, the device further includes:

[0257] A test scenario determination module is configured to determine at least one preset test scenario corresponding to the test requirement information;

[0258] a test scenario matching module configured to execute a template simulation service based on the second service and generate at least one simulation service matching the number of at least one preset test scenario;

[0259] The test configuration information generating module is configured to perform test data configuration on at least one simulation service based on at least one preset test scenario, and obtain test configuration information for each simulation service.

[0260] As an optional embodiment, the simulation service call module includes

[0261] A target test configuration information acquiring unit is configured to acquire target test configuration information corresponding to a target simulation service;

[0262] The test result data acquisition unit is configured to perform test processing on the business data based on the target test configuration information to obtain test result data.

[0263] As an optional embodiment, the device further includes:

[0264] A first port allocation module is configured to perform port allocation on the simulation service and obtain a port allocation result;

[0265] The first address information acquisition module is configured to obtain a simulated service address of the simulated service according to the port allocation result and the network protocol address of the simulated service;

[0266] A first service registration information acquisition module is configured to execute the simulation service address and the simulation service identifier as the first simulation service registration information, and send the first simulation service registration information to the scheduling server;

[0267] or;

[0268] A second port allocation module is configured to perform port allocation on the simulation service and obtain a port allocation result;

[0269] The second address information acquisition module is configured to obtain a simulated service address of the simulated service according to the port allocation result and the network protocol address of the simulated service;

[0270] A service address identifier generating module is configured to generate a service address identifier corresponding to the port allocation result;

[0271] The second service registration information acquisition module is configured to use the simulated service address, service address identifier and simulated service identifier as the second simulated service registration information, and send the second simulated service registration information to the scheduling server.

[0272] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0273] Figure 14 This is a block diagram of an electronic device for testing according to an exemplary embodiment. The electronic device may be a server, and its internal structure diagram may be as shown in FIG. Figure 14 As shown. The electronic device includes a processor, a memory, and a network interface connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a test method is implemented.

[0274] Those skilled in the art will understand that Figure 14 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0275] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1404 including instructions, and the instructions can be executed by the processor 1420 of the electronic device 1400 to perform the above method. Alternatively, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0276] In an exemplary embodiment, a computer program product is further provided, including a computer program / instruction, which implements the above-mentioned testing method when the computer program / instruction is executed by a processor.

[0277] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.

[0278] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A testing method, characterized in that: The method comprises: In response to the simulation service registration information sent by the simulation server, the service address of the simulation service is registered to obtain simulation service information, wherein the simulation service information includes a simulation service address corresponding to the simulation service, and the simulation service corresponds to a second service called by the first service during the test execution process; the simulation service information includes a first corresponding relationship and a second corresponding relationship, wherein the first corresponding relationship is a corresponding relationship between the simulation service address and the service address identifier, and the second corresponding relationship is a corresponding relationship between the simulation service address and the simulation service identifier; In response to the address information acquisition request of the second service sent by the first service, querying the target address information of the target simulated service corresponding to the second service from the simulated service address of the simulated service information; In the case where the target address information is queried, the target address information is sent to the first service, the target address information is used to instruct the first service to call the target simulation service corresponding to the target address information located on the simulation server, and based on the target simulation service, test the business data corresponding to the first service to obtain test result data; The simulation service registration information includes the simulation service address and the simulation service identifier; when there are multiple corresponding simulation services for the second service, the simulation service identifiers of the multiple simulation services are the same, and the simulation service registration information also includes the service address identifier; The method for the simulation server to generate the simulation service identifier is: Obtaining service configuration identification information of the second service; Based on the service configuration identification information, obtaining service configuration information corresponding to the second service; Parsing the service configuration information to obtain parsing result information, wherein the parsing result information includes a target original service identifier of the second service; Based on the target original service identifier, generate a target simulated service identifier of a simulated service corresponding to the second service; The method for the simulation server to generate the service address identifier is: Performing port allocation on the simulated service to obtain a port allocation result; Obtaining a simulated service address of the simulated service according to the port allocation result and the network protocol address of the simulated service; Generate a service address identifier corresponding to the port allocation result; The address information acquisition request includes a target original service identifier and a target service address identifier of the second service, the second service corresponds to multiple simulated services, and the response to the address information acquisition request for the second service sent by the first service, querying the target address information of the target simulated service corresponding to the second service from the simulated service address of the simulated service information includes: Based on the target original service identifier, querying the target simulated service identifier matching the target original service identifier from the simulated service information; When the target simulated service identifier is found, acquiring address information of multiple simulated services corresponding to the target simulated service identifier from the simulated service information; Determining, from the address information of the plurality of simulated services, address information matching the target service address identifier; The matched address information is used as the target address information.

2. The testing method according to claim 1, characterized in that: The simulated service registration information includes a simulated service address and a simulated service identifier, wherein the simulated service identifier is generated based on the original service identifier of the second service, and the simulated service registration information sent by the simulation server is responded to, and the service address of the simulated service is registered, and the obtained simulated service information includes: In response to the simulation service registration information, creating a correspondence between the simulation service address and the simulation service identifier; The corresponding relationship is used as the simulation service information.

3. The testing method according to claim 2, characterized in that: The address information acquisition request includes a target original service identifier of the second service, and the querying of target address information of a target simulated service corresponding to the second service from the simulated service address of the simulated service information in response to the address information acquisition request of the second service sent by the first service includes: Based on the target original service identifier, querying the target simulated service identifier matching the target original service identifier from the simulated service information; When the target simulation service identifier is found, the target address information corresponding to the target simulation service identifier is obtained from the simulation service information based on the target simulation service identifier.

4. The testing method according to claim 1, characterized in that: The simulated service registration information includes a simulated service address, a service address identifier and a simulated service identifier, wherein the service address identifier is a port identifier corresponding to the simulated service, and the simulated service registration information sent by the simulated server is responded to, and the service address of the simulated service is registered, and the obtained simulated service information includes: In response to the simulated service registration information, creating a first correspondence between the simulated service address and the service address identifier; Creating a second correspondence between the simulated service address and the simulated service identifier; The first corresponding relationship and the second corresponding relationship are used as the simulation service information.

5. A testing method, characterized in that: The method comprises: Receive a test request sent by the first service based on target address information, wherein the target address information is address information of a target simulated service corresponding to a second service queried from simulated service information, wherein the simulated service information includes a simulated service address corresponding to a simulated service registered on a scheduling server, wherein the simulated service corresponds to a second service called by the first service during the execution of a test, and wherein the test request carries business data; the simulated service information includes a first corresponding relationship and a second corresponding relationship, wherein the first corresponding relationship is a corresponding relationship between the simulated service address and a service address identifier, and the second corresponding relationship is a corresponding relationship between the simulated service address and a simulated service identifier; Calling the target simulation service corresponding to the target address information, performing test processing on the business data, and obtaining test result data; sending the test result data to the first service; The method further comprises: Obtaining service configuration identification information of the second service; Based on the service configuration identification information, obtaining service configuration information corresponding to the second service; Parsing the service configuration information to obtain parsing result information, wherein the parsing result information includes a target original service identifier of the second service; Based on the target original service identifier, generate a target simulated service identifier of a simulated service corresponding to the second service; When the second service has multiple corresponding simulation services, the method further includes: Performing port allocation on the simulated service to obtain a port allocation result; Obtaining a simulated service address of the simulated service according to the port allocation result and the network protocol address of the simulated service; Generate a service address identifier corresponding to the port allocation result; Using the simulated service address, the service address identifier and the simulated service identifier as second simulated service registration information, and sending the second simulated service registration information to the scheduling server; The target address information is obtained by the dispatch server through the following method: In response to the simulation service registration information sent by the simulation server, register the service address of the simulation service to obtain the simulation service information, wherein the simulation service corresponds to the second service called by the first service during the test execution; In response to the address information acquisition request for the second service sent by the first service, based on the target original service identifier, querying the target simulated service identifier that matches the target original service identifier from the simulated service information; the address information acquisition request includes the target original service identifier and the target service address identifier of the second service; When the target simulated service identifier is found, acquiring address information of multiple simulated services corresponding to the target simulated service identifier from the simulated service information; Determining, from the address information of the plurality of simulated services, address information matching the target service address identifier; The matched address information is used as the target address information.

6. The testing method according to claim 5, characterized in that: The parsing result information also includes input parameter information and output parameter information corresponding to the second service, the input parameter information represents a data structure corresponding to the business data input to the second service, and the output parameter information represents a data structure corresponding to the execution result of the business data output by the second service. After acquiring the service configuration information corresponding to the second service based on the service configuration identification information, the method further includes: The input parameter information and the output parameter information are added to the preset service template information to generate a template simulation service corresponding to the second service.

7. The testing method according to claim 6, characterized in that: The method further comprises: Determine at least one preset test scenario corresponding to the test requirement information; Generate at least one simulation service matching the number of the at least one preset test scenario based on the template simulation service corresponding to the second service; Based on the at least one preset test scenario, test data is configured for the at least one simulation service to obtain test configuration information for each simulation service.

8. The testing method according to claim 7, characterized in that: The calling of the target simulation service corresponding to the target address information to test the business data to obtain the test result data includes: Obtain target test configuration information corresponding to the target simulation service; Based on the target test configuration information, the service data is tested and processed to obtain the test result data.

9. The testing method according to claim 6, characterized in that: After generating the simulation service corresponding to the second service, the method further includes: Performing port allocation on the simulated service to obtain a port allocation result; Obtaining a simulated service address of the simulated service according to the port allocation result and the network protocol address of the simulated service; The simulated service address and the simulated service identifier are used as first simulated service registration information, and the first simulated service registration information is sent to a scheduling server.

10. A testing device, characterized in that: The device comprises: A simulation service registration module is configured to execute in response to the simulation service registration information sent by the simulation server, register the service address of the simulation service, and obtain simulation service information, wherein the simulation service information includes a simulation service address corresponding to the simulation service, and the simulation service corresponds to a second service called by the first service during the test execution process; the simulation service information includes a first corresponding relationship and a second corresponding relationship, wherein the first corresponding relationship is a corresponding relationship between the simulation service address and the service address identifier, and the second corresponding relationship is a corresponding relationship between the simulation service address and the simulation service identifier; a target address query module configured to execute, in response to a request for obtaining address information of a second service sent by the first service, query target address information of a target simulated service corresponding to the second service from the simulated service address of the simulated service information; a target address sending module, configured to execute, when the target address information is queried, sending the target address information to the first service, wherein the target address information is used to instruct the first service to call a target simulation service corresponding to the target address information located on the simulation server, and based on the target simulation service, perform test processing on the business data corresponding to the first service to obtain test result data; The simulation service registration information includes a simulation service address and a simulation service identifier; when there are multiple corresponding simulation services for the second service, the simulation service identifiers of the multiple simulation services are the same, and the simulation service registration information also includes a service address identifier; The method for the simulation server to generate the simulation service identifier is: Obtaining service configuration identification information of the second service; Based on the service configuration identification information, obtaining service configuration information corresponding to the second service; Parsing the service configuration information to obtain parsing result information, wherein the parsing result information includes a target original service identifier of the second service; Based on the target original service identifier, generate a target simulated service identifier of a simulated service corresponding to the second service; The method for the simulation server to generate the service address identifier is: Performing port allocation on the simulated service to obtain a port allocation result; Obtaining a simulated service address of the simulated service according to the port allocation result and the network protocol address of the simulated service; Generate a service address identifier corresponding to the port allocation result; The address information acquisition request includes a target original service identifier and a target service address identifier of the second service, the second service corresponds to multiple simulated services, and the target address query module includes: a simulated service identifier query unit, configured to query a target simulated service identifier matching the target original service identifier from the simulated service information based on the target original service identifier; An address information acquisition unit is configured to acquire address information of multiple simulated services corresponding to the simulated service identifier from the simulated service information when the target simulated service identifier is queried; An address identifier matching unit is configured to determine address information matching the target service address identifier from the address information of the multiple simulated services; The target address determining unit is configured to use the matched address information as the target address information.

11. The testing device according to claim 10, characterized in that: The simulated service registration information includes at least a simulated service address and a simulated service identifier, wherein the simulated service identifier is generated based on the original service identifier of the second service, and the simulated service registration module includes: The correspondence creating unit is configured to create a correspondence between the simulated service address and the simulated service identifier in response to the simulated service registration information, and use the correspondence as the simulated service information.

12. The testing device according to claim 11, characterized in that: The address information acquisition request includes a target original service identifier of the second service, and the target address query module includes: a simulated service identifier query unit, configured to query a target simulated service identifier matching the target original service identifier from the simulated service information based on the target original service identifier; The target address acquisition unit is configured to execute, when the target simulation service identifier is queried, to acquire the target address information corresponding to the target simulation service identifier from the simulation service information based on the target simulation service identifier.

13. The testing device according to claim 10, characterized in that: The simulated service registration information includes a simulated service address, a service address identifier and a simulated service identifier, wherein the service address identifier is a port identifier corresponding to the simulated service, and the simulated service registration module includes: A first correspondence creating unit, configured to create a first correspondence between the simulated service address and the service address identifier in response to the simulated service registration information; The second correspondence creating unit is configured to create a second correspondence between the simulated service address and the simulated service identifier, and use the first correspondence and the second correspondence as the simulated service information.

14. A testing device, characterized in that: The device comprises: A test request receiving module is configured to execute and receive a test request sent by a first service based on target address information, wherein the target address information is address information of a target simulated service corresponding to a second service queried from simulated service information, wherein the simulated service information includes a simulated service address corresponding to a simulated service registered on a scheduling server, wherein the simulated service corresponds to a second service called by the first service during the test execution process, and wherein the test request carries business data; the simulated service information includes a first corresponding relationship and a second corresponding relationship, wherein the first corresponding relationship is a corresponding relationship between the simulated service address and a service address identifier, and the second corresponding relationship is a corresponding relationship between the simulated service address and a simulated service identifier; A simulation service calling module is configured to execute and call the target simulation service corresponding to the target address information, perform test processing on the business data, and obtain test result data; A test result sending module, configured to execute sending the test result data to the first service; The device also includes: A service configuration identification information acquisition module, configured to execute acquisition of the service configuration identification information of the second service; A service configuration information acquisition module, configured to acquire service configuration information corresponding to the second service based on the service configuration identification information; A parsing module, configured to parse the service configuration information to obtain parsing result information, wherein the parsing result information includes a target original service identifier of the second service; A simulation service identifier generation module, configured to generate a target simulation service identifier of a simulation service corresponding to the second service based on the target original service identifier; The device also includes: A second port allocation module is configured to perform port allocation on the simulation service to obtain a port allocation result; A second address information acquisition module is configured to obtain a simulated service address of the simulated service according to the port allocation result and the network protocol address of the simulated service; A service address identifier generating module, configured to generate a service address identifier corresponding to the port allocation result; The second service registration information acquisition module is configured to use the simulated service address, the service address identifier and the simulated service identifier as second simulated service registration information, and send the second simulated service registration information to the scheduling server.

15. The testing device according to claim 14, characterized in that: The parsing result information also includes input parameter information and output parameter information corresponding to the second service, the input parameter information represents a data structure corresponding to the business data input to the second service, and the output parameter information represents a data structure corresponding to the execution result of the business data output by the second service. After acquiring the service configuration information of the second service from the service development information, the device also includes: The simulation service generation module is configured to add the input parameter information and the output parameter information to the preset service template information to generate a template simulation service corresponding to the second service.

16. The testing device according to claim 15, characterized in that: The device also includes: A test scenario determination module, configured to determine at least one preset test scenario corresponding to the test requirement information; A test scenario matching module, configured to execute a template simulation service based on the second service corresponding to the second service, and generate at least one simulation service matching the number of the at least one preset test scenario; The test configuration information generating module is configured to perform test data configuration on the at least one simulation service based on the at least one preset test scenario, and obtain test configuration information of each simulation service.

17. The testing device according to claim 16, characterized in that: The simulation service calling module includes A target test configuration information acquisition unit is configured to execute acquisition of target test configuration information corresponding to the target simulation service; The test result data acquisition unit is configured to perform test processing on the business data based on the target test configuration information to obtain the test result data.

18. The testing device according to claim 15, characterized in that: The device also includes: A first port allocation module is configured to perform port allocation on the simulation service and obtain a port allocation result; A first address information acquisition module is configured to obtain a simulated service address of the simulated service according to the port allocation result and the network protocol address of the simulated service; The first service registration information acquisition module is configured to use the simulated service address and the simulated service identifier as the first simulated service registration information, and send the first simulated service registration information to the scheduling server.

19. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement a testing method as claimed in any one of claims 1 to 9.

20. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform a testing method as claimed in any one of claims 1 to 9.

21. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, a testing method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Test method and related product

    CN109542796A

  • Remote calling method and system, related equipment and computer readable storage medium

    CN110032454A