An artificial intelligence-based vehicle control unit automatic testing method and system
By automatically generating and filtering test cases using an AI-based test case generation model, the problem of low testing efficiency for vehicle controllers has been solved, achieving efficient and accurate automated testing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2026-03-17
AI Technical Summary
Existing vehicle controller testing methods are inefficient, have insufficient coverage, are difficult to control in terms of complexity, and have low execution efficiency, resulting in high testing costs, high error rates, and slow response times.
Using an artificial intelligence-based approach, test cases are automatically generated through a pre-trained test case generation model. These test cases are then evaluated and selected based on coverage, complexity, and execution efficiency to generate a test case set for automated testing.
This improved the comprehensiveness and accuracy of vehicle controller testing, increased testing efficiency and quality, and reduced testing costs.
Smart Images

Figure CN118795866B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automotive testing technology, and in particular to an automated testing method and system for vehicle controllers based on artificial intelligence. Background Technology
[0002] The vehicle controller analyzes the commands issued by the driver and the signals collected by sensors from various components to control the actions of lower-level component controllers, thereby realizing functions such as vehicle start-stop, driving control, fault handling, vehicle electrical management, and information interaction. Currently, testing of the vehicle controller mainly relies on manually writing test cases. This method suffers from problems such as low efficiency, insufficient coverage, difficulty in controlling complexity, and low execution efficiency, resulting in high testing costs, high error rates, and slow response times for the vehicle controller. Summary of the Invention
[0003] To address the aforementioned technical problems, the present invention aims to provide a highly efficient automated testing method and system for vehicle controllers based on artificial intelligence.
[0004] To achieve the above objectives, one aspect of this application proposes an automated testing method for vehicle controllers based on artificial intelligence, comprising the following steps:
[0005] Obtain the basic test information of the vehicle controller, preprocess the basic test information to obtain test case feature information;
[0006] The test case feature information is input into a pre-trained test case generation model to generate test cases.
[0007] The test cases are evaluated to obtain evaluation results, and then the test cases are filtered according to the evaluation results to obtain a test case set;
[0008] The vehicle controller is automatedly tested according to the test case set, and a test report is obtained.
[0009] The basic testing information includes functional requirements, interface information, and testing objectives, while the evaluation results include coverage evaluation value, complexity evaluation value, and execution efficiency evaluation value.
[0010] In some embodiments, the preprocessing of the test basic information to obtain test case feature information specifically includes:
[0011] The test basic information is segmented and filtered to obtain the first test case information;
[0012] Keyword extraction is performed on the first test case information to obtain the second test case information;
[0013] The second test case information is parsed and its relationships are extracted to obtain the third test case information;
[0014] The format of the third test case information is converted to obtain the test case feature information.
[0015] In some embodiments, the automated testing method for the vehicle controller further includes a step of pre-training the test case generation model, wherein pre-training the test case generation model specifically includes:
[0016] Acquire historical test data, which includes test cases that were successfully executed, executed invalidally, and under boundary conditions. Then, extract and label features of each test case to obtain a first test case sample.
[0017] The first test case sample is cleaned and formatted to obtain the second test case sample.
[0018] Determine the composite loss function and divide the second test case samples into a training set, a validation set, and a test set;
[0019] The preset deep neural network is trained using the training set according to the composite loss function to obtain the loss value;
[0020] The parameters of the deep neural network are adjusted based on the loss value using the validation set, and then the performance of the parameter-adjusted deep neural network is evaluated using the test set to obtain the test case generation model.
[0021] In some embodiments, the composite loss function includes a first loss function for training test case coverage, a second loss function for training test case complexity, and a third loss function for training test case execution efficiency.
[0022] In some embodiments, evaluating the test cases to obtain evaluation results, and then filtering the test cases based on the evaluation results to obtain a test case set, specifically includes:
[0023] The test cases are subjected to coverage analysis to obtain the coverage evaluation value, the test cases are subjected to complexity analysis to obtain the complexity evaluation value, and the test cases are subjected to execution efficiency analysis to obtain the execution efficiency evaluation value.
[0024] The evaluation metrics for the test cases are determined, and then the test cases are screened and adjusted based on the coverage evaluation value, the complexity evaluation value, the execution efficiency evaluation value, and the evaluation metrics to obtain the test case set.
[0025] In some embodiments, the evaluation metrics include a coverage threshold, a complexity threshold, and an execution efficiency threshold. The step of filtering and adjusting the test cases based on the coverage evaluation value, the complexity evaluation value, the execution efficiency evaluation value, and the evaluation metrics specifically includes:
[0026] If the coverage evaluation value of the test case is lower than the coverage threshold, the corresponding test case is deleted.
[0027] When the complexity evaluation value of the test case is higher than the complexity threshold, add corresponding test cases according to the complex code segment of the corresponding test case;
[0028] When the execution efficiency evaluation value of the test case is lower than the execution efficiency threshold, the execution order of the corresponding test cases is adjusted.
[0029] In some embodiments, the step of performing automated testing on the vehicle controller according to the test case set and obtaining a test report specifically includes:
[0030] Identify the testing tools, and then configure the testing tools;
[0031] The test case set is executed using the configured testing tool, and the test results and exceptions during the execution process are recorded.
[0032] The test report is generated based on the test results and the abnormal situations.
[0033] To achieve the above objectives, another aspect of this application proposes an automated testing system for vehicle controllers based on artificial intelligence, comprising:
[0034] The feature extraction module is used to obtain the basic test information of the vehicle controller, and to preprocess the basic test information to obtain test case feature information.
[0035] The test case generation module is used to input the test case feature information into a pre-trained test case generation model to generate test cases.
[0036] An evaluation and screening module is used to evaluate the test cases, obtain evaluation results, and then screen the test cases based on the evaluation results to obtain a test case set.
[0037] An automated testing module is used to perform automated testing on the vehicle controller according to the test case set and obtain a test report.
[0038] The basic testing information includes functional requirements, interface information, and testing objectives, while the evaluation results include coverage evaluation value, complexity evaluation value, and execution efficiency evaluation value.
[0039] To achieve the above objectives, another aspect of this application provides an electronic device, which includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for enabling communication between the processor and the memory. When the program is executed by the processor, it implements the automated testing method for a vehicle controller based on artificial intelligence as described above.
[0040] To achieve the above objectives, another aspect of the embodiments of this application proposes a storage medium, which is a computer-readable storage medium for computer-readable storage. The storage medium stores one or more programs, which can be executed by one or more processors to implement the artificial intelligence-based automated testing method for vehicle controllers as described above.
[0041] The beneficial effects of this invention are as follows: The automated testing method and system for vehicle controllers based on artificial intelligence automatically generates test cases according to the functional requirements, interface information, and testing objectives of the vehicle controller using a test case generation model trained based on artificial intelligence algorithms. The generated test cases are then evaluated and filtered to obtain a test case set. Finally, the vehicle controller is automatedly tested using this test case set. This invention utilizes artificial intelligence algorithms to automatically generate test cases for the vehicle controller and filters and adjusts them based on coverage, complexity, and execution efficiency. This enables intelligent generation and optimization of test cases, effectively improving the comprehensiveness and accuracy of vehicle controller testing, as well as increasing testing efficiency and quality, shortening the testing cycle, and reducing testing costs. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the embodiments of the present invention are described below. It should be understood that the drawings described below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 A flowchart illustrating the steps of an automated testing method for a vehicle controller based on artificial intelligence, provided in an embodiment of the present invention;
[0044] Figure 2 A flowchart illustrating the steps for obtaining test case feature information provided in this embodiment of the invention;
[0045] Figure 3 A flowchart illustrating the training process of the test case generation model provided in this embodiment of the invention;
[0046] Figure 4 A flowchart of step S103 provided in an embodiment of the present invention;
[0047] Figure 5 A flowchart of step S1032 provided in an embodiment of the present invention;
[0048] Figure 6 Another flowchart of step S1032 provided in an embodiment of the present invention;
[0049] Figure 7 Another flowchart of step S1032 provided in an embodiment of the present invention;
[0050] Figure 8 A flowchart of step S104 provided in an embodiment of the present invention;
[0051] Figure 9 A flowchart illustrating an automated testing method for a vehicle controller based on artificial intelligence, provided in an embodiment of the present invention;
[0052] Figure 10 A schematic diagram of the structure of an automated testing system for a vehicle controller based on artificial intelligence, provided in an embodiment of the present invention;
[0053] Figure 11 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0055] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various concepts, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words “if,” “when,” or “in response to a determination” as used herein may be interpreted as “when…” or “when…” or “in response to a determination.”
[0056] As used in this application, the terms "at least one", "multiple", "each", "any", etc., "at least one" includes one, two or more, "multiple" includes two or more, "each" refers to each of the corresponding multiples, and "any" refers to any one of the multiples.
[0057] The vehicle controller analyzes the commands issued by the driver and the signals collected by sensors from various components to control the actions of lower-level component controllers, thereby realizing functions such as vehicle start-stop, driving control, fault handling, vehicle electrical management, and information interaction. Currently, testing of the vehicle controller mainly relies on manually writing test cases. This method suffers from problems such as low efficiency, insufficient coverage, difficulty in controlling complexity, and low execution efficiency, resulting in high testing costs, high error rates, and slow response times for the vehicle controller.
[0058] To address this, this invention proposes an automated testing method for vehicle controllers based on artificial intelligence. A test case generation model trained using AI algorithms automatically generates test cases based on the functional requirements, interface information, and testing objectives of the vehicle controller. These generated test cases are then evaluated and filtered to obtain a test case set. Finally, the vehicle controller is automatedly tested using this test case set. This invention utilizes AI algorithms to automatically generate test cases for the vehicle controller and filters and adjusts them based on coverage, complexity, and execution efficiency. This enables intelligent generation and optimization of test cases, effectively improving the comprehensiveness and accuracy of vehicle controller testing, as well as increasing testing efficiency and quality, shortening the testing cycle, and reducing testing costs. This automated testing method for vehicle controllers can be applied to scenarios such as autonomous driving testing, vehicle networking function testing, and battery management system testing, but is not limited to these.
[0059] Reference Figure 1 , Figure 1 This invention provides a flowchart of an automated testing method for a vehicle controller based on artificial intelligence, comprising steps S101 to S104.
[0060] S101. Obtain the test basic information of the vehicle controller, preprocess the test basic information, and obtain the test case feature information;
[0061] Among them, the test basic information includes functional requirements, interface information, and test objectives.
[0062] Furthermore, the test basic information of the vehicle controller includes all the functional requirements of the vehicle controller, test objectives, and interface information between the vehicle controller and other vehicle systems. Among them, the functional requirements include at least one of start-stop control logic, driving control strategies (such as acceleration, deceleration, steering, etc.), fault handling mechanisms (such as fault diagnosis, recovery strategies, etc.), on-vehicle electrical appliance management (such as air conditioning, audio, seats, etc.), and information interaction protocols (such as CAN bus communication, in-vehicle network, etc.). The interface information includes at least one of communication interfaces, data formats, interaction protocols, and dependency relationships and constraint conditions between interfaces. The test objectives include at least one of verifying the correctness of function points, evaluating performance indicators (such as response time, resource consumption, etc.), and detecting security vulnerabilities.
[0063] Refer to Figure 2 , Figure 2 For the flowchart of the steps for obtaining the test case feature information provided by the embodiments of the present invention, further as an optional implementation manner, the step of preprocessing the test basic information to obtain the test case feature information can be specifically divided into the following steps S1011 to S1014:
[0064] S1011. Segment and filter the test basic information to obtain the first test case information;
[0065] Exemplarily, word segmentation tools such as jieba, HanLP, and SnowNLP can be used to segment the test basic information into words or phrases, and then stop words in the test basic information, such as meaningless words like "de" (的) and "le" (了), are removed to reduce the complexity of subsequent processing and obtain the first test case information.
[0066] S1012. Extract keywords from the first test case information to obtain the second test case information;
[0067] Exemplarily, text processing algorithms such as TF-IDF and TextRank can be used to extract keywords and phrases in the first test case information, such as "vehicle speed control", "engine management", "brake system", etc., to obtain the second test case information.
[0068] S1013. Parse the structure and extract relationships from the second test case information to obtain the third test case information;
[0069] For example, syntactic analysis tools such as spaCy and Stanford Parser can be used to parse the sentence structure in the second test case information, identifying sentence components such as subject, predicate, and object. For instance, in the sentence "The controller needs to ensure that the engine speed is maintained at 2000 rpm," "controller" is the executor, and "engine speed maintained at 2000 rpm" is the specific content of the action, where "engine speed" is part of the object, and "maintained at 2000 rpm" is the complement of the object. After structural parsing, the entities in the second test case information (such as vehicle controller, vehicle speed, etc.) and their relationships (such as control, monitoring, etc.) are identified, and semantic role labeling technology is used to identify these relationships to obtain the third test case information.
[0070] S1014. Convert the format of the third test case information to obtain the test case feature information.
[0071] Specifically, the third test case information needs to be converted into a format that the artificial intelligence model can understand to obtain test case feature information.
[0072] S102. Input the test case feature information into the pre-trained test case generation model to generate test cases;
[0073] Specifically, an artificial intelligence algorithm is used to train a test case generation model. Based on this trained model, the collected test case feature information is processed to obtain the test cases. This embodiment of the invention automatically generates test cases for the vehicle controller using a test case generation model trained with an artificial intelligence algorithm. This effectively reduces the manual workload of designing test cases for the vehicle controller and improves the efficiency of test case generation.
[0074] Reference Figure 3 , Figure 3 The flowchart for training the test case generation model provided in this embodiment of the invention is shown. Further, as an optional implementation, the automated testing method for the vehicle controller also includes a step of pre-training the test case generation model. This step of pre-training the test case generation model can be specifically divided into the following steps C1021 to C1025:
[0075] C1021. Obtain historical test data, which includes test cases of successful execution, invalid execution, and boundary conditions. Then, extract and label the features of each test case to obtain the first test case sample.
[0076] Specifically, historical test data is collected extensively from historical test projects, including successfully executed test cases, failed test cases, and boundary condition test cases, to improve the comprehensiveness of the model. Then, features are extracted from each test case, including its validity (success or failure), the functional points covered (such as engine start, brake response, etc.), complexity (such as the number of input parameters and the number of execution steps of the test case), and execution time. The extracted features are then labeled to obtain the first test case sample.
[0077] C1022. Clean and format the first test case sample to obtain the second test case sample;
[0078] Specifically, duplicate, incomplete, or inconsistently formatted test cases are removed from the first test case sample, and then the first test case sample is formatted into a uniform representation to obtain the second test case sample.
[0079] C1023. Determine the composite loss function and divide the second test case samples into a training set, a validation set, and a test set;
[0080] As an optional implementation, the composite loss function includes a first loss function for training test case coverage, a second loss function for training test case complexity, and a third loss function for training test case execution efficiency.
[0081] Specifically, the accuracy of the model's recognition results can be measured by a loss function, which is defined on a single training data point and used to measure the prediction error of that training data. Specifically, the loss value of that training data is determined by the label of that single training data point and the model's prediction result for that training data. In this embodiment of the invention, a training set contains a large amount of training data. Therefore, a coverage loss (i.e., the first loss function) is used to encourage the generated test cases to cover more functional points, a complexity loss (i.e., the second loss function) is used to control the complexity of the test cases, and a validity loss (i.e., the third loss function) is used to suppress invalid test cases.
[0082] C1024. Train the preset deep neural network using the training set and the composite loss function to obtain the loss value;
[0083] C1025. The parameters of the deep neural network are adjusted based on the loss value using the validation set, and then the performance of the parameter-adjusted deep neural network is evaluated using the test set to obtain the test case generation model.
[0084] Specifically, during model training, a composite loss function is used to calculate the prediction error of the model on the training set to obtain the loss value. Then, based on the training loss value, the backpropagation algorithm is used on the validation set to iteratively update the model parameters. Finally, the performance of the model is evaluated using the test set to obtain the trained test cases to generate the model.
[0085] Those skilled in the art will understand that deep neural networks can employ convolutional neural networks, recurrent neural networks, long short-term memory networks, and generative adversarial networks, among others. For example, a deep neural network can be a generative adversarial network.
[0086] S103. Evaluate the test cases, obtain the evaluation results, and then filter the test cases based on the evaluation results to obtain a test case set;
[0087] The evaluation results include coverage evaluation value, complexity evaluation value, and execution efficiency evaluation value.
[0088] Specifically, the embodiments of the present invention consider the coverage, complexity, and execution efficiency of test cases, and evaluate, filter, and adjust the test cases automatically generated by the model. This not only allows for the selection of test cases that cover more functional points based on the coverage evaluation value, thus improving the comprehensiveness of the tests, but also allows for the addition of test cases for complex code segments or insufficiently covered requirements. At the same time, it can also effectively improve the execution efficiency of test cases, thereby further improving the accuracy and quality of test cases.
[0089] Reference Figure 4 , Figure 4 The flowchart of step S103 provided in the embodiment of the present invention is further illustrated as an optional implementation. The step of evaluating test cases, obtaining evaluation results, and then filtering test cases based on the evaluation results to obtain a test case set can be specifically divided into the following steps S1031 and S1032:
[0090] S1031. Perform coverage analysis on the test cases to obtain coverage evaluation values, perform complexity analysis on the test cases to obtain complexity evaluation values, and perform execution efficiency analysis on the test cases to obtain execution efficiency evaluation values.
[0091] Furthermore, coverage analysis includes requirement coverage analysis, functional coverage analysis, scenario coverage analysis, path coverage analysis, and code coverage analysis of the test cases generated by the model. Requirement coverage analysis calculates the ratio of the number of requirement points covered by test cases to the total number of requirement points; functional coverage analysis calculates the number of test cases for each functional module and compares them with the corresponding functional module test requirements to calculate functional coverage; scenario coverage analysis calculates the degree to which test cases cover software usage scenarios, such as normal operation, exception handling, and boundary conditions; path coverage analysis counts all possible paths of the program and calculates the number of test cases for each path; and code coverage analysis calculates the ratio of the number of lines of code actually executed by test cases to the total number of lines of code. Finally, a coverage evaluation value is generated based on the above analysis results. Complexity analysis evaluates the complexity of algorithms or code segments, generating a complexity evaluation value to predict their execution time and resource consumption, and helping testers identify potential performance bottlenecks or difficult-to-test code segments. By analyzing the execution efficiency, the time consumed by each test case from start to finish is statistically analyzed, and the average execution time and longest execution time of all test cases are calculated. Then, an execution efficiency evaluation value is generated based on the average execution time of all test cases and the execution time of a single test case.
[0092] S1032. Determine the evaluation metrics for test cases, and then filter and adjust the test cases based on the coverage evaluation value, complexity evaluation value, execution efficiency evaluation value, and evaluation metrics to obtain a test case set.
[0093] As an optional implementation, the evaluation metrics include coverage threshold, complexity threshold, and execution efficiency threshold. The step of filtering and adjusting test cases based on coverage evaluation value, complexity evaluation value, execution efficiency evaluation value, and evaluation metrics can be specifically divided into the following steps S10321 to S10323:
[0094] S10321. When the coverage evaluation value of a test case is lower than the coverage threshold, delete the corresponding test case.
[0095] S10322. When the complexity evaluation value of a test case is higher than the complexity threshold, add corresponding test cases based on the complex code segment of the corresponding test case.
[0096] S10323. When the execution efficiency evaluation value of a test case is lower than the execution efficiency threshold, adjust the execution order of the corresponding test cases.
[0097] Specifically, based on the results of coverage and complexity analysis, test cases are selected and adjusted to improve test case coverage and execution efficiency. For example... Figure 5The diagram shows a flowchart of step S1032 provided in an embodiment of the present invention. When the coverage evaluation value of a test case is lower than the coverage threshold, test cases that contribute little to the coverage are deleted to reduce testing burden and resource waste; Figure 6 The diagram shows another step flowchart of step S1032 provided in an embodiment of the present invention. When the complexity evaluation value of a test case is higher than the complexity threshold, corresponding test cases are added for complex code segments or insufficiently covered requirements to improve the comprehensiveness of the test cases; such as Figure 7 The diagram shows another step flowchart of step S1032 provided in an embodiment of the present invention. When the execution efficiency evaluation value of a test case is lower than the execution efficiency threshold, the execution order of the test cases is rearranged according to the dependencies between the test cases and the expected execution time. For example, test cases with longer execution times are scheduled to be executed during periods of low resource usage, or interdependent test cases are executed consecutively to reduce context switching overhead.
[0098] Those skilled in the art will understand that the coverage threshold, complexity threshold, and execution efficiency threshold can be set according to the functional requirements, code structure, and resource utilization of the vehicle controller.
[0099] S104. Perform automated testing on the vehicle controller based on the test case set and obtain a test report.
[0100] Reference Figure 8 , Figure 8 The flowchart of step S104 provided in this embodiment of the invention is further illustrated as an optional implementation. The step of performing automated testing on the vehicle controller based on a test case set to obtain a test report can be specifically divided into the following steps S1041 to S1043:
[0101] S1041. Determine the testing tool and then configure the testing tool;
[0102] For example, testing tools such as CANoe, Vector DA VINCI, and LabVIEW can be used to simulate a vehicle network environment, send and receive CAN messages, and set up the hardware and software environment required for testing, including the vehicle controller, simulator, and test computer.
[0103] S1042. Execute the test case set using the configured testing tools, and record the test results and exceptions during the execution process;
[0104] Specifically, the test case set is imported into the testing tool, and the test cases in the test case set are executed by the automated testing tool. The testing tool automatically sends test instructions to the vehicle controller and receives the response from the vehicle controller. During the test, the monitoring function of the testing tool is used to observe the response and behavior of the vehicle controller in real time, and the execution results of each test case, as well as the corresponding response time and data, are recorded. If any anomalies or errors occur during the test, these anomalies are captured and recorded, including error codes, error messages, and the test cases that malfunctioned.
[0105] S1043. Generate a test report based on the test results and any abnormal situations.
[0106] Specifically, the successful test cases, failed test cases, and captured anomalies recorded during the testing process are organized. Then, the organized results are analyzed in depth to identify potential problems or defects in the vehicle controller and determine their severity and priority. Finally, based on the results of the in-depth analysis, a test report is written, including the execution status of test cases, defect reports, test coverage, test conclusions, and recommendations.
[0107] In summary, the process of the AI-based automated testing method for vehicle controllers is as follows: Figure 9 As shown:
[0108] D100. Collect basic test data for the vehicle controller, including functional requirements, interface information, and test objectives.
[0109] D200: Automatically generates test cases using a pre-trained test case generation model based on artificial intelligence algorithms;
[0110] D300: Evaluate and optimize the generated test cases, including test case coverage, complexity, and execution efficiency;
[0111] D400. Based on the evaluation results, the test cases are screened and adjusted to generate the final test case set;
[0112] D500: Use the generated test case set to perform automated testing of the vehicle controller.
[0113] The above describes the automated testing method for vehicle controllers based on artificial intelligence according to embodiments of the present invention. It can be recognized that, compared with prior art vehicle controller testing methods, embodiments of the present invention have the following advantages:
[0114] First, using artificial intelligence algorithms to automatically generate test cases can reduce the manual workload of vehicle controller testing, improve the efficiency of test case generation, and reduce testing costs.
[0115] Second, by filtering and adjusting the test cases generated by the model based on the coverage, complexity, and execution efficiency of the test cases, the comprehensiveness and accuracy of the tests can be effectively improved, thereby increasing the testing efficiency and quality of the vehicle controller.
[0116] Third, test cases can be automatically updated to adapt to the iterative updates of the vehicle controller's functions, reducing the difficulty of test case maintenance.
[0117] Reference Figure 10 This invention also provides an automated testing system for vehicle controllers based on artificial intelligence, comprising:
[0118] The feature extraction module is used to obtain the basic test information of the vehicle controller, preprocess the basic test information, and obtain the test case feature information.
[0119] The test case generation module is used to input test case feature information into a pre-trained test case generation model to generate test cases;
[0120] The evaluation and screening module is used to evaluate test cases, obtain evaluation results, and then screen test cases based on the evaluation results to obtain a test case set;
[0121] The automated testing module is used to perform automated testing on the vehicle controller based on a set of test cases and generate a test report.
[0122] The basic testing information includes functional requirements, interface information, and testing objectives. The evaluation results include coverage evaluation value, complexity evaluation value, and execution efficiency evaluation value.
[0123] The content of the above-described embodiments of the automated testing method for vehicle controllers based on artificial intelligence is applicable to the embodiments of the automated testing system for vehicle controllers based on artificial intelligence. The specific functions implemented by the embodiments of the automated testing system for vehicle controllers based on artificial intelligence are the same as those of the above-described embodiments of the automated testing method for vehicle controllers based on artificial intelligence, and the beneficial effects achieved are also the same as those achieved by the above-described embodiments of the automated testing method for vehicle controllers based on artificial intelligence.
[0124] This invention also provides an electronic device, comprising: a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for communication between the processor and the memory. When the program is executed by the processor, it implements the aforementioned automated testing method for a vehicle controller based on artificial intelligence. This electronic device can be any intelligent terminal, including tablet computers, in-vehicle computers, etc.
[0125] like Figure 11The diagram shown is a hardware structure schematic of an electronic device provided in an embodiment of the present invention. (Refer to...) Figure 11 This invention provides an electronic device, comprising:
[0126] The processor 1001 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention.
[0127] The memory 1002 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 1002 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1002 and is called and executed by the processor 1001 to execute the AI-based automated testing method for vehicle controllers according to the embodiments of this invention.
[0128] Input / output interface 1003 is used to implement information input and output;
[0129] The communication interface 1004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0130] Bus 1005 transmits information between various components of the device (e.g., processor 1001, memory 1002, input / output interface 1003, and communication interface 1004);
[0131] The processor 1001, memory 1002, input / output interface 1003 and communication interface 1004 are connected to each other within the device via bus 1005.
[0132] This invention also provides a storage medium, which is a computer-readable storage medium for computer-readable storage. The storage medium stores one or more programs, which can be executed by one or more processors to implement the above-described automated testing method for vehicle controllers based on artificial intelligence.
[0133] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0134] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform... Figure 1 The method shown.
[0135] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the aforementioned blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this invention are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.
[0136] Furthermore, although the invention has been described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the aforementioned functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the invention. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional skill of an engineer. Therefore, those skilled in the art can implement the invention as set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of the invention, which is determined by the full scope of the appended claims and their equivalents.
[0137] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0138] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0139] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the aforementioned program can be printed, because the aforementioned program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or, if necessary, processing in other suitable ways, and then stored in computer memory.
[0140] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0141] In the foregoing description of this specification, references to terms such as "one embodiment," "another embodiment," or "some embodiments" indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of the present invention. In this specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0142] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
[0143] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.
Claims
1. An artificial intelligence-based vehicle control unit automatic test method, characterized by, The method comprises the following steps: obtaining test basic information of a vehicle control unit, preprocessing the test basic information to obtain test case feature information; inputting the test case feature information into a pre-trained test case generation model to generate a test case; evaluating the test case to obtain an evaluation result, and then screening the test case according to the evaluation result to obtain a test case set; automatically testing the vehicle control unit according to the test case set to obtain a test report; wherein the test basic information comprises functional requirements, interface information and test targets, and the evaluation result comprises coverage evaluation values, complexity evaluation values and execution efficiency evaluation values; the evaluation of the test case to obtain an evaluation result, and then screening the test case according to the evaluation result to obtain a test case set, specifically comprising: performing coverage analysis on the test case to obtain the coverage evaluation values, performing complexity analysis on the test case to obtain the complexity evaluation values, and performing execution efficiency analysis on the test case to obtain the execution efficiency evaluation values; determining evaluation indexes of the test case, and then screening and adjusting the test case according to the coverage evaluation values, the complexity evaluation values, the execution efficiency evaluation values and the evaluation indexes to obtain the test case set; the evaluation indexes comprise coverage thresholds, complexity thresholds and execution efficiency thresholds, and the screening and adjustment of the test case according to the coverage evaluation values, the complexity evaluation values, the execution efficiency evaluation values and the evaluation indexes specifically comprise: when the coverage evaluation value of the test case is lower than the coverage threshold, deleting the corresponding test case; when the complexity evaluation value of the test case is higher than the complexity threshold, adding a corresponding test case according to a complex code segment of the corresponding test case; when the execution efficiency evaluation value of the test case is lower than the execution efficiency threshold, adjusting the execution order of the corresponding test case.
2. The artificial intelligence-based vehicle control unit automatic test method according to claim 1, wherein the preprocessing of the test basic information to obtain test case feature information specifically comprises: performing word segmentation and filtering on the test basic information to obtain first test case information; performing keyword extraction on the first test case information to obtain second test case information; performing structure analysis and relationship extraction on the second test case information to obtain third test case information; performing format conversion on the third test case information to obtain the test case feature information.
3. The artificial intelligence-based vehicle control unit automatic test method of claim 1, wherein The vehicle control unit automatic testing method further comprises the step of pre-training the test case generation model, and the pre-training of the test case generation model specifically comprises: obtaining historical test data, wherein the historical test data comprises test cases of successful execution, invalid execution and boundary conditions, and then performing feature extraction and labeling on each test case to obtain first test case samples; performing cleaning and formatting processing on the first test case samples to obtain second test case samples; Determine a composite loss function, and divide the second test case sample into a training set, a validation set, and a test set; Train a preset deep neural network according to the composite loss function through the training set, to obtain a loss value; Adjust parameters of the deep neural network according to the loss value through the validation set, and then evaluate performance of the deep neural network after parameter adjustment through the test set, to obtain the test case generation model.
4. The artificial intelligence-based vehicle control unit automatic test method of claim 3, wherein, The composite loss function includes a first loss function for training test case coverage, a second loss function for training test case complexity, and a third loss function for training test case execution efficiency.
5. The artificial intelligence-based vehicle control unit automatic test method according to any one of claims 1 to 4, characterized in that, The automatic testing of the whole vehicle controller according to the test case set to obtain a test report specifically includes: Determine a test tool, and then configure the test tool; Execute the test case set through the configured test tool, and record test results and abnormal situations in the execution process; Generate the test report according to the test results and the abnormal situations.
6. An artificial intelligence-based automatic test system for a vehicle control unit, characterized by It includes: A feature extraction module for obtaining test basic information of the whole vehicle controller, pre-processing the test basic information, and obtaining test case feature information; A test case generation module for inputting the test case feature information into a pre-trained test case generation model to generate test cases; An evaluation and screening module for evaluating the test cases to obtain evaluation results, and then screening the test cases according to the evaluation results to obtain a test case set; An automatic testing module for automatically testing the whole vehicle controller according to the test case set to obtain a test report; The test basic information includes functional requirements, interface information, and test targets, and the evaluation results include coverage evaluation values, complexity evaluation values, and execution efficiency evaluation values; The evaluation and screening of the test cases to obtain a test case set specifically includes: Perform coverage analysis on the test cases to obtain the coverage evaluation values, perform complexity analysis on the test cases to obtain the complexity evaluation values, and perform execution efficiency analysis on the test cases to obtain the execution efficiency evaluation values; Determine evaluation indexes of the test cases, and then screen and adjust the test cases according to the coverage evaluation values, the complexity evaluation values, the execution efficiency evaluation values, and the evaluation indexes to obtain the test case set; The evaluation indexes include coverage thresholds, complexity thresholds, and execution efficiency thresholds, and the screening and adjustment of the test cases according to the coverage evaluation values, the complexity evaluation values, the execution efficiency evaluation values, and the evaluation indexes specifically include: When the coverage evaluation value of the test case is lower than the coverage threshold, the corresponding test case is deleted; When the complexity evaluation value of the test case is higher than the complexity threshold, corresponding test cases are added according to complex code segments of the corresponding test case; When the execution efficiency evaluation value of the test case is lower than the execution efficiency threshold, the execution order of the corresponding test case is adjusted.
7. An electronic device, comprising: The electronic device includes a memory, a processor, a program stored on the memory and executable on the processor, and a data bus for realizing connection communication between the processor and the memory, and the program, when executed by the processor, realizes the steps of the artificial intelligence-based automatic test method of the vehicle control unit as claimed in any one of claims 1 to 5.
8. A storage medium, the storage medium being a computer-readable storage medium for computer-readable storage, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to realize the steps of the artificial intelligence-based automatic test method of the vehicle control unit as claimed in any one of claims 1 to 5.
Citation Information
Patent Citations
Test case generation method and device, terminal equipment and readable storage medium
CN117707922A
Vehicle control unit diagnosis test method, device and equipment and storage medium
CN117950391A