A mock test method, device and equipment based on an intelligent routing strategy
The mock testing method using intelligent routing strategies solves the problem of mutual interference in multi-person, multi-environment testing, enables parallel testing of multiple environments, improves testing efficiency and collaboration capabilities, and supports customized configurations.
Patent Information
- Application Number
- CN202310025202.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-09
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2043-01-09
AI Technical Summary
Existing mock testing methods cannot handle simultaneous testing by multiple users in multiple environments, resulting in low testing efficiency and mutual interference, failing to meet the needs of team collaboration.
A mock testing method based on intelligent routing strategy is adopted. By parsing the environment and service information in the service call request, concatenating data tags to form a new request, and matching the configuration strategy and mock response, parallel testing of multiple environments can be achieved.
It enables parallel testing for multiple users and in multiple environments, improving testing efficiency, supporting collaboration between teams, and possessing high versatility and scalability, capable of meeting customized configurations for specific business scenarios.
Smart Images

Figure CN115952099B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of software development, and in particular to a mock testing method and device based on an intelligent routing strategy. BACKGROUND
[0002] Currently, when a test team uses Mock testing, one scenario corresponds to one mock response, and multiple scenarios require multiple manual switching of response information. When there are multiple members sharing mock testing with intersections, the tests need to be executed sequentially, and cannot be tested in parallel. Even modifying the Mock interface response information can cause the failure of other process verification. Therefore, the existing mock testing method is time-consuming and laborious, and interferes with each other, which is not conducive to verifying multiple scenarios, and even less conducive to team collaboration.
[0003] The prior art focuses on the switching of real services and mock services, does not consider the specific test scenarios of the interface, does not consider whether multiple environments can be used at the same time, does not explicitly specify the response strategy of the interface mock information, and is not reusable, which has limitations. SUMMARY
[0004] To solve the problem that the same mock test cannot handle multiple people and multiple environment tests at the same time in the prior art, the embodiments of the present application provide a mock testing method and device based on an intelligent routing strategy.
[0005] The embodiments of the present application provide a mock testing method based on an intelligent routing strategy, which includes: determining whether the called service corresponding to the service call request initiated by the calling party is a mock test service according to the test requirements; if so, classifying the service call request according to the service name in the service call request to obtain service call requests of different categories; determining the service call request source and called service information in the same category service call request; concatenating the service call request source and called service information to the service call request to form a new service call request; matching the corresponding configuration strategy information and mock response according to the new service call request; and returning the configuration strategy information and mock response to the calling party for mock testing by the calling party.
[0006] According to an aspect of the embodiments of the present application, the determination of the service call request source and called service information according to the request data of the service call request includes: determining the environment interface and service interface in the service call request; reading the environment tag returned by the environment interface and the service address returned by the service interface, the environment tag belonging to the service call request source, and the service address belonging to the called service information.
[0007] According to an aspect of the embodiments herein, the forming of the new service calling request by concatenating the service calling request source and the called service information into the service calling request comprises concatenating the field corresponding to the environment label and the service address to the end of the service calling request to form the new service calling request.
[0008] According to an aspect of the embodiments herein, the method further comprises determining whether the service calling request contains a personal label, and if so, concatenating the field corresponding to the service address to the end of the service calling request to form the new service request data.
[0009] According to an aspect of the embodiments herein, the matching of the corresponding configuration policy information and mock response according to the new service calling request comprises if the new service calling request contains a personal label, directly matching the corresponding personal configuration policy and mock response from the database according to the personal label and the service address label, and if the new service calling request does not contain a personal label, matching the corresponding configuration policy and mock response from the database according to the environment label and the service address.
[0010] According to an aspect of the embodiments herein, before the determining of the service calling request source and the called service information, the method further comprises performing legality verification on the input parameters in the service calling request to obtain a verification result, and if the verification result is that the legality verification is not passed, returning the verification result to the calling party, and if the verification result is that the legality verification is passed, determining the service calling request source and the called service information.
[0011] The embodiments herein further disclose a mock testing device based on intelligent routing strategy, comprising: a service calling request obtaining unit configured to obtain a service calling request initiated by a calling party and determine whether the called service is a mock testing service; a judging unit configured to, if the called service is a mock testing service, classify the service calling request according to the service name in the service calling request to obtain service calling requests of different categories; a determining unit configured to determine the service calling request source and the called service information in the service calling requests of the same category; a new service calling request determining unit configured to concatenate the service calling request source and the called service information into the service calling request to form a new service calling request; a matching unit configured to match the corresponding configuration policy information and mock response according to the new service calling request; and a mock testing unit configured to return the configuration policy information and the mock response to the calling party for mock testing by the calling party.
[0012] The embodiment of the present application also provides a computer device, which comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the mock test method based on the intelligent routing strategy when executing the computer program.
[0013] The embodiment of the present application also provides a computer readable storage medium, which stores a computer program, and the computer program implements the mock test method based on the intelligent routing strategy when executed by a processor.
[0014] The embodiment of the present application also provides a computer program product, which comprises a computer program, and the computer program implements the mock test method based on the intelligent routing strategy when executed by a processor.
[0015] The present scheme can meet the test requirements of multiple sets of environments in different scenes of the same interface at the same time of a team, help users customize and configure exclusive mock information according to specific business scenes and specific requirements, and can realize the mandatory and correctness verification of the interface input parameter field, business logic verification and the like. The overall scheme has strong universality, simple deployment and configuration, high scalability, and can improve the front-end and back-end joint debugging and test efficiency based on the micro-service architecture. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0017] Figure 1 Fig. 1 shows a flowchart of a mock test method based on an intelligent routing strategy according to an embodiment of the present application;
[0018] Figure 2 Fig. 2 shows a flowchart of a method for determining service request source and called service information according to an embodiment of the present application;
[0019] Figure 3 Fig. 3 shows another flowchart of a mock test method based on an intelligent routing strategy according to an embodiment of the present application;
[0020] Figure 4 Fig. 4 shows a flowchart of a method for matching configuration strategy information and mock response according to an embodiment of the present application;
[0021] Figure 5 Fig. 5 shows a flowchart of a method for verifying input parameters in a service call request according to an embodiment of the present application;
[0022] Figure 6 Fig. 1 shows a schematic diagram of processing service call requests from different source environments via the same interface according to an embodiment of the present disclosure;
[0023] Figure 7 Fig. 2 shows a schematic diagram of processing service call requests from different calling parties via the same interface in the same environment according to an embodiment of the present disclosure;
[0024] Figure 8 Fig. 3 shows a schematic diagram of a mock testing device based on an intelligent routing strategy according to an embodiment of the present disclosure;
[0025] Figure 9 Fig. 4 shows a schematic diagram of a computer device according to an embodiment of the present disclosure.
[0026] List of acronyms:
[0027] 801, service call request obtaining unit;
[0028] 802, judging unit;
[0029] 803, determining unit;
[0030] 804, new service call request determining unit;
[0031] 805, matching unit;
[0032] 806, mock testing unit;
[0033] 902, computer device;
[0034] 904, processor;
[0035] 906, memory;
[0036] 908, driving mechanism;
[0037] 910, input / output module;
[0038] 912, input device;
[0039] 914, output device;
[0040] 916, presentation device;
[0041] 918, graphical user interface;
[0042] 920, network interface;
[0043] 922, communication link;
[0044] 924, communication bus. DETAILED DESCRIPTION
[0045] In order to enable a person skilled in the art to better understand the technical solutions in the specification, the technical solutions in the specification will be clearly and completely described below in combination with the drawings in the embodiments. Obviously, the described embodiments are only part of the embodiments of the specification, rather than all the embodiments. Based on the embodiments herein, all other embodiments obtained by a person skilled in the art without creative labor fall within the scope of protection of the specification.
[0046] It should be noted that the terms "first", "second", and the like in the specification and claims of the specification and the above drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the specification described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, device, product or equipment including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product or equipment.
[0047] The specification provides method operation steps as described in the embodiments or flowcharts, but can include more or fewer operation steps based on routine or non-creative labor. The order of steps listed in the embodiments is only one of the many step execution orders, and does not represent the only execution order. In actual system or device product execution, the method order shown in the embodiments or drawings can be executed in sequence or in parallel.
[0048] It should be noted that the mock test method based on the intelligent routing strategy herein can be used in the field of software development, and can also be used in the field of financial technology. The application field of the mock test method and device based on the intelligent routing strategy herein is not limited.
[0049] Figure 1 The flowchart of the mock test method based on the intelligent routing strategy of the embodiment is shown, and the following steps are specifically disclosed:
[0050] Step 101, according to the test requirement, determine whether the service call request initiated by the calling party is a mock test service. In this step, the calling party is a party requesting to call the target service, and the calling party initiates a service call request. The service call request contains: uniform resource locator (URL, Uniform Resource Locator), input parameter, message header, method and other data. The URL includes interface name, path, domain name and other data. The service name of the called service.
[0051] In some embodiments of the present disclosure, the URL in a service request initiated by a certain invoker is as follows: http: / / core-fund-ch-jmx-test-env-bus.test.abc.com.cn / service1 / repayOffline.
[0052] In the URL, core-fund-ch-jmx-test-env-bus.test.abc.com.cn is a domain name, representing the address of the called service, and / service1 / repayOffline is an interface path, representing the service name and interface name of the called service.
[0053] In step 102, if yes, the service call requests are classified according to the service names in the service call requests, and different categories of service call requests are obtained. In some embodiments of the present disclosure, the service call requests calling the same service are classified into one category, and the service call requests calling different services are classified into other categories. Therefore, this step realizes the classification of a large number of service call requests, so as to ensure that different call requests for the same service are processed in parallel in the subsequent steps.
[0054] In step 103, the source information of the service call request and the called service information in the same category of service call request are determined. Based on the classified service call requests in step 102, different categories of service call requests are determined. Then, the source information of the service call request and the called service information in the same category of service call request are obtained. Specifically, the environment information of the invoker and the service information of the called service can be obtained by analyzing the URL in the service call request. The environment information represents the type of the environment in which the invoker is located, including but not limited to one or more of the following: test environment, development environment, and production environment. The service information represents the service address and service interface of the called service. The specific steps of this step can be found in the description of step 103. Figure 2 The description of this step is not repeated here.
[0055] Step 104, the service call request source and the called service information are spliced into the service call request to form a new service call request. This step can be performed by the data label module in the mock platform to perform a corresponding data coloring service. Specifically, the service request source and the called service information determined in step 103 are spliced into the service call request as data labels or data identifiers to form a new service call request, which can also be understood as coloring the original service call request. In some embodiments of the present application, the service call request source and the called service information can be spliced into the original service call request in the form of data labels and data identifiers. Specifically, the environment label and the service address corresponding field are spliced into the end of the service call request to form a new service call request.
[0056] Step 105, according to the new service call request, match the corresponding configuration policy information and mock response. In this step, the new service call request includes the environment of the caller, the address and interface of the called service in addition to the information contained in the original service call request.
[0057] In some embodiments of the present application, the configuration policy includes but is not limited to: general policy, input parameter analysis policy, business query policy, customized response policy, etc. Among them, the general policy is to return the configured mock response directly to the caller; the input parameter analysis policy is to give different mock responses according to the combination mode of some fields in the input parameters of the service call request. Specifically, when requesting the same service, different response strategies are configured according to different request parameters. For example, personnel A tests for loan, the total loan is 1000 yuan, and the loan is repaid in 6 installments; personnel B tests for loan with personnel A on the same interface, the total loan is 2000 yuan, and the loan is repaid in 3 installments. Thus, different influence strategies are configured for test personnel A and B. In this application, the business query policy is to query the business stage from the database and give different mock responses; the customized response policy is that the user can configure his own exclusive mock response, which cannot be used by others.
[0058] The configuration policy information and mock response in the present application are response information corresponding to the service call request pre-configured and stored in the database. These response information correspond to different environments and different interfaces of the same service. Therefore, according to the new data label or data identifier spliced in the new service call request, the corresponding configuration policy information and mock response are matched from the database. In this application, the configuration policy can give a quick response to the interface according to the business scenario.
[0059] Step 106, return the configuration policy information and mock response to the calling party for mock testing. In this step, the mock platform returns the matched configuration policy information and mock response to the calling party for mock testing.
[0060] In some embodiments of the present disclosure, the configuration policy information and mock response can be shown by the following code example:
[0061] if ($mock_uri = " / ajtrust / bindCardSmsSend") {
[0062] switch ($mock::getSourceEnv()) {
[0063] case 1: $response_data = $mock::getMockJsonData(json_file: "data / bindCardSmsSend.json");
[0064] case 2: $response_data = $mock::getMockJsonData(json_file: "data / bindCardSmsSend_failure.json");
[0065] break;
[0066] }
[0067] Wherein, mock_uri = " / ajtrust / bindCardSmsSend" indicates that the mock response is provided for the service call request of the URL with the content of / ajtrust / bindCardSmsSend. Wherein, case 1 and case 2 respectively indicate two mock response results corresponding to the service call request. Case 1 indicates a configuration successful mock response result, and case 2 indicates a configuration failure response result.
[0068] The present application does not limit the form of the service call request, the configuration policy information and the mock response.
[0069] Figure 2 The flow chart of a method for determining the service request source and the called service information according to an embodiment of the present disclosure is shown, which specifically includes the following steps:
[0070] Step 201, determine the environment interface and service interface in the service call request. This step is performed by the mock platform, which includes a data tag service and a routing strategy service. This step is specifically performed by the "parameter check" module in the data tag service. In some embodiments of the present specification, the environment interface and service interface of the service call can be obtained from specific parameters in the uniform resource locator (URL).
[0071] For example, Figure 1 The URL shown in the figure is:
[0072] http: / / core-fund-ch-jmx-test-env-bus.test.abc.com.cn / service1 / repayOffline, where the environment interface is env, which belongs to the Springboot framework. According to the env interface, a list of all environment properties available to the application can be generated, and the configuration can be refreshed. In addition, the service interface is repayOffline in the URL, and repayOffline is a specific interface of the service jmx. In some embodiments of the present specification, one service can include multiple interfaces, and each interface can correspond to different configuration responses.
[0073] Step 202, read the environment tag returned by the environment interface and the service address tag returned by the service interface, the environment tag belongs to the source of the service call request, and the service address belongs to the called service information. In some embodiments of the present specification, the environment information in the springboot framework can be obtained by reading the env environment interface, and the environment tag can be obtained. For example, env-150, env-151, env-152, etc. Each environment tag corresponds to an environment. In some other embodiments of the present specification, the address corresponding to a specific interface in the service can be determined through the service address returned by the service interface. In the present application, by obtaining the environment and service address in the service call request, the source and destination of the data can be distinguished, the environment source of the caller and the address information of the called service can be determined, and the user can customize the Mock information according to the specific business scenario and specific needs.
[0074] Figure 3 Another flowchart of a mock test method based on an intelligent routing strategy according to an embodiment of the present specification is shown, which specifically includes the following steps:
[0075] Step 301, determine whether the personal tag is contained in the service call request. In this step, the specific field in the service call request is identified by the mock platform to determine whether the personal tag is contained. The personal tag is defined and added to the service call request by the calling party. In some embodiments of the present specification, if the developer or tester prepares to verify or test some special scenarios, and expects that the special scenario can only be used by the developer himself, and does not affect the test or development of other developers, a personal tag is added to the corresponding service call request. Correspondingly, the calling party pre-configures the corresponding response information into the database. Thus, the service call request containing the personal tag can correspond to the pre-configured response information.
[0076] Step 302, if yes, the field corresponding to the service address is spliced to the end of the service call request to form new service request data. If it is determined that the service call request includes the personal tag, the personal tag is located at the end of the service call request. For example, the personal tag is represented as: &self_tag=xyz.
[0077] In the present application, the personal tag has the highest priority compared to the service call request source and the called service information. Therefore, if the service call request includes the personal tag, the configuration strategy information and the mock response corresponding to the information in the personal tag can be matched directly. Further, in order to determine which specific interface of the service the service call request corresponding to the personal tag calls, the service request tag needs to be obtained. That is, the field corresponding to the service address is spliced to the end of the service call request. For example, as shown in http: / / core-fund-ch-jmx-test-env-bus.test.abc.com.cn / service1 / repayOffline?source_env=env_150&self_tag=xyz, the new service call request includes the environment tag source_env=env_150 and the personal tag self_tag=xyz. In some embodiments of the present specification, after the field corresponding to the service address is spliced to the end of the service call request, the form of the new service request data can also be as follows: http: / / core-fund-ch-jmx-test-env-bus.test.abc.com.cn / service1 / repayOffline?self_tag=xyz. If the environment tag is not required in the service request data, self_tag=xyz can be directly spliced at the end of the original service request data.
[0078] In this step, the field corresponding to the environment tag does not need to be spliced to the end of the service call request.
[0079] Figure 4 A method flow chart for matching configuration policy information and mock response is shown. The method determines the matching method of configuration policy and mock response according to the type of the label contained in the service call request. The method is executed by the routing policy service of the mock platform, and specifically includes the following steps:
[0080] Step 401, if the new service call request contains a personal label, directly match the corresponding personal configuration policy and mock response from the database according to the personal label and the service address label. In this step, the personal label has the highest priority, and the specific interface of the service called by the service call request is determined according to the service address label. Thus, the customized configuration policy and mock response corresponding to the interface and the personal label are matched from the database. Specifically, the customized configuration policy and mock response, i.e. the caller / user can configure his own exclusive mock response, which cannot be used by others.
[0081] Step 402, if the new service call request does not contain a personal label, match the corresponding configuration policy and mock response from the database according to the environment label and the service address. If the new service call request does not contain a personal label, match the configuration policy and mock response corresponding to the environment label and the service address from the database according to the environment label and the service address in the new service call request. In some embodiments of the present specification, the new service call request without a personal label is as follows: http: / / core-fund-ch-jmx-test-env-bus.test.abc.com.cn / service1 / repayOffline?source_env=env_150.
[0082] Figure 5 A method flow chart for verifying the input parameters in the service call request is shown, specifically including the following methods:
[0083] Step 501, determine whether the input parameters in the service call request pass the legality verification, and obtain a verification result. This step is executed by the data label service. When receiving the gateway GateWay service request, the "input parameter verification" module will perform legality verification on the input parameters of the interface: if it passes, it will enter the "data dyeing" service.
[0084] In this step, the service call request includes multiple input parameters. Among them, the input parameter represents the specific parameter related to the called service in the service call request. For example,
[0085] "CaseNo":"ABC_CF202206281922098jWJMbNAxX78";
[0086] "RequestSeqId":"REPAY_JMX_CF2022121318294066Vqzr",
[0087] "ReceiptId":"BO20200205000005001","RepayFlag":"0","PeriodNo":3,
[0088] "Amount":88.64,"RepayAmt":82.56。
[0089] In this step, the legality check is used to check whether the format of the input parameter is accurate, whether the input parameter data is empty, etc.
[0090] Step 502, if the check result is not passed the legality check, the check result is returned to the calling party. In this step, if the input parameter in the service call request does not pass the legality check, the failed check result is returned to the calling party and the log service.
[0091] In this application, the failed check result is as follows:
[0092] case2: $response_data = $mock::getMockJsonData(json_file: "data / bindCardSmsSend_failure.json"
[0093] Step 503, if the check result is passed the legality check, determine the service call request source and the called service information. In this step, if the input parameter in the method call request passes the legality check, the process of determining the service call request and the called service information described in the foregoing is executed.
[0094] Figure 6 The schematic diagram of the embodiment of the present application is shown in the figure. Specifically, the test team simultaneously and in parallel 3 sets of test environments, and the same time uses the loan trial interface. Among them, each environment scenario is as follows:
[0095] Test environment A is: to make real environment loan, the loan amount is 1000 yuan, and the loan period is 6;
[0096] Test environment B is: to make Mock test, the loan amount is 2000, and the loan period is 9;
[0097] The test environment is: performing Mock test, the loan amount is 3000, and the loan period is 12.
[0098] Among them, the gateway in the Mock routing service directly calls the real service 1 of the test environment A, and obtains the response information A of the real service 1. The gateway in the Mock routing service extracts specific fields in the service call request of the test environment B and the test environment C, and forms two new service call requests corresponding to the test environment respectively in the form of data tags, and matches to the corresponding response information B and response information C. Further, the response information B and the response information C are returned to the calling party test environment B and the test environment C. Among them, the response information B and the response information C are response strategy information pre-set and stored in the database.
[0099] Figure 7 The figure shows a service call request diagram of different calling parties in the same environment and the same interface according to an embodiment of the present text. Specifically, the personal dimension - the same set of test environment and the same interface request can give different responses according to different users.
[0100] Testers A, B and C call the same set of repayment trial interfaces of service 1 in the same set of environment. Different testers correspond to different repayment dates, so they belong to different business stages. For example: under the same repayment trial interface, current normal repayment test, overdue repayment test, or early settlement test, debt transfer and repurchase test can be performed.
[0101] The repayment trial scene in the diagram is as follows:
[0102] Tester A: a total of 6 loans, the current period is the 2nd period, and the early settlement trial initiated from the 2nd period belongs to the early settlement test stage;
[0103] Tester B: a total of 3 loans, the 2nd period has been overdue, the current period is the 3rd period, and the normal repayment trial initiated from the 2nd period belongs to the normal repayment test stage;
[0104] Tester C: a total of 9 loans, the 1st period is the current period, and the early settlement trial initiated from the 1st period belongs to the early settlement test stage.
[0105] In the figure, the gateway service in the mock routing service determines that the service call request initiated by the three testers is a mock service, and the mock routing service generates new service call requests for the original service call requests of the three testers based on the data tag service, including: a new service call request of tester A, a new service call request of tester B, and a new service call request of tester C. In this application, the routing policy service further matches corresponding configuration policies and mock responses for the new service call requests of the three testers, respectively, to obtain mock response information A, mock response information B, and mock response information C. Among them, the mock response information A, the mock response information B, and the mock response information C are response policy information pre-set and stored in the database.
[0106] As shown in Figure 8 The structure of the mock test device based on the intelligent routing policy is shown in the figure, and the basic structure of the mock test device based on the intelligent routing policy is described in the figure. The functional units and modules in the figure can be implemented in software, or can be implemented by using general-purpose chips or special-purpose chips to implement the mock test based on the intelligent routing policy. The device specifically includes:
[0107] The service call request acquisition unit 801 is configured to acquire a service call request initiated by a calling party, and determine whether the called service is a mock test service.
[0108] The determination unit 802 is configured to, if the determination result is yes, classify the service call request according to the service name in the service call request, and obtain service call requests of different categories.
[0109] The determination unit 803 is configured to determine the service call request source and the called service information in the service call request of the same category.
[0110] The new service call request determination unit 804 is configured to splice the service call request source and the called service information into the service call request to form a new service call request.
[0111] The matching unit 805 is configured to match corresponding configuration policy information and mock responses according to the new service call request.
[0112] The mock test unit 806 is configured to return the configuration policy information and the mock response to the calling party, and perform mock test by the calling party.
[0113] The scheme can meet the test requirements of multiple sets of environments and different scenes of the same interface at the same time for a team, help users customize and configure exclusive mock information according to specific business scenarios and specific needs, and can realize the mandatory and correctness verification of interface input parameter fields, business logic verification and the like; the overall scheme has strong universality, simple deployment configuration and high extensibility.
[0114] As shown in Figure 9 A computer device provided by the embodiment of the present application is shown in the figure. The mock test method based on the intelligent routing strategy can be applied to the computer device. The computer device 902 can include one or more processors 904, such as one or more central processing units (CPUs), each of which can implement one or more hardware threads. The computer device 902 can also include any memory 906 for storing any kind of information such as code, settings, data, etc. Without limitation, for example, the memory 906 can include any one or a combination of the following: any type of RAM, any type of ROM, a flash memory device, a hard disk, an optical disk, etc. More generally, any memory can store information using any technology. Further, any memory can provide volatile or non-volatile retention of information. Further, any memory can represent a fixed or removable component of the computer device 902. In one case, the computer device 902 can perform any operation of the associated instructions when the processor 904 executes the associated instructions stored in any memory or combination of memories. The computer device 902 also includes one or more drive mechanisms 908 for interacting with any memory, such as a hard disk drive mechanism, an optical disk drive mechanism, etc.
[0115] The computer device 902 can also include an input / output module 910 (I / O) for receiving various inputs (via input devices 912) and for providing various outputs (via output devices 914). One particular output mechanism can include a presentation device 916 and an associated graphical user interface (GUI) 918. In other embodiments, the input / output module 910 (I / O), the input devices 912, and the output devices 914 can also not be included, just as a computer device in a network. The computer device 902 can also include one or more network interfaces 920 for exchanging data with other devices via one or more communication links 922. One or more communication buses 924 couple the above-described components together.
[0116] The communication links 922 can be implemented in any manner, for example, through a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication links 922 can include any combination of hardwired links, wireless links, routers, gateway functionality, name servers, etc., governed by any protocol or combination of protocols.
[0117] corresponding to Figures 1 to 5 The embodiments herein further provide a computer-readable storage medium, having stored thereon a computer program, which, when executed by a processor, performs the steps of the above-mentioned method.
[0118] The embodiments herein further provide a computer-readable instruction, wherein the program in the computer-readable instruction causes the processor to perform the method as shown in Figures 1 to 5 .
[0119] The embodiments herein further provide a computer program product comprising a computer program, which, when executed by a processor, performs the method as shown in Figures 1 to 5 .
[0120] It should be understood that the size of the serial number of the above-mentioned processes does not mean the order of execution in the various embodiments herein, and the execution order of the processes should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments herein.
[0121] It should also be understood that in the embodiments herein, the term "and / or" is only a description of the association relationship of the associated objects, which means that there can be three relationships. For example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone. In addition, the character " / " in this paper generally represents that the front and rear associated objects are in an "or" relationship.
[0122] Those skilled in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized in electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in the above description in general terms. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this paper.
[0123] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-mentioned system, device and unit can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
[0124] In several embodiments provided herein, it should be understood that the disclosed system, apparatus and method can be implemented in other manners. For example, the apparatus embodiments described above are merely schematic. For example, the division of the units is only a logical function division. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electric, mechanical or other form.
[0125] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e. may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments provided herein.
[0126] In addition, each functional unit in each embodiment herein can be integrated into a processing unit, or each unit can be physically present separately, or two or more units can be integrated into one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0127] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions herein, essentially or the part of the prior art that contributes to the technical solutions, or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment herein. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0128] The specific embodiments are applied herein to describe the principles and implementation manners of the embodiments herein. The above description of the embodiments is only for the purpose of helping to understand the methods and core ideas thereof; meanwhile, for those skilled in the art, according to the ideas herein, the specific implementation manners and application ranges can be changed; and in view of the above, the content of the specification should not be understood as limiting the embodiments herein.
Claims
1. A mock testing method based on intelligent routing strategy, characterized in that, The method comprises: According to the test requirements, determine whether the service call request initiated by the caller corresponds to the mock test service of the called service; If so, according to the service name in the service call request, the service call request is classified to obtain service call requests of different categories; Determine the service call request source and the called service information in the same category service call request, which comprises: determining the environment interface and the service interface in the service call request; reading the environment label returned by the environment interface and the service address label returned by the service interface, the environment label belongs to the service call request source, and the service address belongs to the called service information; The service call request source and the called service information are spliced into the service call request to form a new service call request; According to the new service call request, match the corresponding configuration strategy information and mock response; The configuration strategy information and the mock response are returned to the caller for mock test. 2.The mock testing method based on intelligent routing strategy of claim 1, wherein, The service call request source and the called service information are spliced into the service call request to form a new service call request, which comprises: The field corresponding to the environment label and the service address is spliced into the end of the service call request to form a new service call request. 3.The mock testing method based on intelligent routing strategy of claim 1, wherein, The method further comprises: Determine whether the service call request contains a personal label; If so, the service address label is spliced into the end of the service call request to form a new service request data. 4.The mock testing method based on intelligent routing strategy according to claim 2 or 3, characterized in that, According to the new service call request, match the corresponding configuration strategy information and mock response, which comprises: If the new service call request contains a personal label, directly match the corresponding personal configuration strategy and mock response from the database according to the personal label and the service address label; If the new service call request does not contain a personal label, match the corresponding configuration strategy and mock response from the database according to the environment label and the service address. 5.The mock testing method based on intelligent routing strategy of claim 4, wherein, Before determining the service call request source and the called service information, the method further comprises: Determine whether the input parameter in the service call request passes the legality check to obtain a check result; If the check result is that the legality check is not passed, return the check result to the caller; If the check result is that the legality check is passed, determine the service call request source and the called service information. 6.A mock testing device based on intelligent routing strategy, characterized in that, The device comprises: A service call request acquisition unit is configured to acquire a service call request initiated by a caller and determine whether the called service is a mock test service; A judgment unit is configured to classify the service call request according to the service name in the service call request to obtain service call requests of different categories if the called service is a mock test service; A determination unit is configured to determine the service call request source and the called service information in the same category service call request, which comprises: determining the environment interface and the service interface in the service call request; reading the environment label returned by the environment interface and the service address label returned by the service interface, the environment label belongs to the service call request source, and the service address belongs to the called service information; A new service call request determining unit is configured to splice the service call request source and the called service information into the service call request to form a new service call request; A matching unit is configured to match corresponding configuration policy information and mock response according to the new service call request; A mock testing unit is configured to return the configuration policy information and the mock response to the calling party for mock testing by the calling party.
7. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the method in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method in any one of claims 1 to 5.
9. A computer program product, characterised in that, The computer program product includes a computer program, and the computer program is executed by the processor to implement the method in any one of claims 1 to 5.
Citation Information
Patent Citations
Request processing method and device and proxy server
CN111427766A
Script testing method and device based on Mock service, equipment and medium
CN114003510A