Test case allocation method and device, computer equipment and storage medium

By obtaining the execution time and comprehensive duration of the test equipment, and dynamically adjusting the allocation order of test cases, the problems of low resource utilization and long execution time in traditional test cases are solved, and more efficient test case execution is achieved.

CN120276990APending Publication Date: 2025-07-08CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510381864.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-28
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

The traditional random allocation method of test cases leads to low resource utilization of test equipment, long execution time, and great mutual influence between test cases.

Method used

By obtaining the execution time of different test devices for different types of test cases, determine the comprehensive time of the device under the type of test cases, and dynamically adjust the allocation order of test cases according to the comprehensive time, and give priority to the use cases with the shortest comprehensive time.

Benefits of technology

It improves the resource utilization rate of test equipment, reduces the execution time of test cases, and optimizes the allocation process of test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120276990A_ABST
    Figure CN120276990A_ABST
Patent Text Reader

Abstract

The invention relates to a test case allocation method and device, computer equipment and a storage medium. The method comprises the following steps: acquiring execution durations for different test devices to execute different types of test cases respectively; wherein the same test equipment executes each test case for at least one time; for the test cases of the same type, according to at least one execution duration corresponding to the test equipment, determining a comprehensive duration of the test equipment under the test cases of the type; and according to the comprehensive duration of different test devices under different types of test cases, determining an allocation sequence for allocating various types of test cases to each test device. By adopting the method, the resource utilization rate of the test equipment can be maximized, and meanwhile, the execution duration of the test case is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of automated testing technologies, and particularly to a test case allocation method, apparatus, computer device, and storage medium. Background Art

[0002] Compared with manual testing, automated testing can improve testing efficiency, accuracy, and coverage, achieve continuous integration and delivery, and at the same time reduce costs, which is very important for improving the efficiency and quality of software development. When the number of automated test cases reaches a certain order of magnitude, it takes several hours or even longer to perform a full regression of all automated test cases, affecting the version release efficiency.

[0003] In traditional technologies, test cases that have not been executed yet are usually allocated to corresponding test devices according to the idle status of the test devices. However, this random test case allocation method will turn the test case execution preparation work and test case execution cleanup work that only need to be performed once into being performed as many times as there are test cases in the test case set, resulting in a longer execution time for test cases. Moreover, the more test cases there are, the greater the mutual influence between test cases. Therefore, there are problems such as low utilization rate of test device resources and long execution time of test cases. Summary of the Invention

[0004] Based on this, in view of the above technical problems, it is necessary to provide a test case allocation method, apparatus, computer device, and storage medium that can improve the utilization rate of test device resources and reduce the execution duration of test cases.

[0005] In a first aspect, this application provides a test case allocation method, including:

[0006] Obtain the execution durations of different test devices for executing different types of test cases; where the number of executions of each test case by the same test device is at least once;

[0007] For the same type of test cases, determine the comprehensive duration of the test device under the test cases of the type according to at least one execution duration corresponding to the test device;

[0008] Determine the allocation order of allocating different types of test cases to each test device according to the comprehensive durations of different test devices under different types of test cases.

[0009] In one of the embodiments, determining the allocation order of allocating different types of test cases to each test device according to the comprehensive durations of different test devices under different types of test cases includes:

[0010] For each test device, if the comprehensive duration of any type of test case in the test device is the minimum among the comprehensive durations required for executing the same type of test cases in all test devices, then the test case is used as the first candidate test case;

[0011] Use the other test cases except the first candidate test cases as the second candidate test cases;

[0012] Determine the allocation order of different types of test cases for the test device according to the comprehensive durations of each first candidate test case, the comprehensive durations of each second candidate test case, and the comprehensive durations required for the second candidate test cases to be executed in other test devices.

[0013] In one embodiment, determining the allocation order of different types of test cases for the test device according to the comprehensive durations of each first candidate test case, the comprehensive durations of each second candidate test case, and the comprehensive durations required for the second candidate test cases to be executed in other test devices includes:

[0014] According to the comprehensive durations of each first candidate test case, determine the first order of allocating the first candidate test cases for the test device in ascending order of the comprehensive durations;

[0015] According to the comprehensive durations of each second candidate test case and the comprehensive durations required for the second candidate test cases to be executed in other test devices, determine the second order of allocating the second candidate test cases for the test device;

[0016] Determine the allocation order of different test cases for the test device according to the sorting where the first order is prior and the second order is subsequent.

[0017] In one embodiment, determining the second order of allocating the second candidate test cases for the test device according to the comprehensive durations of each second candidate test case and the comprehensive durations required for the second candidate test cases to be executed in other test devices includes:

[0018] For each second candidate test case, respectively determine the difference between the comprehensive duration of the second candidate test case and the comprehensive duration required for the second candidate test case to be executed in each other test device as the duration difference;

[0019] Select the minimum duration difference as the target difference of the second candidate test case;

[0020] According to the target differences of each second candidate test case, determine the second order of allocating the second candidate test cases for the test device in ascending order of the target differences.

[0021] In one embodiment, for the same type of test cases, determine the comprehensive duration of the test device under the type of test cases according to at least one execution duration corresponding to the test device, including:

[0022] Obtain the attenuation factor corresponding to the test device;

[0023] For each execution duration required for the test device to execute the same type of test case each time, determine the execution order when the test device executes the test case and the execution duration is the execution duration;

[0024] Determine the comprehensive duration of the test device under the test case of the type according to the attenuation factor, each execution duration, and the corresponding execution order.

[0025] In one embodiment, determining the comprehensive duration of the test device under the test case of the type according to the attenuation factor, each execution duration, and the corresponding execution order includes:

[0026] For each execution duration, determine the execution weight of the execution duration according to the attenuation factor and the execution order corresponding to the execution duration;

[0027] Perform weighted summation according to each execution duration and the execution weight to obtain the weighted total duration;

[0028] Determine the comprehensive duration of the test device under the test case of the type according to the weighted total duration and the execution weight of each execution duration.

[0029] In a second aspect, the present application further provides a test case allocation device, including:

[0030] A duration acquisition module, configured to acquire the execution durations of different test devices for executing different types of test cases; wherein, the number of executions of the same test device for each test case is at least one;

[0031] A duration determination module, configured to determine the comprehensive duration of the test device under the test case of the type according to at least one execution duration corresponding to the test device for the same type of test case;

[0032] A use case allocation module, configured to determine the allocation order of allocating each type of test case to each test device according to the comprehensive durations of different test devices under different types of test cases.

[0033] In a third aspect, the present application further provides a computer device, including a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0034] Acquire the execution durations of different test devices for executing different types of test cases; wherein, the number of executions of the same test device for each test case is at least one;

[0035] For the same type of test cases, determine the comprehensive duration of the test device under the test cases of this type according to at least one execution duration corresponding to the test device;

[0036] According to the comprehensive durations of different test devices under different types of test cases, determine the allocation order of allocating various types of test cases to each test device.

[0037] In a fourth aspect, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0038] Obtain the execution durations of different test devices respectively executing different types of test cases; wherein, the number of executions of the same test device for each test case is at least once;

[0039] For the same type of test cases, determine the comprehensive duration of the test device under the test cases of this type according to at least one execution duration corresponding to the test device;

[0040] According to the comprehensive durations of different test devices under different types of test cases, determine the allocation order of allocating various types of test cases to each test device.

[0041] In a fifth aspect, the present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the following steps are implemented:

[0042] Obtain the execution durations of different test devices respectively executing different types of test cases; wherein, the number of executions of the same test device for each test case is at least once;

[0043] For the same type of test cases, determine the comprehensive duration of the test device under the test cases of this type according to at least one execution duration corresponding to the test device;

[0044] According to the comprehensive durations of different test devices under different types of test cases, determine the allocation order of allocating various types of test cases to each test device.

[0045] The above test case allocation method, device, computer device, and storage medium obtain the execution durations of different test devices executing different types of test cases; wherein, the number of executions of each test case by the same test device is at least once; for the same type of test cases, according to at least one execution duration corresponding to the test device, determine the comprehensive duration of the test device under the test cases of the type; according to the comprehensive durations of different test devices under different types of test cases, determine the allocation order of allocating various types of test cases to each test device. In this embodiment, for each test device, according to the execution durations of different types of test cases, comprehensively determine the comprehensive duration of the test device, and dynamically adjust the allocation of test cases according to the comprehensive duration, so as to maximize the resource utilization rate of the test device and at the same time reduce the execution duration of the test cases. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to these drawings.

[0047] Figure 1 It is an application environment diagram of a test case allocation method provided in this embodiment;

[0048] Figure 2 It is a flowchart of the first test case allocation method provided in this embodiment;

[0049] Figure 3 It is a flowchart of a use case allocation step provided in this embodiment;

[0050] Figure 4 It is a flowchart of a comprehensive duration determination step provided in this embodiment;

[0051] Figure 5 It is a flowchart of the second test case allocation method provided in this embodiment;

[0052] Figure 6 It is a structural block diagram of a test case allocation device provided in this embodiment;

[0053] Figure 7 It is an internal structure diagram of a computer device provided in this embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0054] To make the objectives, technical solutions, and advantages of this application more clear and understandable, the following further details this application in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely used to explain this application and are not intended to limit this application.

[0055] The test case allocation method provided by the embodiments of this application can be applied to an application environment as Figure 1 shown. Among them, the allocation device 101 communicates with the test device cluster 102 through a network. The test device cluster 102 may include at least two test devices. The allocation device 101 obtains the execution durations of different test devices for executing different types of test cases; among them, the number of executions of each test case by the same test device is at least once; for the same type of test case, according to at least one execution duration corresponding to the test device, determine the comprehensive duration of the test device for the test case of the type; according to the comprehensive durations of different test devices for different types of test cases, determine the allocation order of allocating each type of test case to each test device. Among them, the allocation device 101 can be either a terminal or a server. The terminal can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server can be implemented by an independent server or a server cluster composed of multiple servers.

[0056] In an exemplary embodiment, as Figure 2 shown, a test case allocation method is provided. Taking the method applied to the Figure 1 allocation device 101 in it as an example, it includes the following steps 201 to step 203. Among them:

[0057] Step 201, obtain the execution durations of different test devices for executing different types of test cases.

[0058] Among them, the number of executions of each test case by the same test device is at least once.

[0059] Specifically, obtain different types of test cases from the test case set; obtain all test devices that can execute test cases from the test device list; for each type of test case executed by each test device, obtain at least one execution duration of the test device for executing the test case of the type. According to each execution duration, an execution duration table can be constructed, such as the test case last three execution duration table shown in Table 1 below:

[0060] Table 1 Test case last three execution duration table

[0061]

[0062] Step 202: For test cases of the same type, determine the comprehensive duration of the test device under the test cases of this type according to at least one execution duration corresponding to the test device.

[0063] Specifically, determine the preset order weights corresponding to the execution orders of each execution duration of the test device under the test cases of this type; for test cases of the same type, perform weighted summation according to at least one execution duration corresponding to the test device and the corresponding order weights, and use the summation result as the comprehensive duration of the test device under the test cases of this type.

[0064] Step 203: Determine the allocation order of allocating test cases of each type to each test device according to the comprehensive durations of different test devices under different types of test cases.

[0065] One optional implementation method is: according to the comprehensive durations of different test devices under different types of test cases, allocate test cases of the type with the shortest comprehensive duration to different test devices in sequence, and at the same time mark the allocated test cases as executed test cases; for the test device that has executed the current test case, allocate test cases of the type with the shortest comprehensive duration to it again from the remaining unmarked executed test cases until all types of test cases are marked as executed test cases.

[0066] Another optional implementation method is: for each test device, if the comprehensive duration of any type of test case in the test device is the smallest among the comprehensive durations required for executing the same type of test cases in all test devices, then use this test case as the first candidate test case; use the other test cases except the first candidate test case as the second candidate test cases; determine the allocation order of allocating different types of test cases to the test device according to the comprehensive durations of each first candidate test case, the comprehensive durations of each second candidate test case, and the comprehensive durations required for the second candidate test cases to be executed in other test devices.

[0067] Specifically, for each test device, select the corresponding type of test case with the minimum comprehensive duration among all test devices for the test device to execute, and use this type of test case as the first candidate test case; regard the remaining test cases as the second candidate test cases; for each first candidate test case, sort the first candidate test cases in ascending order of comprehensive duration to obtain the first candidate sorting; for each second candidate test case, determine the allocation score of the second candidate test case according to the comprehensive duration of the second candidate test case and the comprehensive duration required for execution on other test devices; sort the second candidate test cases in ascending order of allocation score to obtain the second candidate sorting; determine the allocation order of different types of test cases for the test device in the order of the first candidate sorting first and the second candidate test cases later.

[0068] Exemplarily, as shown in the comprehensive duration table in Table 2 below, taking test device 1 as an example, it is obvious that when test device 1 executes test cases 2 and 5, its comprehensive time used is better than that of other test devices. That is, the comprehensive duration of test device 1 for executing test case 2 is 71.42 < 75.71 < 79.28, and the comprehensive duration of test case 5 is 96.85 < 100.28 < 106.42. Therefore, set test cases 2 and 5 as the first candidate test cases; set test cases 1, 3, and 4 as the second candidate test cases.

[0069] Table 2 Comprehensive Duration Table

[0070]

[0071] For the above test case allocation method, device, computer device, and storage medium, obtain the execution durations of different test devices for executing different types of test cases; where the number of executions of each test case by the same test device is at least one; for the same type of test case, determine the comprehensive duration of the test device under the test case of the type according to at least one execution duration corresponding to the test device; determine the allocation order of allocating each type of test case to each test device according to the comprehensive durations of different test devices under different types of test cases. In this embodiment, for each test device, the comprehensive duration of the test device is comprehensively determined according to the execution durations of different types of test cases, and the allocation of test cases is dynamically adjusted according to the comprehensive duration to maximize the resource utilization rate of the test device and at the same time reduce the execution duration of the test cases.

[0072] Figure 3It is a schematic flowchart of the use case allocation step in an embodiment. In this embodiment, the allocation order step of determining different types of test cases to be allocated to the test device according to the comprehensive duration of each first candidate use case, the comprehensive duration of each second candidate use case, and the comprehensive duration required for the second candidate use case to be executed in other test devices in the previous embodiment is refined. Therefore, a method for the use case allocation step is provided, including the following steps:

[0073] Step 301: According to the comprehensive duration of each first candidate use case, determine the first order of allocating the first candidate use cases to the test device in ascending order of the comprehensive duration.

[0074] Specifically, for each test device, sort the first candidate use cases in ascending order of the comprehensive duration according to the comprehensive duration of each first candidate use case, and use the sorting result as the first order of allocating the first candidate use cases to the test device.

[0075] Exemplarily, as shown in the comprehensive duration table in Table 2 above, taking test device 1 as an example, it can be known from the above embodiment that for test device 1, use case 2 and use case 5 can be set as the first candidate use cases. The comprehensive duration for executing the first candidate use case 2 is 71.42, and the comprehensive duration for executing the first candidate use case 5 is 96.85. Since 71.42 < 96.85, it is proved that test device 1 takes less time and has better performance when executing the first candidate use case 2 than when executing the first candidate use case 5. Therefore, the first order of allocating the first candidate use cases to test device 1 is determined as: use case 2 - use case 5.

[0076] Step 302: According to the comprehensive duration of each second candidate use case and the comprehensive duration required for the second candidate use case to be executed in other test devices, determine the second order of allocating the second candidate use cases to the test device.

[0077] One optional implementation: For each second candidate use case, determine the comprehensive execution score of the second candidate use case according to the comprehensive duration of the second candidate use case and the comprehensive duration required for the second candidate use case to be executed in other test devices; determine the second order of allocating the second candidate use cases to the test device in descending order of the comprehensive execution score.

[0078] Another optional implementation: For each second candidate use case, respectively determine the difference between the comprehensive duration of the second candidate use case and the comprehensive duration required for the second candidate use case to be executed in each other test device as the duration difference; select the smallest duration difference as the target difference of the second candidate use case; determine the second order of allocating the second candidate use cases to the test device in ascending order of the target difference of each second candidate use case.

[0079] Exemplarily, taking the comprehensive duration table shown in Table 2 above as an example of the test device 1, it can be seen from the above embodiments that for the test device 1, Test Case 1, Test Case 3, and Test Case 4 can be set as the second candidate test cases.

[0080] For the second candidate test case 1, determine the minimum difference duration between the comprehensive duration used by the test device 1 to execute the second candidate test case 1 and the comprehensive duration used by other test devices to execute the second candidate test case 1, that is, min(112.85 - 93.7, 112.85 - 86.42) = 19.15. Therefore, the target difference value of the second candidate test case 1 is 19.15.

[0081] For the second candidate test case 3, determine the minimum difference duration between the comprehensive duration used by the test device 1 to execute the second candidate test case 3 and the comprehensive duration used by other test devices to execute the second candidate test case 3, that is, min(102.85 - 85.71, 102.85 - 79.28) = 17.14. Therefore, the target difference value of the second candidate test case 3 is 17.14.

[0082] For the second candidate test case 4, determine the minimum difference duration between the comprehensive duration used by the test device 1 to execute the second candidate test case 4 and the comprehensive duration used by other test devices to execute the second candidate test case 4, that is, min(97.85 - 115.71, 97.85 - 82.85) = -17.86. Therefore, the target difference value of the second candidate test case 3 is -17.86.

[0083] Obviously, for the second candidate test cases, the target difference value corresponding to the second candidate test case 4 executed by the test device 1 is the smallest, and the target difference value corresponding to the second candidate test case 1 is the largest. Therefore, in the order of the target difference value from small to large, the second order for allocating the second candidate test cases to the test device 1 is determined as: Test Case 4 - Test Case 3 - Test Case 1.

[0084] Step 303: Determine the allocation order for allocating different test cases to the test device according to the sorting where the first order is prior and the second order is subsequent.

[0085] Exemplarily, taking the comprehensive duration table shown in Table 2 above as an example of the test device 1, it can be seen from the above embodiments that for the test device 1, the first sorting is Test Case 2 - Test Case 5, and the second order is Test Case 4 - Test Case 3 - Test Case 1. Therefore, according to the sorting where the first order is prior and the second order is subsequent, the allocation order 1 for allocating different test cases to the test device 1 is determined as: Test Case 2 - Test Case 5 - Test Case 4 - Test Case 3 - Test Case 1. Similarly, the allocation order 2 for allocating different test cases to the test device 2 can be obtained as: Test Case 3 - Test Case 1 - Test Case 2 - Test Case 5 - Test Case 4. The allocation order 3 for allocating different test cases to the test device 3 is: Test Case 4 - Test Case 1 - Test Case 3 - Test Case 2 - Test Case 5.

[0086] It should be noted that in the process of the allocation device allocating test cases to the test device in this embodiment, the test cases can be allocated according to the corresponding allocation order of the test device. Exemplarily, for each test device, the test cases are sequentially selected for allocation according to the corresponding allocation order of the test device, and after the current test case is executed by the test device, the test case is marked as executed until all test cases are executed, and the execution duration of all test cases in this time is collected and archived.

[0087] Exemplarily, as shown in the comprehensive duration table in Table 2 above, it is known that:

[0088] The corresponding allocation order 1 of test device 1: [Test case 2, Test case 5, Test case 4, Test case 3, Test case 1];

[0089] The corresponding allocation order 2 of test device 2: [Test case 3, Test case 1, Test case 2, Test case 5, Test case 4];

[0090] The corresponding allocation order 3 of test device 3: [Test case 4, Test case 1, Test case 3, Test case 2, Test case 5];

[0091] Therefore, when initially allocating test cases, test case 2 can be selected and allocated to test device 1, test case 3 can be selected and allocated to test device 2, and test case 4 can be selected and allocated to test device 3; if test device 1 finishes executing test case 2 first and the status of test device 1 is updated to idle, then test case 5 is allocated; if test device 2 is updated to the idle state first, then test case 1 is allocated; if test device 3 is updated to the idle state first, then test case 1 is allocated.

[0092] In the above embodiment, for the first candidate test cases where the test device performs optimally among all test devices, they are sorted in ascending order according to the comprehensive duration of the first candidate test cases, so that the test device preferentially executes these first candidate test cases, initially reducing the execution duration of the test cases. For the second candidate test cases where the test device does not perform optimally among all test devices, the execution order of the second candidate test cases is comprehensively determined according to the comprehensive duration of the second candidate test cases and the comprehensive duration required for execution in other test devices, further improving the resource utilization rate of the test device.

[0093] Figure 4 It is a flow chart of the steps for determining the comprehensive duration in an embodiment. In this embodiment, for the same type of test cases in the previous embodiment, the comprehensive duration of the test device under the type of test cases is determined according to at least one execution duration corresponding to the test device, so a method for determining the comprehensive duration is given, including the following steps:

[0094] Step 401, obtain the attenuation factor corresponding to the test device.

[0095] Among them, the attenuation factor can be understood as a preset weight set to account for the possible attenuation of the computing power or resources of the test device during successive executions of different types or the same type of test cases by the test device.

[0096] Specifically, for each test device, obtain the attenuation factor corresponding to the test device.

[0097] Step 402: For each execution duration required for the test device to execute the same type of test case each time, determine the execution order when the test device executes the test case with the execution duration.

[0098] Exemplarily, as shown in the table of the last three execution durations of the test cases in Table 1 above, taking test device 1 as an example, test device 1 executes test case 1 three times. The first execution duration is 120s, the second execution duration is 100s, and the third execution duration is 110s. Then, for test case 1 executed on test device 1, the execution order corresponding to the execution duration of 120s is 1, the execution order corresponding to the execution duration of 100s is 2, and the execution order corresponding to the execution duration of 110s is 3.

[0099] Step 403: Determine the comprehensive duration of the test device under the type of test case according to the attenuation factor, each execution duration, and the corresponding execution order.

[0100] One optional implementation is as follows: For each execution duration, take the product value among the attenuation factor, the execution duration, and the corresponding execution order as the weighted duration corresponding to the execution duration; for each test case executed on the test device, perform an average processing on all the weighted durations corresponding to the test case, and take the average processing result as the comprehensive duration of the test device under the type of test case.

[0101] Another optional implementation is as follows: For each execution duration, determine the execution weight of the execution duration according to the attenuation factor and the execution order corresponding to the execution duration; perform a weighted summation according to each execution duration and the execution weight to obtain the weighted total duration; determine the comprehensive duration of the test device under the type of test case according to the weighted total duration and the execution weight of each execution duration.

[0102] Specifically, through the following formula (1-1), determine the comprehensive duration of the test device under the type of test case according to the attenuation factor, each execution duration, and the corresponding execution order:

[0103] (1-1)

[0104] Among them, represents the comprehensive duration of the test device under the type of test case, ti is the execution duration for the most recent Nth time, α i is the decay factor of the execution duration for the most recent Nth time, N is the number of execution time records to be retained, and i is the execution order of the execution duration.

[0105] Exemplarily, for the execution duration table of the most recent three times of the test cases shown in Table 1 above, through the above formula (1-1), the comprehensive duration of the corresponding test device can be obtained:

[0106] The comprehensive duration of test device 1: ;

[0107] The comprehensive duration of test device 2: ;

[0108] The comprehensive duration of test device 3: .

[0109] In this embodiment, the decay factor corresponding to the test device is obtained; for each execution duration required for the test device to execute the same type of test case each time, the execution order when the test device uses the execution duration is determined; according to the decay factor, each execution duration, and the corresponding execution order, the comprehensive duration of the test device under the corresponding type of test case is determined. This embodiment can more accurately and reasonably determine the comprehensive duration of the test device under the corresponding type of test case, and further improve the accuracy of the allocation order of different types of test cases for the test device.

[0110] In one embodiment, this embodiment gives an optional method for test case allocation, and is described by taking the application of this method to a server as an example. As Figure 5 shown, this method includes the following steps:

[0111] Step 501, obtain the execution durations of different test devices for executing different types of test cases respectively.

[0112] Among them, the number of executions of the same test device for each test case is at least one.

[0113] Step 502, obtain the decay factor corresponding to the test device.

[0114] Step 503, for each execution duration required for the test device to execute the same type of test case each time, determine the execution order when the test device uses the execution duration.

[0115] Step 504, for each execution duration, determine the execution weight of the execution duration according to the decay factor and the execution order corresponding to the execution duration.

[0116] Step 505, perform weighted summation according to each execution duration and the execution weight to obtain the weighted total duration.

[0117] Step 506: Determine the comprehensive duration of the test device under the test cases of the type according to the weighted total duration and the execution weights of the respective execution durations.

[0118] Step 507: For each test device, if the comprehensive duration of any type of test case in the test device is the minimum among the comprehensive durations required for executing the same type of test cases in all test devices, then use the test case as the first candidate test case.

[0119] Step 508: Use the other test cases except the first candidate test case as the second candidate test cases.

[0120] Step 509: According to the comprehensive durations of the respective first candidate test cases, determine the first order of allocating the first candidate test cases to the test device in ascending order of the comprehensive durations.

[0121] Step 510: For each second candidate test case, respectively determine the difference between the comprehensive duration of the second candidate test case and the comprehensive duration required for execution in each other test device as the duration difference.

[0122] Step 511: Select the minimum duration difference as the target difference of the second candidate test case.

[0123] Step 512: According to the target differences of the respective second candidate test cases, determine the second order of allocating the second candidate test cases to the test device in ascending order of the target differences.

[0124] Step 513: Determine the allocation order of allocating different test cases to the test device in the order that the first order comes first and the second order comes second.

[0125] It should be understood that although the various steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same moment, but can be executed at different moments. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0126] Based on the same inventive concept, an embodiment of the present application further provides a test case allocation device for implementing the above-mentioned test case allocation method. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the test case allocation device provided below can refer to the limitations on the test case allocation method in the above text, and will not be repeated here.

[0127] In an exemplary embodiment, as Figure 6 shown, a test case allocation device is provided, including: a duration acquisition module 10, a duration determination module 11, and a use case allocation module 12, where:

[0128] The duration acquisition module 10 is configured to acquire the execution durations of different test devices for executing different types of test cases; wherein, the number of executions of each test case by the same test device is at least once;

[0129] The duration determination module 11 is configured to, for the same type of test case, determine the comprehensive duration of the test device under the test case of the type according to at least one execution duration corresponding to the test device;

[0130] The use case allocation module 12 is configured to determine the allocation order of allocating various types of test cases to each test device according to the comprehensive durations of different test devices under different types of test cases.

[0131] In some embodiments, the use case allocation module 12 further includes:

[0132] The first use case unit is configured to, for each test device, if the comprehensive duration of any type of test case in the test device is the smallest among the comprehensive durations required for executing the same type of test case in all test devices, then use the test case as the first candidate test case;

[0133] The second use case unit is configured to use the other test cases except the first candidate test cases as the second candidate test cases;

[0134] The use case allocation unit is configured to determine the allocation order of allocating different types of test cases to the test device according to the comprehensive durations of each first candidate test case, the comprehensive durations of each second candidate test case, and the comprehensive durations required for execution in other test devices of the second candidate test cases.

[0135] In some embodiments, the use case allocation unit is further configured to determine a first order for allocating first candidate use cases to the test device according to the comprehensive duration of each first candidate use case, in ascending order of the comprehensive duration; determine a second order for allocating second candidate use cases to the test device according to the comprehensive duration of each second candidate use case and the comprehensive duration required for execution in other test devices; and determine an allocation order for allocating different test cases to the test device according to the sorting where the first order is prior and the second order is subsequent.

[0136] In some embodiments, for each second candidate use case, the use case allocation unit is further configured to determine the difference between the comprehensive duration of the second candidate use case and the comprehensive duration required for execution in each other test device as the duration difference; select the smallest duration difference as the target difference of the second candidate use case; and determine a second order for allocating second candidate use cases to the test device according to the target differences of each second candidate use case, in ascending order of the target differences.

[0137] In some embodiments, the duration determination module 11 further includes:

[0138] A factor acquisition unit, configured to acquire an attenuation factor corresponding to the test device;

[0139] An order determination unit, configured to determine, for each execution duration required for the test device to execute the same type of test case each time, the execution order when the time used by the test device for executing the test case is the execution duration;

[0140] A duration determination unit, configured to determine the comprehensive duration of the test device under the type of test case according to the attenuation factor, each execution duration, and the corresponding execution order.

[0141] In some embodiments, the duration determination unit is further configured to, for each execution duration, determine the execution weight of the execution duration according to the attenuation factor and the execution order corresponding to the execution duration; perform weighted summation according to each execution duration and the execution weight to obtain a weighted total duration; and determine the comprehensive duration of the test device under the type of test case according to the weighted total duration and the execution weights of each execution duration.

[0142] Each module in the above test case allocation device can be implemented in whole or in part by software, hardware, and their combination. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory of the computer device in the form of software, so as to facilitate the processor to call and execute the operations corresponding to each of the above modules.

[0143] In an exemplary embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 7As shown in the figure. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it realizes a test case allocation method.

[0144] Those skilled in the art can understand that Figure 7 the structure shown in the figure is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0145] In one embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are realized.

[0146] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, the steps in the above method embodiments are realized.

[0147] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, the steps in the above method embodiments are realized.

[0148] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.

[0149] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.

[0150] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

[0151] The above-described embodiments merely represent several implementation manners of this application. The description is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of this application. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all belong to the protection scope of this application. Therefore, the protection scope of this application should be subject to the appended claims.

Claims

1. A test case allocation method, characterized in that, The method includes: Obtaining the execution duration of different test devices for executing different types of test cases respectively; wherein, the number of executions of each test case by the same test device is at least once; For the same type of test case, determining the comprehensive duration of the test device under the test case according to at least one execution duration corresponding to the test device; Determining the allocation order of allocating different types of test cases to each of the test devices according to the comprehensive durations of different test devices under different types of test cases.

2. The method according to claim 1, wherein The determining the allocation order of allocating different types of test cases to each of the test devices according to the comprehensive durations of different test devices under different types of test cases includes: For each test device, if the comprehensive duration of any type of test case in the test device is the smallest among the comprehensive durations required for executing the same type of test case in all test devices, then taking the test case as the first candidate test case; Taking the other test cases except the first candidate test cases as the second candidate test cases; Determining the allocation order of allocating different types of test cases to the test device according to the comprehensive durations of each first candidate test case, the comprehensive durations of each second candidate test case, and the comprehensive durations required for the second candidate test cases to be executed in other test devices.

3. The method according to claim 2, wherein The determining the allocation order of allocating different types of test cases to the test device according to the comprehensive durations of each first candidate test case, the comprehensive durations of each second candidate test case, and the comprehensive durations required for the second candidate test cases to be executed in other test devices includes: Determining the first order of allocating the first candidate test cases to the test device according to the comprehensive durations of each first candidate test case in ascending order of the comprehensive duration; Determining the second order of allocating the second candidate test cases to the test device according to the comprehensive durations of each second candidate test case and the comprehensive durations required for the second candidate test cases to be executed in other test devices; Determining the allocation order of allocating different test cases to the test device according to the sorting where the first order is prior and the second order is subsequent.

4. The method according to claim 3, wherein The determining the second order of allocating the second candidate test cases to the test device according to the comprehensive durations of each second candidate test case and the comprehensive durations required for the second candidate test cases to be executed in other test devices includes: For each second candidate test case, respectively determining the difference between the comprehensive duration of the second candidate test case and the comprehensive duration required for the second candidate test case to be executed in each other test device as the duration difference; Selecting the smallest duration difference as the target difference of the second candidate test case; Determining the second order of allocating the second candidate test cases to the test device according to the target differences of each second candidate test case in ascending order of the target difference.

5. The method according to claim 1, wherein The determining the comprehensive duration of the test device under the test case according to at least one execution duration corresponding to the test device for the same type of test case includes: Obtaining the attenuation factor corresponding to the test device; For each execution duration required for the test device to execute the same type of test case each time, determine the execution order when the test device takes the execution duration during the execution of the test case; According to the attenuation factor, each of the execution durations, and the corresponding execution order, determine the comprehensive duration of the test device under the test case of this type.

6. The method according to claim 5, wherein The determining the comprehensive duration of the test device under the test case of this type according to the attenuation factor, each of the execution durations, and the corresponding execution order includes: For each execution duration, determine the execution weight of the execution duration according to the attenuation factor and the execution order corresponding to the execution duration; Perform weighted summation according to each of the execution durations and the execution weights to obtain a weighted total duration; According to the weighted total duration and the execution weights of each of the execution durations, determine the comprehensive duration of the test device under the test case of this type.

7. A test case allocation device, characterized in that, The device includes: A duration acquisition module, configured to acquire the execution durations of different test devices executing different types of test cases respectively; wherein, the number of executions of each test case by the same test device is at least once; A duration determination module, configured to, for the same type of test case, determine the comprehensive duration of the test device under the test case of this type according to at least one execution duration corresponding to the test device; A test case allocation module, configured to determine the allocation order of allocating each type of test case to each of the test devices according to the comprehensive durations of different test devices under different types of test cases.

8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 6 are implemented.