Testing methods, equipment, and storage media based on virtualization services

By obtaining the simulated response of the dependent test request in the virtualized server, the problem of test case failure caused by the failed dependent test request is solved, the execution success rate of the test case is improved, and the reliability of the automated test is enhanced.

CN114281673BActive Publication Date: 2024-09-24CHINA UNITED NETWORK COMM GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111397552.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-23
Publication Date
2024-09-24
Estimated Expiration
2041-11-23

AI Technical Summary

Technical Problem

In the field of computer technology, the execution success rate of test cases in the existing technology is low because the failure to execute any test request will cause the test case to fail. In particular, the failure of a dependent test request may fail due to unavailability of business services or network reasons. , affecting the effectiveness of test cases.

Method used

By obtaining the simulated response of the dependent test request in the virtualized server, if the dependent test request fails to execute n times, the pre-obtained successful execution history response is used as the simulated response, and the remaining test requests in the test case are continued to be executed to improve the test case. execution success rate.

Benefits of technology

This method improves the execution success rate of test cases by simulating responses when a dependent test request fails to execute, avoids test case failures caused by failed dependent test requests, and improves the reliability of automated testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114281673B
    Figure CN114281673B
Patent Text Reader

Abstract

The present application provides a test method, device and storage medium based on virtualization service. The method includes: in the process of executing a test case, if the dependent test request in the test case fails to execute n times, then obtain a simulated response of the dependent test request, the simulated response is a historical response of the successful execution of the dependent test request pre-acquired by the virtualization server, n is an integer greater than 0, and the simulated response of the dependent test request is used as the execution result of the dependent test request, and the remaining test requests in the test case are continued to be executed to obtain the first test result of the test case, wherein the test case includes a target test request and at least one dependent test request, and the dependent test request is a test request that needs to be executed in order to execute the target test request. Improve the success rate of test case execution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a testing method, device and storage medium based on virtualization services. Background Art

[0002] In the field of computer technology, business systems are often tested automatically through test cases (or test cases). A test case may include at least one target test request and at least one dependent test request associated with the target test request. The target test request can be understood as the test target that the test case needs to achieve; the dependent test request is the test request that must be executed in order to execute the target test request.

[0003] In the prior art, in the process of automated testing of a business system through test cases, any failure in executing a test request will result in the failure of executing the test case, making it difficult to complete the testing of the target test request, resulting in a low success rate of executing the test case. Summary of the invention

[0004] The present application provides a testing method, device and storage medium based on virtualization services, in order to improve the execution success rate of test cases.

[0005] In a first aspect, an embodiment of the present application provides a testing method based on a virtualization service, which is applied to a testing device, and the method includes: in the process of executing a test case, if a dependent test request in the test case fails to execute n times, then obtaining a simulated response to the dependent test request, the simulated response is a historical response of the successful execution of the dependent test request pre-acquired by the virtualization server, and n is an integer greater than 0; using the simulated response to the dependent test request as the execution result of the dependent test request, continuing to execute the remaining test requests in the test case, and obtaining a first test result of the test case; wherein the test case includes a target test request and at least one dependent test request of the target test request.

[0006] In a possible implementation, obtaining the simulated response to the dependency test request includes: sending a simulated response request to a virtualization server, the simulated response request carrying the dependency test request; and receiving the simulated response to the dependency test request sent by the virtualization server.

[0007] In a possible implementation, before sending the simulated response request to the virtualization server, the method further includes: sending a first instruction to the virtualization server, where the first instruction is used to instruct the virtualization server to provide a simulated response through a virtualization service.

[0008] In a possible implementation, the method further includes: when the test case fails to execute, determining whether the request that failed to execute is a dependent test request; if the request that failed to execute is a dependent test request, repeatedly executing the dependent test request until the dependent test request is successfully executed or the number of executions of the dependent test request reaches n times.

[0009] In a possible implementation, the method further includes: if the request that fails to execute is the target test request, ending the test and obtaining a second test result of the test case, wherein the second test result indicates that the test case fails.

[0010] In a second aspect, an embodiment of the present application provides a testing method based on a virtualization service, which is applied to a virtualization server, and the method includes: receiving a simulated response request sent by a testing device, the simulated response request carrying a dependent test request that failed to execute, and the dependent test request is one of at least one dependent test request of a target test request in a test case; determining a simulated response corresponding to the dependent test request based on the dependent test request and a plurality of pre-stored simulation templates, the simulated response being a historical response of a successfully executed test request pre-acquired by the virtualization server, the test request corresponding to the dependent test request, and the simulation template including the test request and the historical response corresponding to the test request; and sending a simulated response corresponding to the dependent test request to the testing device.

[0011] In one possible implementation, the simulation response corresponding to the dependent test request is determined based on the dependent test request and multiple pre-stored simulation templates, including: matching the dependent test request with the test requests in the multiple simulation templates respectively, obtaining the simulation template with the highest matching degree with the dependent test request, and using the historical response in the simulation template as the simulation response corresponding to the dependent test request.

[0012] In a possible implementation, the method further includes: receiving a first instruction sent by the test device; and according to the first instruction, starting the virtualization service and / or switching the mode of the virtualization service to a simulation mode, wherein the simulation mode is used to provide a simulation response.

[0013] In a possible implementation, the method further includes: obtaining at least one test request that is successfully executed during the process of the test device executing the test case, and the execution result of the test request; using the execution result of the test request as a historical response to the test request, and combining it with the test request to obtain the simulation template.

[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising: an acquisition unit, for acquiring a simulated response to a dependent test request if a dependent test request in the test case fails to execute n times during the execution of a test case, the simulated response being a historical response of the successful execution of the dependent test request pre-acquired by the virtualization server, where n is an integer greater than 0; a test execution unit, for taking the simulated response to the dependent test request as the execution result of the dependent test request, continuing to execute the remaining test requests in the test case, and obtaining a first test result of the test case; wherein the test case comprises a target test request and at least one dependent test request of the target test request.

[0015] In a fourth aspect, an embodiment of the present application provides a server, comprising: a receiving unit, configured to receive a simulated response request sent by a test device, the simulated response request carrying a dependent test request that failed to execute, the dependent test request being one of at least one dependent test request of a target test request in a test case; a processing unit, configured to determine a simulated response corresponding to the dependent test request based on the dependent test request and a plurality of pre-stored simulation templates, the simulated response being a historical response of the virtualized server that successfully executed the dependent test request, the test request corresponding to the dependent test request, and the simulation template comprising the test request and a simulated response corresponding to the test request; and a sending unit, configured to send a simulated response corresponding to the dependent test request to the test device.

[0016] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory, and executing the method in the first aspect or each possible implementation manner.

[0017] In a sixth aspect, an embodiment of the present application provides a server, comprising: a processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory, and executing the method in the second aspect or each possible implementation manner.

[0018] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium for storing computer program instructions, wherein the computer program enables a computer to execute a method as in the first aspect, the second aspect, or each possible implementation manner.

[0019] The virtualization service-based testing method, device, and storage medium provided in the present application, for the case where the test request that fails to execute in the test case is a dependent test request, consider obtaining a simulated response to the dependent test request from the virtualization server to simulate the successful execution of the dependent test request without affecting the execution of subsequent test requests, thereby improving the success rate of the test case execution. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0021] Figure 1 A schematic diagram of an application scenario of a test system 100 provided in an embodiment of the present application;

[0022] Figure 2 A flowchart of a virtualization service-based testing method 200 provided in an embodiment of the present application;

[0023] Figure 3 A flowchart of a virtualization service-based testing method 300 provided in an embodiment of the present application;

[0024] Figure 4 A schematic diagram of an interactive process of a virtualization service-based testing method 400 provided in an embodiment of the present application;

[0025] Figure 5 is a schematic block diagram of an electronic device provided in an embodiment of the present application;

[0026] Figure 6 is a schematic block diagram of a server provided in an embodiment of the present application;

[0027] Figure 7 A schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0029] At present, the business system is often tested automatically through test cases (or test cases). A test case includes multiple test requests, each of which can request a business service of the business system under test to be tested. The test request can be a request to the interface of the business system under test to receive the execution result returned by the corresponding interface of the business system in response to the test request. A test case can include at least one target test request and at least one dependent test request associated with the target test request. Among them, the target test request can be understood as the test target that the test case needs to achieve. For example, it is necessary to test whether the business service of "receiving prizes" of the business system is normal, and the test request sent to the interface corresponding to the receiving prize of the business system is the target test request; the dependent test request is a test request that must be executed in order to execute the target test request. For example, before testing the business service of "receiving prizes", it is necessary to "log in to the account" and "get the prize list", then the test request sent to the interface corresponding to the "log in to the account" and "get the prize list" of the business system is the dependent test request.

[0030] In the prior art, in the process of automated testing of a business system through test cases, any failure in the execution of a test request will result in the failure of the test case. It is understandable that the failure of the dependent test request may be due to the unavailability of the corresponding business service (such as restarting or service abnormality), or the instability of the corresponding business service (such as the configuration is being modified, there is dirty data, the service load is too high, etc.), or the execution fails due to network reasons. The failure of the test case execution caused by these reasons is not a valid test result of the test case. Therefore, the execution success rate of the test case is low.

[0031] In response to the above technical problems, the testing method provided in the embodiment of the present application can obtain a simulated response based on the virtualization service to simulate the successful execution of the dependent test request when the dependent test request fails to execute, without affecting the execution result of the target test request, thereby improving the execution success rate of the test case.

[0032] It should be noted that the embodiments of the present application do not impose any limitations on the business system under test, which can be a business system applied to any field (such as communications, e-commerce, data statistics, etc.). Generally speaking, the business system under test can be a software system that implements business functions, such as a software code with multiple service (function) modules.

[0033] The embodiments of the present application will be described below with reference to the accompanying drawings.

[0034] Figure 1A schematic diagram of an application scenario of a test system 100 provided in an embodiment of the present application. The test system 100 may include a test device 110, a virtualization server 120, and a business server (or business server cluster) 130. The virtualization server 120 may be an independent server, or may belong to the same server cluster as the business server (or business server cluster) 130.

[0035] The test device 110 may be deployed on an electronic device, which may be, for example, a server, a terminal device, a chip, etc., wherein the terminal device may be, for example, a smart phone, a laptop, a tablet computer, a personal desktop computer, etc. When the electronic device is a server, the server on which the test device 110 is deployed may belong to the same server cluster as the virtualization server 120 and / or the business server (or business server cluster) 130.

[0036] The testing device 110 may also be directly deployed in the virtualization server 120 or the business server (or server cluster) 130 .

[0037] The testing device 110 is connected to the virtualization server 120 and the business server (or business server cluster) 130 respectively in a wired or wireless manner.

[0038] As an example and not a limiting description, the overall architecture of the test device in this embodiment can be an integrated test framework (such as testNG) in Springboot to build an automated test framework that can run automated test cases manually or automatically on a scheduled basis.

[0039] By way of example and not limitation, a service virtualization tool (such as hoverfly) is built in the virtualization server in this embodiment.

[0040] Figure 2 A flowchart of a virtualization service-based testing method 200 provided in an embodiment of the present application. Figure 2 The method provided in the illustrated embodiment may be performed by the test device 110 or an electronic device equipped with the test device 110. For example, Figure 1 As shown, the method includes:

[0041] S210: During the process of executing the test case, if the dependent test request in the test case fails to execute n times, the test device obtains a simulated response to the dependent test request, where the simulated response is a historical response of the virtualized server that successfully executes the dependent test request, where n is an integer greater than 0;

[0042] S220: The testing device takes the simulated response to the dependent test request as the execution result of the dependent test request, continues to execute the remaining test requests in the test case, and obtains a first test result of the test case;

[0043] The test case includes a target test request and at least one dependent test request of the target test request.

[0044] In an embodiment of the present application, in order to improve the success rate of test case execution, for the case where the test request that fails to execute in the test case is a dependent test request, consideration is given to obtaining a simulated response to the dependent test request, for example, obtaining a simulated response to the dependent test request from a virtualized server, so as to simulate the successful execution of the dependent test request without affecting the execution of subsequent test requests.

[0045] Optionally, the test device may obtain a simulated response to the dependent test request from the virtualized server after the dependent test request fails to execute, that is, n=1; or, the test device may obtain a simulated response to the dependent test request from the virtualized server after the dependent test request fails to execute multiple times, in which case n is an integer greater than 1. Optionally, n may be equal to 3.

[0046] It should be noted that the test device obtains the simulated response of the dependency test request from the virtualization server, which can be understood as obtaining the simulated response of the dependency test request from the virtualization server during the process of executing the dependency test request for the n+1th time.

[0047] The test device obtains a simulated response to the dependent test request from the virtualized server, which can be understood as making a request through a proxy for the n+1th time, and the proxy address is the address of the virtualized service.

[0048] Optionally, the test case execution by the test device may be periodically triggered, timed triggered, or triggered by a user operation. After the test device triggers a test process, one or more test cases may be executed. When the test device executes multiple test cases in a test process, the multiple test cases may be executed sequentially or in parallel, which is not limited in this embodiment.

[0049] Figure 3 A flow chart of a virtualized service-based testing method 300 provided in an embodiment of the present application. Figure 3 As shown, the method includes some or all of the following steps:

[0050] S310: When the test case fails to be executed, the testing device determines whether the request that failed to be executed is a dependent test request.

[0051] If the request that fails to execute is a dependent test request, execute S320; if the request that fails to execute is a target test request, execute S350.

[0052] S320: The testing device repeatedly executes the dependency test request until the dependency test request is successfully executed or the dependency test request is executed n times.

[0053] If the number of repetitions does not reach n times and the dependent test request is executed successfully during the repeated execution of the dependent test request, continue to execute the remaining test requests in the test case to obtain the first test result of the test case, where n is an integer greater than 0; if the number of executions of the dependent test request reaches n times during the repeated execution of the dependent test request, execute S330.

[0054] S330: The testing device obtains a simulated response to the dependency test request from the virtualization server, where the simulated response is an execution result of the successful execution of the dependency test request pre-acquired by the virtualization server.

[0055] S340: The testing device takes the simulated response to the dependent test request as the execution result of the dependent test request, continues to execute the remaining test requests in the test case, and obtains the first test result of the test case.

[0056] S350: The testing device ends the test and obtains a second test result of the test case, where the test result indicates that the test case fails.

[0057] The above S330 and S340 are Figure 2 The processes and effects of S210 and S220 in the illustrated embodiment are the same or similar and will not be described in detail herein.

[0058] In the above S310, the testing device determines whether the request that failed to execute is a dependent test request during the execution of the test case, and can identify whether the test request is a dependent test request based on the request header, request body or preset identifier of the dependent test request.

[0059] In the above S320, if the number of times the dependency test request is repeatedly executed reaches n times and the dependency test request is still not successfully executed, a simulated response of the dependency test request can be obtained from the virtualization server. If the simulated response of the dependency test request cannot be obtained from the virtualization server, the test process of the test case is terminated. Optionally, if the simulated response of the dependency test request cannot be obtained from the virtualization server, a simulated response of the dependency test request can be manually added, for example, a simulation template containing the simulated response of the dependency test request is added in the virtualization server.

[0060] Figure 4The following is a schematic diagram of an interactive process of a virtualized service-based testing method 400 provided in an embodiment of the present application. Figure 4 As shown, the method includes some or all of the following steps:

[0061] S410: The testing device sends a first instruction to the virtualization server, where the first instruction is used to instruct the virtualization server to start the virtualization service and / or switch the mode of the virtualization service to a simulation mode, where the simulation mode is used to provide a simulation response.

[0062] Correspondingly, the virtualization server receives the first instruction sent by the testing device;

[0063] S420: The virtualization server starts the virtualization service and / or switches the mode of the virtualization service to a simulation mode according to the first instruction, where the simulation mode is used to provide a simulation response.

[0064] S430: The testing device sends a simulation response request to the virtualization server, where the simulation response request carries a dependent test request that failed to execute;

[0065] Correspondingly, the virtualized server receives the simulated response request sent by the test device;

[0066] S440: The virtualization server determines a simulation response corresponding to the dependent test request according to the dependent test request and a plurality of pre-stored simulation templates, wherein the simulation response is a historical response of a successfully executed test request pre-acquired by the virtualization server, the test request corresponds to the dependent test request that failed to execute, and the simulation template includes the test request and the historical response corresponding to the test request;

[0067] S450: The virtualization server sends a simulation response corresponding to the dependent test request to the test device.

[0068] Correspondingly, the testing device receives a simulated response to the dependent test request sent by the virtualization server.

[0069] S460: The test device uses the simulated response of the dependent test request as the execution result of the dependent test request, and continues to execute the remaining test requests in the test case to obtain the test result of the test case.

[0070] It should be noted that with respect to the above S410 and S420, the virtualization service of the virtualization server may be closed or in a closed state by default. To ensure successful acquisition of a simulated response that depends on the test request, the testing device may send a first instruction to the virtualization server to instruct the virtualization server to turn on the virtualization service; alternatively, the virtualization service of the virtualization server may be turned on or in an turned on state by default, but the current mode of the virtualization service is not a simulation mode, for example, the mode of the virtualization service is a capture mode (the capture mode will be explained below), the testing device may send a first instruction to the virtualization server to instruct the virtualization server to switch the mode of the virtualization service to the simulation mode; of course, the first instruction sent by the testing device to the virtualization server may instruct the virtualization server to turn on the virtualization service and switch the mode of the virtualization service to the simulation mode.

[0071] In the above S430 to S450, as a specific implementation method for the test device to obtain a simulated response dependent on a test request from a virtualized server, the test device and the virtualized server may transmit a simulated response request and a simulated response requested by the simulated response request through signaling interaction.

[0072] It should be noted that with respect to S440, each simulation template includes a test request and a historical response corresponding to the test request.

[0073] In some embodiments, the simulation template may be acquired by the virtualization server in a capture mode.

[0074] For example, before the test device sends the first instruction to the virtualization server, the mode of the virtualization service of the virtualization server can be a capture mode. In the capture mode, the virtualization server can capture the execution result of the test device that is executing the test case. Exemplarily, the virtualization server obtains at least one test request that is successfully executed during the execution of the test case by the test device, and the execution result of the test request (i.e., the above-mentioned historical response), and obtains the simulation template based on the test request and the execution result of the test request. In other words, the virtualization server uses the successfully executed test request as the test request in the simulation template, and uses the execution result corresponding to the test request as the historical response in the simulation template.

[0075] Optionally, any of the above test requests (including dependent test requests and target test requests executed by the test device during the test case execution) may include the path of the requested service interface, and the test request in the simulation template may be the path of the service interface requested by the test request. For example, if the test request executed by the test device includes http: / / xxx / userInfo / getName, "xxx / userInfo / getName" is used as the identifier of the test request in the simulation template.

[0076] The above S440 may specifically include: the virtualization server may match the dependent test request with the test requests in the multiple simulation templates respectively, obtain the simulation template with the highest matching degree with the dependent test request, and use the historical response in the simulation template as the simulation response corresponding to the dependent test request.

[0077] For example, the path of the service interface included in the dependent test request is http: / / xxx / userInfo / getName. The virtualization server can search for the test request "xxx / userInfo / getName" that matches it in multiple simulation templates, and then determine the simulation template that matches the dependent test request, and then use the historical response in the matching simulation template as the simulation response corresponding to the dependent test request.

[0078] Optionally, create a TestCaseRetry class in an integrated testing framework (such as testNG), implement the IRetryAnalyzer interface, implement the retry method, and complete the following logic:

[0079] a. Set the maximum number of retries to n+1 (for example, 4).

[0080] b. Before the n+1th retry, start the virtualization service, set the mode of the virtualization service to simulation mode, import the simulation template matched by the dependent test request that needs to be retried, and then retry the request for the fourth time. During this retry, the simulation response in the simulation template matched by the dependent test request will be returned, thereby simulating the successful response of the request. Among them, all operations on the virtualization service are remotely operated through the idle application program interface (RESTAPI) and are automatically completed by the test device execution program.

[0081] c. If the simulation template corresponding to the dependent test request that needs to be retried cannot be matched, the request is likely to continue to fail, eventually causing the test case to fail. In this case, the user can manually import the simulation template so that the request can match the simulation template when the test case is re-executed, so that the request can succeed.

[0082] d. If the retried dependent test request is the target test request, no simulation is performed, only a retry is performed, and the real request address is continued to be accessed instead of the proxy address.

[0083] Optionally, create a TestCaseRetryListener class in an integrated testing framework (such as testNG), implement the IAnnotationTransformer interface, implement the new transform method, and complete the following logic:

[0084] a. Listen to all test cases.

[0085] b. When it is found that the test case does not have the annotation retry analyzer (retryAnalyzer) added, the annotation is added dynamically to ensure that all test cases will trigger a rerun after failure.

[0086] Optionally, optimize the code architecture of the automated test case to complete the following logic:

[0087] a. Wrap each test request and its associated processing code in an exception capture (try-catch) code block.

[0088] b. When the nth (for example, the third) request response processing fails, the information of the failed request (request header, request body, mark whether it is a target test request or a dependent test request) is recorded in the capture (catch).

[0089] c. Before the n+1th (eg, the 4th) request, the request method is set to request through a proxy, and the proxy address is the address of the virtualized service.

[0090] d. When the n+1th (e.g., 4th) request response processing fails, the failed request information is written into the test report (in this case, the request still fails because the simulation template cannot be matched)

[0091] Optionally, this embodiment may further include at least one of the following examples:

[0092] (1) After developing the TestCaseRetry class, when testNG fails to execute an automated test case, it will automatically execute the retry method in the TestCaseRetry class.

[0093] (2) After developing the TestCaseRetryListener class, testNG will automatically monitor all test cases and execute the logic implemented in the transform method;

[0094] (3) The try-catch code block can capture the exception and perform relevant processing when the code executes abnormally;

[0095] (4) When an interface request is initiated through a proxy (the proxy address is the address of the virtualized service), the test request will be sent to the virtualized server and processed by the virtualized service, but will not be sent to the business system under test, thereby achieving the effect of simulating a successful response.

[0096] (5) The simulation template of each test request can be customized to cope with complex request scenarios. For example, for a request to obtain a list of prizes, the prizes for different users may be different. In this case, the template needs to be modified to distinguish the prizes returned in the response based on different user IDs. This can be achieved, for example, through hoverfly.

[0097] (6) Setting the maximum number of retries to n+1 (for example, 4) is to avoid infinite retries of the test case. Generally speaking, if the dependent test request fails n times (for example, 3 times) in a short period of time, it is likely that the n+1th time (for example, the 4th time) will also fail, so it is appropriate to start the simulated response at this time.

[0098] (7) Since the target request is exactly what the test case is going to test, if the target test request fails, the simulation response will not be started, otherwise the test result of the test case will be invalid.

[0099] Above, combined Figures 2 to 4 The method provided by the embodiment of the present application is described in detail. Figures 5 to 7 The device provided in the embodiments of the present application is described in detail.

[0100] Figure 5 is a schematic block diagram of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device 500 may include:

[0101] The acquisition unit 510 is used to acquire a simulated response of the dependent test request if the dependent test request in the test case fails to execute n times during the execution of the test case, where the simulated response is a historical response of the virtualized server that successfully executes the dependent test request, wherein n is an integer greater than or equal to 0;

[0102] The test execution unit 520 is used to take the simulated response of the dependent test request as the execution result of the dependent test request, continue to execute the remaining test requests in the test case, and obtain a first test result of the test case;

[0103] The test case includes a target test request and at least one dependent test request of the target test request.

[0104] In one possible design, the acquisition unit 510 is specifically used to: send a simulated response request to the virtualization server, where the simulated response request carries the dependent test request; and receive a simulated response to the dependent test request sent by the virtualization server.

[0105] In one possible design, the electronic device 500 also includes a sending unit 530, which is used to send a first instruction to the virtualization server, wherein the first instruction is used to instruct the virtualization server to start the virtualization service and / or switch the mode of the virtualization service to a simulation mode, which is used to provide a simulation response.

[0106] In one possible design, the test execution unit 520 is also used to determine whether the request that failed to execute is a dependent test request when the test case fails to execute; if the request that failed to execute is a dependent test request, the dependent test request is repeatedly executed until the dependent test request is successfully executed or the number of executions of the dependent test request reaches n times.

[0107] In one possible design, the test execution unit 520 is also used to end the test if the request that failed to execute is the target test request, and obtain a second test result of the test case, where the second test result indicates that the test case failed.

[0108] The electronic device provided in the above embodiment can execute the technical solution on the test device side in the above method embodiment, and its implementation principle and technical effect are similar, which will not be described in detail in this embodiment.

[0109] Figure 6 is a schematic block diagram of a server provided in an embodiment of the present application. Figure 6 As shown, the server 600 may include:

[0110] The receiving unit 610 is used to receive a simulation response request sent by a test device, where the simulation response request carries a dependent test request that failed to execute, where the dependent test request is one of at least one dependent test request of a target test request in a test case;

[0111] The processing unit 620 is used to determine a simulation response corresponding to the dependency test request according to the dependency test request and a plurality of pre-stored simulation templates, wherein the simulation response is a historical response of the virtualization server that successfully executes the dependency test request and is pre-acquired, the test request corresponds to the dependency test request, and the simulation template includes the test request and the historical response corresponding to the test request;

[0112] The sending unit 630 is used to send a simulation response corresponding to the dependent test request to the test device.

[0113] In one possible design, the processing unit 620 is specifically used to match the dependent test request with the test requests in the multiple simulation templates respectively, obtain the simulation template with the highest matching degree with the dependent test request, and use the simulation response in the simulation template as the historical response corresponding to the dependent test request.

[0114] In one possible design, the receiving unit 610 is also used to receive a first instruction sent by the test device; the processing unit 620 is also used to start the virtualization service and / or switch the mode of the virtualization service to a simulation mode according to the first instruction, and the simulation mode is used to provide a simulation response.

[0115] In one possible design, the processing unit 620 is also used to obtain at least one test request that is successfully executed during the test device's execution of the test case, as well as the execution result of the test request; the execution result of the test request is used as a historical response to the test request, and combined with the test request to obtain the simulation template.

[0116] The server provided in the above embodiment can execute the technical solution of virtualizing the server side in the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated in this embodiment.

[0117] The present application also provides a server. Figure 7 , the embodiments of this application are only based on Figure 7 This is just an example for explanation and does not mean that the present application is limited to this.

[0118] Figure 7 This is a schematic structural diagram of an electronic device provided in an embodiment of the present application. Figure 7 The electronic device 700 shown includes a processor 710, which can call and run a computer program from a memory to implement the method in the embodiment of the present application.

[0119] Alternatively, if Figure 7 As shown, the electronic device 700 may further include a memory 730. The processor 710 may call and run a computer program from the memory 730 to implement the method in the embodiment of the present application.

[0120] The memory 730 may be a separate device independent of the processor 710 , or may be integrated into the processor 710 .

[0121] Alternatively, if Figure 7As shown, the electronic device 700 may further include a transceiver 720, and the processor 710 may control the transceiver 720 to communicate with other devices, specifically, may send information or data to other devices, or receive information or data sent by other devices.

[0122] The transceiver 720 may include a transmitter and a receiver. The transceiver 720 may further include an antenna, and the number of the antennas may be one or more.

[0123] Optionally, the electronic device 700 can implement corresponding processes corresponding to the testing device in each method of the embodiments of the present application, which will not be described here for the sake of brevity.

[0124] Optionally, the electronic device 700 can implement the corresponding processes corresponding to the virtualized server in the various methods of the embodiments of the present application, which will not be described here for the sake of brevity.

[0125] The electronic device 700 may be a terminal device or a server.

[0126] It should be understood that the processor of the embodiment of the present application may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiment can be completed by the hardware integrated logic circuit or software instructions in the processor. The above processor can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor are combined and performed. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, and other mature storage media in the art. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0127] It can be understood that the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0128] It should be understood that the above-mentioned memory is exemplary but not restrictive. For example, the memory in the embodiments of the present application may also be static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (synch link DRAM, SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DR RAM), etc. That is to say, the memory in the embodiments of the present application is intended to include but not limited to these and any other suitable types of memory.

[0129] An embodiment of the present application also provides a computer-readable storage medium for storing a computer program.

[0130] Optionally, the computer-readable storage medium can be applied to the electronic device in the embodiments of the present application, and the computer program enables the computer to execute the corresponding processes performed by the test device or virtualization server in the various methods of the embodiments of the present application. For the sake of brevity, they are not repeated here.

[0131] An embodiment of the present application also provides a computer program product, including computer program instructions.

[0132] Optionally, the computer program product can be applied to the electronic device in the embodiments of the present application, and the computer program instructions enable the computer to execute the corresponding processes performed by the test device or virtualization server in the various methods of the embodiments of the present application. For the sake of brevity, they are not repeated here.

[0133] The embodiment of the present application also provides a computer program.

[0134] Optionally, the computer program can be applied to the electronic device in the embodiments of the present application. When the computer program runs on a computer, the computer executes the corresponding processes performed by the test device or virtualization server in the various methods of the embodiments of the present application. For the sake of brevity, they are not repeated here.

[0135] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0136] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0137] In the several embodiments provided in the present application, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0138] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0139] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0140] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. In view of such an understanding, the technical solution of the present application can be embodied in the form of a software product in essence or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0141] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A testing method based on virtualized services, characterized in that: Applied to a test device, the method comprises: During the execution of the test case, if the dependent test request in the test case fails to execute n times, a simulated response of the dependent test request is obtained, where the simulated response is a historical response of the dependent test request that is successfully executed and pre-acquired by the virtualization server, and n is an integer greater than 0; Taking the simulated response to the dependent test request as the execution result of the dependent test request, continuing to execute the remaining test requests in the test case, and obtaining a first test result of the test case; Wherein, the test case includes a target test request and at least one dependent test request of the target test request; The obtaining of the simulated response to the dependent test request includes: Sending a simulated response request to the virtualization server, wherein the simulated response request carries the dependent test request; Receiving a simulated response to the dependent test request sent by the virtualization server; the simulated response is determined by the virtualization server according to the dependent test request and a plurality of pre-stored simulation templates; the simulation template includes a test request and a historical response corresponding to the test request; The virtualization server determines the simulation response specifically including: matching the dependent test request with the test requests in the plurality of simulation templates respectively, obtaining the simulation template with the highest matching degree with the dependent test request, and using the historical response in the simulation template as the simulation response corresponding to the dependent test request; When the test case fails to execute, determining whether the request that failed to execute is a dependent test request; If the request that failed to execute is a dependent test request, repeatedly execute the dependent test request until the dependent test request is successfully executed or the number of executions of the dependent test request reaches n times; If the request that fails to execute is the target test request, the test is terminated and a second test result of the test case is obtained, where the second test result indicates that the test case has failed.

2. The method according to claim 1, characterized in that Before sending the simulated response request to the virtualized server, the method further includes: A first instruction is sent to the virtualization server, where the first instruction is used to instruct the virtualization server to start a virtualization service and / or switch a mode of the virtualization service to a simulation mode, where the simulation mode is used to provide a simulation response.

3. A testing method based on virtualized services, characterized in that: Applied to a virtualized server, the method comprises: Receiving a simulation response request sent by a test device, wherein the simulation response request carries a dependent test request that failed to execute, and the dependent test request is one of at least one dependent test request of a target test request in a test case; Determine a simulation response corresponding to the dependent test request according to the dependent test request and a plurality of pre-stored simulation templates, wherein the simulation response is a historical response of a successfully executed test request pre-acquired by the virtualization server, the test request corresponds to the dependent test request, and the simulation template includes the test request and the historical response corresponding to the test request; Sending a simulation response corresponding to the dependent test request to the test device; The step of determining a simulation response corresponding to the dependency test request according to the dependency test request and a plurality of pre-stored simulation templates includes: Matching the dependent test request with the test requests in the multiple simulation templates respectively to obtain the simulation template with the highest matching degree with the dependent test request, and using the historical response in the simulation template as the simulation response corresponding to the dependent test request; When the test device fails to execute the test case, the test device determines whether the request that failed to execute is a dependent test request; if the request that failed to execute is a dependent test request, the dependent test request is repeatedly executed until the dependent test request is successfully executed or the number of executions of the dependent test request reaches n times; if the request that failed to execute is the target test request, the test is terminated and a second test result of the test case is obtained, and the second test result indicates that the test case test has failed.

4. The method according to claim 3, characterized in that The method further comprises: receiving a first instruction sent by the testing device; According to the first instruction, the virtualization service is started and / or the mode of the virtualization service is switched to a simulation mode, where the simulation mode is used to provide a simulation response.

5. The method according to claim 4, characterized in that The method further comprises: Acquire at least one test request successfully executed during the process of the test device executing the test case, and the execution result of the test request; The execution result of the test request is used as the historical response of the test request and combined with the test request to obtain the simulation template.

6. An electronic device, characterized in that: include: An acquisition unit, used for acquiring a simulated response of the dependent test request if the dependent test request in the test case fails to execute n times during the execution of the test case, wherein the simulated response is a historical response of the successful execution of the dependent test request pre-acquired by the virtualization server, and n is an integer greater than 0; A test execution unit, configured to take the simulated response to the dependent test request as the execution result of the dependent test request, continue to execute the remaining test requests in the test case, and obtain a first test result of the test case; Wherein, the test case includes a target test request and at least one dependent test request of the target test request; When acquiring the simulated response to the dependent test request, the acquisition unit is specifically used to: send a simulated response request to the virtualization server, the simulated response request carrying the dependent test request; receive a simulated response to the dependent test request sent by the virtualization server; the simulated response is determined by the virtualization server according to the dependent test request and a plurality of pre-stored simulation templates; the simulation template includes a test request and a historical response corresponding to the test request; The virtualization server determines the simulation response specifically including: matching the dependent test request with the test requests in the plurality of simulation templates respectively, obtaining the simulation template with the highest matching degree with the dependent test request, and using the historical response in the simulation template as the simulation response corresponding to the dependent test request; A test execution unit is used to determine whether the request that failed to execute is a dependent test request when the test case fails to execute; if the request that failed to execute is a dependent test request, repeatedly execute the dependent test request until the dependent test request is successfully executed or the number of executions of the dependent test request reaches n times; if the request that failed to execute is the target test request, end the test and obtain a second test result of the test case, wherein the second test result indicates that the test case test has failed.

7. A server, characterized in that: include: A receiving unit, configured to receive a simulation response request sent by a test device, wherein the simulation response request carries a dependent test request that failed to execute, and the dependent test request is one of at least one dependent test request of a target test request in a test case; A processing unit, configured to determine a simulation response corresponding to the dependency test request according to the dependency test request and a plurality of pre-stored simulation templates, wherein the simulation response is a historical response of the virtualization server that successfully executes the dependency test request, the test request corresponds to the dependency test request, and the simulation template includes the test request and the simulation response corresponding to the test request; A sending unit, configured to send a simulation response corresponding to the dependency test request to a test device; The processing unit is specifically used to: match the dependent test request with the test requests in the multiple simulation templates respectively, obtain the simulation template with the highest matching degree with the dependent test request, and use the historical response in the simulation template as the simulation response corresponding to the dependent test request; Among them, when the test device fails to execute the test case, the test device determines whether the request that failed to execute is a dependent test request; if the request that failed to execute is a dependent test request, the dependent test request is repeatedly executed until the dependent test request is successfully executed or the number of executions of the dependent test request reaches n times; if the request that failed to execute is the target test request, the test is terminated and a second test result of the test case is obtained, and the second test result indicates that the test case test has failed.

8. An electronic device, characterized in that: include: Memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to claim 1 or 2.

9. A server, characterized in that: include: Memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 3 to 5.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 5 when executed by a processor.