Vehicle test task execution method and device, test equipment and vehicle
By obtaining the vehicle's test task information and sorting and combining using mutually exclusive task numbers, the target combination number sequence is determined, and the problem of poor execution order of test tasks in the prior art is solved, and the shortest execution time and automated scheduling of test tasks are achieved.
Patent Information
- Application Number
- CN202510205218.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-06-10
AI Technical Summary
In the prior art, the execution order of the test task is determined by manually drawing a test task execution timing chart, which takes a long time and is not necessarily the optimal order, resulting in a longer execution time of the test task.
By obtaining the vehicle's test task information, using the mutually exclusive task number as a combination constraint, the test task number is sorted and combined to obtain the combined number sequence, and the target combination number sequence is determined based on the total execution time of the test task in the combined number sequence to achieve the optimal sort of the test task.
The optimal sorting of test tasks is realized, so that the test tasks in the target combination numbering sequence have the shortest execution time when executed, avoiding the time-consuming and manual drawing of timing charts by hand, and saving time and effort, and can still be automatically adjusted when the test tasks category and number change.
Smart Images

Figure CN120124952A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of task scheduling, and in particular, to a method, device, test equipment, and vehicle for executing vehicle test tasks. Background Art
[0002] In order to ensure the quality of the whole vehicle, after the automatic assembly of vehicle parts on the final assembly line, the whole vehicle will undergo offline inspections such as static function inspection, road test inspection, aging test, and appearance inspection. Among them, the aging test simulates the user's vehicle usage scenario through a fully automated method to achieve the purpose of testing the functions of the whole vehicle at high frequencies, and to stimulate the obvious / latent faults of the vehicle in advance, so as to prevent problems from flowing into the market and bringing bad user experience. Therefore, the aging test is an essential link for the vehicle manufacturer to ensure quality.
[0003] With the continuous increase in the number of aging test function points and the increase in test frequencies, the aging test duration will also increase accordingly. In order to improve the test coverage while ensuring that each test link can deliver the vehicle in a timely manner, it is necessary to reasonably schedule the test tasks, make full use of the test task execution time slots, and reduce the test duration. Currently, the execution order of test tasks is determined by manually drawing the test task execution timing diagram. However, the method of manually drawing the test task execution timing diagram not only takes a long time, but also the determined execution order of test tasks may not be the optimal sorting of test tasks (for example, the shortest duration). In addition, when adding test function points, it is necessary to manually re-sort the test tasks again, which is not only time-consuming and laborious, but also has problems such as the unsatisfactory sorting effect of test tasks resulting in a long execution duration of test tasks. Therefore, it is necessary to improve the test task execution method in the related technology. Summary of the Invention
[0004] In view of the above-mentioned disadvantages of the prior art, this application provides a method, device, test equipment, and vehicle for executing vehicle test tasks to solve the above technical problems.
[0005] A method for executing vehicle test tasks provided by this application includes: obtaining test task information of a vehicle; the test task information includes a test task number, an execution duration of the test task, and a mutually exclusive task number; using the mutually exclusive task number as a combined constraint condition for the test task number, and sorting and combining the test task numbers according to the combined constraint condition to obtain a combined number sequence; determining a target combined number sequence according to the total execution duration of the test tasks in the combined number sequence; the test tasks in the target combined number sequence have the minimum total execution duration; and executing the test tasks according to the target combined number sequence.
[0006] In one embodiment of the present application, the process of sorting and combining the test task numbers according to the combination constraint conditions to obtain a combined number sequence includes: sorting the test task numbers in a random sorting manner to obtain a plurality of task number sequences; and combining the test task numbers in each task number sequence according to the combination constraint conditions to obtain a plurality of the combined number sequences.
[0007] In one embodiment of the present application, the process of determining a target combined number sequence according to the total execution duration of the test tasks in the combined number sequence includes: calculating the selection probability of the combined number sequence according to the total execution duration of the test tasks in the combined number sequence; determining an alternative number sequence from the combined number sequences based on the selection probability of the combined number sequence; the selection probability of the alternative number sequence is negatively correlated with the total execution duration of the test tasks in the alternative number sequence; the selection probability of the alternative number sequence is greater than a preset probability threshold; transforming the alternative number sequence to obtain a plurality of transformed number sequences; and combining the test task numbers in each transformed number sequence according to the combination constraint conditions to obtain a plurality of transformed combined sequences; calculating the selection probability of the transformed combined sequence according to the total execution duration of the test tasks in the transformed combined sequence; determining an alternative number sequence from the transformed combined sequences based on the selection probability of the transformed combined sequence; continuing to transform the re-determined alternative number sequence, and re-determining an alternative number sequence based on the continuously transformed alternative number sequence until the number of transformations of the re-determined alternative number sequence reaches a preset number of iterations to obtain a final alternative number sequence; and taking the number sequence with the maximum selection probability in the final alternative number sequence as the target combined number sequence.
[0008] In one embodiment of the present application, the process of transforming the alternative number sequence to obtain a plurality of transformed number sequences includes: pairing the alternative number sequence according to a preset pairing quantity to obtain a plurality of paired sequence combinations; and performing a crossover operation on the test task numbers in different task number sequences in each paired sequence combination to obtain a plurality of crossover number sequences; and performing a mutation operation on the test task numbers in each crossover number sequence to obtain a plurality of the transformed number sequences.
[0009] In an embodiment of the present application, the process of calculating the selection probability of the combination number sequence according to the total execution duration of the test tasks in the combination number sequence includes: calculating the fitness of the combination number sequence based on the total execution duration of the test tasks in the combination number sequence; the fitness of the combination number sequence is negatively correlated with the total execution duration of the test tasks in the combination number sequence; and calculating the selection probability of the combination number sequence based on the fitness of the combination number sequence; the selection probability of the combination number sequence is positively correlated with the fitness of the combination number sequence.
[0010] In an embodiment of the present application, if the target combination number sequence includes a test task number and a combination of test task numbers, the process of executing the test tasks according to the target combination number sequence includes: determining a first thread number according to the arrangement position of the test task number in the target combination number sequence; and establishing a correspondence between the test case of the test task number and the first thread number, denoted as the first correspondence; determining a second thread number according to the arrangement position of the combination of test task numbers in the target combination number sequence; and establishing a correspondence between the test case of each test task number in the combination of test task numbers and the second thread number, denoted as the second correspondence; merging the first correspondence and the second correspondence to obtain a correspondence between the thread number and the test case; starting threads in the order of the thread numbers and executing the test cases corresponding to the thread numbers on the threads.
[0011] In an embodiment of the present application, if the combination number sequence includes a test task number and a combination of test task numbers, before determining the target combination number sequence according to the total execution duration of the test tasks in the combination number sequence, the method further includes: taking the longest execution duration of all the test tasks in the combination of test task numbers as the execution duration of the combination of test task numbers; taking the test tasks corresponding to all the test task numbers in the combination number sequence as the target test tasks; adding the execution duration of the target test tasks and the execution durations of all the combinations of test task numbers in the combination number sequence to obtain the total execution duration of the test tasks in the combination number sequence.
[0012] According to one aspect of the embodiments of the present application, a vehicle test task execution device is provided. The device includes: an information acquisition module for acquiring test task information of the vehicle; the test task information includes a test task number, an execution duration of the test task, and a mutually exclusive task number; a number combination module for using the mutually exclusive task number as a combination constraint condition for the test task number, and sorting and combining the test task numbers according to the combination constraint condition to obtain a combined number sequence; a sequence determination module for determining a target combined number sequence according to the total execution duration of the test tasks in the combined number sequence; the test tasks in the target combined number sequence have the minimum total execution duration; a task execution module for executing the test tasks according to the target combined number sequence.
[0013] According to one aspect of the embodiments of the present application, a test device is provided, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enabling the test device to implement the vehicle test task execution method as described above.
[0014] According to one aspect of the embodiments of the present application, a vehicle is provided, the vehicle includes the vehicle test task execution device as described above or the test device as described above.
[0015] The beneficial effects of the present application: By acquiring the test task information of the vehicle, using the mutually exclusive task number as a combination constraint condition for the test task number, sorting and combining the test task numbers according to the combination constraint condition to obtain a combined number sequence, determining a target combined number sequence according to the total execution duration of the test tasks in the combined number sequence, and executing the test tasks according to the target combined number sequence. In the above process, by automatically sorting and combining the test task numbers and determining the target combined number sequence according to the total execution duration of the test tasks in the combined number sequence, the optimal sorting of the test tasks is achieved, so that the test tasks in the target combined number sequence have the shortest execution duration when executed, avoiding manually drawing the test task execution timing diagram, which has the characteristics of saving time and effort; in addition, when the type and quantity of the test tasks change, it is still possible to automatically sort and combine the test task numbers and determine the target combined number sequence again according to the total execution duration of the test tasks in the combined number sequence, which has strong applicability and scalability.
[0016] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. Description of the Drawings
[0017] The accompanying drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with this application, and are used together with the specification to explain the principles of this application. Obviously, the accompanying drawings in the following description are only some embodiments of this application. For those of ordinary skill in the art, other accompanying drawings can be obtained based on these drawings without creative efforts. In the accompanying drawings:
[0018] Figure 1 is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of this application;
[0019] Figure 2 is a flowchart of a vehicle test task execution method shown in an exemplary embodiment of this application;
[0020] Figure 3 is a schematic diagram of performing a crossover operation on test task numbers in different task number sequences shown in an exemplary embodiment of this application;
[0021] Figure 4 is a schematic diagram of performing a mutation operation on test task numbers in each crossover number sequence shown in an exemplary embodiment of this application;
[0022] Figure 5 is a flowchart of a vehicle test task execution method shown in another exemplary embodiment of this application;
[0023] Figure 6 is a block diagram of a vehicle test task execution device shown in an exemplary embodiment of this application;
[0024] Figure 7 shows a schematic diagram of the structure of a computer system of a test device suitable for implementing the embodiments of this application. Detailed Embodiments
[0025] The following will describe the embodiments of this application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be understood that the preferred embodiments are only for explaining this application and not for limiting the protection scope of this application.
[0026] It should be noted that the diagrams provided in the following embodiments only illustrate the basic concept of this application in a schematic manner. Therefore, only the components related to this application are shown in the diagrams, rather than being drawn according to the number, shape, and size of the components in actual implementation. The types, numbers, and proportions of the components in actual implementation can be arbitrarily changed, and the component layout type may also be more complex.
[0027] In the following description, a large number of details are explored to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.
[0028] Figure 1 It is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application.
[0029] Referring to Figure 1 As shown, the system architecture may include a storage device 101 and a test controller 102. Among them, the test controller 102 may be at least one of a desktop Graphics Processing Unit (GPU) computer, a GPU computing cluster, a neural network computer, etc. Relevant technicians can use the test controller 102 to obtain the test task information of the vehicle, use the mutually exclusive task number as the combination constraint condition of the test task number, and sort and combine the test task numbers according to the combination constraint condition to obtain a combined number sequence. According to the total execution duration of the test tasks in the combined number sequence, determine the target combined number sequence, and execute the test tasks according to the target combined number sequence. The storage device 101 is used to store the test task information of the vehicle and provide it to the test controller 102 for processing.
[0030] Schematically, after the test controller 102 obtains the test task information of the vehicle in the storage device 101, it uses the mutually exclusive task number as the combination constraint condition of the test task number, and sorts and combines the test task numbers according to the combination constraint condition to obtain a combined number sequence. According to the total execution duration of the test tasks in the combined number sequence, determine the target combined number sequence, and execute the test tasks according to the target combined number sequence. Through the above process, by automatically sorting and combining the test task numbers and determining the target combined number sequence according to the total execution duration of the test tasks in the combined number sequence, the optimal sorting of the test tasks is achieved, so that the test tasks in the target combined number sequence have the shortest execution duration when executed, avoiding manually drawing the test task execution timing diagram, which has the characteristics of saving time and effort; in addition, when the type and quantity of the test tasks change, it is still possible to automatically sort and combine the test task numbers and determine the target combined number sequence again according to the total execution duration of the test tasks in the combined number sequence, which has strong applicability and scalability.
[0031] It should be noted that the vehicle test task execution method provided by the embodiments of the present application is generally executed by the test controller 102. Correspondingly, the vehicle test task execution device is generally arranged in the test controller 102.
[0032] The implementation details of the technical solutions of the embodiments of the present application are elaborated in detail below:
[0033] Figure 2 is a flowchart of a vehicle test task execution method shown in an exemplary embodiment of the present application. The vehicle test task execution method can be executed by a computing processing device, and the computing processing device can be Figure 1 the test controller 102 shown in Figure 2 As shown, the vehicle test task execution method at least includes steps S210 to S240, which are introduced in detail as follows:
[0034] In step S210, the test task information of the vehicle is obtained. In an embodiment of the present application, the test task information includes a test task number, an execution duration of the test task, a mutually exclusive task number, a thread number, etc. The test task numbers are stored in a test task number set, and each test task number has a corresponding test case. The execution duration of the test task is stored in a test task execution duration set, the thread number is stored in a thread number set, and the mutually exclusive task number is stored in a test task mutual exclusion set. The test task mutual exclusion set is a set including several mutually exclusive test task groups, and the test tasks in each mutually exclusive test task group cannot be executed simultaneously.
[0035] In step S220, the mutually exclusive task number is used as a combination constraint condition for the test task numbers, and the test task numbers are sorted and combined according to the combination constraint condition to obtain a combined number sequence. In an embodiment of the present application, the process of sorting and combining the test task numbers according to the combination constraint condition includes: sorting the test task numbers in a random sorting manner to obtain a plurality of task number sequences; combining the test task numbers in each task number sequence according to the combination constraint condition to obtain a plurality of combined number sequences. By sorting the test task numbers in a random sorting manner, the diversity of the task number sequences is increased, and the test task numbers combined in each task number sequence can be placed on the same thread for simultaneous execution, thereby shortening the execution duration of all test tasks.
[0036] In step S230, a target combination number sequence is determined according to the total execution duration of the test tasks in the combination number sequence. In an embodiment of the present application, the test tasks in the target combination number sequence have the minimum total execution duration. The process of determining the target combination number sequence according to the total execution duration of the test tasks in the combination number sequence includes: calculating the selection probability of the combination number sequence according to the total execution duration of the test tasks in the combination number sequence; determining an alternative number sequence from the combination number sequence based on the selection probability of the combination number sequence; the selection probability of the alternative number sequence is negatively correlated with the total execution duration of the test tasks in the alternative number sequence; the selection probability of the alternative number sequence is greater than a preset probability threshold; performing transformation on the alternative number sequence to obtain a plurality of transformed number sequences; and combining the test task numbers in each transformed number sequence according to the combination constraint conditions to obtain a plurality of transformed combination sequences; calculating the selection probability of the transformed combination sequence according to the total execution duration of the test tasks in the transformed combination sequence; determining an alternative number sequence again from the transformed combination sequence based on the selection probability of the transformed combination sequence; continuing to perform transformation on the re-determined alternative number sequence, and based on the continuously transformed alternative number sequence, determining the alternative number sequence again until the number of times of transformation of the re-determined alternative number sequence reaches a preset number of iterations to obtain a final alternative number sequence; taking the number sequence with the maximum selection probability in the final alternative number sequence as the target combination number sequence. By continuously iterating, continuously selecting the number sequence with a selection probability greater than the preset probability threshold, and finally taking the number sequence with the maximum selection probability in the alternative number sequence as the target combination number sequence, the minimization of the total execution duration of all test tasks is achieved.
[0037] In step S240, the test tasks are executed according to the target combination number sequence. In an embodiment of the present application, by automatically sorting and combining the test task numbers and determining the target combination number sequence according to the total execution duration of the test tasks in the combination number sequence, the optimal sorting of the test tasks is achieved, so that the test tasks in the target combination number sequence have the shortest execution duration when executed, avoiding manually drawing the test task execution timing diagram, which is time-saving and labor-saving; in addition, when the types and quantities of the test tasks change, the test task numbers can still be automatically sorted and combined, and the target combination number sequence can be determined again according to the total execution duration of the test tasks in the combination number sequence, which has the characteristics of strong applicability and scalability.
[0038] In an embodiment of the present application, the process of sorting and combining the test task numbers according to the combination constraint conditions to obtain the combination number sequence includes:
[0039] Sort the test task numbers in a random order to obtain multiple task number sequences. In an embodiment of the present application, taking the test task numbers including 1, 2, 3, 4, 5, 6, and 7 as an example, one of the task number sequences is 2, 1, 7, 4, 3, 5, 6. The set of this task number sequence is NS = {2, 1, 7, 4, 3, 5, 6}. In the NS set, the test cases of the test task numbers that are earlier are executed first. For example, the test case of test task number 2 is executed before the test case of test task number 1, and a thread is assigned to each test case of the test task number, and the corresponding test case is processed through the assigned thread.
[0040] According to the combination constraint conditions, combine the test task numbers in each task number sequence to obtain multiple combined number sequences. In an embodiment of the present application, in the process of combining the test task numbers in each task number sequence, the combination constraint conditions should be considered, that is, mutually exclusive test task numbers cannot be combined to avoid mutually exclusive test tasks from being executed on the same thread.
[0041] In an embodiment of the present application, the process of determining the target combined number sequence according to the total execution duration of the test tasks in the combined number sequence includes:
[0042] Calculate the selection probability of the combined number sequence according to the total execution duration of the test tasks in the combined number sequence; based on the selection probability of the combined number sequence, determine the alternative number sequence from the combined number sequences. In an embodiment of the present application, the selection probability of the alternative number sequence is negatively correlated with the total execution duration of the test tasks in the alternative number sequence; the selection probability of the alternative number sequence is greater than the preset probability threshold; the preset probability threshold is set according to the actual situation. The method of determining the alternative number sequence from the combined number sequences based on the selection probability of the combined number sequence is implemented by the roulette wheel selection method. Selecting the number sequence with a selection probability greater than the preset probability threshold is beneficial to taking the combined number sequence with a smaller total execution duration as the alternative number sequence and entering the next sequence transformation process to continuously optimize the total execution duration of the test tasks.
[0043] Transform the alternative number sequences to obtain multiple transformed number sequences; and combine the test task numbers in each transformed number sequence according to the combination constraint conditions to obtain multiple transformed combination sequences; calculate the selection probabilities of the transformed combination sequences according to the total execution duration of the test tasks in the transformed combination sequences; and re-determine the alternative number sequences from the transformed combination sequences based on the selection probabilities of the transformed combination sequences. In an embodiment of the present application, the operation of transforming the alternative number sequences includes crossover operation, mutation operation, etc. By transforming the alternative number sequences to obtain multiple transformed number sequences, the diversity of the number sequences is enriched. The selection probability of the transformed combination sequence is negatively correlated with the total execution duration of the test tasks in the transformed combination sequence, and the re-determined alternative number sequence is greater than the preset probability threshold.
[0044] Continue to transform the re-determined alternative number sequences, and re-determine the alternative number sequences again based on the continuously transformed alternative number sequences until the number of transformations of the re-determined alternative number sequences reaches the preset number of iterations to obtain the final alternative number sequences. In an embodiment of the present application, the process of re-determining the alternative number sequences again based on the continuously transformed alternative number sequences includes: combining the test task numbers in the continuously transformed alternative number sequences according to the combination constraint conditions to obtain the continuously transformed combined number sequences; calculating the selection probabilities of the continuously transformed combined number sequences according to the total execution duration of the test tasks in the continuously transformed combined number sequences; and obtaining the re-determined alternative number sequences based on the comparison result between the selection probability of the continuously transformed combined number sequence and the preset probability threshold.
[0045] Use the number sequence with the maximum selection probability in the final alternative number sequences as the target combined number sequence. In an embodiment of the present application, the target combined number sequence is the number sequence with the maximum selection probability among all alternative number sequences, that is, the test tasks in the target combined number sequence have the minimum total execution duration. By performing multiple transformations on the re-determined alternative number sequences to obtain the final alternative number sequences and selecting the number sequence with the maximum selection probability from the final alternative number sequences, the effect of minimizing the total execution duration of the test tasks is achieved.
[0046] In another embodiment of the present application, taking the test task numbers including 1, 2, 3, 4, 5, 6, and 7 as an example, the target combined number sequence {Q 1 : (1, 6), Q 2 : (2, 4, 5), Q 3 : (3, 7)} is obtained, where test task 1 and test task 6 are assigned to thread Q 1 for execution, test task 2, test task 4, and test task 5 are assigned to thread Q 2 for execution, and test task 3 and test task 7 are assigned to thread Q3 Execute on.
[0047] In an embodiment of the present application, the process of transforming the alternative number sequence to obtain a plurality of transformed number sequences includes:
[0048] Pair the alternative number sequences according to a preset pairing quantity to obtain a plurality of paired sequence combinations; and perform a crossover operation on the test task numbers in different task number sequences in each paired sequence combination to obtain a plurality of crossover number sequences. In an embodiment of the present application, the method of pairing the alternative number sequences adopts a random pairing method. The preset pairing quantity can be 2, 3 or other values. Here, taking the preset pairing quantity as 2 as an example, after pairing the alternative number sequences, each paired sequence combination includes two task number sequences. Take the two task number sequences as parent 1 and parent 2 respectively. The process of performing a crossover operation on parent 1 and parent 2: Randomly generate two different crossover points in parent 1, and randomly generate two different crossover points in parent 2; Set offspring 1 and offspring 2. Some of the test task numbers in offspring 1 inherit the test task numbers between the two different crossover points of parent 2, and some of the other test task numbers in offspring 1 are inherited in the order of the positions of the test task numbers in parent 1, and the test task numbers inherited by offspring 1 from parent 2 do not repeat the test task numbers inherited by offspring 1 from parent 1; Some of the test task numbers in offspring 2 inherit the test task numbers between the two different crossover points of parent 1, and some of the other test task numbers in offspring 2 are inherited in the order of the positions of the test task numbers in parent 2, and the test task numbers inherited by offspring 2 from parent 1 do not repeat the test task numbers inherited by offspring 2 from parent 1. All the offspring are used as crossover number sequences.
[0049] Figure 3 It is a schematic diagram showing the crossover operation of the test task numbers in different task number sequences shown in an exemplary embodiment of the present application. In Figure 3Among them, the arrangement order of the test task numbers in Parent 1 is 1, 4, 6, 5, 3, 7, 2. The crossover point 1 in Parent 1 is located at the gap between the test task number 4 and the test task number 6. The crossover point 2 in Parent 1 is located at the gap between the test task number 3 and the test task number 7. The arrangement order of the test task numbers in Parent 2 is 2, 6, 3, 7, 1, 4, 5. The crossover point 1 in Parent 2 is located at the gap between the test task number 6 and the test task number 3. The crossover point 2 in Parent 2 is located at the gap between the test task number 1 and the test task number 4. The test task numbers 3, 7, 1 in Offspring 1 inherit the test task numbers between the crossover point 1 and the crossover point 2 in Parent 2, and the arrangement order of the test task numbers 3, 7, 1 remains unchanged. The first test task number in Offspring 1 inherits the second test task number 4 in Parent 1. The second test task number in Offspring 1 inherits the third test task number 6 in Parent 1. The sixth test task number in Offspring 1 inherits the fourth test task number 5 in Parent 1. The seventh test task number in Offspring 1 inherits the seventh test task number 2 in Parent 1. The test task numbers 6, 5, 3 in Offspring 2 inherit the test task numbers between the crossover point 1 and the crossover point 2 in Parent 1, and the arrangement order of the test task numbers 6, 5, 3 remains unchanged. The first test task number in Offspring 2 inherits the first test task number 2 in Parent 2. The second test task number in Offspring 2 inherits the fourth test task number 7 in Parent 2. The sixth test task number in Offspring 2 inherits the fifth test task number 1 in Parent 2. The seventh test task number in Offspring 2 inherits the sixth test task number 4 in Parent 2.
[0050] Perform mutation operations on the test task numbers in each crossover number sequence to obtain multiple transformed number sequences. In an embodiment of the present application, the process of performing mutation operations on the test task numbers in each crossover number sequence includes: taking the two-point mutation method as an example, randomly generate two mutation positions in each crossover number sequence, and exchange the test task numbers at the two mutation positions.
[0051] Figure 4 is a schematic diagram showing the mutation operation on the test task numbers in each crossover number sequence shown in an exemplary embodiment of the present application. As Figure 4 shown, the arrangement order of the test task numbers in the crossover number sequence is 1, 4, 6, 5, 2, 7, 3. Among them, the randomly generated mutation positions are the third number position and the sixth number position in the crossover number sequence. After exchanging the test task number 6 at the third number position and the test task number 7 at the sixth number position, the transformed number sequence 1, 4, 7, 5, 2, 6, 3 is obtained.
[0052] In one embodiment of the present application, the process of calculating the selection probability of a combined number sequence according to the total execution duration of test tasks in the combined number sequence includes:
[0053] Based on the total execution duration of test tasks in the combined number sequence, calculate the fitness of the combined number sequence. In one embodiment of the present application, the fitness of the combined number sequence is negatively correlated with the total execution duration of test tasks in the combined number sequence. The calculation formula for the fitness of the combined number sequence is as follows:
[0054] F i = 1 / C(i) Equation (1)
[0055] Wherein, F i represents the fitness of the i-th combined number sequence, and C(i) represents the total execution duration of test tasks in the i-th combined number sequence. The smaller C(i) is, the larger F i is. In the genetic algorithm, the higher the fitness of the combined number sequence, the closer the arrangement order of the combined number sequence is to the optimal solution.
[0056] And based on the fitness of the combined number sequence, calculate the selection probability of the combined number sequence. In one embodiment of the present application, the selection probability of the combined number sequence is positively correlated with the fitness of the combined number sequence. The calculation formula for the selection probability of the combined number sequence is as follows:
[0057]
[0058] Wherein, p i represents the selection probability of the i-th combined number sequence, F i represents the fitness of the i-th combined number sequence, and n represents the number of combined number sequences. The probability of a combined number sequence with low fitness being selected for the next transformation is small, and the probability of a combined number sequence with high fitness being selected for the next transformation is large. Thus, by performing a preset number of transformations on the transformation number sequence and determining the alternative number sequence according to the selection probability of the combined number sequence, the total execution duration of the test tasks is further shortened.
[0059] In one embodiment of the present application, if the target combined number sequence includes test task numbers and combinations of test task numbers, the process of executing test tasks according to the target combined number sequence includes:
[0060] Determine the first thread number according to the arrangement position of the test task number in the target combined number sequence; and establish a correspondence between the test case of the test task number and the first thread number, denoted as the first correspondence. In one embodiment of the present application, if the arrangement position of the test task number in the target combined number sequence is the first position, the first thread number is Q 1; If the arrangement position of the test task number in the target combination number sequence is the second position, the first thread number is Q 2 , Determine the first thread number corresponding to each test task number in this way. After determining the first thread number corresponding to the test task number, the first correspondence is also determined. The determination of the first correspondence facilitates the scheduling of test cases for different test tasks when starting threads.
[0061] Determine the second thread number according to the arrangement position of the test task number combination in the target combination number sequence; and establish the correspondence between the test cases of each test task number in the test task number combination and the second thread number, denoted as the second correspondence. In an embodiment of the present application, if the arrangement position of the test task number combination in the target combination number sequence is the first position, the second thread number is 1, and if the arrangement position of the test task number combination in the target combination number sequence is the second position, the second thread number is 2. Determine the second thread number corresponding to each test task number combination in this way. After determining the second thread number corresponding to the test task number, the second correspondence is also determined. The determination of the second correspondence facilitates the scheduling of test cases corresponding to the test tasks in the test task number combination when starting threads.
[0062] Combine the first correspondence and the second correspondence to obtain the correspondence between the thread number and the test case. In an embodiment of the present application, the correspondence between the thread number and the test case includes the correspondence between the test case of the test task number and the first thread number, and the correspondence between the test cases of each test task number in the test task number combination and the second thread number, so that the test cases can be scheduled according to the correspondence between the thread number and the test case.
[0063] Start the threads in the order of the thread numbers, and execute the test cases corresponding to the thread numbers on the threads. In an embodiment of the present application, in the order of number Q 1 , number Q 2 , number Q 3 to start the threads, and when the thread numbered Q 1 is started, execute the corresponding test case on the thread numbered Q 1 , thus completing the execution process of the test task.
[0064] In an embodiment of the present application, if the combination number sequence includes test task numbers and test task number combinations, before determining the target combination number sequence according to the total execution duration of the test tasks in the combination number sequence, the method further includes:
[0065] Take the longest execution duration of all test tasks in the test task number combination as the execution duration of the test task number combination. In an embodiment of the present application, obtain the execution duration of each test task in the test task number combination, compare the execution durations of all test tasks in the test task number combination, and take the longest execution duration of all test tasks in the test task number combination as the execution duration of the test task number combination. Since the test tasks in the test task number combination are executed in parallel on the same thread, the total execution time of the test tasks is saved.
[0066] Take the test tasks corresponding to all test task numbers in the combination number sequence as the target test tasks; add the execution duration of the target test tasks and the execution durations of all test task number combinations in the combination number sequence to obtain the total execution duration of the test tasks in the combination number sequence. In an embodiment of the present application, the total execution duration of the test tasks in the combination number sequence is the sum of the execution duration of the target test tasks in the combination number sequence and the execution durations of all test task number combinations in the combination number sequence.
[0067] Figure 5 It is a flowchart of a vehicle test task execution method shown in another exemplary embodiment of the present application; as Figure 5 shown, the vehicle test task execution method includes: (1) Obtain a test task set, the test task set includes n test cases, each test case corresponds to a test task, and n is a positive integer; (2) Preprocess the test task set to obtain a test case number set, a test case execution duration set, and a test case mutual exclusion set. The preprocessing methods include data classification, data integration, etc.; (3) Input the test case number set, the test case execution duration set, and the test case mutual exclusion set into a genetic algorithm module with constraint conditions, and perform iterative calculations through the genetic algorithm module with constraint conditions to obtain a target combination number sequence; (4) Set up a thread pool, and the task scheduling module corresponds the test case numbers in the target combination number sequence with the thread numbers to realize serial or parallel execution of test tasks on the corresponding threads.
[0068] In this embodiment, the process of obtaining the target combination number sequence through iterative calculation by the genetic algorithm module with constraint conditions includes: (1) Initialization: Randomly sort the test case numbers to obtain multiple case number sequences; and combine the case number sequences according to the combination constraint conditions to obtain multiple combined case number sequences; (2) Fitness evaluation: Calculate the fitness of each combined case number sequence; (3) Sequence selection: Calculate the selection probability of each combined case number sequence, and determine the alternative number sequences from the combined case number sequences according to the selection probability of each combined case number sequence; (4) Sequence crossover: Perform crossover operations on multiple alternative number sequences to obtain multiple crossed case number sequences; (5) Sequence mutation: Perform mutation operations on each crossed case number sequence to obtain multiple transformed case number sequences; and combine the test case numbers in each transformed case number sequence according to the combination constraint conditions to obtain multiple transformed case combination sequences; calculate the selection probability of each transformed case combination sequence, and re-determine the alternative number sequences from the transformed case combination sequences according to the selection probability of each transformed case combination sequence; (6) According to the preset number of iterations, perform crossover and mutation on the re-determined alternative number sequences, and based on the mutated alternative number sequences, re-determine the alternative number sequences again until the number of times of performing crossover and mutation on the re-determined alternative number sequences reaches the preset number of iterations to obtain the final alternative number sequences, and use the number sequence with the maximum selection probability in the final alternative number sequences as the target combination number sequence.
[0069] This application can automate the scheduling and execution of test tasks, without the need to manually compile timing diagrams. When adding new test tasks, only the mutual exclusion relationship between test cases needs to be added to the test case mutual exclusion set to re-obtain the optimal scheduling strategy (target combination number sequence), which has the characteristics of strong scalability; in addition, the genetic algorithm is used to continuously iterate to obtain the scheduling strategy with the least execution time (target combination number sequence). When the number of test cases or the required test functions gradually increase, the genetic algorithm is more advantageous because it can obtain the global optimal solution.
[0070] The following introduces the device embodiment of this application, which can be used to execute the vehicle test task execution method in the above embodiments of this application. For the details not disclosed in the device embodiment of this application, please refer to the embodiments of the vehicle test task execution method in the above of this application.
[0071] Figure 6 It is a block diagram of a vehicle test task execution device shown in an exemplary embodiment of this application. This device can be applied to Figure 1The described implementation environment is specifically configured in the test controller 102. This device can also be applied to other exemplary implementation environments and is specifically configured in other devices. This embodiment does not limit the implementation environment applicable to this device.
[0072] As Figure 6 shown, this exemplary vehicle test task execution device includes:
[0073] The information acquisition module 601 is used to acquire the test task information of the vehicle.
[0074] The number combination module 602 is used to use the mutually exclusive task numbers as the combination constraint conditions for the test task numbers, and sort and combine the test task numbers according to the combination constraint conditions to obtain a combined number sequence.
[0075] The sequence determination module 603 is used to determine the target combined number sequence according to the total execution duration of the test tasks in the combined number sequence.
[0076] The task execution module 604 is used to execute the test tasks according to the target combined number sequence.
[0077] In an embodiment of the present application, the test task information includes test task numbers, the execution duration of the test tasks, mutually exclusive task numbers, thread numbers, etc. The test task numbers are stored in the test task number set, each test task number has a corresponding test case, the execution duration of the test tasks is stored in the test task execution duration set, the thread numbers are stored in the thread number set, and the mutually exclusive task numbers are stored in the test task mutual exclusion set. The test task mutual exclusion set is a set containing several mutually exclusive test task groups, and the test tasks in each mutually exclusive test task group cannot be executed simultaneously.
[0078] In an embodiment of the present application, the process of sorting and combining the test task numbers according to the combination constraint conditions to obtain a combined number sequence includes: sorting the test task numbers in a random sorting manner to obtain multiple task number sequences; combining the test task numbers in each task number sequence according to the combination constraint conditions to obtain multiple combined number sequences. By sorting the test task numbers in a random sorting manner, the diversity of the task number sequences is increased, and the test task numbers combined in each task number sequence can be placed on the same thread for simultaneous execution, thereby shortening the execution duration of all test tasks.
[0079] In an embodiment of the present application, the test tasks in the target combination number sequence have the minimum total execution duration. The process of determining the target combination number sequence according to the total execution duration of the test tasks in the combination number sequence includes: calculating the selection probability of the combination number sequence according to the total execution duration of the test tasks in the combination number sequence; determining an alternative number sequence from the combination number sequence based on the selection probability of the combination number sequence; the selection probability of the alternative number sequence is negatively correlated with the total execution duration of the test tasks in the alternative number sequence; the selection probability of the alternative number sequence is greater than a preset probability threshold; performing transformation on the alternative number sequence to obtain a plurality of transformed number sequences; and combining the test task numbers in each transformed number sequence according to the combination constraint conditions to obtain a plurality of transformed combination sequences; calculating the selection probability of the transformed combination sequence according to the total execution duration of the test tasks in the transformed combination sequence; determining an alternative number sequence again from the transformed combination sequence based on the selection probability of the transformed combination sequence; continuing to perform transformation on the re-determined alternative number sequence, and determining the alternative number sequence again based on the continuously transformed alternative number sequence until the number of transformation times of the re-determined alternative number sequence reaches a preset iteration number to obtain a final alternative number sequence; taking the number sequence with the maximum selection probability in the final alternative number sequence as the target combination number sequence. By continuously iterating, continuously selecting the number sequence with the selection probability greater than the preset probability threshold, and taking the number sequence with the maximum selection probability in the final alternative number sequence as the target combination number sequence, the minimization of the total execution duration of all test tasks is achieved.
[0080] In an embodiment of the present application, by automatically sorting and combining the test task numbers, and determining the target combination number sequence according to the total execution duration of the test tasks in the combination number sequence, the optimal sorting of the test tasks is achieved, so that the test tasks in the target combination number sequence have the shortest execution duration when executed, avoiding manually drawing the test task execution time sequence diagram, which has the characteristics of saving time and effort; in addition, when the types and quantities of the test tasks change, the test task numbers can still be automatically sorted and combined, and the target combination number sequence can be determined again according to the total execution duration of the test tasks in the combination number sequence, which has strong applicability and scalability.
[0081] It should be noted that the vehicle test task execution device provided in the above embodiment and the vehicle test task execution method provided in the above embodiment belong to the same concept. The specific ways in which each module and unit perform operations have been described in detail in the method embodiment, and will not be elaborated here. In practical applications, the vehicle test task execution device provided in the above embodiment can, according to needs, allocate the above functions to different functional modules, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above. This is not limited here either.
[0082] Embodiments of the present application also provide a testing device, including: one or more processors; a storage device for storing one or more programs, which, when executed by the one or more processors, cause the testing device to implement the vehicle testing task execution methods provided in the above various embodiments.
[0083] Embodiments of the present application also provide a vehicle, which includes the vehicle testing task execution device provided in the above various embodiments or the testing device provided in the above various embodiments.
[0084] Figure 7 The structural diagram of a computer system suitable for implementing the testing device of the embodiments of the present application is shown. It should be noted that, Figure 7 the shown computer system 700 of the testing device is only an example, and should not impose any limitation on the functions and usage scope of the embodiments of the present application.
[0085] As Figure 7 shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage section 708 into the random access memory (RAM) 703, such as executing the method in the above embodiments. In the RAM 703, various programs and data required for system operation are also stored. The CPU 701, ROM 702, and RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0086] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as required. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as required, so that the computer program read from it can be installed into the storage section 708 as required.
[0087] In particular, according to an embodiment of the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication section 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, various functions defined in the system of the present application are executed.
[0088] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium, a computer-readable medium, or any combination of the two. The computer-readable medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable computer program is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program included on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0089] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. Among them, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above-mentioned module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0090] The units involved in the embodiments described in the present application can be implemented in software or in hardware, and the described units can also be provided in a processor. Among them, the names of these units do not constitute a limitation to the units themselves in some cases.
[0091] Another aspect of the present application also provides a computer-readable medium on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer is caused to execute the vehicle test task execution method as described above. The computer-readable medium can be included in the test device described in the above embodiments, or can exist separately without being assembled into the test device.
[0092] Another aspect of the present application also provides a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable medium. A processor of a computer device reads the computer instructions from the computer-readable medium, and the processor executes the computer instructions, causing the computer device to execute the vehicle test task execution methods provided in the above various embodiments.
[0093] The above embodiments are only used to exemplarily illustrate the principles and effects of the present application, rather than to limit the present application. Any person familiar with this technology can make modifications or changes to the above embodiments without departing from the spirit and scope of the present application. Therefore, all equivalent modifications or changes completed by those with ordinary knowledge in the technical field without departing from the spirit and technical ideas disclosed in the present application should still be covered by the claims of the present application.
Claims
1. A vehicle test task execution method, characterized in that: The method comprises: Acquire the test task information of the vehicle; the test task information includes the test task number, the execution time of the test task and the mutually exclusive task number; Using the mutually exclusive task numbers as combination constraints of the test task numbers, and sorting and combining the test task numbers according to the combination constraints to obtain a combination number sequence; Determine a target combination number sequence according to the total execution time of the test tasks in the combination number sequence; the test tasks in the target combination number sequence have a minimum total execution time; The test task is executed according to the target combination number sequence.
2. The vehicle test task execution method according to claim 1, characterized in that: According to the combination constraint condition, the test task numbers are sorted and combined to obtain a combination number sequence, comprising: Sorting the test task numbers in a random order to obtain multiple task number sequences; According to the combination constraint condition, the test task numbers in each task number sequence are combined to obtain a plurality of the combination number sequences.
3. The vehicle test task execution method according to claim 2, characterized in that: The process of determining the target combination number sequence according to the total execution time of the test tasks in the combination number sequence includes: According to the total execution time of the test tasks in the combination number sequence, the probability of the combination number sequence being selected is calculated; based on the probability of the combination number sequence being selected, an alternative number sequence is determined from the combination number sequence; the probability of the alternative number sequence being selected is negatively correlated with the total execution time of the test tasks in the alternative number sequence; the probability of the alternative number sequence being selected is greater than a preset probability threshold; Transform the candidate numbering sequence to obtain a plurality of transformed numbering sequences; and combine the test task numbers in each transformed numbering sequence according to the combination constraint condition to obtain a plurality of transformed combination sequences; calculate the probability of selection of the transformed combination sequence according to the total execution time of the test tasks in the transformed combination sequence; and re-determine the candidate numbering sequence from the transformed combination sequence based on the probability of selection of the transformed combination sequence; Continue to transform the re-determined candidate number sequence, and determine the candidate number sequence again based on the candidate number sequence after the continued transformation, until the number of transformations of the re-determined candidate number sequence reaches a preset number of iterations, thereby obtaining a final candidate number sequence; The number sequence with the greatest probability of being selected in the final candidate number sequence is used as the target combination number sequence.
4. The vehicle test task execution method according to claim 3, characterized in that: The process of transforming the candidate numbering sequence to obtain a plurality of transformed numbering sequences includes: Pairing the candidate number sequences according to a preset number of pairings to obtain a plurality of pairing sequence combinations; and performing a crossover operation on the test task numbers in different task number sequences in each pairing sequence combination to obtain a plurality of crossover number sequences; A mutation operation is performed on the test task numbers in each cross numbering sequence to obtain a plurality of the transformation numbering sequences.
5. The vehicle test task execution method according to claim 3, characterized in that: The process of calculating the selection probability of the combination number sequence according to the total execution time of the test tasks in the combination number sequence includes: Based on the total execution time of the test tasks in the combination number sequence, the fitness of the combination number sequence is calculated; the fitness of the combination number sequence is negatively correlated with the total execution time of the test tasks in the combination number sequence; Based on the fitness of the combination number sequence, the probability of the combination number sequence being selected is calculated; the probability of the combination number sequence being selected is positively correlated with the fitness of the combination number sequence.
6. The vehicle test task execution method according to any one of claims 1 to 5, characterized in that: If the target combination number sequence includes a test task number and a test task number combination, the process of executing the test task according to the target combination number sequence includes: Determine a first thread number according to the arrangement position of the test task number in the target combination number sequence; and establish a correspondence between the test case of the test task number and the first thread number, which is recorded as a first correspondence; Determine the second thread number according to the arrangement position of the test task number combination in the target combination number sequence; and establish a correspondence between the test case of each test task number in the test task number combination and the second thread number, recorded as a second correspondence; Merging the first corresponding relationship and the second corresponding relationship to obtain a corresponding relationship between thread numbers and test cases; The threads are started in the order of the thread numbers, and the test cases corresponding to the thread numbers are executed on the threads.
7. The vehicle test task execution method according to any one of claims 1 to 5, characterized in that: If the combination number sequence includes test task numbers and test task number combinations, before determining the target combination number sequence according to the total execution time of the test tasks in the combination number sequence, the method further includes: The longest execution time of all test tasks in the test task number combination is used as the execution time of the test task number combination; The test tasks corresponding to all the test task numbers in the combination number sequence are taken as the target test tasks; the execution time of the target test tasks and the execution time of all the test task number combinations in the combination number sequence are added together to obtain the total execution time of the test tasks in the combination number sequence.
8. A vehicle test task execution device, characterized in that: The device comprises: An information acquisition module is used to acquire the test task information of the vehicle; the test task information includes the test task number, the execution time of the test task and the mutually exclusive task number; A number combination module, used for taking the mutually exclusive task numbers as combination constraints of the test task numbers, and sorting and combining the test task numbers according to the combination constraints to obtain a combination number sequence; A sequence determination module, used to determine a target combination number sequence according to the total execution time of the test tasks in the combination number sequence; the test tasks in the target combination number sequence have a minimum total execution time; A task execution module is used to execute the test task according to the target combination number sequence.
9. A testing device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the test equipment to implement the vehicle test task execution method as described in any one of claims 1 to 7.
10. A vehicle, characterized in that: The vehicle includes the vehicle test task execution device according to claim 8 or the test equipment according to claim 9.