CN113946502A - Test method, test device, electronic equipment and storage medium - Google Patents
Test method, test device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113946502A CN113946502A CN202111044052.5A CN202111044052A CN113946502A CN 113946502 A CN113946502 A CN 113946502A CN 202111044052 A CN202111044052 A CN 202111044052A CN 113946502 A CN113946502 A CN 113946502A
- Authority
- CN
- China
- Prior art keywords
- service
- simulation
- target
- information
- address
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 294
- 238000010998 test method Methods 0.000 title claims abstract description 7
- 238000004088 simulation Methods 0.000 claims abstract description 770
- 238000000034 method Methods 0.000 claims abstract description 51
- 230000008569 process Effects 0.000 claims description 20
- 230000004044 response Effects 0.000 claims description 18
- 238000012545 processing Methods 0.000 claims description 11
- 238000004458 analytical method Methods 0.000 description 19
- 238000010586 diagram Methods 0.000 description 16
- 238000004590 computer program Methods 0.000 description 7
- 238000010276 construction Methods 0.000 description 4
- 238000011161 development Methods 0.000 description 4
- 238000013507 mapping Methods 0.000 description 4
- 230000001419 dependent effect Effects 0.000 description 3
- 230000003111 delayed effect Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000002457 bidirectional effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3692—Test management for test results analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present disclosure relates to a test method, apparatus, electronic device, and storage medium, the method comprising: responding to the simulation service registration information sent by the simulation server, performing service address registration on the simulation service to obtain simulation service information, receiving an address information acquisition request of a second service sent by the first service, and inquiring target address information of a target simulation service corresponding to the second service from the simulation service address of the simulation service information. And sending the target address information to the first service, so that the first service calls the target simulation service on the simulation server based on the target address information, and testing the service data corresponding to the first service to obtain test result data. The method can avoid the situation that the second service is unavailable or the data returned by the second service is unavailable in the test, thereby improving the test efficiency.
Description
Technical Field
The present disclosure relates to the field of service testing technologies, and in particular, to a testing method and apparatus, an electronic device, and a storage medium.
Background
The mutual access among the services at the rear end of the server depends on a remote calling protocol, the scheduling among the services is uniformly coordinated through the scheduling server, and the dependent services of the services are called in the service execution process so as to meet the access requirements of users.
In the related art, a plurality of services may be passed through in one access of a user. In different test environments, there may be unavailable services in the multiple services, or there may be a situation where data returned by the services is unavailable and does not conform to a test scenario, thereby resulting in inefficient testing.
Disclosure of Invention
The present disclosure provides a testing method, device and system to at least solve the problem of low testing efficiency in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of embodiments of the present disclosure, there is provided a testing method, the method comprising;
responding to simulation service registration information sent by a simulation server, performing service address registration on the simulation service to obtain simulation service information, wherein the simulation service information comprises a simulation service address corresponding to the simulation service, and the simulation service corresponds to a second service called by a first service in the test execution process;
responding to an address information acquisition request of a second service sent by the first service, and inquiring target address information of a target simulation service corresponding to the second service from a simulation service address of the simulation service information;
and under the condition that the target address information is inquired, sending the target address information to the first service, wherein the target address information is used for indicating the first service to call a target simulation service corresponding to the target address information on the simulation server, and testing the service data corresponding to the first service based on the target simulation service to obtain test result data.
As an optional embodiment, the simulation service registration information includes a simulation service address and a simulation service identifier, where the simulation service identifier is generated based on an original service identifier of the second service, and the performing, in response to the simulation service registration information sent by the simulation server, service address registration on the simulation service to obtain the simulation service information includes:
responding to the simulation service registration information, and creating a corresponding relation between the simulation service address and the simulation service identifier;
and taking the corresponding relation as the simulation service information.
As an optional embodiment, the address information obtaining request includes a target original service identifier of the second service, and the querying, in response to the address information obtaining request of the second service sent by the first service, target address information of a target simulated service corresponding to the second service from a simulated service address of the simulated service information includes:
based on the target original service identification, inquiring a target simulation service identification matched with the target original service identification from the simulation service information;
and under the condition that the target simulation service identification is inquired, acquiring target address information corresponding to the target simulation service identification from the simulation service information based on the target simulation service identification.
As an optional embodiment, the simulation service registration information includes a simulation service address, a service address identifier, and a simulation service identifier, where the service address identifier is a port identifier corresponding to the simulation service, and performing service address registration on the simulation service in response to the simulation service registration information sent by the simulation server to obtain the simulation service information includes:
responding to the simulation service registration information, and creating a first corresponding relation between the simulation service address and the service address identifier;
creating a second corresponding relation between the simulation service address and the simulation service identifier;
and taking the first corresponding relation and the second corresponding relation as the simulation service information.
As an optional embodiment, the address information obtaining request includes a target original service identifier and a target service address identifier of the second service, the second service corresponds to a plurality of simulated services, and querying target address information of a target simulated service corresponding to the second service from simulated service addresses of the simulated service information in response to the address information obtaining request of the second service sent by the first service includes:
based on the target original service identification, inquiring a target simulation service identification matched with the target original service identification from the simulation service information;
under the condition that the target simulation service identification is inquired, acquiring address information of a plurality of simulation services corresponding to the target simulation service identification from the simulation service information;
determining address information matched with the target service address identification from the address information of the plurality of simulated services;
and taking the matched address information as the target address information.
According to a second aspect of embodiments of the present disclosure, there is provided a testing method, the method comprising;
receiving a test request sent by a first service based on target address information, wherein the target address information is address information of a target simulation service corresponding to a second service inquired from simulation service information, the simulation service information comprises a simulation service address corresponding to a simulation service registered on a scheduling server, the simulation service corresponds to the second service called by the first service in a test execution process, and the test request carries service data;
calling a target simulation service corresponding to the target address information, and testing the service data to obtain test result data;
sending the test result data to the first service.
As an optional embodiment, the method further comprises:
acquiring service configuration identification information of the second service;
acquiring service configuration information corresponding to the second service based on the service configuration identification information;
analyzing the service configuration information to obtain analysis result information, wherein the analysis result information comprises a target original service identifier of the second service;
and generating a target simulation service identifier of the simulation service corresponding to the second service based on the target original service identifier.
As an optional embodiment, the parsing result information further includes input parameter information and output parameter information corresponding to the second service, where the input parameter information represents a data structure corresponding to the service data input to the second service, the output parameter information represents a data structure corresponding to an execution result of the service data output by the second service, and after acquiring the service configuration information corresponding to the second service based on the service configuration identification information, the method further includes:
and adding the input parameter information and the output parameter information into preset service template information to generate template simulation service corresponding to the second service.
As an optional embodiment, the method further comprises:
determining at least one preset test scene corresponding to the test requirement information;
generating at least one simulation service matched with the number of the at least one preset test scene based on the template simulation service corresponding to the second service;
and respectively carrying out test data configuration on the at least one simulation service based on the at least one preset test scene to obtain test configuration information of each simulation service.
As an optional embodiment, the invoking a target simulation service corresponding to the target address information to perform test processing on the service data, and obtaining test result data includes:
acquiring target test configuration information corresponding to the target simulation service;
and testing the service data based on the target test configuration information to obtain the test result data.
As an optional embodiment, after generating the simulated service corresponding to the second service, the method further includes:
carrying out port allocation on the simulation service to obtain a port allocation result;
obtaining a simulation service address of the simulation service according to the port distribution result and the network protocol address of the simulation service;
taking the simulation service address and the simulation service identification as first simulation service registration information, and sending the first simulation service registration information to a scheduling server;
or;
carrying out port allocation on the simulation service to obtain a port allocation result;
obtaining a simulation service address of the simulation service according to the port distribution result and the network protocol address of the simulation service;
generating a service address identifier corresponding to the port allocation result;
and taking the simulation service address, the service address identifier and the simulation service identifier as second simulation service registration information, and sending the second simulation service registration information to the dispatching server.
According to a third aspect of embodiments of the present disclosure, there is provided a test apparatus, the apparatus comprising;
the simulation service registration module is configured to execute simulation service registration information sent by a simulation server, perform service address registration on a simulation service, and obtain simulation service information, wherein the simulation service information comprises a simulation service address corresponding to the simulation service, and the simulation service corresponds to a second service called by a first service in a test execution process;
a target address query module configured to execute, in response to an address information acquisition request of a second service sent by the first service, query, from a simulation service address of the simulation service information, target address information of a target simulation service corresponding to the second service;
and the target address sending module is configured to send the target address information to the first service when the target address information is inquired, wherein the target address information is used for indicating the first service to call a target simulation service corresponding to the target address information on the simulation server, and based on the target simulation service, the service data corresponding to the first service is subjected to test processing to obtain test result data.
As an optional embodiment, the simulation service registration information at least includes a simulation service address and a simulation service identifier, the simulation service identifier is generated based on an original service identifier of the second service, and the simulation service registration module includes:
a correspondence creating unit configured to perform creating a correspondence between the simulation service address and the simulation service identification in response to the simulation service registration information, and take the correspondence as the simulation service information.
As an optional embodiment, the address information obtaining request includes a target original service identifier of the second service, and the target address querying module includes:
a simulation service identification query unit configured to perform query of the simulation service information for a target simulation service identification matching the target original service identification based on the target original service identification;
and the target address acquisition unit is configured to acquire target address information corresponding to the target simulation service identifier from the simulation service information based on the target simulation service identifier under the condition that the target simulation service identifier is inquired.
As an optional embodiment, the simulation service registration information includes a simulation service address, a service address identifier, and a simulation service identifier, where the service address identifier is a port identifier corresponding to the simulation service, and the simulation service registration module includes:
a first correspondence creating unit configured to perform creating a first correspondence between the simulation service address and the service address identification in response to the simulation service registration information;
a second mapping relationship creating unit configured to create a second mapping relationship between the simulation service address and the simulation service identifier, and use the first mapping relationship and the second mapping relationship as the simulation service information.
As an optional embodiment, the address information obtaining request includes a target original service identifier and a target service address identifier of the second service, the second service corresponds to a plurality of analog services, and the target address querying module includes:
a simulation service identification query unit configured to perform query of the simulation service information for a target simulation service identification matching the target original service identification based on the target original service identification;
an address information obtaining unit configured to perform, in a case where the target simulation service identifier is queried, obtaining, from the simulation service information, address information of a plurality of simulation services corresponding to the simulation service identifier;
an address identifier matching unit configured to perform determining address information matching the target service address identifier from among the address information of the plurality of simulation services;
a target address determination unit configured to perform the matching address information as the target address information.
According to a fourth aspect of embodiments of the present disclosure, there is provided a test apparatus, the apparatus comprising;
a test request receiving module configured to execute receiving of a test request sent by a first service based on target address information, where the target address information is address information of a target simulation service corresponding to a second service queried from simulation service information, the simulation service information includes a simulation service address corresponding to a simulation service registered on a scheduling server, the simulation service corresponds to the second service called by the first service in a test execution process, and the test request carries service data;
the simulation service calling module is configured to execute calling of a target simulation service corresponding to the target address information, and test the service data to obtain test result data;
a test result sending module configured to perform sending the test result data to the first service.
As an optional embodiment, the apparatus further comprises:
a service configuration identification information acquisition module configured to perform acquisition of service configuration identification information of the second service;
a service configuration information obtaining module configured to obtain service configuration information corresponding to the second service based on the service configuration identification information;
the analysis module is configured to analyze the service configuration information to obtain analysis result information, and the analysis result information comprises a target original service identifier of the second service;
and the simulation service identification generation module is configured to execute generation of a target simulation service identification of the simulation service corresponding to the second service based on the target original service identification.
As an optional embodiment, the parsing result information further includes input parameter information and output parameter information corresponding to the second service, where the input parameter information represents a data structure corresponding to the service data input to the second service, the output parameter information represents a data structure corresponding to an execution result of the service data output by the second service, and after the service configuration information of the second service is acquired from the service development information, the apparatus further includes:
and the simulation service generation module is configured to add the input parameter information and the output parameter information to preset service template information to generate a template simulation service corresponding to the second service.
As an optional embodiment, the apparatus further comprises:
a test scenario determination module configured to perform determining at least one preset test scenario corresponding to the test requirement information;
the test scene matching module is configured to execute template simulation services corresponding to the second services and generate at least one simulation service matched with the number of the at least one preset test scene;
and the test configuration information generation module is configured to execute test data configuration on the at least one simulation service respectively based on the at least one preset test scene to obtain test configuration information of each simulation service.
As an alternative embodiment, the simulation service calling module comprises
A target test configuration information acquisition unit configured to perform acquisition of target test configuration information corresponding to the target simulation service;
and the test result data acquisition unit is configured to execute test processing on the service data based on the target test configuration information to obtain the test result data.
As an optional embodiment, the apparatus further comprises:
the first port distribution module is configured to execute port distribution on the simulation service to obtain a port distribution result;
the first address information acquisition module is configured to execute the operation according to the port distribution result and the network protocol address of the simulation service to obtain the simulation service address of the simulation service;
a first service registration information obtaining module configured to perform the simulation service address and the simulation service identifier as first simulation service registration information, and send the first simulation service registration information to the scheduling server;
or;
the second port distribution module is configured to execute port distribution on the simulation service to obtain a port distribution result;
the second address information acquisition module is configured to execute the operation according to the port distribution result and the network protocol address of the simulation service to obtain the simulation service address of the simulation service;
the service address identifier generating module is configured to execute generation of a service address identifier corresponding to the port allocation result;
a second service registration information obtaining module configured to perform the simulation service address, the service address identification, and the simulation service identification as second simulation service registration information, and transmit the second simulation service registration information to the scheduling server.
According to a fifth aspect of embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement a testing method as described above.
According to a sixth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to perform a testing method as described above.
According to a seventh aspect of embodiments of the present disclosure, there is provided a computer program product comprising computer programs/instructions which, when executed by a processor, implement one of the testing methods described above.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
the method comprises the following steps: responding to the simulation service registration information sent by the simulation server, performing service address registration on the simulation service to obtain simulation service information, receiving an address information acquisition request of a second service sent by the first service, and inquiring target address information of a target simulation service corresponding to the second service from the simulation service address of the simulation service information. And sending the target address information to the first service, so that the first service calls the target simulation service on the simulation server based on the target address information, and testing the service data corresponding to the first service to obtain test result data. The method can avoid the situation that the second service is unavailable or the data returned by the second service is unavailable in the test, thereby improving the test efficiency.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
Fig. 1 is a schematic diagram illustrating an application scenario of a testing method according to an exemplary embodiment.
FIG. 2 is an interaction flow diagram illustrating a testing method in accordance with an exemplary embodiment.
Fig. 3 is a flow chart illustrating registering simulation services based on first simulation service registration information in a testing method according to an example embodiment.
Fig. 4 is a flowchart illustrating registration of a simulation service based on second simulation service registration information in a testing method according to an example embodiment.
Fig. 5 is a diagram illustrating a method for obtaining target address information based on a target original service identifier in a test method according to an exemplary embodiment.
Fig. 6 is a flowchart illustrating a method for 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.
Fig. 7 is a diagram illustrating a method for obtaining target address information based on a target original service identifier and a target service address identifier according to an exemplary embodiment.
FIG. 8 is a flow diagram illustrating the generation of a target simulation service identification in a testing method in accordance with an exemplary embodiment.
FIG. 9 is a flow diagram illustrating the generation of a template simulation service in a testing method in accordance with an exemplary embodiment.
FIG. 10 is a flowchart illustrating a method of scheduling server-side testing in accordance with an exemplary embodiment.
FIG. 11 is a flow diagram illustrating a method of simulating server-side testing in accordance with an exemplary embodiment.
Fig. 12 is a block diagram illustrating a test apparatus on a dispatch server side in accordance with an example embodiment.
FIG. 13 is a block diagram illustrating a simulation server-side testing device in accordance with an exemplary embodiment.
FIG. 14 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The following terms are explained first:
software Development Kit (SDK) is generally a collection of Development tools used by some Software engineers to build application Software for a particular Software package, Software framework, hardware platform, operating system, etc.
maven is a java project construction system, and is a software project management tool which can manage the construction, report and document of projects through a small piece of description information.
The gRPC service in the remote invocation service is one of RPC services, and it uses Protocol Buffer as a serialization format, which is a serialization framework from google, is lighter and more efficient than Json, and simultaneously, is designed based on HTTP/2 standard, bringing about characteristics such as bidirectional flow, flow control, header compression, multiple multiplexing requests on a single TCP connection, and the like.
Fig. 1 is a schematic diagram of an application scenario of a testing method according to an exemplary embodiment, where the application scenario includes: dispatch server 110, simulation server 120, first service 130, and target simulation service 140. The dispatch server 110 receives the simulation service registration information sent by the simulation server 120, and registers a service address for the simulation service to obtain the simulation service information. The scheduling server 110 receives an address information obtaining request of the second service sent by the first service 130, where the address information obtaining request includes a target original service identifier of the second service, and the scheduling server 110 obtains target address information of a target simulation service corresponding to the second service based on the target original service identifier. The dispatch server 110 sends the destination address information to the first service 130. The first service 130 sends a test request to the simulation server 120 based on the target address information, and the simulation server 120 calls the target simulation service 140 to perform test processing on the service data carried in the test request, so as to obtain test result data. The simulation server 120 sends the test result data to the first service 130.
In the embodiment of the present disclosure, the scheduling server 110 and the simulation server 120 may include one independently operating server, or distributed servers, or a server cluster composed of a plurality of servers. The dispatch server 110 and simulation server 120 may include network communication units, processors and memory, and the like. Specifically, the dispatch server 110 may provide target address information of the target simulation service, and the simulation server 120 may call the target simulation service for the test process.
In the embodiment of the present disclosure, the first service 130 and the second service may be distributed services, where the distributed services are obtained by dividing a large service into a plurality of service modules, the service modules are respectively deployed on different machines, and data interaction is performed between the service modules through interfaces. The target simulation service 140 is a simulation service corresponding to the second service, and may be provided on the simulation server 120.
FIG. 2 is an interactive flow diagram illustrating a testing method according to an exemplary embodiment, as shown in FIG. 2, including the following steps.
S210, the scheduling server responds to the simulation service registration information sent by the simulation server, service address registration is carried out on the simulation service, simulation service information is obtained, the simulation service information comprises a simulation service address corresponding to the simulation service, and the simulation service corresponds to a second service called by the first service in the test execution process.
As an optional embodiment, the second service is a dependent service of the first service, and during the execution of the first service, the first service needs to invoke the second service, and correspondingly, during the execution test of the first service, the first service also needs to invoke the second service. In the related art, when the first service calls the second service, the second service may not be available or data output by the second service may not be available, and when the second service is not available or data output by the second service is not available, the second service may be determined to be an original service that does not satisfy the preset test condition. And the scheduling server stores the address information of the simulation service corresponding to the unavailable second service. The scheduling server further stores address information of the available second service, and in the case that the second service is available, the scheduling server may send the address information of the available second service to the first service.
As an alternative embodiment, referring to fig. 3, before the dispatch server receives the address information obtaining request of the second service sent by the first service, the dispatch server may register a simulated service corresponding to the second service on the dispatch server, so that the first service calls the simulated service corresponding to the second service when calling the second service, and the method further includes:
s310, the simulation server performs port allocation on the simulation service to obtain a port allocation result;
s320, the simulation server obtains a simulation service address corresponding to the simulation service according to the port distribution result and the network protocol address of the simulation service;
s330, the simulation server takes the simulation service address and the simulation service identification as first simulation service registration information and sends the first simulation service registration information to the scheduling server;
and S340, the scheduling server responds to the first simulation service registration information, creates a corresponding relation between the simulation service address and the simulation service identifier, and takes the corresponding relation as the simulation service information.
As an alternative embodiment, after generating the simulation service corresponding to the second service on the simulation server, the simulation server may allocate a port to the simulation service, where the port to which the simulation service is allocated is a port allocation result. The simulation server may also allocate a thread for executing the simulation service to the simulation service, so as to start the simulation service and obtain an Internet Protocol Address (ip Address) of the simulation service. The simulation server combines the port and the network protocol address allocated to the simulation service, so that the simulation service address of the simulation service can be obtained, and the simulation service can be called based on the simulation service address. When the simulation service is generated on the simulation server, a simulation service identifier of the simulation service is also generated, so that a corresponding relationship 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 an original service identifier of the second service, and the simulation service identifier can be name information of the simulation service. The simulation server sends the simulation service identifier and the simulation service address to the scheduling server as first simulation service registration information.
When the scheduling server receives the first simulation service registration information, the scheduling server responds to the first simulation service registration information sent by the simulation server to register 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 first service is completed. When the service address is registered, the corresponding relation between the simulation service address and the simulation service identifier is established and used as the simulation service information, so that when the dispatching server receives an address acquisition request of a second service sent by the first service, the address information of the simulation service can be acquired by inquiring the target address information corresponding to the target original service identifier in the simulation service information.
The simulation server sends the first simulation service registration information to the scheduling server, so that the registration of the simulation service can be completed, the registration of the simulation service can be completed quickly, the user operation is facilitated, and the user experience is improved. And the simulation server distributes ports to the simulation services, so that the uniqueness of the address information of the simulation services is ensured, and the address information is convenient to query.
As an alternative embodiment, referring to fig. 4, before the dispatch server receives the address information obtaining request of the second service sent by the first service, the dispatch server may register a simulated service corresponding to the second service on the dispatch server, so that the first service calls the simulated service corresponding to the second service when calling the second service, and the method further includes:
s410, the simulation server performs port allocation on the simulation service to obtain a port allocation result;
s420, the simulation server obtains a simulation service address corresponding to the simulation service according to the port distribution result and the network protocol address of the simulation service;
s430, the simulation server generates a service address identifier corresponding to a port distribution result;
and S440, the simulation server takes the simulation service address, the service address identifier and the simulation service identifier as second simulation service registration information and sends the second simulation service registration information to the scheduling server.
S450, the scheduling server responds to the second simulation service registration information and creates a first corresponding relation between the simulation service address and the service address identifier;
s460, the scheduling server creates a second corresponding relation between the simulation service address and the simulation service identifier, and uses the first corresponding relation and the second corresponding relation as simulation service information.
As an alternative embodiment, after generating the simulation service corresponding to the second service on the simulation server, the simulation server may allocate a port to the simulation service, where the port to which the simulation service is allocated is a port allocation result. In the case where there are a plurality of corresponding analog services for the second service, each analog service is assigned to a different port.
When the simulation service is generated on the simulation server, the simulation service identifier of the simulation service is also generated, the corresponding relation between the simulation service identifier and the simulation service is established, and the simulation service identifier can be generated based on the original service identifier of the second service, so that the simulation service identifiers of a plurality of simulation services are the same. Therefore, in the case that the second service has a plurality of corresponding simulation services, the simulation server may further determine a service address identifier corresponding to the port to which each simulation service is allocated, and by using the service address identifier, a target simulation service may be determined from the plurality of simulation services when the simulation service is called. The service address identification may be swim lane information.
The simulation server can also allocate a thread for executing the simulation service to the simulation service, so that the simulation service is started to obtain the ip address of the simulation service. The simulation server combines the port and the ip address allocated to the simulation service, so that the simulation service address of the simulation service can be obtained, and the simulation service can be called based on the simulation service address. The simulation server sends the simulation service identifier, the address identifier and the simulation service address to the scheduling server as second simulation service registration information.
And when the scheduling server receives the second simulation service registration information, responding to the second simulation service registration information sent by the simulation server, performing service address registration on the simulation service to obtain the simulation service information, and completing the registration of the simulation service corresponding to the second service. When the service address is registered, a first corresponding relation between the simulation service address and the service address identification is created, so that the simulation service corresponding to each service address identification can correspond to the same simulation service address, a second corresponding relation between the simulation service address and the simulation service identification is created, so that each simulation service address can correspond to the simulation service identification, and therefore when the dispatching server receives an address acquisition request of the second service sent by the first service, the address information of the simulation service can be acquired by inquiring target address information corresponding to a target original service identification and a target service address identification in the simulation service information.
The simulation server sends the second simulation service registration information to the scheduling server, so that the registration of the simulation service can be quickly completed through the second simulation service registration information, the user operation is facilitated, and the user experience is improved. And the simulation server distributes ports to the simulation services and generates service address identifiers, so that the uniqueness of the address information of the simulation services is ensured, and the address information is convenient to query.
S220, the scheduling server responds to the address information acquisition request of the second service sent by the first service, and inquires target address information of a target simulation service corresponding to the second service from the simulation service address of the simulation service information.
As an optional embodiment, if the scheduling server can query the simulation service information for the target simulation service corresponding to the second service, the scheduling server sends the target address information of the target simulation service to the first service. If the scheduling server does not inquire the target address information of the target simulation service corresponding to the second service from the simulation service information, the scheduling server can directly inquire the address information of the second service and send the address information of the second service to the first service.
As an optional embodiment, the address information obtaining request includes a target original service identifier of the second service, and the querying, by the scheduling server, 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 response to the address information obtaining request of the second service sent by the first service includes:
the scheduling server inquires a target simulation service identifier matched with the target original service identifier from the simulation service information based on the target original service identifier;
and under the condition that the target simulation service identification is inquired, the scheduling server acquires target address information corresponding to the target simulation service identification from the simulation service information based on the target simulation service identification.
As an alternative embodiment, in the case that the second service is unavailable, the destination address information of the simulated service corresponding to the second service may be acquired from the scheduling server. The simulation service identifier is generated based on the original service identifier of the corresponding original service, so that the scheduling server can query a target simulation service identifier matched with the target original service identifier from the simulation service information, namely query the simulation service identifier generated based on the target original service identifier, and use the simulation service identifier as the target simulation service identifier.
The scheduling server may obtain address information corresponding to the target simulation service identifier from the simulation service information when the target simulation service identifier is queried, and use the address information corresponding to the target simulation service identifier as target address information of the target simulation service.
As an alternative embodiment, as shown in fig. 5, service a is a first service, service B is a second service, simulation service B0 is a target simulation service corresponding to the second service, and simulation service B may be registered in the dispatch server in advance. The service A sends a target original service identifier b to the scheduling server, and the scheduling server acquires target address information b '0 corresponding to a target simulation service identifier b' matched with the target original service identifier b. The service A receives the target address information B '0 and accesses the simulation service B0 based on the target address information B' 0, transmits the traffic data to the simulation service B0, and receives the test result data returned by the simulation service B0.
Under the condition that the second service corresponds to one simulation service, the scheduling server acquires address information corresponding to the target simulation service identifier as target address information, so that the problem that the second service is unavailable is avoided, and the testing efficiency is improved.
As an alternative embodiment, referring to fig. 6, the address information obtaining request further includes a destination service address identifier, the second service corresponds to a plurality of simulated services, and the querying, by the scheduling server, the destination address information of the destination simulated service corresponding to the second service from the simulated service addresses of the simulated service information in response to the address information obtaining request of the second service sent by the first service includes:
s610, the scheduling server inquires a target simulation service identifier matched with the target original service identifier from the simulation service information based on the target original service identifier;
s620, under the condition that the target simulation service identification is inquired by the scheduling server, acquiring address information of a plurality of simulation services corresponding to the target simulation service identification from the simulation service information;
s630, the scheduling server determines address information matched with the target service address identifier from the address information of the plurality of simulation services;
and S640, the scheduling server takes the matched address information as target address information.
As an alternative embodiment, as shown in fig. 7, when the second service is available but the data returned by the second service is unavailable, the target address information of the target simulation service corresponding to the second service may be obtained from the scheduling server, the target simulation service is preset with target test data configuration information, and when the first service calls the target simulation service based on the target address information, the target simulation service may return test result data based on the target test data configuration information.
The scheduling server may query the simulation service information for a target simulation service identifier matching the target original service identifier based on the target original service identifier. In the case that the second service corresponds to a plurality of simulation services, the target simulation service identifier corresponds to the plurality of simulation services, and a plurality of address information corresponding to the target simulation service identifier, that is, address information of the plurality of simulation services corresponding to the target simulation service identifier, may be obtained from the simulation service information.
The address information obtaining request further includes a target service address identifier, where the target service address identifier is used to indicate an address identifier of a simulation service corresponding to the test data configuration information corresponding to the current test scenario, and the target service address identifier may be lane information. The swim lane information may enable simulation services corresponding to different test scenarios to run on separate physical machines. And the dispatching server determines address information matched with the target service address identification from the address information of the plurality of simulation services, and takes the matched address information as the target address information of the target simulation service.
As an alternative embodiment, as shown in fig. 7, the service C is a first service, the service D is a second service, the simulation service D2 is a target simulation service corresponding to the second service, and the simulation service D2 may be registered in the scheduling server in advance. And the service C sends a target original service identifier d and a target service address identifier d2 to the dispatching server, and the dispatching server acquires a plurality of address information corresponding to the target simulation service identifier d 'matched with the target original service identifier d, wherein the address information comprises address information d' 1, address information d '2 and address information d' 3. Address information d '2 matching the destination service address identification d2 is determined from the plurality of address information, and the address information d' 2 is transmitted as destination address information to the service a. The service A receives the destination address information D '2 and accesses the simulation service D2 based on the destination address information D' 2, transmits the traffic data to the simulation service D2, and receives the test result data returned by the simulation service D2.
Under the condition that the second service corresponds to a plurality of simulation services, the scheduling server acquires a plurality of address information corresponding to the target simulation service identification, and acquires address information matched with the target service address identification from the plurality of address information as target address information, so that the problem that the return data of the second service is unavailable is avoided, and the test efficiency is improved.
And S230, the scheduling server sends the target address information to the first service under the condition of inquiring the target address information.
S240, the simulation server receives a test request sent by the first service based on the target address information, wherein the test request carries service data;
as an optional embodiment, after receiving the target address information, the first service sends a test request based on the target address information, and requests the simulation server to invoke the target simulation service. The test request sent by the first service carries the service data, and after the simulation server calls the target simulation service, the service data can be tested based on the target simulation service to obtain test result data.
S250, the simulation server calls a target simulation service corresponding to the target address information, and tests and processes the service data to obtain test result data;
as an optional embodiment, invoking a target simulation service corresponding to the target address information to perform test processing on the service data, and obtaining test result data includes:
the simulation server acquires target test configuration information corresponding to a target simulation service;
and the simulation server tests and processes the service data based on the target test configuration information to obtain test result data.
As an optional embodiment, the simulation server may generate a target simulation service and a target simulation service identifier corresponding to the second service in advance, and establish a corresponding relationship between the target simulation service identifier and the target test configuration information, where the corresponding relationship may be described by meta information of the target simulation service.
The simulation server calls a target simulation service corresponding to the target address information, a target simulation service identifier of the target simulation service can be obtained, and meta information of the target simulation service matched with the target simulation service identifier is obtained, wherein the meta information is information describing various data in the target simulation service, and the various data comprise test configuration information of the target simulation service, the target simulation service identifier and the like. And the simulation server obtains target test configuration information corresponding to the target simulation service according to the meta information of the target simulation service, wherein the target test configuration information is configuration information of a return mode of test data corresponding to the target simulation service. The simulation server can perform test processing on the service data based on the target test configuration information.
The target test configuration information is configured based on the target test scenario, so that the test result data corresponding to the target test scenario can be obtained according to the return mode of the execution result of the service data configured in the target test configuration information.
The simulation server can perform test processing based on target test configuration information corresponding to the target simulation service, returns test result data corresponding to a target test scenario, and can be adapted to various different test scenarios, so that test diversity is improved.
And S260, the simulation server sends test result data to the first service.
As an alternative embodiment, please refer to fig. 8, the method further includes:
s810, the simulation server acquires service configuration identification information of a second service;
s820, the simulation server acquires service configuration information corresponding to the second service based on the service configuration identification information;
s830, the simulation server analyzes the service configuration information to obtain analysis result information, wherein the analysis result information comprises a target original service identifier of the second service;
and 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.
As an optional embodiment, the simulation server obtains service configuration identification information of the second service, where the service configuration identification information may be a build identification of a project building system of a Software Development Kit (SDK) to which the second service belongs, and in a case that the project building system is maven, the build identification may include a project organization identification (groupId), a project identification (artifactId), and version information (version). And after the simulation service acquires the construction identification, downloading the SDK corresponding to the construction identification. The simulation server obtains service configuration information in the SDK, wherein the service configuration information can be service declaration information of a remote calling service, and the remote calling service can be a gPC service.
The simulation server analyzes the service declaration information of the remote calling service, namely analyzes the service declaration information of the gPC service, so that analysis result information can be obtained, and the analysis result information comprises a target original service identifier of the second service. The target original service identification may be an original service name of the second service. The simulation server may generate a target simulation service identifier of the simulation service corresponding to the second service according to the target original service identifier. And under the condition that 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.
The simulation server can automatically analyze the service configuration information to generate analysis result information, and the user selects the original service identifier from the analysis result information to generate the simulation service identifier, so that the problem caused by the input error of the user can be avoided, and the efficiency of generating the simulation service name is improved.
As an optional embodiment, the parsing result information further includes input parameter information and output parameter information corresponding to the second service, and after acquiring the service configuration information of the second service from the service development information, the method further includes:
and adding the input parameter information and the output parameter information into preset service template information to generate template simulation service corresponding to the second service.
As an alternative embodiment, preset service template information is obtained from a service template library, and the service template library may be a self-defined service instance factory. The service template information is a general service agent object which can be used as a simulation service entity required when the simulation service is started. When generating any simulation service corresponding to the original service which does not meet the test condition, the service template information can be used as a simulation service entity.
The analysis result information obtained by analyzing the service configuration information of the second service also comprises input parameter information and output parameter information of 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. And adding the input parameter information and the output parameter information into the service template information, so that the input and output structures of the service template information added with the input parameter information and the output parameter information are the same as those of the second service, and the second service can be simulated by adding the service template information added with the input parameter information and the output parameter information, so that the template simulation service corresponding to the second service is obtained.
When the simulation service corresponding to any original service which does not meet the test condition is generated, the input parameter information and the output parameter information of the original service which does not meet the test condition can be obtained from the analysis result information obtained by analyzing the service configuration information of any original service which does not meet the test condition in a reflection analysis mode. And adding the input parameter information and the output parameter information of the original service to the service template information to obtain the template simulation service corresponding to the original service.
The simulation server can automatically analyze the service configuration information to generate analysis result information, the user selects input parameter information and output parameter information from the analysis result information, the input parameter information and the output parameter information are combined with preset service template information to obtain template simulation service, the template simulation service corresponding to the second service can be quickly established, and the efficiency of generating the simulation service is improved.
As an alternative embodiment, please refer to fig. 9, the method further includes:
s910, the simulation server determines at least one preset test scene corresponding to the test requirement information;
s920, the simulation server generates at least one simulation service matched with the number of the preset test scenes according to the template simulation service corresponding to the second service;
s930, the simulation server performs test data configuration on at least one simulation service respectively based on at least one preset test scene to obtain test configuration information of each simulation service.
As an optional embodiment, the test requirement information of the first service is obtained, and the corresponding at least one preset test scenario is obtained according to the test requirement information. And copying the template simulation service corresponding to the second service according to the number of the preset test scenes to obtain at least one simulation service matched with the number of the preset test scenes. The preset test scenes and the simulation services are in one-to-one correspondence, test data configuration is respectively carried out on the simulation services corresponding to each preset test scene, and test configuration information of each simulation service can be obtained.
As an alternative embodiment, when configuring the test data for the analog service, the test data may be configured after allocating a port to the analog service and starting the analog service.
As an alternative embodiment, the preset test scenario 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.
And under the condition that the preset test scene is a matched data test scene, setting the simulation service to return an execution result matched with the service data as test result data corresponding to the service data, and obtaining the test configuration information of the simulation service according to the setting. For example, when receiving the service data X, the configuration simulation service may return an execution result X matching the service data X as test result data corresponding to the service data X.
And under the condition that the preset test scene is a random data test scene, setting the simulation service to return any execution result in the execution results of the preset service data as test result data corresponding to the service data, and obtaining the test configuration information of the simulation service according to the setting. For example, the execution result of the preset business data includes A, B, C, D and E five execution results, and when the setting simulation service receives the business data x, any one of the five execution results A, B, C, D and E may be returned as the test result data corresponding to the business data x.
And under the condition that the preset test scene is a paging data test scene, setting the simulation service to return the next execution result of the execution result of each service data as the test result data corresponding to the currently received service data, and obtaining the test configuration information of the simulation service according to the setting. For example, the execution result of the preset service data includes A, B, C, D and E five execution results, the simulation service may return the execution result a as the test result data corresponding to the service data x1 when receiving the service data x1, the simulation service may return the execution result B as the test result data corresponding to the service data x2 when receiving the service data x2, and so on, and the simulation service may return the execution result E as the test result data corresponding to the service data x5 when receiving the service data x 5.
In the case that the preset test scenario is a proportional return test scenario, the set simulation service may return an execution result of the service data corresponding to the data proportional information based on the preset data proportional information, as test result data corresponding to the service data, and obtain test configuration information of the simulation service according to the setting. For example, the preset data proportion information is set to be 50%, and when the simulation service receives the service data X, the simulation service may return an execution result of 50% X as test result data corresponding to the service data X.
In the case that the preset test scenario is a delayed return test scenario, the setting of the simulation service may delay returning of the execution result of the service data based on the preset delay time, and obtain the test configuration information of the simulation service according to the setting. For example, the preset delay time is set to t1, and when the simulation service receives the service data X, the simulation service may wait for t1 time and then return the execution result X as the test result data corresponding to the service data X.
Based on different preset test scenes, test data configuration is respectively carried out on the plurality of simulation services, so that the simulation services can cover more test scenes, and the test efficiency and accuracy are improved.
Fig. 10 is a flowchart illustrating a testing method according to an exemplary embodiment, where the testing method is applied to a dispatch server, as shown in fig. 10, and the method includes the following steps.
S1010, responding to simulation service registration information sent by a simulation server, performing service address registration on the simulation service to obtain simulation service information, wherein the simulation service information comprises a simulation service address corresponding to the simulation service, and the simulation service corresponds to a second service called by a first service in the test execution process;
s1020, in response to an address information acquisition request of a second service sent by the first service, inquiring target address information of a target simulation service corresponding to the second service from a simulation service address of the simulation service information;
and S1030, under the condition that the target address information is inquired, sending the target address information to the first service, wherein the target address information is used for indicating the first service to call a target simulation service corresponding to the target address information on the simulation server, and testing the service data corresponding to the first service based on the target simulation service to obtain test result data.
As an optional embodiment, the scheduling server receives simulation service registration information sent by the simulation server, performs service address registration on the simulation service to obtain simulation service information, creates a corresponding relationship between the simulation service address and the simulation service identifier under the condition that the simulation service registration information includes the simulation service address and the simulation service identifier, and uses the corresponding relationship as the simulation service information. And under the condition that the simulation service registration information comprises a simulation service address, a service address identifier and a simulation service identifier, creating a first corresponding relation between the simulation service address and the service address identifier, creating a second corresponding relation between the simulation service address and the simulation service identifier, and taking the first corresponding relation and the second corresponding relation as the simulation service information.
The second service is a dependent service of the first service, and the first service needs to call the second service in the process of executing the test on the first service. The method comprises the steps that a scheduling server receives an address information acquisition request of a second service sent by a first service, wherein the address information acquisition request comprises a target original service identification of the second service. The simulation service identification is generated based on the target original service identification of the corresponding original service, so that the scheduling server inquires the target simulation service identification matched with the target original service identification from the simulation service information and takes the address information corresponding to the target simulation service identification as the target address information.
The address information acquisition request can further include a target service address identifier, in the case of multiple simulated services corresponding to the second service, the scheduling server queries a target simulated service identifier matching the target original service identifier from the simulated service information, where the target simulated service identifier corresponds to multiple pieces of address information, and the scheduling server can determine, from the multiple pieces of address information, address information matching the target service address identifier and use the matched address information as the target address information.
In case that the target address information is queried, the scheduling server may transmit the target address information to the first service. Under the condition that the target simulation service identifier corresponding to the target original service identifier is not inquired, namely, the simulation service corresponding to the second service does not exist, the scheduling server can directly acquire the address information of the second service according to the target original service identifier and send the address information of the second service to the first service.
The scheduling server can query target address information of a target simulation service corresponding to the second service based on the target original service identifier, so that the first service accesses the target simulation service through the target address information, thereby avoiding the situation that the second service is unavailable or data returned by the second service is unavailable during testing, and improving the testing efficiency.
Fig. 11 is a flow chart illustrating a testing method according to an exemplary embodiment, as shown in fig. 11, applied in a simulation server, the method including the following steps.
S1110, receiving a test request sent by a first service based on target address information, wherein the target address information is address information of a target simulation service corresponding to a second service inquired from simulation service information, and the test request carries service data;
s1120, calling a target simulation service corresponding to the target address information, and testing the service data to obtain test result data;
s1130, sending the test result data to the first service.
As an optional embodiment, the simulation service information includes a simulation service address corresponding to a simulation service registered on the scheduling server, the simulation service corresponds to a second service called by the first service in the test execution process, the second service is a service called by the first service in the test execution process, the simulation service corresponds to a second service called by the first service in the test execution process, and the second service may be an original service that does not meet the preset test condition. The simulation service information represents the corresponding relation between the simulation service address and the simulation service identifier. The simulation server may generate a target simulation service and a target simulation service identifier corresponding to the second service in advance, and establish a correspondence between the target simulation service identifier and the target test configuration information, where the correspondence may be described by meta information of the target simulation service. The simulation server may receive a test request sent by the first service based on the target address information, and call a target simulation service corresponding to the target address information.
The simulation server may obtain a target simulation service identifier of the target simulation service, and obtain meta information of the target simulation service matching the target simulation service identifier, where the meta information is information describing various types of data in the target simulation service. And the simulation server obtains target test configuration information corresponding to the target simulation service according to the meta information of the target simulation service, wherein the target test configuration information is configuration information of a return mode of test data corresponding to the target simulation service.
When the test data configuration is performed, the simulation server may perform the test data configuration on at least one simulation service respectively based on at least one preset test scenario, so as to obtain test configuration information corresponding to each simulation service. The number of the preset test scenes is the same as the number of the simulation services. Therefore, the target test configuration information is configured based on the target test scenario, and the simulation server can obtain the test result data corresponding to the target test scenario according to the return mode of the execution result of the service data configured in the target test configuration information.
And the simulation server sends the test result data to the first service.
The simulation server can quickly construct simulation services, test data configuration is respectively carried out on the simulation services based on different preset test scenes, test result data corresponding to a target test scene are obtained during testing, more test scenes can be covered, and the testing accuracy and efficiency are improved.
The embodiment of the disclosure provides a test method, which includes: responding to the simulation service registration information sent by the simulation server, performing service address registration on the simulation service to obtain simulation service information, receiving an address information acquisition request of a second service sent by the first service, and inquiring target address information of a target simulation service corresponding to the second service from the simulation service address of the simulation service information. And sending the target address information to the first service, so that the first service calls the target simulation service on the simulation server based on the target address information, and testing the service data corresponding to the first service to obtain test result data. The method can avoid the situation that the second service is unavailable or the data returned by the second service is unavailable in the test, thereby improving the test efficiency.
FIG. 12 is a block diagram illustrating a test apparatus according to an exemplary embodiment. Referring to fig. 12, the apparatus includes;
the simulation service registration module 1210 is configured to execute a simulation service registration message sent by a simulation server, perform service address registration on a simulation service, and obtain simulation service information, where 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 a first service in a test execution process;
a target address query module 1220 configured to execute, in response to an address information acquisition request of the second service sent by the first service, querying target address information of a target simulation service corresponding to the second service from a simulation service address of the simulation service information;
and the target address sending module 1230 is configured to send target address information to the first service when the target address information is queried, where the target address information is used to instruct the first service to call a target simulation service corresponding to the target address information on the simulation server, and perform test processing on the service data corresponding to the first service based on the target simulation service to obtain test result data.
As an alternative embodiment, the simulation service registration information at least includes a simulation service address and a simulation service identifier, the simulation service identifier is generated based on the original service identifier of the second service, and the simulation service registration module 1210 includes:
and a correspondence creating unit configured to perform creating a correspondence between the simulation service address and the simulation service identification in response to the simulation service registration information, and take the correspondence as the simulation service information.
As an alternative embodiment, the address information obtaining request includes a target original service identifier of the second service, and the target address querying module 1220 includes:
the simulation service identification query unit is configured to execute query of target simulation service identification matched with the target original service identification from the simulation service information based on the target original service identification;
and the target address acquisition unit is configured to acquire target address information corresponding to the target simulation service identifier from the simulation service information based on the target simulation service identifier under the condition that the target simulation service identifier is inquired.
As an alternative embodiment, the simulation service registration information includes a simulation service address, a service address identifier, and a simulation service identifier, where the service address identifier is a port identifier corresponding to a simulation service, and the simulation service registration module 1210 includes:
a first correspondence relationship creating unit configured to perform creating a first correspondence relationship between the simulation service address and the service address identification in response to the simulation service registration information;
and the second corresponding relation creating unit is configured to execute creating a second corresponding relation between the simulation service address and the simulation service identifier, and take the first corresponding relation and the second corresponding relation as simulation service information.
As an alternative embodiment, the address information obtaining request includes a target original service identifier and a target service address identifier of a second service, the second service corresponds to a plurality of simulated services, and the target address querying module 1220 includes:
the simulation service identification query unit is configured to execute query of target simulation service identification matched with the target original service identification from the simulation service information based on the target original service identification;
the address information acquisition unit is configured to acquire address information of a plurality of simulation services corresponding to the simulation service identification from the simulation service information under the condition that the target simulation service identification is inquired;
an address identifier matching unit configured to perform determining address information matching a target service address identifier from among address information of a plurality of simulation services;
a target address determination unit configured to perform the matching of the address information as target address information.
FIG. 13 is a block diagram illustrating a test apparatus according to an exemplary embodiment. Referring to fig. 13, the apparatus includes;
a test request receiving module 1310 configured to execute receiving a test request sent by a first service based on target address information, where the target address information is address information of a target simulation service corresponding to a second service queried from simulation service information, the simulation service information includes a simulation service address corresponding to a simulation service registered on a scheduling server, the simulation service corresponds to the second service called by the first service in a test execution process, and the test request carries service data;
a simulation service calling module 1320, configured to execute a target simulation service corresponding to the calling target address information, and perform test processing on the service data to obtain test result data;
the test result sending module 1330 is configured to perform sending the test result data to the first service.
As an optional embodiment, the apparatus further comprises:
a service configuration identification information acquisition module configured to perform acquisition of service configuration identification information of a second service;
the service configuration information acquisition module is configured to execute service configuration information corresponding to the second service based on the service configuration identification information;
the analysis module is configured to analyze the service configuration information to obtain analysis result information, and the analysis result information comprises a target original service identifier of the second service;
and the simulation service identification generation module is configured to execute generation of a target simulation service identification of the simulation service corresponding to the second service based on the target original service identification.
As an optional embodiment, the parsing result information further includes input parameter information and output parameter information corresponding to the second service, where the input parameter information represents a data structure corresponding to the service data input to the second service, and the output parameter information represents a data structure corresponding to an execution result of the service data output by the second service, and after acquiring the service configuration information of the second service from the service development information, the apparatus further includes:
and the simulation service generation module is configured to add the input parameter information and the output parameter information to preset service template information and generate a template simulation service corresponding to the second service.
As an optional embodiment, the apparatus further comprises:
the test scene determining module is configured to execute determining at least one preset test scene corresponding to the test requirement information;
the test scene matching module is configured to execute template simulation services corresponding to the second services and generate at least one simulation service matched with the number of at least one preset test scene;
and the test configuration information generation module is configured to execute test data configuration on at least one simulation service respectively based on at least one preset test scene to obtain test configuration information of each simulation service.
As an alternative embodiment, the simulation service calling module comprises
A target test configuration information acquisition unit configured to execute acquisition of target test configuration information corresponding to a target simulation service;
and the test result data acquisition unit is configured to execute test processing on the service data based on the target test configuration information to obtain test result data.
As an optional embodiment, the apparatus further comprises:
the first port distribution module is configured to execute port distribution on the analog service to obtain a port distribution result;
the first address information acquisition module is configured to execute the network protocol address according to the port distribution result and the simulation service to obtain the simulation service address of the simulation service;
a first service registration information acquisition module configured to perform a simulation service address and a simulation service identifier as first simulation service registration information, and transmit the first simulation service registration information to the scheduling server;
or;
the second port distribution module is configured to execute port distribution on the analog service to obtain a port distribution result;
the second address information acquisition module is configured to execute the network protocol address according to the port distribution result and the simulation service to obtain the simulation service address of the simulation service;
the service address identifier generating module is configured to execute the generation of the service address identifier corresponding to the port allocation result;
and the second service registration information acquisition module is configured to execute taking the simulation service address, the service address identifier and the simulation service identifier as second simulation service registration information and send the second simulation service registration information to the scheduling server.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 14 is a block diagram illustrating an electronic device for testing, which may be a server, according to an exemplary embodiment, and an internal structure thereof may be as shown in fig. 14. The electronic device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic equipment comprises a nonvolatile 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 an operating system and computer programs in the non-volatile storage medium. The network interface of the electronic device is used for connecting and communicating with an external terminal through a network. The computer program is executed by a processor to implement a testing method.
Those skilled in the art will appreciate that the architecture shown in fig. 14 is merely a block diagram of some of the structures associated with the disclosed aspects and does not constitute a limitation on the electronic devices to which the disclosed aspects apply, as a particular electronic device may include more or less components than those shown, or combine certain components, or have a different arrangement of components.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as the memory 1404 comprising instructions, executable by the processor 1420 of the electronic device 1400 to perform the above-described method is also provided. Alternatively, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, there is also provided a computer program product comprising computer programs/instructions which, when executed by a processor, implement one of the testing methods described above.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (10)
1. A method of testing, the method comprising:
responding to simulation service registration information sent by a simulation server, performing service address registration on the simulation service to obtain simulation service information, wherein the simulation service information comprises a simulation service address corresponding to the simulation service, and the simulation service corresponds to a second service called by a first service in the test execution process;
responding to an address information acquisition request of a second service sent by the first service, and inquiring target address information of a target simulation service corresponding to the second service from a simulation service address of the simulation service information;
and under the condition that the target address information is inquired, sending the target address information to the first service, wherein the target address information is used for indicating the first service to call a target simulation service corresponding to the target address information on the simulation server, and testing the service data corresponding to the first service based on the target simulation service to obtain test result data.
2. The method according to claim 1, wherein the simulation service registration information includes a simulation service address and a simulation service identifier, the simulation service identifier is generated based on an original service identifier of the second service, and the registering the simulation service address in response to the simulation service registration information sent by the simulation server to obtain the simulation service information includes:
responding to the simulation service registration information, and creating a corresponding relation between the simulation service address and the simulation service identifier;
and taking the corresponding relation as the simulation service information.
3. The testing method according to claim 2, wherein the address information obtaining request includes a target original service identifier of the second service, and the querying, from the simulated service address of the simulated service information, target address information of a target simulated service corresponding to the second service in response to the address information obtaining request of the second service sent by the first service comprises:
based on the target original service identification, inquiring a target simulation service identification matched with the target original service identification from the simulation service information;
and under the condition that the target simulation service identification is inquired, acquiring target address information corresponding to the target simulation service identification from the simulation service information based on the target simulation service identification.
4. The testing method according to claim 1, wherein 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 performing service address registration on the simulation service in response to the simulation service registration information sent by the simulation server to obtain the simulation service information includes:
responding to the simulation service registration information, and creating a first corresponding relation between the simulation service address and the service address identifier;
creating a second corresponding relation between the simulation service address and the simulation service identifier;
and taking the first corresponding relation and the second corresponding relation as the simulation service information.
5. The method according to claim 4, wherein the address information obtaining request includes a target original service identifier and a target service address identifier of the second service, the second service corresponds to a plurality of simulated services, and the querying, from the simulated service addresses of the simulated service information, the target address information of the target simulated service corresponding to the second service in response to the address information obtaining request of the second service sent by the first service includes:
based on the target original service identification, inquiring a target simulation service identification matched with the target original service identification from the simulation service information;
under the condition that the target simulation service identification is inquired, acquiring address information of a plurality of simulation services corresponding to the target simulation service identification from the simulation service information;
determining address information matched with the target service address identification from the address information of the plurality of simulated services;
and taking the matched address information as the target address information.
6. A method of testing, the method comprising:
receiving a test request sent by a first service based on target address information, wherein the target address information is address information of a target simulation service corresponding to a second service inquired from simulation service information, the simulation service information comprises a simulation service address corresponding to a simulation service registered on a scheduling server, the simulation service corresponds to the second service called by the first service in a test execution process, and the test request carries service data;
calling a target simulation service corresponding to the target address information, and testing the service data to obtain test result data;
sending the test result data to the first service.
7. A test apparatus, the apparatus comprising:
the simulation service registration module is configured to execute simulation service registration information sent by a simulation server, perform service address registration on a simulation service, and obtain simulation service information, wherein the simulation service information comprises a simulation service address corresponding to the simulation service, and the simulation service corresponds to a second service called by a first service in a test execution process;
a target address query module configured to execute, in response to an address information acquisition request of a second service sent by the first service, query, from a simulation service address of the simulation service information, target address information of a target simulation service corresponding to the second service;
and the target address sending module is configured to send the target address information to the first service when the target address information is inquired, wherein the target address information is used for indicating the first service to call a target simulation service corresponding to the target address information on the simulation server, and based on the target simulation service, the service data corresponding to the first service is subjected to test processing to obtain test result data.
8. A test apparatus, the apparatus comprising:
a test request receiving module configured to execute receiving of a test request sent by a first service based on target address information, where the target address information is address information of a target simulation service corresponding to a second service queried from simulation service information, the simulation service information includes a simulation service address corresponding to a simulation service registered on a scheduling server, the simulation service corresponds to the second service called by the first service in a test execution process, and the test request carries service data;
the simulation service calling module is configured to execute calling of a target simulation service corresponding to the target address information, and test the service data to obtain test result data;
a test result sending module configured to perform sending the test result data to the first service.
9. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement a testing method according to any one of claims 1 to 6.
10. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform a testing method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111044052.5A CN113946502A (en) | 2021-09-07 | 2021-09-07 | Test method, test device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111044052.5A CN113946502A (en) | 2021-09-07 | 2021-09-07 | Test method, test device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113946502A true CN113946502A (en) | 2022-01-18 |
Family
ID=79328020
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111044052.5A Pending CN113946502A (en) | 2021-09-07 | 2021-09-07 | Test method, test device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113946502A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115048231A (en) * | 2022-06-23 | 2022-09-13 | 上海幻电信息科技有限公司 | Method and device for calling simulation service, storage medium and electronic equipment |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150229719A1 (en) * | 2014-02-12 | 2015-08-13 | Level 3 Communications, Llc | External Injection of Cloud Based Network Functions Into Network Services |
CN109542796A (en) * | 2018-12-28 | 2019-03-29 | 深圳云天励飞技术有限公司 | Test method and Related product |
CN110032454A (en) * | 2018-01-12 | 2019-07-19 | 北京京东尚科信息技术有限公司 | Remote invocation method, system and relevant device and computer readable storage medium |
CN110659206A (en) * | 2019-08-30 | 2020-01-07 | 平安普惠企业管理有限公司 | Simulation architecture establishing method, device, medium and electronic equipment based on microservice |
CN110765024A (en) * | 2019-10-29 | 2020-02-07 | 百度在线网络技术(北京)有限公司 | Simulation test method, simulation test device, electronic equipment and computer-readable storage medium |
CN111159039A (en) * | 2019-12-30 | 2020-05-15 | 中信百信银行股份有限公司 | Service simulation method, system, device and storage medium |
CN111865679A (en) * | 2020-07-14 | 2020-10-30 | 北京自如信息科技有限公司 | Data simulation method, device, equipment and readable storage medium |
CN112637008A (en) * | 2020-12-14 | 2021-04-09 | 广州品唯软件有限公司 | Link simulation test method, device, system, computer equipment and storage medium |
-
2021
- 2021-09-07 CN CN202111044052.5A patent/CN113946502A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150229719A1 (en) * | 2014-02-12 | 2015-08-13 | Level 3 Communications, Llc | External Injection of Cloud Based Network Functions Into Network Services |
CN110032454A (en) * | 2018-01-12 | 2019-07-19 | 北京京东尚科信息技术有限公司 | Remote invocation method, system and relevant device and computer readable storage medium |
CN109542796A (en) * | 2018-12-28 | 2019-03-29 | 深圳云天励飞技术有限公司 | Test method and Related product |
CN110659206A (en) * | 2019-08-30 | 2020-01-07 | 平安普惠企业管理有限公司 | Simulation architecture establishing method, device, medium and electronic equipment based on microservice |
CN110765024A (en) * | 2019-10-29 | 2020-02-07 | 百度在线网络技术(北京)有限公司 | Simulation test method, simulation test device, electronic equipment and computer-readable storage medium |
CN111159039A (en) * | 2019-12-30 | 2020-05-15 | 中信百信银行股份有限公司 | Service simulation method, system, device and storage medium |
CN111865679A (en) * | 2020-07-14 | 2020-10-30 | 北京自如信息科技有限公司 | Data simulation method, device, equipment and readable storage medium |
CN112637008A (en) * | 2020-12-14 | 2021-04-09 | 广州品唯软件有限公司 | Link simulation test method, device, system, computer equipment and storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115048231A (en) * | 2022-06-23 | 2022-09-13 | 上海幻电信息科技有限公司 | Method and device for calling simulation service, storage medium and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8589885B2 (en) | Debugger launch and attach on compute clusters | |
CN109922158A (en) | Data processing method, device, medium and electronic equipment based on micro services | |
CN103001815B (en) | The acquisition methods of test data, Apparatus and system | |
CN110413418B (en) | Cache synchronization device and method, cache synchronization system and electronic equipment | |
CN111245916A (en) | Service calling method, service arranging method and device based on micro-service gateway | |
CN113810438A (en) | Scheduling and requesting methods of service computing resources, node equipment and terminal | |
CN110677383B (en) | Firewall wall opening method and device, storage medium and computer equipment | |
CN111858083A (en) | Remote service calling method and device, electronic equipment and storage medium | |
CN113810230A (en) | Method, device and system for carrying out network configuration on containers in container cluster | |
CN106970843B (en) | Remote calling method and device | |
CN113946502A (en) | Test method, test device, electronic equipment and storage medium | |
CN111966556A (en) | Performance pressure measurement method and device, server and computer readable storage medium | |
CN111611065A (en) | Calling method and device of machine learning algorithm, storage medium and electronic equipment | |
CN115567521A (en) | Communication method and device between local area network and public cloud, and computing equipment | |
CN111371578A (en) | Method and device for deploying virtualized network function | |
CN112860398A (en) | Data processing method, device, equipment and medium based on rule engine | |
CN110855528A (en) | Message processing method and test equipment | |
CN111427634A (en) | Atomic service scheduling method and device | |
CN114356456B (en) | Service processing method, device, storage medium and electronic equipment | |
CN116668520A (en) | Gateway-based service arrangement method, system, equipment and storage medium | |
Zilhão et al. | A modular tool for benchmarking loT publish-subscribe middleware | |
CN116974655A (en) | Capability scheduling method and capability scheduling functional entity | |
CN113454969B (en) | Information interaction method, device, equipment, system and storage medium | |
CN112235158B (en) | Flow mirroring method and device, virtual machine platform and storage medium | |
CN111935329B (en) | Domain name resolution method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |