Controller CAN communication test method and system based on LLM

By generating test cases based on the LLM-based large language model, the problem of low CAN signal verification efficiency in the existing technology is solved, efficient CAN communication testing is achieved, the connectivity of the CAN communication link and the Ethernet communication link and the correctness of signal transmission are verified, and the testing cost is reduced.

CN120630964AActive Publication Date: 2025-09-12AUTOCORE INTELLIGENT TECH (NANJING) CO LTD

Patent Information

Application Number
CN202511150147.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-18
Publication Date
2025-09-12
Estimated Expiration
2045-08-18

AI Technical Summary

Technical Problem

When verifying CAN signal verification in automotive ECUs, existing technologies need to focus on changes in the underlying CAN signals, resulting in complex and inefficient testing. This makes it impossible to effectively verify the connectivity of the CAN and Ethernet communication links and the correctness of CAN signal transmission.

Method used

A large language model based on LLM is used to generate test cases that conform to the natural language of BDD. Through the verification of VSS Path and CAN Signal, test cases are automatically generated, eliminating manual writing steps, focusing on VSS standards, and realizing automated testing.

Benefits of technology

It improves the efficiency of CAN communication testing and reduces testing costs. It can automatically verify the connectivity of CAN communication links and Ethernet communication links and the correctness of CAN signal transmission, reducing the amount of automated test code development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120630964A_ABST
    Figure CN120630964A_ABST
Patent Text Reader

Abstract

The invention discloses an LLM-based controller CAN communication test method and system, and the method comprises the steps: converting a DBC file into a configuration file, reading a VSS and CAN signal corresponding relation file, and inputting the VSS and CAN signal corresponding relation file to an LLM; calling an LLM model, and generating a test case according to the cue word; constructing an automatic framework to implement an execution function based on a behavior-driven development BDD mode; and associating the generated test case with an execution function in the automation framework, constructing a complete test suite, and operating the test suite to execute a CAN bus communication test. VSS path and CAN Signal verification is carried out on the basis of the controller which already realizes the VSS technology, the test case conforming to the BDD natural language is generated by using the LLM, the test case is directly used as the test script, the step of manually compiling the test case is omitted, the test efficiency is improved, and the test cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a CAN communication testing technology, and in particular to a controller CAN communication testing method and system based on LLM. Background Art

[0002] With the advancement of automotive electronic architecture, a new generation of automotive electrical and electronic architecture has been introduced. ECU hardware configurations across different vehicle models are gradually converging towards an electronic and electrical architecture consisting of a central computing unit (CCU) and two to four zone controller units (ZCUs). As vehicle functionality grows, the signal volume on the CAN bus is also increasing. As core components in vehicles, zone controllers support an increasing number of CAN signals, making CAN signal value verification crucial as a fundamental communication link. CAN signal names, numbers, and values ​​vary across different manufacturers' DBC files. Abstracting CAN signals using the VSS standard and converting them into VSS paths eliminates the need to consider the underlying differences in CAN signaling, and this technical solution is gaining widespread adoption.

[0003] Based on the already implemented technology of converting CAN signals to VSS Path, this technology implements CAN communication link verification, including initial values, maximum values, minimum values, and random values. Compared with existing technologies, this technology only requires focusing on the VSS standard, obtaining the physical values ​​of CAN signals through VSSPath, and generating test cases based on standard templates through LLM. These test cases can be directly imported into the BDD framework, achieving automated testing and improving test verification efficiency. Summary of the Invention

[0004] In order to solve the deficiencies in the prior art, the present invention aims to provide a controller CAN communication test method and system based on LLM.

[0005] To achieve the purpose of the present invention, the technical solution adopted by the present invention is: A controller CAN communication test method based on LLM, comprising the steps of: (1) Convert the DBC file into a configuration file, read the VSS and CAN signal correspondence file, and give it as input to the LLM; (2) Call the LLM model and generate test cases based on the prompt words; (3) Build an automation framework based on the behavior-driven development (BDD) model to implement execution functions; (4) Associate the generated test cases with the execution functions in the automation framework, build a complete test suite, and run the test suite to perform CAN bus communication tests.

[0006] Furthermore, in step (1), the configuration file is in the form of messages, each of which includes: Message type: "CAN"; Message ID: uniquely identifies each CAN message; Message name: describes the message function; Byte size: Standard CAN: 8 bytes; CAN FD: 8 to 64 bytes; Signal list: Each signal contains detailed parameters such as location, data type, and range.

[0007] Furthermore, in step (2), prompt words are written according to specific test requirements, and test cases are automatically generated based on the LLM model using templated prompt words. The LLM model automatically reviews whether the test cases meet the requirements, and the user makes the final confirmation.

[0008] Furthermore, prompt words are written according to the specific communication test process, which includes: From top to bottom, the test node controls the VSS client to send the VSS path and corresponding values. The VSS client subscribes to the VSS service through the DDS topic. The VSS service is deployed on the CCU. The VSS service maps the VSS signal to the VSS path and converts the VSS signal value according to the DBC rules, converting the physical value into the original value. The ZCU converts the VSS signal into a CAN signal and connects it to the real-time simulator via the CAN-BUS. The test node controls the real-time simulator to obtain the CAN signal. From bottom to top, the test node controls the real-time simulator to send CAN signals, which are forwarded to the ZCU via the CAN-BUS. The ZCU converts the CAN signals into VSS signals and forwards them to the CCU via DDS. The VSS Service processes the VSS signals and maps them into different VSS paths. The test node controls the VSS Client to obtain the VSS paths and corresponding values ​​to verify whether the CAN signals and VSS path values ​​are consistent.

[0009] Furthermore, the DBC file is converted into signal.json, and the mapping.json file of the VSS and CAN signal correspondence is read; Parse the mapping relationship between VSS signals and VSS paths according to the input mapping file mapping.json, obtain the CAN signal value according to the configuration file signal.json, use the LLM model to understand the content of the mapping file, and generate structured test cases according to the format requirements.

[0010] Furthermore, the test case format includes: Feature: A feature represents a function; Scenario: used to describe a use case; Step: contains Given, When, and Then, which are used to define the steps of the scenario; Given: The environment required for a given scene, a prerequisite; When: a user event; Then: Define the verification results, verification points in normal testing, and assertions.

[0011] Furthermore, in step (3), the execution function includes: CAN communication function: encapsulates CAN bus data transmission, reception and analysis logic; VSS Client call function: implements interaction with the vehicle signal specification VSS server; VSS path and CAN signal verification function: define signal path verification and CAN signal value verification rules; Given / Then BDD syntax function: standardizes test step descriptions and associates test preconditions with assertion logic.

[0012] A controller CAN communication test case generation method based on LLM, comprising the steps of: (1) Convert the DBC file into a configuration file, read the VSS and CAN signal correspondence file, and give it as input to the LLM; (2) Call the LLM model and generate test cases based on the prompt words; the model automatically reviews whether the test cases meet the requirements, and the user makes the final confirmation and converts the test cases into executable automated test scripts.

[0013] A controller CAN communication test case generation system based on LLM, including a file parsing module, an LLM test case generation module, and an automated script generation module; The file parsing module parses the input related files and extracts key information. The parsed information flows to the LLM test case generation module, which uses the large language model (LLM) to automatically generate test cases for the controller CAN communication based on the parsed content and preset prompt words. The test cases output by the LLM test case generation module are passed to the automated script generation module, which converts the test cases into executable automated test scripts.

[0014] The beneficial effects of the present invention are that, compared with the prior art, the LLM-based controller CAN communication testing method described herein verifies the VSS path and CAN signal based on a controller that has implemented VSS technology. This method can verify both the connectivity of the CAN communication link and the Ethernet communication link, as well as the correctness of CAN signal transmission, while only focusing on the VSS standard and not on changes in the underlying CAN signal. LLM is used to generate test cases that conform to the BDD natural language. These test cases are directly used as test scripts, eliminating the need for manual test case writing and the development of a large amount of automated test code, thereby improving test efficiency and reducing testing costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 This is the controller CAN communication test flow chart based on LLM; Figure 2 This is a flow chart of the test case generation method for controller CAN communication based on LLM; Figure 3 This is a schematic diagram of the signal.json format; Figure 4 This is an example picture of the prompt word; Figure 5 This is a flow chart of the controller CAN communication test method based on LLM; Figure 6 This is a schematic diagram of the controller CAN communication test case generation system based on LLM. DETAILED DESCRIPTION

[0016] The technical solution of the present invention will be further described below in conjunction with the accompanying drawings and embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention and are not intended to limit the scope of protection of this application.

[0017] like Figure 1 As shown, the present invention is based on the controller CAN communication test process of LLM, and the test node can be deployed on a PC or other devices containing a central processing unit.

[0018] From top to bottom, the test node is responsible for controlling the VSS Client to send the VSS Path and corresponding values. The VSS Client can be deployed independently on the device, on the test node, or on the CCU. The VSS Client subscribes to the VSS Service through the DDS topic and sets the VSS Path and its corresponding value through the set interface. The VSS Service is deployed on the CCU and maps the VSS Signal to the VSS Path. The VSS Signal value is converted according to DBC rules, converting the physical value to the original value. The ZCU converts the VSS Signal to a CAN Signal and connects it to the real-time simulator via the CAN bus. The test node controls the real-time simulator to obtain the CAN Signal. The real-time simulator simulates CAN messages from various on-board sensors, ECUs, and other sensors.

[0019] From bottom to top, the test node controls the real-time simulator to send CAN signals, which are forwarded to the ZCU via the CAN-BUS. The ZCU converts the CAN signals into VSS signals and forwards them to the CCU via DDS. The VSS Service processes the VSS signals and maps them into different VSS paths. The test node controls the VSS Client to obtain the VSS paths and corresponding values ​​to verify whether the CAN signals and VSS path values ​​are consistent.

[0020] like Figure 2 As shown, the test case generation method for controller CAN communication based on LLM of the present invention includes the steps of: The first step is to convert the DBC file into signal.json. The converted format is as follows Figure 3 As shown; read the mapping.json file of VSS and CAN signals, and give these two json files as input to LLM; Parse the DBC file into signal.json, list all CAN signals under the CAN message, list id, name, startBit, bitSize, dataType, etc., and calculate the physical value range of the CAN signal based on factor and offset.

[0021] like Figure 3 As shown, the file structure is based on messages, and each message contains the following key information: Message type: "CAN" Message ID (id): uniquely identifies each CAN message; Message name (name): describes the message function; Byte size: Standard CAN: 8 bytes; CAN FD: 8 to 64 bytes; Signal list (signals): Each signal contains detailed parameters such as location, data type, range, etc.

[0022] The second step is to build a test case automatic generation system based on a large language model and write prompt words according to specific needs. Examples of prompt words are as follows: Figure 4 As shown; Users can define LLM roles based on prompts. Prompts can also be used to specify test case content and text format. Test cases can be generated using different models to find the most effective ones. Test cases can be tested for compliance. If a generated test case does not meet the requirements, the prompts can be modified. The LLM model will then automatically review the test case for compliance, and the user can then provide final confirmation.

[0023] Automatically generates test cases using templated prompts based on LLM. It parses the VSS signal and VSS path mapping relationship according to the input mapping.json. It obtains the initial, maximum, and minimum values ​​of the CAN signal based on signal.json. It uses a large language model to understand the contents of the JSON mapping file and generates structured test cases according to the format requirements. It supports Markdown format output for direct use.

[0024] The test case format generated by the prompt word in this example is consistent with the behavior description of BDD: Feature: A feature represents a function; Scenario: used to describe a use case; Step: Contains words like Given, When, and Then, which are used to define the steps of the scenario; Given: The environment required for a given scenario, a prerequisite; When: a user event, such as click, input, etc. Then: Defines the verification results, verification points in normal testing, and assertions.

[0025] When using LLM to generate test cases, no additional logic is required to implement the association between VSS Path and CAN Signal, nor is additional logic required to implement the extraction of CAN Signal values. All these tasks are completed by LLM. The user only needs to provide the appropriate prompt words and select the appropriate AI model.

[0026] The test cases generated by LLM are well-suited to the BDD automated testing framework. Using the BDD testing framework, a subset of the Gherkin language is used to define test scenarios. Features are broken down into scenarios, and each step in the scenario is described in natural language. The natural language in each step of the scenario is recognized, parsed, and converted into code.

[0027] like Figure 5 As shown, the controller CAN communication test method based on LLM of the present invention includes the following steps: (1) Import the DBC file, convert the DBC file into signal.json, read the VSS and CAN signal correspondence file mapping.json, and give these two json files as input to LLM; The CAN database file (Database CAN, DBC) is typically provided by the manufacturer in a standard format, but it can also be a custom DBC file. It primarily contains message and signal definitions and can be in .dbc, .xml, or other formats. By extracting this file, we can obtain information such as the message type, message ID, message name, byte size, and signal list (each signal includes detailed parameters such as location, data type, and range). Based on this information, we generate a data configuration file. The generated configuration file in the example is in JSON format, but other formats are also possible. The VSS and CAN signal mapping file, mapping.json, can also be in other formats, depending on whether the LLM supports it. Currently, LLMs on the market support multiple file formats.

[0028] (2) Call the LLM model and generate test cases based on the prompt words; (3) Build an automation framework based on the behavior-driven development (BDD) model to implement the following steps: CAN communication function: encapsulates CAN bus data transmission, reception and analysis logic; VSS Client call function: implements interaction with the Vehicle Signal Specification (VSS) server; VSS Path and CAN Signal verification function: define signal path verification and CAN signal value verification rules; Given / Then and other BDD syntax functions: standardize test step descriptions, and associate test preconditions with assertion logic.

[0029] (4) Associate the generated test cases with the execution functions in the automation framework to build a complete test suite; run the test suite to perform CAN bus communication tests; collect test data and generate a test report containing the case execution status and signal verification results.

[0030] This process combines automated parsing, AI-assisted use case generation, and the BDD framework to achieve efficient construction and execution of CAN bus communication tests, covering the complete test cycle from input processing to result output.

[0031] like Figure 6 As shown, the controller CAN communication test case generation system based on LLM of the present invention includes three sequentially connected functional modules: a file parsing module, an LLM test case generation module, and an automatic script generation module.

[0032] First, the file parsing module is responsible for parsing the input related files (such as DBC files) and extracting key information. Then, the parsed information is transferred to the LLM test case generation module. This module uses the large language model (LLM) to automatically generate test cases for the controller CAN communication based on the parsed content and preset prompt words. Finally, the test cases output by the LLM test case generation module are passed to the automated script generation module, which converts the test cases into executable automated test scripts, thereby realizing the modular operation of the controller CAN communication test-related processes based on LLM.

[0033] The beneficial effects of the present invention are that, compared with the prior art, the LLM-based controller CAN communication testing method described herein verifies the VSS path and CAN signal based on a controller that has implemented VSS technology. This method can verify both the connectivity of the CAN communication link and the Ethernet communication link, as well as the correctness of CAN signal transmission, while only focusing on the VSS standard and not on changes in the underlying CAN signal. LLM is used to generate test cases that conform to the BDD natural language. These test cases are directly used as test scripts, eliminating the need for manual test case writing and the development of a large amount of automated test code, thereby improving test efficiency and reducing testing costs.

[0034] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. However, those skilled in the art should understand that the above implementation examples are only preferred implementation plans of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, and is not a limitation on the scope of protection of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the scope of protection of the present invention.

Claims

1. A controller CAN communication test method based on LLM, characterized in that: Including steps: (1) Convert the DBC file into a configuration file, read the VSS and CAN signal correspondence file, and give it as input to the LLM; (2) Call the LLM model and generate test cases based on the prompt words; (3) Build an automation framework based on the behavior-driven development (BDD) model to implement execution functions; (4) Associate the generated test cases with the execution functions in the automation framework, build a complete test suite, and run the test suite to perform CAN bus communication tests.

2. The controller CAN communication test method based on LLM according to claim 1, characterized in that: In step (1), the configuration file is in the form of messages, each of which includes: Message type: "CAN"; Message ID: uniquely identifies each CAN message; Message name: describes the message function; Byte size: Standard CAN: 8 bytes; CAN FD: 8 to 64 bytes; Signal list: Each signal contains detailed parameters such as location, data type, and range.

3. The controller CAN communication test method based on LLM according to claim 1, characterized in that: In step (2), prompt words are written according to specific test requirements, and test cases are automatically generated based on the LLM model using templated prompt words. The LLM model automatically reviews whether the test cases meet the requirements, and the user makes the final confirmation.

4. The controller CAN communication test method based on LLM according to claim 3 is characterized in that: Write prompt words according to the specific communication test process, which includes: From top to bottom, the test node controls the VSS client to issue the VSS path and corresponding values. The VSS client subscribes to the VSS service through ddstopic. The VSS service is deployed on the CCU. The VSS service maps the VSS signal to the VSS path and converts the VSS signal value according to the DBC rules, converting the physical value to the original value. The ZCU converts the VSS signal into a CAN signal and connects it to the real-time simulator via the CAN-BUS. The test node controls the real-time simulator to obtain the CAN signal. From bottom to top, the test node controls the real-time simulator to send CAN signals, which are forwarded to the ZCU via the CAN-BUS. The ZCU converts the CAN signals into VSS signals and forwards them to the CCU via DDS. The VSS Service processes the VSS signals and maps them into different VSS paths. The test node controls the VSS Client to obtain the VSS paths and corresponding values, and verifies whether the CANSignal and VSS path values ​​are consistent.

5. The controller CAN communication test method based on LLM according to claim 3 is characterized in that: Convert the DBC file into signal.json and read the mapping file of VSS and CAN signals, mapping.json; Parse the mapping relationship between VSS signals and VSS paths according to the input mapping file mapping.json, obtain the CAN signal value according to the configuration file signal.json, use the LLM model to understand the content of the mapping file, and generate structured test cases according to the format requirements.

6. The controller CAN communication test method based on LLM according to claim 3 is characterized in that: The test case format includes: Feature: A feature represents a function; Scenario: used to describe a use case; Step: contains Given, When, and Then, which are used to define the steps of the scenario; Given: The environment required for a given scene, a prerequisite; When: a user event; Then: Define the verification results, verification points in normal testing, and assertions.

7. The controller CAN communication test method based on LLM according to claim 1, characterized in that: In step (3), the execution function includes: CAN communication function: encapsulates CAN bus data transmission, reception and analysis logic; VSS Client call function: implements interaction with the vehicle signal specification VSS server; VSS Path and CAN Signal verification function: define signal path verification and CAN signal value verification rules; Given / Then BDD syntax function: standardizes test step descriptions and associates test preconditions with assertion logic.

8. A controller CAN communication test case generation method based on LLM, characterized in that: Including steps: (1) Convert the DBC file into a configuration file, read the VSS and CAN signal correspondence file, and give it as input to the LLM; (2) Call the LLM model and generate test cases based on the prompt words; The LLM model automatically reviews whether the test cases meet the requirements, and the user makes the final confirmation and converts the test cases into executable automated test scripts.

9. A controller CAN communication test case generation system based on LLM, characterized in that: Contains file parsing module, LLM test case generation module, and automated script generation module; The file parsing module parses the input related files and extracts key information. The parsed information flows to the LLM test case generation module, which uses the large language model (LLM) to automatically generate test cases for the controller CAN communication based on the parsed content and preset prompt words. The test cases output by the LLM test case generation module are passed to the automated script generation module, which converts the test cases into executable automated test scripts.

Citation Information

Patent Citations

  • Service-oriented automobile domain controller data forwarding system and method

    CN115412478A

  • CAN communication automation test method

    CN116489043A

  • Vehicle can signal abstract application method

    CN116633715A

  • HIL automatic test method and system suitable for CAN signal interface of hybrid gearbox controller, and storage medium

    CN117499284A

  • Test script generation method and device, computer equipment and storage medium

    CN118626364A

Cited By

  • Industrial controller automatic test system and method based on artificial intelligence

    CN121300335A

  • Vehicle body control network communication signal automatic test method and system

    CN121547378A

  • Test script generation method, BMS product test method and electronic equipment

    CN122173409A