Test script recommendation method and device, equipment and readable storage medium
By densely pooling and sorting the historical behavior data of the test script, combining script evaluation coefficients and steady-state matching, the execution order of the test script is optimized, solving the problem of high time cost caused by the huge test script library, and achieving more Efficient testing process.
Patent Information
- Application Number
- CN202410921406.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-11-12
AI Technical Summary
The existing test script library is huge, resulting in the need to effectively cover a large number of test scripts when testing the new version of software, which is very cost-effective.
By obtaining the historical behavior data of each test script, converting it into dense vectors and pooling it averagely, sorting it to obtain the test script recommendation sequence, determining the script evaluation coefficient and star rating based on the historical execution times and the number of failure detection times, and deleting low-star scripts , and the script with the average pooling value smaller than the threshold is cut through the golden segmentation method, and finally establish a test script to the directed line of the task for steady-state matching.
The execution order of test scripts is optimized, the test time cost is reduced, the testing efficiency is improved, the script execution conflict is reduced, and the execution efficiency is improved.
Smart Images

Figure CN118939532A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of automated testing technology, and in particular to a test script recommendation method, apparatus, device and readable storage medium. Background Art
[0002] Existing software versions are frequently iterated, and a lot of code function verification is required to ensure the smooth operation of the software after it is launched. Before the new version of the software is released online, the function verification needs to be completed quickly, and the test script scope must be effectively covered to achieve the most effective test execution.
[0003] However, current test script libraries are often too large. Testing new versions of software requires effective coverage of test scripts, which results in too many test scripts and high time costs. Summary of the invention
[0004] The present application provides a test script recommendation method, apparatus, device and readable storage medium, aiming to solve the technical problems that the current test script library is often too large, the new version software testing requires effective coverage of the test scripts, there are many test scripts, and the time cost is high.
[0005] In a first aspect, an embodiment of the present application provides a test script recommendation method, the test script recommendation method comprising:
[0006] For each test script, historical behavior data is obtained, wherein the historical behavior data includes multiple execution data, and each execution data includes script attribute data generated by each execution;
[0007] Convert historical behavior data into dense vectors, perform average pooling on the dense vectors, and obtain the average pooling value of each test script;
[0008] All test scripts are sorted according to the average pooling value of each test script to obtain the recommended sequence of test scripts.
[0009] Optionally, before converting the historical behavior data into a dense vector and performing average pooling on the dense vector to obtain an average pooling value of each test script, the following steps are included:
[0010] Combine multiple execution data in the historical behavior data in pairs to obtain all execution combination data;
[0011] For each execution combination data, all corresponding two script attribute data belonging to the same script attribute are linearly fused to obtain the first feature matrix of all script attributes;
[0012] The first feature matrix of all script attributes is average-pooled to obtain a second feature matrix, and the second feature matrix is converted into a feature vector;
[0013] Normalize the feature vector to obtain the fusion feature of each execution combination data;
[0014] New historical behavior data are formed by the fusion features of all execution combination data.
[0015] Optionally, after all the test scripts are sorted according to the average pooling value of each test script to obtain a test script recommendation sequence, the method further includes:
[0016] For each test script in the test script recommendation sequence, obtain the historical execution times and the times of program failure detection;
[0017] Determine the script evaluation coefficient based on the number of historical executions and the number of program failures detected;
[0018] Determine the script star rating based on the historical execution times and the script evaluation coefficient;
[0019] The test script with the lowest script star rating is deleted from the test script recommendation sequence to obtain a new test script recommendation sequence.
[0020] Optionally, after deleting the test script with the lowest script star rating from the test script recommendation sequence to obtain a new test script recommendation sequence, the method further includes:
[0021] A normal distribution formula is established based on the average pooled value of each test script in the new test script recommendation sequence;
[0022] Use the golden section method to solve the normal distribution formula and get the optimal solution;
[0023] Determine the optimal clipping value based on the optimal solution;
[0024] The test scripts whose average pooling values are less than the optimal clipping value are deleted from the new test script recommendation sequence to obtain the final test script recommendation sequence.
[0025] Optionally, after deleting the test scripts whose average pooling values are less than the optimal clipping value from the new test script recommendation sequence to obtain the final test script recommendation sequence, the method further includes:
[0026] Acquire multiple test tasks, wherein each test task includes a final test script recommendation sequence;
[0027] Select the same number of test tasks and test scripts for steady-state matching;
[0028] Establish a directed line that corresponds one-to-one from test scripts to test tasks;
[0029] For each test task, according to the order of the test scripts in the final test script recommendation sequence of the test task, a directed line from the test task to the test script is established in sequence;
[0030] If a loop is formed between the test task and the test script, the test script forming the loop is used as the steady-state matching execution script of the test task, and the test task and test script forming the loop are deleted from the test tasks and test scripts for steady-state matching;
[0031] If the test task and the test script have not completed steady-state matching, return to execute the step of establishing a directed line from the test task to the test script in sequence for each test task according to the order of the test scripts in the final test script recommendation sequence of the test task.
[0032] In a second aspect, an embodiment of the present application provides a test script recommendation device, the test script recommendation device comprising:
[0033] An acquisition module, used for acquiring historical behavior data for each test script, wherein the historical behavior data includes multiple execution data, and each execution data includes script attribute data generated by each execution;
[0034] The pooling module is used to convert historical behavior data into dense vectors, perform average pooling on the dense vectors, and obtain the average pooling value of each test script;
[0035] The sorting module is used to sort all test scripts according to the average pooling value of each test script to obtain a recommended sequence of test scripts.
[0036] Optionally, the test script recommendation device further includes a fusion module, which is used to:
[0037] Combine multiple execution data in the historical behavior data in pairs to obtain all execution combination data;
[0038] For each execution combination data, all corresponding two script attribute data belonging to the same script attribute are linearly fused to obtain the first feature matrix of all script attributes;
[0039] The first feature matrix of all script attributes is average-pooled to obtain a second feature matrix, and the second feature matrix is converted into a feature vector;
[0040] Normalize the feature vector to obtain the fusion feature of each execution combination data;
[0041] New historical behavior data are formed by the fusion features of all execution combination data.
[0042] Optionally, the test script recommendation device further includes a star rating determination module, which is used to:
[0043] For each test script in the test script recommendation sequence, obtain the historical execution times and the times of program failure detection;
[0044] Determine the script evaluation coefficient based on the number of historical executions and the number of program failures detected;
[0045] Determine the script star rating based on the historical execution times and the script evaluation coefficient;
[0046] The test script with the lowest script star rating is deleted from the test script recommendation sequence to obtain a new test script recommendation sequence.
[0047] In a third aspect, an embodiment of the present application provides a test script recommendation device, which includes a processor, a memory, and a test script recommendation program stored on the memory and executable by the processor, wherein when the test script recommendation program is executed by the processor, the steps of the test script recommendation method described above are implemented.
[0048] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a test script recommendation program is stored, wherein when the test script recommendation program is executed by a processor, the steps of the test script recommendation method as described above are implemented.
[0049] The beneficial effects brought by the technical solution provided in the embodiments of the present application include:
[0050] In an embodiment of the present application, for each test script, historical behavior data is obtained, and the historical behavior data includes multiple execution data, and each execution data includes script attribute data generated by each execution; the historical behavior data is converted into a dense vector, and the dense vector is averagely pooled to obtain the average pooling value of each test script; all test scripts are sorted according to the average pooling value of each test script to obtain a test script recommendation sequence. In an embodiment of the present application, the historical behavior data of each test script is averagely pooled and sorted based on the average pooling value. The historical behavior data of the test script is composed of various script attribute data generated by each historical execution of the test script, such as the number of program faults detected by the i-th execution of the test script and the script execution time, that is, the test scripts are prioritized according to the historical behavior value of the test script, and the test scripts with the highest ranking can be executed first, thereby solving the problem of a large number of test scripts and being more in line with the use value preferences of the test users. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 This is a flowchart of an embodiment of a method for recommending a test script for this application;
[0052] Figure 2A schematic diagram of the fusion process of an embodiment of a method for recommending a test script for this application;
[0053] Figure 3 A steady-state matching diagram of an embodiment of a method for recommending a test script for this application;
[0054] Figure 4 A schematic diagram of the functional modules of an embodiment of a test script recommendation device for this application;
[0055] Figure 5 A schematic diagram of the hardware structure of the test script recommendation device involved in the embodiment of the present application. DETAILED DESCRIPTION
[0056] In order to enable those skilled in the art to better understand the solution of the present application, 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 only 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.
[0057] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0058] In a first aspect, an embodiment of the present application provides a test script recommendation method.
[0059] In one embodiment, referring to Figure 1 , Figure 1 This is a flowchart of an embodiment of the test script recommendation method of this application, such as Figure 1 As shown, the recommended test script method includes:
[0060] Step S10, for each test script, historical behavior data is obtained, wherein the historical behavior data includes multiple execution data, and each execution data includes script attribute data generated by each execution.
[0061] In this embodiment, the historical behavior data of each test script is first collected and obtained, and a historical behavior database of the test script can be established in advance. For example, the execution entry data of all test scripts under the corresponding test project can be obtained from other systems, including but not limited to version information, execution time, script characteristics, failed steps, failure descriptions and associated bugs (i.e., program failures) and other information. The bug data associated with all test scripts under the corresponding test project can also be obtained from other systems (such as bug management platforms), including but not limited to version information, severity level, bug handling status, failed steps, failure descriptions, feature names and associated script names and other information. The information with the same attributes in the script data obtained from the two places is merged to establish a historical behavior database of the test script. The historical behavior data includes multiple execution data, representing user sequences, in U i ={u1,u2,...,u n}, the script sequence to be sorted is represented by I i ={i1,i2,...,i n}, the historical behavior data of each test script can be expressed as B u ={b1 u ,b2 u ,...,b |Bu| u}, where |B u | represents the length of the historical behavior data sequence, b i u ={s i,1 u ,s i,2 u ...,s i,k u},s i,k u Represents the kth script attribute data generated by the i-th execution of the test script.
[0062] Step S20, converting the historical behavior data into a dense vector, performing average pooling on the dense vector, and obtaining an average pooling value for each test script.
[0063] In this embodiment, the formula e i u =concat(Embedding(b i u )) Historical behavior data b i u Convert to dense vector e i u , and then the historical behavior data B of each test script can be u Indicated as E u ={e1 u,e2 u ,...,e |Bu| u}, through the formula For dense vector e i u Perform average pooling to obtain the average pooling value A for each test script u .
[0064] Step S30, sorting all test scripts according to the average pooling value of each test script to obtain a recommended sequence of test scripts.
[0065] In this embodiment, according to the average pooling value A of each test script u All test scripts can be sorted in ascending or descending order according to specific requirements to obtain a recommended sequence of test scripts.
[0066] In this embodiment, the historical behavior data of each test script is first collected and acquired, and a historical behavior database of the test scripts can be established in advance. The historical behavior data of each test script is averaged and pooled and sorted based on the average pooled value. The historical behavior data of the test script is composed of various script attribute data generated by each historical execution of the test script, such as the number of program faults detected by the i-th execution of the test script and the script execution duration, etc., that is, the test scripts are prioritized according to the historical behavior value of the test scripts, and can be sorted in ascending or descending order according to specific needs. The test scripts ranked higher or lower can be executed first, thereby solving the problem of a large number of test scripts and being more in line with the usage value preferences of test users.
[0067] Furthermore, in one embodiment, before step S20, the following steps are included:
[0068] Combine multiple execution data in the historical behavior data in pairs to obtain all execution combination data;
[0069] For each execution combination data, all corresponding two script attribute data belonging to the same script attribute are linearly fused to obtain the first feature matrix of all script attributes;
[0070] The first feature matrix of all script attributes is average-pooled to obtain a second feature matrix, and the second feature matrix is converted into a feature vector;
[0071] Normalize the feature vector to obtain the fusion feature of each execution combination data;
[0072] New historical behavior data are formed by the fusion features of all execution combination data.
[0073] In this embodiment, the historical behavior data of each test script includes multiple execution data. Average pooling of the historical behavior data of all scripts will result in a large amount of data calculation and processing, especially when the number of test scripts to be sorted and the number of multiple execution data of the test scripts are relatively large. Therefore, the multiple execution data in the historical behavior data of each test script are combined in pairs, and the number of multiple execution data in the historical behavior data of all test scripts is reduced to half of the original amount through fusion. For details, refer to Figure 2 , Figure 2 This is a fusion flow diagram of an embodiment of the test script recommendation method of this application, such as Figure 2 As shown, for example, b in the historical behavior data i1 u ={s i1,1 u ,s i1,2 u ,s i1,3 u ,...,s i1,k u ,} and b i2 u ={s i2,1 u ,s i2,2 u ,s i2,3 u ,...,s i2,k u ,} are combined to obtain the combined execution combination data. For each execution combination data, all the corresponding two script attribute data belonging to the same script attribute are linearly fused to obtain the first feature matrix b of all script attributes. The script attributes include the number of detected program faults and the script execution time, etc. For example, the number of program faults detected in the first historical execution of a test script is 8, and the script execution time is 1 second. The number of program faults detected in the second historical execution is 5, and the script execution time is 0.8 seconds. All the corresponding two script attribute data belonging to the same script attribute are linearly fused, that is, the number of program faults detected twice and the script execution time are linearly fused respectively. After fusion, the first feature matrix b of all script attributes is obtained. The first feature matrix b of all script attributes is averagely pooled to obtain the second feature matrix c. The second feature matrix is converted into a feature vector x. The feature vector x is normalized by dividing it by its L2 norm to obtain the fused feature z of each execution combination data. The fused feature z of all execution combination data is used to analyze the historical behavior data B. u The multiple execution data before all combinations in are replaced, that is, new historical behavior data is obtained, thereby realizing the historical behavior data B uThe amount of data is reduced to half of the original amount. In addition, if the historical behavior data sequence is treated as an unordered set and each historical attribute is treated equally, it is impossible to distinguish the importance of different historical attributes, thereby weakening the representation effect of the optimal execution sequence. In actual scenarios, different attribute values in the script's historical behavior have different representation capabilities for script execution. For example, compared with the attribute of the number of failures of the script one month ago, it is more appropriate to represent the current number of failures of the script with the number of failures one day ago. By linearly fusing the two features of the same script attribute as mentioned above, while effectively reducing the number of samples, it can also effectively reduce the impact of different time representations on the effectiveness of sorting. It is expected that the sorting accuracy can be improved by about 10%.
[0074] Furthermore, in one embodiment, after step S30, the following steps are included:
[0075] For each test script in the test script recommendation sequence, obtain the historical execution times and the times of program failure detection;
[0076] Determine the script evaluation coefficient based on the number of historical executions and the number of program failures detected;
[0077] Determine the script star rating based on the historical execution times and the script evaluation coefficient;
[0078] The test script with the lowest script star rating is deleted from the test script recommendation sequence to obtain a new test script recommendation sequence.
[0079] In this embodiment, for each test script in the test script recommendation sequence, the historical execution times S and the number of program faults detected C are obtained from a pre-established test script library, and the script evaluation coefficient C / S can be further determined based on the historical execution times and the number of program faults detected. Linear scoring is performed based on the historical execution times S and the script evaluation coefficient C / S, and the script star rating is determined based on the score obtained by the linear scoring. The specific script star rating method can be found in Table 1. Table 1 is a table of script star rating methods. According to Table 1, it can be seen that the lowest script star rating level 1 either has a historical execution time S of 0, that is, the test script has not been executed, or the test script has been executed many times but no program fault has been detected once, which indicates that the value of the test script is relatively low. Therefore, the test script with the lowest script star rating, that is, a script star rating of level 1, is deleted from the test script recommendation sequence to obtain a new test script recommendation sequence.
[0080] Table 1.
[0081]
[0082] Furthermore, in one embodiment, after deleting the test script with the lowest star rating from the test script recommendation sequence to obtain a new test script recommendation sequence, the method includes:
[0083] A normal distribution formula is established based on the average pooled value of each test script in the new test script recommendation sequence;
[0084] Use the golden section method to solve the normal distribution formula and get the optimal solution;
[0085] Determine the optimal clipping value based on the optimal solution;
[0086] The test scripts whose average pooling values are less than the optimal clipping value are deleted from the new test script recommendation sequence to obtain the final test script recommendation sequence.
[0087] In this embodiment, after deleting the test script with the lowest star rating, i.e., the script star rating of level 1, from the test script recommendation sequence, the remaining new test script recommendation sequence with star ratings of levels 2-5 is trimmed using the normal distribution golden section method. Specifically, the normal distribution formula is established based on the average pooling value of each test script in the new test script recommendation sequence. Where μ is the mean, σ is the standard deviation, and p(x) represents the probability density represented by the random variable x with the average pooling value. The golden section method is used to solve the above normal distribution formula. For example, 0.78 can be taken as the optimal solution after three golden sections. The optimal clipping value is determined by the formula based on the optimal solution 0.78 Therefore, the test scripts whose average pooling value is less than the optimal clipping value α are deleted from the new test script recommendation sequence to obtain the final test script recommendation sequence, which is expected to save about 22% of the script execution time and execution scale.
[0088] Further, in one embodiment, after deleting the test scripts whose average pooling values are less than the optimal clipping value from the new test script recommendation sequence to obtain the final test script recommendation sequence, the method includes:
[0089] Acquire multiple test tasks, wherein each test task includes a final test script recommendation sequence;
[0090] Select the same number of test tasks and test scripts for steady-state matching;
[0091] Establish a directed line that corresponds one-to-one from test scripts to test tasks;
[0092] For each test task, according to the order of the test scripts in the final test script recommendation sequence of the test task, a directed line from the test task to the test script is established in sequence;
[0093] If a loop is formed between the test task and the test script, the test script forming the loop is used as the steady-state matching execution script of the test task, and the test task and test script forming the loop are deleted from the test tasks and test scripts for steady-state matching;
[0094] If the test task and the test script have not completed steady-state matching, return to execute the step of establishing a directed line from the test task to the test script in sequence for each test task according to the order of the test scripts in the final test script recommendation sequence of the test task.
[0095] In this embodiment, after solving the priority sorting of the test scripts and cutting the scale of the number through the above steps, if two test tasks are executed simultaneously for different test environments, each of which includes the final test script recommendation sequence, if two identical test scripts are executed simultaneously, a script execution conflict may occur. Therefore, it is necessary to use a steady-state matching algorithm to adjust the execution order of the scripts in the two simultaneously executed test tasks to ensure that when the two test tasks are executed simultaneously, two identical scripts are not executed simultaneously. In order to perform steady-state matching, the same number of test tasks and test scripts must be selected. For details, refer to Figure 3 , Figure 3 This is a steady-state matching diagram of an embodiment of the test script recommendation method of this application, such as Figure 3 As shown, four test tasks A1A2A3A4 and four test scripts B1B2B3B4 are selected. By default, a directed line from test script B1 to test task A1 and a directed line from test script B2 to test task A2 are established. By analogy, the final test script recommended sequence corresponding to test task A1 is B3B2B4B1, the final test script recommended sequence corresponding to test task A2 is B4B1B2B3, and the final test script recommended sequences corresponding to test tasks A3 and A4 are as follows: Figure 3 As shown in the list on the upper left, for each test task, according to the order of the test scripts in the final test script recommendation sequence of the test task, a directed line from the test task to the test script is established in sequence, referring to Figure 3 As shown in b,<A1,B3> and<A3,B1> A loop is formed, a match is achieved and the task A1 executes the script B3, and the task A3 executes the script B1. If the test task and the test script have not completed the steady-state match, the task returns to execute the steps of establishing a directed line from the test task to the test script in sequence according to the order of the test scripts in the final test script recommendation sequence of the test task. Figure 3As shown in c,<A2,B4> and<A4,B2> A loop is formed, a match is achieved and the task leaves. Task A2 executes script B4, and task A4 executes script B2. All matches are completed. Subsequent conflicting sequences can be cycled according to this steady-state matching algorithm until there are no conflicts, thus entering a fully steady-state execution mode. Relying on the above-mentioned steady-state matching algorithm, script execution conflicts can be effectively reduced and execution efficiency can be improved. It is estimated that the execution efficiency can be improved by about 12%.
[0096] In a second aspect, an embodiment of the present application also provides a test script recommendation device.
[0097] In one embodiment, referring to Figure 4 , Figure 4 This is a functional module diagram of an embodiment of a test script recommendation device for this application, such as Figure 4 As shown, the recommended device for the test script includes:
[0098] An acquisition module 10 is used to acquire historical behavior data for each test script, wherein the historical behavior data includes multiple execution data, and each execution data includes script attribute data generated by each execution;
[0099] A pooling module 20, used to convert historical behavior data into dense vectors, perform average pooling on the dense vectors, and obtain an average pooling value for each test script;
[0100] The sorting module 30 is used to sort all the test scripts according to the average pooling value of each test script to obtain a recommended sequence of test scripts.
[0101] Furthermore, in one embodiment, the test script recommendation device further includes a fusion module, which is used to:
[0102] Combine multiple execution data in the historical behavior data in pairs to obtain all execution combination data;
[0103] For each execution combination data, all corresponding two script attribute data belonging to the same script attribute are linearly fused to obtain the first feature matrix of all script attributes;
[0104] The first feature matrix of all script attributes is average-pooled to obtain a second feature matrix, and the second feature matrix is converted into a feature vector;
[0105] Normalize the feature vector to obtain the fusion feature of each execution combination data;
[0106] New historical behavior data are formed by the fusion features of all execution combination data.
[0107] Furthermore, in one embodiment, the test script recommendation device further includes a star rating determination module, which is used to:
[0108] For each test script in the test script recommendation sequence, obtain the historical execution times and the times of program failure detection;
[0109] Determine the script evaluation coefficient based on the number of historical executions and the number of program failures detected;
[0110] Determine the script star rating based on the historical execution times and the script evaluation coefficient;
[0111] The test script with the lowest script star rating is deleted from the test script recommendation sequence to obtain a new test script recommendation sequence.
[0112] Furthermore, in one embodiment, the test script recommendation device further includes a normal distribution module, which is used to:
[0113] A normal distribution formula is established based on the average pooled value of each test script in the new test script recommendation sequence;
[0114] Use the golden section method to solve the normal distribution formula and get the optimal solution;
[0115] Determine the optimal clipping value based on the optimal solution;
[0116] The test scripts whose average pooling values are less than the optimal clipping value are deleted from the new test script recommendation sequence to obtain the final test script recommendation sequence.
[0117] Furthermore, in one embodiment, the test script recommendation device further includes a steady-state matching module, which is used to:
[0118] Acquire multiple test tasks, wherein each test task includes a final test script recommendation sequence;
[0119] Select the same number of test tasks and test scripts for steady-state matching;
[0120] Establish a directed line that corresponds one-to-one from test scripts to test tasks;
[0121] For each test task, according to the order of the test scripts in the final test script recommendation sequence of the test task, a directed line from the test task to the test script is established in sequence;
[0122] If a loop is formed between the test task and the test script, the test script forming the loop is used as the steady-state matching execution script of the test task, and the test task and test script forming the loop are deleted from the test tasks and test scripts for steady-state matching;
[0123] If the test task and the test script have not completed steady-state matching, return to execute the step of establishing a directed line from the test task to the test script in sequence for each test task according to the order of the test scripts in the final test script recommendation sequence of the test task.
[0124] Among them, the functional implementation of each module in the above-mentioned test script recommendation device corresponds to the various steps in the above-mentioned test script recommendation method embodiment, and its functions and implementation processes will not be repeated here one by one.
[0125] In a third aspect, an embodiment of the present application provides a test script recommendation device.
[0126] Reference Figure 5 , Figure 5 The hardware structure diagram of the test script recommendation device involved in the embodiment of the present application is shown in FIG. In the embodiment of the present application, the test script recommendation device may include a processor, a memory, a communication interface, and a communication bus.
[0127] The communication bus may be of any type and is used to interconnect the processor, the memory, and the communication interface.
[0128] The communication interface includes input / output (I / O) interface, physical interface and logical interface, etc., which are used to realize the interconnection of devices inside the test script recommendation device, and the interface used to realize the interconnection of the test script recommendation device with other devices (such as other computing devices or user devices). The physical interface can be an Ethernet interface, a fiber optic interface, an ATM interface, etc.; the user device can be a display (Display), a keyboard (Keyboard), etc.
[0129] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.
[0130] The processor may be a general-purpose processor, and the general-purpose processor may call the test script recommendation program stored in the memory and execute the test script recommendation method provided by the embodiment of the present application. For example, the general-purpose processor may be a central processing unit (CPU). The method executed when the test script recommendation program is called may refer to the various embodiments of the test script recommendation method of the present application, which will not be repeated here.
[0131] Those skilled in the art will understand that Figure 5 The hardware structure shown in the figure does not constitute a limitation on the present application, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0132] In a fourth aspect, an embodiment of the present application also provides a readable storage medium.
[0133] A test script recommendation program is stored on a readable storage medium of the present application, wherein when the test script recommendation program is executed by a processor, the steps of the test script recommendation method as described above are implemented.
[0134] Among them, the method implemented when the test script recommendation program is executed can refer to the various embodiments of the test script recommendation method of the present application, and will not be repeated here.
[0135] It should be noted that the serial numbers of the above-mentioned embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.
[0136] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. The terms "first", "second" and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit "first", "second" and "third" to different types.
[0137] In the description of the embodiments of the present application, "exemplary", "for example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a specific way.
[0138] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; the “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.
[0139] In some processes described in the embodiments of the present application, multiple operations or steps that appear in a specific order are included, but it should be understood that these operations or steps may not be executed in the order in which they appear in the embodiments of the present application or in parallel, and the sequence number of the operation is only used to distinguish the different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed in sequence or in parallel, and these operations or steps may be combined.
[0140] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD) as described above, and includes a number of instructions for a terminal device to execute the methods described in each embodiment of the present application.
[0141] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A test script recommendation method, It is characterized in that The test script recommended method includes: For each test script, historical behavior data is obtained, wherein the historical behavior data includes multiple execution data, and each execution data includes script attribute data generated by each execution; Convert historical behavior data into dense vectors, perform average pooling on the dense vectors, and obtain the average pooling value of each test script; All test scripts are sorted according to the average pooling value of each test script to obtain the recommended sequence of test scripts.
2. The test script recommendation method according to claim 1, It is characterized in that Before converting the historical behavior data into a dense vector and performing average pooling on the dense vector to obtain the average pooling value of each test script, the following steps are included: Combine multiple execution data in the historical behavior data in pairs to obtain all execution combination data; For each execution combination data, all corresponding two script attribute data belonging to the same script attribute are linearly fused to obtain the first feature matrix of all script attributes; The first feature matrix of all script attributes is average-pooled to obtain a second feature matrix, and the second feature matrix is converted into a feature vector; Normalize the feature vector to obtain the fusion feature of each execution combination data; New historical behavior data are formed by the fusion features of all execution combination data.
3. The test script recommendation method according to claim 1, It is characterized in that After all the test scripts are sorted according to the average pooling value of each test script to obtain a test script recommendation sequence, the following steps are included: For each test script in the test script recommendation sequence, obtain the historical execution times and the times of program failure detection; Determine the script evaluation coefficient based on the number of historical executions and the number of program failures detected; Determine the script star rating based on the historical execution times and the script evaluation coefficient; The test script with the lowest script star rating is deleted from the test script recommendation sequence to obtain a new test script recommendation sequence.
4. The test script recommendation method according to claim 3, It is characterized in that After deleting the test script with the lowest script star rating from the test script recommendation sequence to obtain a new test script recommendation sequence, the method includes: A normal distribution formula is established based on the average pooled value of each test script in the new test script recommendation sequence; Use the golden section method to solve the normal distribution formula and get the optimal solution; Determine the optimal clipping value based on the optimal solution; The test scripts whose average pooling values are less than the optimal clipping value are deleted from the new test script recommendation sequence to obtain the final test script recommendation sequence.
5. The test script recommendation method according to claim 4, It is characterized in that After deleting the test scripts whose average pooling values are less than the optimal clipping value from the new test script recommendation sequence to obtain the final test script recommendation sequence, the method further comprises: Acquire multiple test tasks, wherein each test task includes a final test script recommendation sequence; Select the same number of test tasks and test scripts for steady-state matching; Establish a directed line that corresponds one-to-one from test scripts to test tasks; For each test task, according to the order of the test scripts in the final test script recommendation sequence of the test task, a directed line from the test task to the test script is established in sequence; If a loop is formed between the test task and the test script, the test script forming the loop is used as the steady-state matching execution script of the test task, and the test task and test script forming the loop are deleted from the test tasks and test scripts for steady-state matching; If the test task and the test script have not completed steady-state matching, return to execute the step of establishing a directed line from the test task to the test script in sequence for each test task according to the order of the test scripts in the final test script recommendation sequence of the test task.
6. A test script recommendation device, It is characterized in that The test script recommendation device comprises: An acquisition module, used for acquiring historical behavior data for each test script, wherein the historical behavior data includes multiple execution data, and each execution data includes script attribute data generated by each execution; The pooling module is used to convert historical behavior data into dense vectors, perform average pooling on the dense vectors, and obtain the average pooling value of each test script; The sorting module is used to sort all test scripts according to the average pooling value of each test script to obtain a recommended sequence of test scripts.
7. The test script recommendation device according to claim 6, It is characterized in that The test script recommendation device further includes a fusion module, which is used to: Combine multiple execution data in the historical behavior data in pairs to obtain all execution combination data; For each execution combination data, all corresponding two script attribute data belonging to the same script attribute are linearly fused to obtain the first feature matrix of all script attributes; The first feature matrix of all script attributes is average-pooled to obtain a second feature matrix, and the second feature matrix is converted into a feature vector; Normalize the feature vector to obtain the fusion feature of each execution combination data; New historical behavior data are formed by the fusion features of all execution combination data.
8. The test script recommendation device according to claim 6, It is characterized in that The test script recommendation device further includes a star rating determination module, which is used to: For each test script in the test script recommendation sequence, obtain the historical execution times and the times of program failure detection; Determine the script evaluation coefficient based on the number of historical executions and the number of program failures detected; Determine the script star rating based on the historical execution times and the script evaluation coefficient; The test script with the lowest script star rating is deleted from the test script recommendation sequence to obtain a new test script recommendation sequence.
9. A test script recommends equipment, It is characterized in that The test script recommendation device includes a processor, a memory, and a test script recommendation program stored in the memory and executable by the processor, wherein when the test script recommendation program is executed by the processor, the steps of the test script recommendation method as described in any one of claims 1 to 5 are implemented.
10. A readable storage medium, It is characterized in that A test script recommendation program is stored on the readable storage medium, wherein when the test script recommendation program is executed by a processor, the steps of the test script recommendation method according to any one of claims 1 to 5 are implemented.
Citation Information
Cited By
Method of processing information on plurality of test cases which are previously executed before and electronic apparatus thereof
TWI934435B
