Test time prediction method and device, electronic device, and storage medium

In the automated test of cloud network, the target historical test environment is selected using environment similarity calculation and correcting its test time, the problem of uncertain test script execution time is solved, and the reliability and work efficiency of the test plan are improved.

CN114238106BActive Publication Date: 2025-02-28CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111526996.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-13
Publication Date
2025-02-28
Estimated Expiration
2041-12-13

AI Technical Summary

Technical Problem

During the automated testing process of cloud network, the execution time of the test script in different environments is different, making it difficult for testers to formulate clear plans, which may cause delays in delivery and affect work efficiency.

Method used

By calculating the current test environment with multiple historical test environments, selecting the most similar target historical test environment, and selecting the target historical test script with a high similarity to the test script to be executed from the environment, correcting its historical test time to predict the execution time of the test script to be executed in the current environment.

Benefits of technology

Improves the accuracy of test time predictions, helps testers develop clearer plans, reduce delivery delays and improve work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114238106B_ABST
    Figure CN114238106B_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose a test time prediction method and device, electronic device, and computer-readable storage medium. The method includes: calculating the similarity between the current test environment and each historical test environment, and obtaining the environment similarity value between the current test environment and the historical test environment; determining the target historical test environment from multiple historical test environments according to the environment similarity value; determining the target historical test script whose script similarity value with the test script to be executed is greater than a preset threshold from the historical test scripts corresponding to the target historical test environment; correcting the historical test time corresponding to the target historical test script to obtain the target test time, and using the target test time as the execution test time of the test script to be executed in the current test environment. The embodiments of the present application can make the test time prediction more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of cloud computing, and in particular to a test time prediction method, a test time prediction device, an electronic device, and a computer-readable storage medium. Background Art

[0002] Cloud testing is aimed at testing the basic resources that carry cloud upper-layer applications. The test objects include the cloud platform itself and the correctness of cloud platform application deployment. In related technologies, cloud testing can be roughly divided into manual testing and automated testing. Manual testing is performed by professionals manually calling various functions of the cloud platform. Automated testing replaces manual operations with automated scripts. It is simple to operate, has low requirements for testers, and can shorten the test cycle from several days to several hours.

[0003] During the cloud network automation testing process, the execution time of test scripts in different environments is different, making it difficult for testers to make clear plans for testing, which may cause delivery delays and affect work efficiency. Summary of the invention

[0004] In order to solve the above technical problems, the embodiments of the present application provide a road condition refreshing method and device, an electronic device, and a computer-readable storage medium.

[0005] According to one aspect of an embodiment of the present application, a test time prediction method is provided, wherein a current test environment includes executed test scripts and test scripts to be executed, and each historical test environment includes historical test scripts, the method comprising: performing similarity calculations on the current test environment and each historical test environment to obtain an environment similarity value between the current test environment and the historical test environment; determining a target historical test environment from multiple historical test environments based on the environment similarity value; determining a target historical test script from the historical test scripts corresponding to the target historical test environment, wherein the script similarity value between the target historical test script and the test script to be executed is greater than a preset threshold; correcting the historical test time corresponding to the target historical test script to obtain a target test time, and using the target test time as the execution test time of the test script to be executed in the current test environment.

[0006] According to one aspect of an embodiment of the present application, a test time prediction device is provided, including: an environment similarity value calculation module, configured to perform similarity calculation on the current test environment and each historical test environment, respectively, to obtain an environment similarity value between the current test environment and the historical test environment; a target historical test environment selection module, configured to determine a target historical test environment from multiple historical test environments according to the environment similarity value; a target historical test script selection module, configured to determine a target historical test script whose script similarity value with the test script to be executed is greater than a preset threshold from the historical test scripts corresponding to the target historical test environment; a correction time and test time calculation module, configured to perform correction processing on the historical test time corresponding to the target historical test script, to obtain a target test time, and to use the target test time as the execution test time of the test script to be executed in the current test environment.

[0007] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the test time prediction method as described above.

[0008] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the test time prediction method as described above.

[0009] In the technical solution provided by the embodiments of the present application, considering that the historical test environment may have similarities with the current test environment in configuration and performance, the present application uses the historical test time of the test script executed in the historical test environment to predict the execution test time in the current test environment. When calculating the environmental similarity value, due to the differences in software and hardware configurations between the environments, it is difficult to directly quantify it as an environmental similarity index. Therefore, the similarity between the two test environments is calculated based on the test time, which has a wider scope of application. After selecting the historical test environment that is most similar to the current test environment as the target historical test environment according to the environmental similarity value, the difference between the current test environment and the target historical test environment is quantified by calculating the corrected time value. The historical test time of the selected target historical test script is further corrected by the corrected time value, so that the test time prediction is more accurate.

[0010] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0012] Figure 1 is a schematic diagram of a test time prediction system framework shown in an exemplary embodiment of the present application;

[0013] Figure 2 is a schematic diagram of a test time prediction structure framework shown in an exemplary embodiment of the present application;

[0014] Figure 3 is a flow chart of a test time prediction method shown in an exemplary embodiment of the present application;

[0015] Figure 4 yes Figure 3 A flowchart of step S110 in the illustrated embodiment in an exemplary embodiment;

[0016] Figure 5 yes Figure 4 A flowchart of step S1101 in the illustrated embodiment in an exemplary embodiment;

[0017] Figure 6 yes Figure 3 A flowchart of step S140 in the illustrated embodiment in an exemplary embodiment;

[0018] Figure 7 is a block diagram of a test time prediction device shown in an exemplary embodiment of the present application;

[0019] Figure 8 It is a structural diagram of a computer system suitable for implementing an electronic device of an embodiment of the present application. DETAILED DESCRIPTION

[0020] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0021] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0022] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0023] The term "multiple" as used in this application refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.

[0024] The schemes provided in the embodiments of the present application involve schemes including automated testing technologies for cloud environments. It is understandable that automated testing of cloud environments is a new type of cloud testing scheme. Cloud testing refers to the testing of basic resources that carry cloud upper layer applications. All software tools and test environments that need to be used in the test can be used for cloud testing, and the test objects include the correctness of the cloud platform itself and the deployment of cloud platform applications, such as hardware environment, software environment, adaptive software, functional automation testing, performance testing, etc. The test software can have different test indicators for the hardware environment and software environment in different application scenarios. The cloud testing platform can be applied to automated functional testing and compatibility testing, performance testing, test script design, problem report analysis, and test management of the cloud environment. With the application of cloud technology in finance, manufacturing, medical care, education and other fields, the scale of the cloud is also expanding rapidly. Faced with the surge in cloud testing and acceptance business, traditional manual testing is difficult to meet the efficiency requirements. Automated cloud testing can effectively improve test efficiency, reduce technical requirements for testers, and play an increasingly important role in cloud testing acceptance.

[0025] The cloud testing platform provides a portal for users to initiate automated testing tasks so that they can conduct automated cloud testing on the cloud testing platform, such as functions, performance, and compatibility. Testers and other users can conduct relevant automated testing on the cloud testing platform by directly using the testing capabilities of the cloud testing platform, or they can upload automated testing scripts to the website provided by the cloud testing platform to run automated testing scripts on the cloud testing platform and conduct relevant tests.

[0026] The solution provided in the embodiment of the present application involves a time series prediction technology. It can be understood that time series prediction refers to predicting the future development of a thing based on the correlation between the states of the evolution of the thing.

[0027] In the related art, during the cloud network automation testing process, since the execution time of the test script is different in different environments, it is difficult for the tester to know the execution time of the test script in the current test environment before the test is completed, which makes it difficult for the tester to make a clear plan for the test, thus affecting the delivery time and work efficiency. Therefore, it is necessary to predict the execution time of the test script in the current test environment. The historical test time of historical test scripts in historical test environments has a good reference value. The relevant time prediction method directly uses the historical test time of the test script in a certain historical test environment, or takes the average of the historical test time of the test script in multiple historical test environments. The test time result of the test script executed in the current test environment has a large error with the actual test time result.

[0028] The historical test environment may be similar to the current test environment in configuration and performance. Therefore, the historical test data executed in the historical test environment has great reference value for the time prediction of the current test environment. Therefore, in the cloud network automated testing scenario, the embodiment of the present application provides a test time prediction system. Figure 1 is a schematic diagram of a test time prediction system framework shown in an exemplary embodiment of the present application, such as Figure 1 As shown, the test time prediction system includes a cloud test platform, wherein:

[0029] The tester specifies the test script and initiates a test request on the cloud testing platform. After receiving the test request, the cloud testing platform runs the test script for testing. After the test is completed, the test script, test environment and test time are stored in the test database.

[0030] The test environment in the test database includes a historical test environment and a current test environment. The test environment that has been tested is the historical test environment, and the environment currently being tested is the current test environment. The current test environment includes executed test scripts and test scripts to be executed, and each historical test environment includes multiple historical test scripts. It should be understood that the executed test scripts in the current test environment may have been executed in one or more historical test environments, that is, the executed test scripts in the current test environment may have script intersections with the historical test scripts contained in one or more historical test environments; the test scripts to be executed in the current test environment may have been executed in one or more historical test environments, that is, the test scripts to be executed in the current test environment may have script intersections with the historical test scripts contained in one or more historical test environments.

[0031] After the cloud testing platform executes the test script to be executed, it predicts the execution time of the test script to be executed in the current test environment based on the executed test scripts in the current test environment and the historical test scripts in the historical test environment:

[0032] The cloud testing platform calculates the environmental similarity between the current test environment and each historical test environment, and obtains the environmental similarity value between the current test environment and the historical test environment; and determines the target historical test environment from multiple historical test environments according to the environmental similarity value;

[0033] Determine, from the historical test scripts corresponding to the target historical test environment, a target historical test script whose script similarity value with the test script to be executed is greater than a preset threshold;

[0034] The historical test time corresponding to the target historical test script is corrected to obtain the target test time, and the target test time is used as the execution test time of the test script to be executed in the current test environment.

[0035] That is, in the cloud network automated testing scenario, the user specifies several test scripts for testing on the cloud testing platform. The cloud testing platform predicts the test time for the test scripts to be executed based on the test time of the executed test scripts in the current test environment and the historical test time in the historical test environment.

[0036] See also Figure 2 , Figure 2 FIG. 1 is a schematic diagram of a test time prediction structure framework shown in an exemplary embodiment of the present application. Figure 2 It can be seen from the test time prediction structure framework shown that the cloud testing platform has logical calculation. The cloud testing platform receives the test request for the test script to be executed initiated by the user, and then calculates the environment similarity value between the current test environment and each historical test environment respectively, and determines the target historical test environment from multiple historical test environments according to the environment similarity value, and determines the target historical test script whose script similarity value with the test script to be executed is greater than the preset threshold from the historical test scripts corresponding to the target historical test environment; the historical test time corresponding to the target historical test script is corrected to obtain the execution test time of the test script to be executed in the current test environment.

[0037] It should be noted that the cloud testing platform in the embodiment of the present application is an automated testing management platform, which is responsible for initiating tests, displaying predicted time, calculating test progress, etc.

[0038] based on Figure 2In the application scenario shown, after adopting the technical solution of the embodiment of the present application, the cloud testing platform calculates the environment similarity value between the current test environment and the historical test environment based on the executed test scripts in the current test environment and the historical test scripts of the historical test environment, searches for the target historical test environment that is most similar to the current test environment from the historical test environment, calculates the corrected time value based on the historical test time of the historical test scripts of the target historical test environment and the current test time of the executed test scripts in the current test environment, and then corrects the target historical test script according to the corrected time value, thereby realizing the prediction of the execution test time of the test script to be executed in the current test environment, and greatly improving the accuracy of time prediction.

[0039] The following is a detailed description of various implementation details of the technical solution of the embodiment of the present application:

[0040] See also Figure 3 , Figure 3 FIG. 1 is a flow chart of a test time prediction method shown in an exemplary embodiment of the present application. The method can be Figure 2 The cloud test platform in the test time prediction structure framework is executed. It should be understood that the method can also be applied to other exemplary implementation environments and specifically executed by devices in other implementation environments. This embodiment does not limit the implementation environment to which the method is applicable.

[0041] like Figure 3 As shown, the test time prediction method at least includes steps S110 to S130, which are described in detail as follows:

[0042] Step S110 , calculating similarity between the current test environment and each historical test environment, and obtaining an environment similarity value between the current test environment and the historical test environment.

[0043] First of all, it should be explained that the current test environment includes executed test scripts and test scripts to be executed, there are multiple historical test environments, and each historical test environment includes multiple historical test scripts.

[0044] The environment similarity value in the embodiment of the present application refers to the similarity between two test environments. The larger the environment similarity value, the more reference there is for the time prediction in the current test environment. Due to the differences in software and hardware configurations between environments, it is difficult to directly quantify them as environment similarity indicators. Therefore, the similarity between two test environments is calculated based on the test time, which has a wider scope of application.

[0045] In one embodiment of the present application, see Figure 4The process of calculating the similarity between the current test environment and each historical test environment in step S110 to obtain the environment similarity value between the current test environment and the historical test environment may include steps S1101 to S1104, which are described in detail as follows:

[0046] Step S1101 : determining, from among the historical test scripts contained in a plurality of historical test environments, an associated historical test script of an executed test script.

[0047] In one embodiment of the present application, see Figure 5 The process of determining the associated historical test script of the executed test script from the historical test scripts contained in the multiple historical test environments in step S1101 may include steps S11011 to S11012, which are described in detail as follows:

[0048] Step S11011, calculating script intersections between the executed test scripts and the historical test scripts contained in each historical test environment, and obtaining multiple intersection results.

[0049] The script intersection in the embodiment of the present application refers to the intersection between the set of all executed test scripts in the current test environment and the set of historical test scripts in the historical test environment.

[0050] For example, if the executed test scripts in the current test environment include script 1, script 2, script 3, script 4 and script 5; the historical test scripts in the first historical test environment include script 1, script 2, script A, script B; the historical test scripts in the second historical test environment include script 1, script 2, script 3, script 4, script 5, script 6 and script 7; the historical test scripts in the third historical test environment include script 1, script A, script B, script C and script D; then the script intersection between the executed test scripts and the historical test scripts contained in the first historical test environment is script 1 and script 2, and the intersection result is 2; the script intersection between the executed test scripts and the historical test scripts contained in the second historical test environment is script 1, script 2, script 3, script 4, script 5, and the intersection result is 5; the script intersection between the executed test script and the historical test scripts contained in the third historical test environment is script 1, and the intersection result is 1.

[0051] Step S11012, screen out historical test environments whose intersection results are greater than a preset intersection quantity threshold from multiple historical test environments according to the intersection results, and use the script intersection of the historical test scripts contained in the screened historical test environments and the executed test scripts as the associated historical test scripts.

[0052] The preset intersection quantity threshold in the embodiment of the present application is a value set in advance by humans or computers based on experience or experiments. The preset intersection quantity threshold is used to screen out the historical test environment with the most intersection results with the current test environment from multiple historical test environments. There may be only one or more historical test environments screened out, and then the associated historical test scripts that have reference value for test time prediction are determined from the screened historical test environments.

[0053] The associated historical test script in the embodiment of the present application is the script intersection of the historical test scripts contained in the historical test environment screened out above and the executed test scripts.

[0054] For example, the executed test scripts in the current test environment include script 1, script 2, script 3, script 4 and script 5; the historical test scripts in the first historical test environment include script 1, script 2, script A, and script B; the historical test scripts in the second historical test environment include script 1, script 2, script 3, script 4, script 5, script 6 and script 7; the historical test scripts in the third historical test environment include script 1, script A, script B, script C and script D; the script intersection between the executed test scripts and the historical test scripts contained in the first historical test environment is script 1 and script 2, and the intersection result is 2; the script intersection between the executed test scripts and the historical test scripts contained in the second historical test environment is script 1, script 2, script 3, script 4, script 5, and the intersection result is 5; the script intersection between the executed test script and the historical test scripts contained in the third historical test environment is script 1, and the intersection result is 1. On this basis, if the preset intersection quantity threshold is 1, the historical environments screened out are the first historical test environment and the second historical test environment. For the first historical test environment, the associated historical test scripts are the script intersection between the executed test scripts and the historical test scripts contained in the first historical test environment, that is, the associated historical test scripts in the first historical test environment are script 1 and script 2; for the second historical test environment, the associated historical test scripts are the script intersection between the executed test scripts and the historical test scripts contained in the second historical test environment, that is, the associated historical test scripts in the second historical test environment are script 1, script 2, script 3, script 4, and script 5.

[0055] Step S1102, obtaining the execution test time of the executed test script and the script similarity value between the executed test script and the associated historical test script.

[0056] The script similarity value in the embodiment of the present application refers to the ratio of the number of associated historical test scripts to the number of all executed test scripts. The script similarity value is positively correlated with the script intersection, and the value range of the script similarity value is (0, 1].

[0057] For example, the executed test scripts in the current test environment include script 1, script 2, script 3, script 4 and script 5; the historical test scripts in the first historical test environment include script 1, script 2, script A, and script B; the historical test scripts in the second historical test environment include script 1, script 2, script 3, script 4, script 5, script 6 and script 7; the historical test scripts in the third historical test environment include script 1, script A, script B, script C and script D; the script intersection between the executed test scripts and the historical test scripts contained in the first historical test environment is script 1 and script 2, and the intersection result is 2; the script intersection between the executed test scripts and the historical test scripts contained in the second historical test environment is script 1, script 2, script 3, script 4, script 5, and the intersection result is 5; the script intersection between the executed test script and the historical test scripts contained in the third historical test environment is script 1, and the intersection result is 1. The preset intersection number threshold is 1, and the associated historical test scripts in the first historical test environment are script 1 and script 2; the associated historical test scripts in the second historical test environment are script 1, script 2, script 3, script 4, and script 5. On this basis, the number of associated historical test scripts in the first historical test environment is 2, and the number of executed test scripts is 5, so the script similarity value between the executed test script and the associated historical test script in the first historical test environment is 2 / 5; the number of associated historical test scripts in the second historical test environment is 5, and the number of executed test scripts is 5, so the script similarity value between the executed test script and the associated historical test script in the second historical test environment is 5 / 5=1.

[0058] Step S1103, obtaining a first time value according to the execution test time and the historical test time corresponding to the associated historical test script.

[0059] The test execution time in the embodiment of the present application refers to the test execution time of the executed test script in the current test environment.

[0060] In one embodiment of the present application, the process of obtaining the first time value according to the execution test time of the executed test script and the historical test time corresponding to the associated historical test script may include the following steps, which are described in detail as follows:

[0061] Performing a difference operation on the historical test time corresponding to the associated historical test script and the execution test time of the executed test script to obtain a first calculation result;

[0062] A quotient operation is performed on the first calculation result and the execution test time of the executed test script to obtain the first time value.

[0063] In one embodiment of the present application, when there is only one executed test script and there is only one associated historical test script in a historical test environment, the following formula may be used to calculate the first time value:

[0064]

[0065] In this formula, T k Represents the historical test time corresponding to the associated historical test script, T m It represents the execution time of the executed test script in the current environment. It can be understood that T k -T m The obtained value is the first calculation result. The obtained value is the first time value.

[0066] In one embodiment of the present application, when there is only one executed test script and there is only one associated historical test script in a historical test environment, the following formula may be used to calculate the first time value:

[0067]

[0068] Among them, in this formula, some parameters in this formula are the same as the parameters in the previous formula, and N represents the preset coefficient.

[0069] In one embodiment of the present application, when there is one executed test script and there are multiple associated historical test scripts in one historical test environment, or when there are multiple executed test scripts and there are multiple associated historical test scripts in one historical test environment, the following formula may be used to calculate the first time value:

[0070]

[0071] Among them, some parameters in this formula are the same as those in the above formula, except that: (T k -T m ) 2 The obtained value is the first calculation result. The obtained value is the first time value.

[0072] The preset coefficients in the embodiments of the present application are set by relevant staff based on experience or through experiments. Since the running time of some scripts in the same environment is unstable, in order to make the running time of the scripts in the test environment more stable, the weight coefficients based on experience are set as the preset coefficients.

[0073] Step S1104, obtaining an environment similarity value between the current test environment and the historical test environment according to the script similarity value and the first time value.

[0074] In one embodiment of the present application, when there is only one executed script and only one associated historical test script, the following formula can be used to calculate the environment similarity value between the current test environment and the historical test environment:

[0075]

[0076] Among them, some parameters in this formula are the same as the parameters in the previous formula, S represents the environment similarity value, and K represents the script similarity value.

[0077] In one embodiment of the present application, when there is one executed test script and there are multiple associated historical test scripts in one historical test environment, or when there are multiple executed test scripts and there are multiple associated historical test scripts in one historical test environment, the following formula can be used to calculate the environment similarity value between the current test environment and the historical test environment:

[0078]

[0079] Among them, some parameters in this formula are the same as those in the previous formula.

[0080] Step S120 , determining a target historical test environment from multiple historical test environments according to the environment similarity value.

[0081] In one embodiment of the present application, the process of determining the target historical test environment from the historical test environments according to the environment similarity value in step S120 is described in detail as follows:

[0082] A historical test environment having the largest environment similarity value with the current test environment is determined from multiple historical test environments as the target historical test environment.

[0083] That is, a unique target historical test environment is determined from multiple historical test environments, and the environment similarity value between the target historical test environment and the current test environment is the largest, indicating that the target historical test environment is most referenced for the test time prediction in the current test environment.

[0084] Step S130 , determining a target historical test script whose script similarity value with the test script to be executed is greater than a preset threshold from the historical test scripts corresponding to the target historical test environment.

[0085] In one embodiment of the present application, on the basis of one target historical test environment, the process of determining, from the historical test scripts corresponding to the target historical test environment in step S130, a target historical test script whose script similarity value with the test script to be executed is greater than a preset threshold, may include the following steps, which are described in detail as follows:

[0086] Obtain script similarity values ​​between the test script to be executed in the current test environment and each historical test script in the target historical test environment.

[0087] Selecting a historical test script from the target historical test environment, whose script similarity value with the test script to be executed in the current test environment is greater than a preset threshold, as the target historical test script;

[0088] or,

[0089] A historical test script having the largest script similarity value with the test script to be executed in the current test environment is selected from the target historical test environment as the target historical test script.

[0090] That is, on the basis of one target historical test environment, the historical test script with the largest script similarity value is selected as the target historical test script, then there is only one target historical test script, and the target test time obtained in the subsequent test time prediction is unique. At this time, the prediction can be completed by taking the target test time as the execution test time of the test script to be executed in the current test environment. If the historical test script with a script similarity value greater than a preset threshold is selected as the target historical test script, there may be multiple target historical test scripts.

[0091] Step S140, correcting the historical test time corresponding to the target historical test script to obtain the target test time, and using the target test time as the execution test time of the test script to be executed in the current test environment.

[0092] In one embodiment of the present application, see Figure 6 In step S140, the process of correcting the historical test time corresponding to the target historical test script to obtain the target test time may include steps S1401 to S1403, which are described in detail as follows:

[0093] Step S1401, obtaining an environment similarity value between a current test environment and a target historical test environment.

[0094] Step S1402, obtaining a corrected time value according to the environment similarity value, the execution test time of the executed test script, and the historical test time of the associated historical test script.

[0095] In one embodiment of the present application, in step S1402, the calculation process of the modified time value may include the following steps, which are described in detail as follows:

[0096] A second time value is obtained according to the execution test time of the executed test script and the historical test time of the associated historical test script.

[0097] Exemplarily, the execution test time of the executed test script is divided by the historical test time of the associated historical test script to obtain the second time value.

[0098] In one embodiment of the present application, when there is only one executed test script and there is only one associated historical test script in a historical test environment, the following formula may be used to calculate the second time value:

[0099]

[0100] Among them, some parameters in this formula are the same as those in the previous formula.

[0101] In one embodiment of the present application, when there is one executed test script and there are multiple associated historical test scripts in one historical test environment, or when there are multiple executed test scripts and there are multiple associated historical test scripts in one historical test environment, the following formula can be used to calculate the second time value:

[0102]

[0103] Among them, some parameters in this formula are the same as those in the previous formula.

[0104] A third time value is obtained according to the historical test time of the associated historical test script and the second time value.

[0105] Exemplarily, the historical test time is multiplied by the second time value to obtain the third time value.

[0106] In one embodiment of the present application, when there is only one executed test script and there is only one associated historical test script in one historical test environment, the following formula may be used to calculate the third time value:

[0107]

[0108] Among them, some parameters in this formula are the same as those in the previous formula.

[0109] In one embodiment of the present application, when there is one executed test script and there are multiple associated historical test scripts in one historical test environment, or when there are multiple executed test scripts and there are multiple associated historical test scripts in one historical test environment, the following formula may be used to calculate the third time value:

[0110]

[0111] Among them, some parameters in this formula are the same as those in the previous formula, ΔT k Indicates the average value of the historical test time corresponding to each associated historical test script.

[0112] A corrected time value is obtained according to the third time value and the environment similarity value.

[0113] Exemplarily, the third time value is multiplied by the environment similarity value to obtain a corrected time value.

[0114] In one embodiment of the present application, when there is only one executed test script and there is only one associated historical test script in a historical test environment, the following formula can be used to calculate the correction time value:

[0115]

[0116] Among them, some parameters in this formula are the same as those in the previous formula.

[0117] In one embodiment of the present application, when there is one executed test script and there are multiple associated historical test scripts in one historical test environment, or when there are multiple executed test scripts and there are multiple associated historical test scripts in one historical test environment, the following formula can be used to calculate the correction time value:

[0118]

[0119] Among them, some parameters in this formula are the same as those in the above formula, and δ represents the correction time value.

[0120] Step S1403, correcting the historical test time corresponding to the target historical test script according to the correction time value to obtain the target test time.

[0121] In an embodiment of the present application, on the basis of one target historical test environment, when the number of target historical test scripts is one, the target test time obtained by correcting the historical test time corresponding to the target historical test script is unique. At this time, the target test time can be used as the execution test time of the test script to be executed in the current test environment to complete the prediction.

[0122] In the embodiment of the present application, on the basis of one target historical test environment, when the number of target historical test scripts is multiple, the historical test time corresponding to the target historical test script is corrected according to the correction time value to obtain the target test time, which may include the following process, which is described in detail as follows:

[0123] According to the correction time value, the historical test time corresponding to each target historical test script is corrected to obtain multiple correction results, and a target test time is obtained according to the multiple correction results.

[0124] Exemplarily, the process of obtaining a target test time according to a plurality of correction results may include: averaging the plurality of correction results to obtain a target test time.

[0125] Exemplarily, the process of obtaining a target test time based on a plurality of correction results may further include: assigning different fusion coefficients to the plurality of correction results respectively, and calculating a target test time.

[0126] In the embodiment of the present application, on the basis of one target historical test environment, when the number of target historical test scripts is multiple, the historical test time corresponding to the target historical test script is corrected according to the correction time value to obtain the target test time, which may also include the following process, which is described in detail as follows:

[0127] A basic test time is obtained according to the historical test time corresponding to each target historical test script, and the basic test time is corrected according to the corrected time value to obtain the target test time.

[0128] For example, the target test time can be calculated using the following formula:

[0129] Tx=T k '±δ

[0130] Among them, T x Represent the target test time, and use the target test time as the execution test time of the test script x to be executed in the current test environment, T k 'Represents the basic test time. The sign "±" depends on the general deviation direction of the historical test time and the execution test time of the executed test script. If the historical test time of the historical test script is mostly greater than the execution test time of the executed test script, the sign is "-", otherwise, the sign is "+".

[0131] Exemplarily, the process of obtaining a basic test time according to the historical test time corresponding to each target historical test script may include: calculating the average value of the historical test time corresponding to each target historical test script to obtain a basic test time.

[0132] Exemplarily, the process of obtaining a basic test time according to the historical test time corresponding to each target historical test script may also include: assigning different fusion coefficients to the historical test time corresponding to each target historical test script, and calculating a basic test time.

[0133] From the above, it can be seen that the present application takes into account that the historical test environment may have similarities with the current test environment in configuration and performance, and uses the historical test time of the test script executed in the historical test environment to predict the execution test time in the current test environment. When calculating the environmental similarity value, due to the differences in software and hardware configurations between the environments, it is difficult to directly quantify it as an environmental similarity index. Therefore, the similarity between the two test environments is calculated based on the test time, which has a wider scope of application. After selecting the historical test environment that is most similar to the current test environment as the target historical test environment based on the environmental similarity value, the difference between the current test environment and the target historical test environment is quantified by calculating the corrected time value. The historical test time of the selected target historical test script is further corrected by the corrected time value, so that the test time prediction is more accurate.

[0134] In another exemplary embodiment, Figure 3 Based on the embodiment shown, before step S110, the test time prediction method further includes steps S101 to S102, which are described in detail as follows:

[0135] Step S101, obtaining historical test times corresponding to multiple historical test scripts;

[0136] Step S102, grouping the historical test scripts according to the historical test environments corresponding to the historical test scripts; wherein the historical test scripts in the same group correspond to the same historical test environments.

[0137] Exemplarily, each historical test environment includes multiple groups of data consisting of historical test script identifiers-historical test times.

[0138] From the above, it can be seen that the method provided in this embodiment groups each historical test script according to the historical test environment before prediction. When making test time predictions, it is convenient to obtain historical test scripts and historical test times under each historical test environment, saving data acquisition time and speeding up data acquisition, thereby helping to improve the prediction efficiency of test time.

[0139] In another exemplary embodiment, Figure 3 Based on the embodiment shown, after predicting the test time of a test script to be executed in the current test environment, the number of executed test scripts in the current test environment and the current test time of the executed test scripts in the current test environment are updated. When all the test scripts to be executed are completed in the current test environment, all the executed test scripts in the current test environment and their corresponding current test times are recorded in the test database, and the historical test time is obtained from the test database when the test time prediction is performed next time.

[0140] From the above, we can see that the data in the test database is continuously accumulated as the test progresses. Since historical test data is of great reference value for time prediction, the executed test scripts in the current test environment are updated in time after each test. After all the test scripts to be executed are completed in the current test environment, the historical test scripts in the test database are updated in time, which is conducive to improving the accuracy of subsequent predictions.

[0141] In some exemplary embodiments, in order to further improve the accuracy of test time prediction, more comprehensive situations need to be considered in the process of test time prediction, such as test progress. With the increase of historical test scripts and / or the increase of executed test scripts, the accuracy of the predicted test time will become higher and higher. Therefore, machine learning can be used to predict test time.

[0142] Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Among them, machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.

[0143] Based on the powerful learning ability of machine learning, through the machine learning process for a large number of historical test scripts, the machine learning model can estimate features such as environmental similarity values, correction time values, and execution test time of the test script to be executed in the current test environment, so as to ensure that the predicted execution test time of the test script to be executed in the current test environment is more accurate and reliable. Exemplarily, the machine learning model may include a supervised model based on a neural network, such as a binary classification machine learning model, and the machine learning model is trained by using a large number of historical test scripts so that the machine learning model adjusts model parameters during the training process, so that the adjusted model parameters have comprehensive predictive performance for features such as environmental similarity values, correction time values, and execution test time of the test script to be executed in the current test environment.

[0144] Figure 7 is a block diagram of a test time prediction device shown in an exemplary embodiment of the present application. The device can be applied to Figure 2The implementation environment shown is specifically configured in the cloud test platform. The device can also be applied to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the device is applicable.

[0145] like Figure 7 As shown, the exemplary test time prediction device includes:

[0146] The environment similarity value calculation module 7101 is configured to perform similarity calculations on the current test environment and each historical test environment to obtain an environment similarity value between the current test environment and the historical test environment;

[0147] The target historical test environment selection module 7102 is configured to determine, from the historical test scripts corresponding to the target historical test environment, a target historical test script whose script similarity value with the test script to be executed is greater than a preset threshold;

[0148] A target historical test script selection module 7103 is configured to determine a target historical test script whose script similarity value with the test script to be executed is greater than a preset threshold from the historical test scripts corresponding to the target historical test environment;

[0149] The correction time and test time calculation module 7104 is configured to correct the historical test time corresponding to the target historical test script, obtain the target test time, and use the target test time as the execution test time of the test script to be executed in the current test environment.

[0150] In one embodiment of the present application, the environment similarity value calculation module 7101 includes:

[0151] A first determining unit is configured to determine an associated historical test script of an executed test script from historical test scripts contained in a plurality of historical test environments;

[0152] An acquisition unit configured to acquire an execution test time of an executed test script and a script similarity value between the executed test script and an associated historical test script;

[0153] A first calculation unit is configured to obtain a first time value according to the execution test time and the historical test time corresponding to the associated historical test script;

[0154] The second calculation unit is configured to obtain an environment similarity value between the current test environment and the historical test environment according to the script similarity value and the first time value.

[0155] In one embodiment of the present application, the first determining unit includes:

[0156] A first calculation subunit is configured to calculate script intersections between the executed test scripts and the historical test scripts contained in each historical test environment to obtain multiple intersection results;

[0157] The first selection subunit is configured to screen out historical test environments whose intersection results are greater than a preset intersection quantity threshold from multiple historical test environments according to the intersection results, and use the script intersection of the historical test scripts contained in the screened historical test environment and the executed test script as the associated historical test script.

[0158] In one embodiment of the present application, the correction time and test time calculation module 7104 includes:

[0159] A second acquisition unit is configured to acquire an environment similarity value between a current test environment and a target historical test environment;

[0160] a third calculation unit configured to obtain a corrected time value according to the environment similarity value, the execution test time, and the historical test time;

[0161] The fourth calculation unit is configured to correct the historical test time corresponding to the target historical test script according to the correction time value to obtain the target test time.

[0162] It should be noted that the test time prediction device provided in the above embodiment and the test time prediction method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment and will not be repeated here. In practical applications, the test time prediction device provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.

[0163] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the electronic device implements the test time prediction method provided in the above-mentioned embodiments.

[0164] Figure 8 The structure diagram of the computer system suitable for implementing the electronic device of the embodiment of the present application is shown. It should be noted that: Figure 8 The computer system 1200 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0165] like Figure 8As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1202 or the program loaded from the storage part 1208 to the random access memory (RAM) 1203, such as executing the method described in the above embodiment. In the RAM 1203, various programs and data required for system operation are also stored. The CPU 1201, the ROM 1202 and the RAM 1203 are connected to each other through the bus 1204. The input / output (I / O) interface 1205 is also connected to the bus 1204.

[0166] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1210 as needed so that a computer program read therefrom is installed into the storage section 1208 as needed.

[0167] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1209, and / or installed from a removable medium 1211. When the computer program is executed by a central processing unit (CPU) 1201, various functions defined in the system of the present application are executed.

[0168] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0169] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0170] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0171] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the road condition refreshing method as described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0172] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the road condition refreshing method provided in each of the above embodiments.

[0173] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.

Claims

1. A test time prediction method, characterized in that: The current test environment includes executed test scripts and test scripts to be executed, and each historical test environment includes historical test scripts. The method includes: Calculate the similarity between the current test environment and each historical test environment to obtain the environment similarity value between the current test environment and the historical test environment; Determine a target historical test environment from a plurality of historical test environments according to the environment similarity value; Determine, from the historical test scripts corresponding to the target historical test environment, a target historical test script whose script similarity value with the test script to be executed is greater than a preset threshold; The historical test time corresponding to the target historical test script is corrected to obtain the target test time, and the target test time is used as the execution test time of the test script to be executed in the current test environment; wherein, the historical test time corresponding to the target historical test script is corrected to obtain the target test time, including: obtaining the environment similarity value between the current test environment and the target historical test environment; obtaining a corrected time value according to the environment similarity value, the execution test time and the historical test time; and the historical test time corresponding to the target historical test script is corrected according to the corrected time value to obtain the target test time.

2. The method according to claim 1, characterized in that The calculating the similarity between the current test environment and each historical test environment to obtain the environment similarity value between the current test environment and the historical test environment includes: Determine, from the historical test scripts contained in the plurality of historical test environments, an associated historical test script of the executed test script; Obtaining the execution test time of the executed test script and the script similarity value between the executed test script and the associated historical test script; Obtaining a first time value according to the execution test time and the historical test time corresponding to the associated historical test script; An environment similarity value between the current test environment and the historical test environment is obtained according to the script similarity value and the first time value.

3. The method according to claim 2, characterized in that The step of determining the associated historical test script of the executed test script from the historical test scripts contained in the plurality of historical test environments comprises: Calculating script intersections between the executed test scripts and the historical test scripts contained in each historical test environment to obtain multiple intersection results; According to the intersection result, historical test environments whose intersection results are greater than a preset intersection quantity threshold are screened out from multiple historical test environments, and the script intersection of the historical test scripts contained in the screened historical test environment and the executed test scripts is used as the associated historical test script.

4. The method according to claim 1, characterized in that: Determining a target historical test environment from the historical test environments according to the environment similarity value includes: A historical test environment having the largest environment similarity value with the current test environment is determined from multiple historical test environments as the target historical test environment.

5. The method according to claim 1, characterized in that There are multiple target historical test scripts; and the historical test time corresponding to the target historical test script is corrected according to the correction time value to obtain the target test time, including: According to the correction time value, the historical test time corresponding to each target historical test script is corrected to obtain multiple correction results, and the target test time is obtained according to the multiple correction results; or, The basic test time is obtained according to the historical test time corresponding to each target historical test script, and the basic test time is corrected according to the corrected time value to obtain the target test time.

6. The method according to any one of claims 1 to 4, characterized in that Before calculating the similarity between the current test environment and each historical test environment respectively, the method further includes: Get the historical test time corresponding to multiple historical test scripts; The historical test scripts are grouped according to the historical test environments corresponding to the historical test scripts; wherein the historical test scripts in the same group correspond to the same historical test environments.

7. A test time prediction device, characterized in that: The current test environment includes executed test scripts and test scripts to be executed, and each historical test environment includes historical test scripts. The device includes: An environment similarity value calculation module is configured to perform similarity calculations on the current test environment and each historical test environment to obtain an environment similarity value between the current test environment and the historical test environment; a target historical test environment selection module, configured to determine a target historical test environment from a plurality of historical test environments according to the environment similarity value; A target historical test script selection module is configured to determine a target historical test script whose script similarity value with the test script to be executed is greater than a preset threshold from the historical test scripts corresponding to the target historical test environment; A correction time and test time calculation module is configured to correct the historical test time corresponding to the target historical test script to obtain a target test time, and use the target test time as the execution test time of the test script to be executed in the current test environment; wherein, the correction process for the historical test time corresponding to the target historical test script to obtain the target test time includes: obtaining an environmental similarity value between the current test environment and the target historical test environment; obtaining a correction time value based on the environmental similarity value, the execution test time and the historical test time; and correcting the historical test time corresponding to the target historical test script based on the correction time value to obtain the target test time.

8. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the test time prediction method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the test time prediction method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Automated software defect verification

    CN111045916A

  • Test time prediction system and method

    CN111325367A