An automated testing method and system for automotive electronic control units
By standardizing and analyzing test requirements and building an automated test platform, a closed-loop test environment is constructed, which solves the problem of low automation in ECU automated testing, achieves efficient and accurate test result generation and batch adaptation, and reduces costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI ZHIJIE NEW ENERGY VEHICLE CO LTD
- Filing Date
- 2026-03-31
- Publication Date
- 2026-06-30
Smart Images

Figure CN122308329A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automotive electronics testing technology, and discloses an automated testing method and system for automotive electronic control units. Background Technology
[0002] The automotive electronic control unit (ECU) is a core component of the vehicle's overall control system. Its functional stability, logical accuracy, and robustness directly determine the vehicle's driving safety and user experience. With the development of automotive electronics technology, the functional complexity of ECUs is constantly increasing, and the corresponding testing requirements are becoming increasingly diverse. Currently, the analysis of requirements and generation of test cases for automated testing of automotive ECUs are highly dependent on manual processes, and the output test cases lack a standardized architecture. There is no standardized automatic conversion path from test cases to executable scripts, relying on manual coding and development. This results in poor script reusability, long development cycles, and difficulty in achieving efficient batch conversion. Most test cases use open-loop static test environments, which cannot dynamically inject test parameters according to script execution requirements. The test environment and script have low matching degree, and cannot simulate the closed-loop interactive conditions of ECU operation in real vehicles. The test results deviate significantly from the actual vehicle state. The test execution process cannot achieve full-process data synchronous acquisition with time-series markers, and can only complete post-event result comparison. It cannot achieve real-time verification of test data and expected results, and the identification of abnormal conditions is lagging. Summary of the Invention
[0003] This invention addresses the technical problems of low automation, insufficient timing accuracy, and weak closed-loop testing capabilities in existing technologies. Therefore, this invention provides an automated testing method and system for automotive electronic control units.
[0004] To achieve the above-mentioned technical effects, the technical solution adopted by the present invention is: an automated testing method for automotive electronic control units, comprising the following steps: S1: Analyze the test requirements to obtain a set of test cases containing the operation sequence, triggering conditions, and expected results; S2: Based on the test case set, the test case set is transformed through the programming interface of the automated testing platform to obtain an executable script; S3: Based on the execution requirements of the executable script, inject dynamic test parameters to obtain a closed-loop test environment that matches the executable script; S4: In the closed-loop test environment, the executable script is executed to synchronously collect data throughout the entire test process, obtaining test data with time-series markers; the test data is compared with the expected results in real time to obtain real-time test verification results; S5: Process and analyze the test data and the real-time test verification results to obtain a structured test report.
[0005] As a preferred embodiment, step S1 includes: S11: Extract key features from the test scenario corresponding to the test requirements to obtain the bus type, test target, and prerequisites; S12: Based on the bus type and test target, parse the database file in the format corresponding to the bus type to obtain the signal path and verification logic; S13: Based on the test objective, the preconditions, the signal path and the verification logic, integrate and generate the test case set; The bus type includes at least one of CAN, CANFD, LIN, and automotive Ethernet, and the database file includes DBC, LDF, and A2L format files that match the bus type.
[0006] As a preferred embodiment, step S2 includes: S21: Load the database file through the COM programming interface of the automated testing platform, configure the hardware channel parameters determined by the bus type and the test target, and obtain the mapping relationship between the executable script and the underlying functions of the automated testing platform; S22: Based on the test case set and the mapping relationship, decompose the operation sequence, triggering conditions and expected results of the test case set to obtain the smallest unit of test execution; S23: The smallest execution unit is encapsulated through the script programming interface of the automated testing platform to obtain an executable function; S24: Based on the triggering conditions and the expected results, combine the executable functions to obtain an executable script.
[0007] As a preferred embodiment, step S3 includes: S31: Based on the hardware channel parameters, the ECU power-on / power-off process and abnormal ECU voltage conditions are simulated by a programmable power supply to obtain a power supply environment that meets the test requirements; S32: Based on the bus type, inject the bus physical layer fault type determined by the bus type and the test target through the communication device to complete the configuration of the dynamic test parameters; S33: Based on the power supply environment and dynamic test parameters, the operating conditions of the automotive electronic control unit are simulated using vehicle simulation software to obtain the closed-loop test environment.
[0008] As a preferred embodiment, step S4 includes: S41: The execution timing is obtained by controlling the transmission order of the signals corresponding to the executable script through a timer; S42: Execute the executable script according to the execution sequence to obtain the test data.
[0009] As a preferred embodiment, step S5 includes: S51: Integrate and analyze the test data and real-time test verification results to obtain the root cause of test failure; S52: Based on the root cause of the test failure, backtrack the entire test process to obtain the problem tracing results corresponding to the root cause of the test failure. S53: Based on the root causes of the test failures and the results of the problem tracing, integrate and generate the structured test report.
[0010] As a preferred implementation, the timer mechanism uses threading.Timer to achieve timing control with an accuracy of no less than 1ms. When the real-time test verification result is abnormal, the test process is paused or an abnormality is marked.
[0011] As a preferred embodiment, the dynamic test parameters include at least one of power supply anomaly parameters, bus communication fault parameters, and signal delay and packet loss parameters.
[0012] As a preferred implementation, the structured test report includes test case execution status, a list of failed test cases, root cause analysis of failures, test coverage statistics, and issue tracing information.
[0013] This invention also proposes an automated testing system for automotive electronic control units, comprising: The test requirement parsing module is used to parse test requirements and obtain a set of test cases containing operation sequences, triggering conditions, and expected results. The script conversion module is used to convert the test case set into an executable script through the programming interface of the automated testing platform. The closed-loop test environment construction module is used to inject dynamic test parameters according to the running requirements of the executable script to obtain a closed-loop test environment that matches the executable script. The test execution and verification module is used to execute the executable script in the closed-loop test environment, synchronously collect data throughout the entire test process, obtain test data with time-series markers, and compare the test data with the expected results in real time to obtain real-time test verification results. The test report generation module is used to process and analyze the test data and the real-time test verification results to obtain a structured test report.
[0014] Compared with the prior art, this invention automatically outputs a set of test cases containing all core elements such as operation sequence, triggering conditions and expected results by standardizing the analysis of test requirements. This completely eliminates the strong dependence on manually written test cases, solves the problems of poor consistency and uncontrollable coverage of manual test cases, and greatly improves the standardization and generation efficiency of test cases, adapting to the batch testing needs of ECU with multiple versions and rapid iterations. By using the standardized programming interface of the automated testing platform, the automated conversion path from test cases to executable scripts is opened up, eliminating the need for manual coding development, eliminating the differences in specifications and logical defects in manual development, and significantly shortening the script development cycle; at the same time, through standardized function encapsulation, the cross-platform and cross-vehicle reusability of test scripts is significantly improved.
[0015] Based on the execution requirements of the executable script, dynamic test parameters can be injected in a targeted manner to automatically build a closed-loop test environment that is completely matched with the test script. This realistically simulates the vehicle interaction conditions and abnormal scenarios of the ECU running in a real vehicle, completely solving the problem of the disconnect between open-loop static environment test results and real vehicle scenarios, and greatly improving the authenticity and effectiveness of test results.
[0016] During test execution, the entire test process is synchronously collected, and test data with timing tags is output to fully restore the signal interaction and timing logic of the test process. At the same time, the test data is compared with the expected results in real time, and abnormal conditions can be identified and marked in a timely manner. With timing control with an accuracy of no less than 1ms, the synchronization of multi-bus communication and the repeatability of the test process are ensured, which greatly improves the accuracy of test results.
[0017] It can automatically process and deeply analyze test data and real-time verification results, automatically locate the root cause of test failures and complete the entire process of problem tracing, and directly output a structured test report containing test case execution status, root cause analysis, coverage statistics and tracing information, eliminating the inefficient mode of manual data processing and report writing, while meeting the functional safety compliance requirements of the automotive industry for traceable testing process and quantifiable results.
[0018] It natively supports unified adaptation of multiple protocol buses such as CAN, CANFD, LIN, and automotive Ethernet. Through an open architecture that decouples software and hardware, it reduces dependence on specific commercial software and closed hardware ecosystems, supports flexible adaptation and unified scheduling of heterogeneous hardware resources, avoids the repeated investment in dedicated test equipment, and significantly reduces the construction and maintenance costs of the test system. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating the automated testing method for automotive electronic control units according to the present invention. Figure 2This is a schematic diagram of the module structure of the automated testing system for automotive electronic control units of the present invention.
[0020] In the diagram: 1. Test requirements analysis module, 2. Script conversion module, 3. Closed-loop test environment construction module, 4. Test execution and verification module, 5. Test report generation module. Detailed Implementation
[0021] The present invention will now be described in further detail with reference to the embodiments and accompanying drawings. However, this should not be construed as limiting the scope of the above-described subject matter of the present invention to the following embodiments; all technologies implemented based on the content of the present invention fall within the scope of the present invention.
[0022] Example 1: This example provides an automated testing method for automotive electronic control units, referring to... Figure 1 Specifically, it includes the following steps: S1: Parse the test requirements to obtain a test case set containing the operation sequence, triggering conditions, and expected results. The testing requirements include functional testing, performance testing, fault injection testing, and other related requirements for the ECU to be tested, including core information such as test scenarios, test indicators, and acceptance criteria.
[0023] The specific execution process of step S1 is as follows: S11: Extract key features from the test scenario corresponding to the test requirements to obtain the bus type, test target, and prerequisites; where the bus type is the vehicle communication bus used by the ECU under test, including but not limited to CAN, CANFD, LIN, and vehicle Ethernet; the test target is the ECU function or performance indicator that needs to be verified in this test; and the prerequisites are the environmental conditions, ECU status, communication status, and other requirements that need to be met before the test is executed.
[0024] S12: Based on the bus type and test target, parse the database file corresponding to the bus type to obtain the signal path and verification logic; specifically, for CAN / CANFD bus, parse the corresponding DBC format database file, for LIN bus, parse the corresponding LDF format database file, and for vehicle Ethernet bus and ECU internal calibration parameters, parse the corresponding A2L format database file; by parsing the database file, obtain core information such as the signal sending node, receiving node, signal length, resolution, offset, and verification method, and then determine the signal transmission path and the verification logic for signal validity.
[0025] S13: Based on the test objectives, preconditions, signal paths, and verification logic, integrate and generate a test case set; each test case contains a unique test case ID, operation sequence, trigger condition, and expected result. The operation sequence is the order of test execution steps, the trigger condition is the precondition trigger logic for executing the corresponding operation, and the expected result is the signal status and functional response that the ECU should output after the test is executed.
[0026] S2: Based on the test case set, the test case set is transformed through the programming interface of the automated testing platform to obtain an executable script; The automated testing platform is a general-purpose testing platform that supports vehicle bus testing. It has COM programming interface and script programming interface, and supports the development and execution of scripting languages such as Python and C#.
[0027] The specific execution process of step S2 is as follows: S21: Load the above database file through the COM programming interface of the automated test platform, configure the hardware channel parameters determined by the bus type and the test target, and obtain the mapping relationship between the executable script and the underlying functions of the automated test platform. The hardware channel parameters include bus hardware channel number, communication baud rate, sampling point, terminating resistor, etc. The mapping relationship is a one-to-one correspondence between the function calls of the executable script and the underlying bus communication, hardware control, signal acquisition, and other functions of the automated test platform, ensuring that the script can directly call the underlying hardware and software functions.
[0028] S22: Based on the test case set and mapping relationship, decompose the operation sequence, triggering conditions and expected results of the test case set to obtain the smallest unit of test execution; The smallest unit is a single-step test operation that cannot be further divided, such as sending a single signal, controlling a single voltage, acquiring a single signal, or making a single logic judgment.
[0029] S23: Encapsulate the smallest execution unit through the script programming interface of the automated testing platform to obtain an executable function; Each executable function corresponds to one or more minimum execution units, and encapsulates input parameter verification, execution status feedback, and exception handling logic to ensure the reusability and stability of the function.
[0030] S24: Based on the triggering conditions and expected results, combine the executable functions to obtain the executable script; The executable script sets the execution order and triggering conditions of functions according to the operation sequence of the test cases, and embeds the judgment logic of expected results to achieve the integration of test execution and result judgment.
[0031] S3: Based on the execution requirements of the executable script, inject dynamic test parameters to obtain a closed-loop test environment that matches the executable script; The dynamic test parameters include at least one of the following: power supply anomaly parameters, bus communication fault parameters, and signal delay and packet loss parameters. Power supply anomaly parameters include parameters such as overvoltage, undervoltage, voltage surges and drops, and abnormal power-on / power-off timing. Bus communication fault parameters include physical layer and data link layer fault parameters such as bus short circuit, bus open circuit, bit error, and CRC error. Signal delay and packet loss parameters include parameters such as signal transmission delay, reception delay, random packet loss, and periodic packet loss.
[0032] The specific execution process of step S3 is as follows: S31: Based on the hardware channel parameters, the ECU power-on / power-off process and abnormal ECU voltage conditions are simulated by a programmable power supply to obtain a power supply environment that meets the test requirements. The programmable power supply is connected to the power supply terminal of the ECU under test. The output voltage, power-on slope, power-off slope, and output timing of the programmable power supply are controlled by scripts to simulate the normal power supply conditions and abnormal voltage conditions of the ECU during actual vehicle operation, providing a stable and controllable power supply environment for the ECU.
[0033] S32: Based on the bus type, inject the bus physical layer fault type determined by the bus type and the test target through the communication device to complete the configuration of dynamic test parameters; The communication equipment is a bus simulation device and fault injection device that supports the corresponding bus type. It can inject dynamic parameters such as bus faults, signal delays, and signal packet loss according to script instructions to simulate communication anomalies during real vehicle operation. S33: Based on the power supply environment and dynamic test parameters, the vehicle simulation software simulates the operating conditions of the automotive electronic control unit to obtain a closed-loop test environment. The vehicle simulation software supports vehicle dynamics simulation and bus simulation. It can provide real-time feedback of the corresponding vehicle operating status signals based on the ECU's output signals, forming a closed-loop test circuit of ECU output – simulation feedback – ECU response, completely simulating the ECU's operating environment in a real vehicle.
[0034] S4: In a closed-loop test environment, execute the executable script to synchronously collect data throughout the entire test process, obtaining test data with time-series tags; compare the test data with the expected results in real time to obtain real-time test verification results; The specific execution process of step S4 is as follows: S41: The execution timing is obtained by controlling the transmission order of the corresponding signals of the executable script through a timer; the timer mechanism uses threading.Timer to achieve timing control with an accuracy of no less than 1ms, which can accurately control the sending time of each signal and the execution time of each operation, ensuring that the timing of the test execution is completely consistent with the design requirements.
[0035] S42: Execute the executable script according to the execution sequence to obtain test data; during script execution, the ECU power supply voltage, bus signal, ECU output signal, and simulation feedback signal of the entire test process are synchronously collected through hardware acquisition devices and bus acquisition devices. Each set of collected data corresponds to a unique timing mark, forming test data with timing marks; at the same time, after each test operation is completed, the collected test data is immediately compared with the expected results corresponding to the test cases in real time to determine whether the test results meet the requirements and obtain real-time test verification results; when the real-time test verification results are abnormal, the test process is immediately paused or an abnormality is marked to facilitate subsequent troubleshooting.
[0036] S5: Process and analyze the test data and real-time test verification results to obtain a structured test report; The specific execution process of step S5 is as follows: S51: Integrate and analyze the test data and real-time test verification results to obtain the root cause of test failure; for test cases with abnormal verification results, combine the test data with time-marked information to analyze the time of the abnormality, the state of the abnormal signal, and the execution of the preceding operation, match the preset fault root cause library, and locate the root cause of the test failure, including but not limited to power supply abnormality, communication failure, ECU logic defect, signal timing mismatch, etc.
[0037] S52: Based on the root cause of the test failure, backtrack the entire test process to obtain the problem tracing result corresponding to the root cause of the test failure; according to the time sequence mark of the anomaly, backtrack the entire process test data, operation execution records, and signal interaction records within a preset time before and after the time, restore the complete process of the anomaly, clarify the triggering link and scope of impact of the anomaly, and form the problem tracing result.
[0038] S53: Based on the test failure root causes and problem tracing results, integrate and generate the structured test report; wherein, the structured test report includes test case execution status, a list of failed test cases, failure root cause analysis, test coverage statistics, and problem tracing information, and can be exported to PDF, Excel and other formats as needed, to facilitate the archiving of test results and the tracking of problem rectification.
[0039] Example 2: This example also provides an automated testing system for automotive electronic control units, see reference. Figure 2The system, used to implement the aforementioned automated testing method for automotive electronic control units, specifically includes: Test requirement parsing module 1 is used to parse test requirements and obtain a test case set containing operation sequences, triggering conditions and expected results; Script conversion module 2 is used to convert the test case set into an executable script through the programming interface of the automated testing platform. The closed-loop test environment construction module 3 is used to inject dynamic test parameters according to the running requirements of the executable script to obtain a closed-loop test environment that matches the executable script. Test execution and verification module 4 is used to execute the executable script in the closed-loop test environment, synchronously collect data throughout the entire test process, obtain test data with time-series markers, and compare the test data with the expected results in real time to obtain real-time test verification results; The test report generation module 5 is used to process and analyze the test data and the real-time test verification results to obtain a structured test report.
[0040] Each module of the system in this embodiment corresponds one-to-one with the steps in the above method, and its implementation logic and technical effect are completely consistent, so they will not be described again here.
[0041] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. An automated testing method for automotive electronic control units, characterized in that, Includes the following steps: S1: Analyze the test requirements to obtain a set of test cases containing the operation sequence, triggering conditions, and expected results; S2: Based on the test case set, the test case set is transformed through the programming interface of the automated testing platform to obtain an executable script; S3: Based on the execution requirements of the executable script, inject dynamic test parameters to obtain a closed-loop test environment that matches the executable script; S4: In the closed-loop test environment, the executable script is executed to synchronously collect data throughout the entire test process, obtaining test data with time-series markers; the test data is compared with the expected results in real time to obtain real-time test verification results; S5: Process and analyze the test data and the real-time test verification results to obtain a structured test report.
2. The automated testing method for automotive electronic control units according to claim 1, characterized in that, Step S1 includes: S11: Extract key features from the test scenario corresponding to the test requirements to obtain the bus type, test target, and prerequisites; S12: Based on the bus type and test target, parse the database file in the format corresponding to the bus type to obtain the signal path and verification logic; S13: Based on the test objective, the preconditions, the signal path and the verification logic, integrate and generate the test case set; The bus type includes at least one of CAN, CANFD, LIN, and automotive Ethernet, and the database file includes DBC, LDF, and A2L format files that match the bus type.
3. The automated testing method for automotive electronic control units according to claim 2, characterized in that, Step S2 includes: S21: Load the database file through the COM programming interface of the automated testing platform, configure the hardware channel parameters determined by the bus type and the test target, and obtain the mapping relationship between the executable script and the underlying functions of the automated testing platform; S22: Based on the test case set and the mapping relationship, decompose the operation sequence, triggering conditions and expected results of the test case set to obtain the smallest unit of test execution; S23: The smallest execution unit is encapsulated through the script programming interface of the automated testing platform to obtain an executable function; S24: Based on the triggering conditions and the expected results, combine the executable functions to obtain an executable script.
4. The automated testing method for automotive electronic control units according to claim 3, characterized in that, Step S3 includes: S31: Based on the hardware channel parameters, the ECU power-on / power-off process and abnormal ECU voltage conditions are simulated by a programmable power supply to obtain a power supply environment that meets the test requirements; S32: Based on the bus type, inject the bus physical layer fault type determined by the bus type and the test target through the communication device to complete the configuration of the dynamic test parameters; S33: Based on the power supply environment and dynamic test parameters, the operating conditions of the automotive electronic control unit are simulated using vehicle simulation software to obtain the closed-loop test environment.
5. The automated testing method for automotive electronic control units according to claim 4, characterized in that, Step S4 includes: S41: The execution timing is obtained by controlling the transmission order of the signals corresponding to the executable script through a timer; S42: Execute the executable script according to the execution sequence to obtain the test data.
6. The automated testing method for automotive electronic control units according to claim 5, characterized in that, Step S5 includes: S51: Integrate and analyze the test data and real-time test verification results to obtain the root cause of test failure; S52: Based on the root cause of the test failure, backtrack the entire test process to obtain the problem tracing results corresponding to the root cause of the test failure. S53: Based on the root causes of the test failures and the results of the problem tracing, integrate and generate the structured test report.
7. The automated testing method for automotive electronic control units according to claim 6, characterized in that, The timer mechanism uses threading.Timer to achieve timing control with an accuracy of no less than 1ms. When the real-time test verification result is abnormal, the test process is paused or an abnormality is marked.
8. The automated testing method for automotive electronic control units according to claim 7, characterized in that, The dynamic test parameters include at least one of the following: power supply anomaly parameters, bus communication fault parameters, signal delay and packet loss parameters.
9. The automated testing method for automotive electronic control units according to claim 8, characterized in that, The structured test report includes test case execution status, a list of failed test cases, root cause analysis of failures, test coverage statistics, and issue tracing information.
10. An automated testing system for automotive electronic control units, characterized in that, include: Test requirement parsing module (1) is used to parse test requirements and obtain a test case set containing operation sequence, triggering conditions and expected results; The script conversion module (2) is used to convert the test case set according to the test case set through the programming interface of the automated testing platform to obtain an executable script; The closed-loop test environment construction module (3) is used to inject dynamic test parameters according to the running requirements of the executable script to obtain a closed-loop test environment that matches the executable script. The test execution and verification module (4) is used to execute the executable script in the closed-loop test environment, synchronously collect the entire test process, obtain test data with time-series markers, and compare the test data with the expected results in real time to obtain real-time test verification results. The test report generation module (5) is used to process and analyze the test data and the real-time test verification results to obtain a structured test report.