CN-121979798-A - CAPL script-based FBL automatic test method
Abstract
The invention belongs to the technical field of FBL (flash memory) test, and particularly relates to an FBL automatic test method based on CAPL scripts, which comprises the steps of S1, obtaining communication parameters and expected response parameters of a target ECU, establishing diagnosis communication with the target ECU based on the communication parameters, setting the expected response parameters as first global variables, S2, automatically executing a multi-step test flow to the target ECU through CAPL scripts, S3, carrying out self-adaptive analysis and processing on response messages returned by the target ECU in the S2 execution process through an event processing mechanism of CAPL scripts, S4, comparing the expected response parameters with actual response data, automatically judging whether the current test step passes or fails according to comparison results, and S5, automatically generating a structured test report after the test flow is executed. The method can dynamically adapt the communication characteristics of different ECUs on the premise of no manual intervention, process the flow control and suspension state in real time and accurately verify the brushing result.
Inventors
- ZHAO QIANLAN
- LUO YI
- CHEN WEI
Assignees
- 重庆青山工业有限责任公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260205
Claims (10)
- 1. The FBL automatic test method based on CAPL script is characterized by comprising the following steps: S1, reading an external configuration file, and acquiring communication parameters and expected response parameters of a target ECU (electronic control unit), wherein diagnostic communication with the target ECU is established based on the communication parameters; S2, automatically executing a multi-step test flow to the target ECU through CAPL scripts based on the communication established in the S1, wherein the test flow comprises a firmware data downloading stage and a diagnosis request interaction stage; S3, carrying out self-adaptive analysis and processing on a response message returned by the target ECU in the S2 executing process through an event processing mechanism of CAPL scripts, wherein the self-adaptive analysis and processing comprises the following steps: Identifying and skipping specific responses that indicate that the request was suspended to maintain continuity of the test flow; in the firmware data downloading stage, identifying a flow control frame returned by a target ECU, and dynamically adjusting the sending rhythm of a data block according to control parameters in the flow control frame so as to realize the synchronization with the transmission rate of the ECU; in the diagnosis request interaction stage, a response message which is returned by the target ECU and indicates the result of a single test step is identified, and actual response data carried by the response message is stored into a second global variable; s4, comparing the expected response parameter in the first global variable in the S1 with the actual response data in the second global variable in the S3, and automatically judging whether the current test step passes or fails according to the comparison result; And S5, automatically generating a structured test report after the test flow is executed, wherein the report comprises test environment information, test execution overall profile and execution results of all test steps.
- 2. The method for automatically testing the FBL based on CAPL script according to claim 1, wherein in S1, the external configuration file is a cin file, and wherein the defined parameters include the communication parameters, firmware block size parameters and policy parameters for controlling a test flow execution policy.
- 3. The method for automatically testing the FBL based on the CAPL script according to claim 2, wherein in S2, the controlling the test flow according to the preset condition includes selecting to stop the current test case or record the failure and continue to execute the subsequent test steps according to the policy parameters in the external configuration file when a certain test step is determined to be failed.
- 4. The method for automated FBL testing based on CAPL script as recited in claim 1, wherein the diagnostic requests sent in the diagnostic request interaction phase include an enter extended session request, a secure access request, and a routine control request.
- 5. The method for automated FBL testing based on CAPL script as set forth in claim 1, wherein in S1, the communication parameters include a physical addressing CAN identifier for sending a diagnostic request to the target ECU and a UDS service identifier for constructing the diagnostic request.
- 6. The method for automated FBL testing based on CAPL script, wherein S3, the specific response indicating that the request is suspended is a response message conforming to UDS protocol with UDS service identifier equal to 0x78, and the flow control frame is a response message conforming to UDS protocol with header byte 0x30 or 0x32, and the control parameters include block size and minimum interval time.
- 7. The method for automatically testing the FBL based on CAPL script according to claim 6, wherein S3, in the firmware data downloading stage, the transmission interval between the adjacent data blocks is dynamically set according to the minimum interval time in the flow control frame.
- 8. The method for automated testing of FBL based on CAPL script as set forth in claim 6, wherein the comparing in S4 specifically comprises: If the actual response is positive, and the response code is consistent with the expected response parameter, judging that the response code passes through; if the actual response is a negative response with the UDS service identifier equal to 0x7F and the error code contained in the negative response is consistent with the expected response parameter, the passing is judged.
- 9. The method for automated FBL testing based on CAPL script as set forth in claim 1, further comprising step S0 of loading a graphical test execution interface constructed based on XML language, and receiving a selection input of the test case through the interface to determine a test procedure to be executed before executing S1.
- 10. The method for automated FBL testing based on CAPL script according to claim 1, wherein S5, the test environment information includes tool version, configuration file path, script execution path and log file path, the test execution overall profile includes execution start time, total test case number, passing case number, failing case number and passing rate, and the execution result of each test step includes step description, expected response, actual response and determination state.
Description
CAPL script-based FBL automatic test method Technical Field The invention belongs to the technical field of FBL (film bulk density) flash test, and particularly relates to an FBL automatic test method based on CAPL scripts. Background In the development and production process of an Electronic Control Unit (ECU) of an automobile, firmware update based on Flash Bootloader (FBL) is a key link for ensuring the iteration of the ECU function, defect repair and safety upgrade. FBL flash testing typically involves complex diagnostic communication procedures including session control, secure access, data transfer, verification validation, etc., which are subject to strict compliance with diagnostic protocol specifications such as ISO 14229 (UDS) or kw p 2000. At present, the test is widely applied to scenes such as research and development verification, final inspection of production lines, after-sales maintenance and the like of whole factories and Tier1 suppliers. However, the existing FBL test methods have significant technical bottlenecks. Firstly, the traditional test is highly dependent on manual operation of a universal diagnostic tool (such as a peripheral work device, a CANoe built-in diagnostic function and the like), and a tester needs to manually trigger each diagnostic request and check the responses one by one, so that the efficiency is low, and misjudgment or missing detection is easily caused by human negligence. And moreover, although the basic flow execution can be realized by the partial semiautomatic script, the hard coding logic of the partial semiautomatic script seriously lacks flexibility, and is difficult to adapt to different ECU models, bootloader versions or communication protocols (such as the difference between UDS and KWP 2000), so that the script multiplexing rate is low and the maintenance cost is high. More critical is that the existing scheme generally lacks dynamic monitoring capability for the whole process of brushing and writing, namely, the flow control frame returned by the ECU cannot be analyzed in real time to adaptively adjust the data sending rhythm, the intermediate states such as 'request suspension' (RequestPending) and the like are difficult to identify to maintain flow continuity, and meanwhile, under abnormal working conditions (such as voltage fluctuation and communication interruption), an automatic rollback mechanism and structured log record are lacking, so that fault positioning is difficult, and the reliability and traceability of the test are seriously affected. Therefore, how to dynamically adapt to the communication characteristics of different ECUs without manual intervention, process the flow control and suspension state in real time, and accurately verify the brushing results becomes a current urgent problem. Disclosure of Invention Aiming at the defects of the prior art, the invention provides an FBL automatic test method based on CAPL script, which can dynamically adapt the communication characteristics of different ECUs without manual intervention, process the flow control and suspension state in real time and accurately verify the brushing result. In order to solve the technical problems, the invention adopts the following technical scheme: A CAPL script-based FBL automatic test method comprises the following steps: S1, reading an external configuration file, and acquiring communication parameters and expected response parameters of a target ECU (electronic control unit), wherein diagnostic communication with the target ECU is established based on the communication parameters; S2, automatically executing a multi-step test flow to the target ECU through CAPL scripts based on the communication established in the S1, wherein the test flow comprises a firmware data downloading stage and a diagnosis request interaction stage; S3, carrying out self-adaptive analysis and processing on a response message returned by the target ECU in the S2 executing process through an event processing mechanism of CAPL scripts, wherein the self-adaptive analysis and processing comprises the following steps: Identifying and skipping specific responses that indicate that the request was suspended to maintain continuity of the test flow; in the firmware data downloading stage, identifying a flow control frame returned by a target ECU, and dynamically adjusting the sending rhythm of a data block according to control parameters in the flow control frame so as to realize the synchronization with the transmission rate of the ECU; in the diagnosis request interaction stage, a response message which is returned by the target ECU and indicates the result of a single test step is identified, and actual response data carried by the response message is stored into a second global variable; s4, comparing the expected response parameter in the first global variable in the S1 with the actual response data in the second global variable in the S3, and automatically judging whether the curren