An automated testing method and apparatus for a vehicle body controller
By generating test cases for the body controller using a large language model and a Transformer model, and combining this with automated testing equipment, the problem of low efficiency in traditional testing methods is solved, enabling efficient, comprehensive, and flexible multi-scenario testing.
Patent Information
- Application Number
- CN202510055372.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2045-01-14
AI Technical Summary
Traditional vehicle body controller testing methods are inefficient, and test case writing is cumbersome and error-prone, making it difficult to achieve efficient, comprehensive, and flexible multi-scenario composite function testing.
The functional requirements specification is transformed into a structured text of control logic using the Large Language Model (LLM). Test cases in Excel format are generated using the Transformer model, and test scripts are automated through a script generation module. Simulation and signal generation are performed in conjunction with an automated testing device.
It enables efficient and accurate multi-scenario testing of the vehicle body controller functional modules, improves test coverage and quality, and optimizes the automated testing process.
Smart Images

Figure CN119987331B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of automotive electronics technology, and relates to testing technology for body controllers, and particularly to an automated testing method and apparatus for body controllers. Background Technology
[0002] With the rapid development of automotive electronics technology, the functions of the Body Control Module (BCM) in vehicles are becoming increasingly complex, encompassing multiple aspects such as door control, window operation, and headlight adjustment. This makes the testing of the Body Control Module both increasingly important and challenging.
[0003] In traditional vehicle body controller testing, test cases are primarily written manually by testers, which is inefficient. Testers need to spend a significant amount of time and effort sifting through a vast amount of standard functional specifications to extract complex functional logic and various possible input / output scenarios, and then transforming these into test cases. This process is tedious and prone to human oversight and errors, making it difficult to guarantee the completeness and accuracy of the test cases.
[0004] As vehicle body controller products continue to evolve, they are rapidly developing in terms of functional richness, processing power, and system integration. This also presents challenges to traditional testing methods and equipment. Traditional testing methods typically use physical hardware to build test environments, simulating the actual operating conditions of a vehicle by directly connecting various real sensors and actuators. This approach suffers from several drawbacks. First, it lacks flexibility, making it difficult to quickly adjust test scenarios and parameters. Second, the coupling of functions between modules increases testing complexity, hindering efficient resource scheduling and synchronous control during testing, and making it difficult to accurately simulate the complex environments and operating conditions faced by the vehicle body controller in actual vehicle operation. Third, there is currently a lack of effective testing frameworks and tools to integrate the testing process. Manually writing test scripts and injecting test signals is prone to errors, resulting in a lack of systematicity and coherence in the testing process, and a low degree of automation.
[0005] In summary, the existing methods of manually writing test cases for body controllers and traditional testing equipment are no longer sufficient to meet the increasingly complex testing needs of body controllers. There is an urgent need for an efficient, comprehensive, flexible and intelligent automated testing method and device to solve these problems. Summary of the Invention
[0006] In view of this, the purpose of the present invention is to provide an automated testing method and apparatus for a vehicle body controller, which, through the innovative integration of software and hardware technologies, enables accurate and efficient multi-scenario composite functional testing of all functional modules of the vehicle body controller.
[0007] To achieve the above objectives, the present invention provides the following technical solution:
[0008] An automated testing method for a vehicle body controller, the method comprising the following steps:
[0009] S1. The functional requirements specification text of the vehicle body controller is transformed into a structured control logic text using a Large Language Model (LLM), which includes:
[0010] S11. Pre-train the large language model LLM using automotive domain textual knowledge and functional specification data of the body controller.
[0011] S12. Input the enterprise specifications, standard functional specifications, and experience scenarios to be tested for the body controller into the pre-trained large language model in natural language, and output the structured text of the control logic.
[0012] S2. Test cases that convert the structured text of control logic into Excel format using the Transformer model, including:
[0013] S21. Pre-list all relevant test cases based on the structured text of the control logic.
[0014] S22. Perform data preprocessing on the control logic structured text and test case data respectively to obtain the control logic structured text training set and the test case training set;
[0015] S23. Establish a Transformer model, pre-train the Transformer model using a control logic structured text training set and a test case training set, and process the control logic structured text to be executed using the pre-trained Transformer model to obtain the corresponding test cases.
[0016] S3. The obtained test cases are converted into test scripts through the script generation module for automated testing.
[0017] Furthermore, in step S11,
[0018] S111. Perform corpus structuring on the functional requirements specification of the vehicle body controller, generate a vehicle body controller knowledge graph, and construct a functional requirements specification corpus. Obtain the structured control logic text written in the functional requirements specification from the review use case table records;
[0019] S112. Map the structured text of control logic to the functional requirement specification corpus, and embed a word segmenter in the functional requirement specification corpus to establish a mapping relationship between the product functional requirement specification and the structured text of control logic through the word segmenter.
[0020] S113. Input the established mapping relationship into the body controller knowledge graph to form the reasoning context of the control logic structured text; model based on the mapping relationship corresponding to the reasoning context of the control logic structured text, and obtain the LLM large language model after training;
[0021] Furthermore, in step S111, the product functional requirements specification document is decomposed into functional long texts, and combined with the functional standards of the body controller, a body controller knowledge graph is generated.
[0022] Furthermore, in step S112, the step of establishing a mapping relationship between the product functional requirements specification document and the structured control logic text using a word segmenter includes: identifying the initial state, actions, and conditions contained in the structured control logic text by recognizing the structured control logic text;
[0023] Furthermore, in step S23, the established Transformer model includes at least an encoder and a decoder, which processes the control logic structured text according to the following steps:
[0024] S231. Preprocess the input control logic structured text requirements to obtain a digital matrix;
[0025] S232. Perform content embedding and position embedding processing on the digital matrix to obtain a vector matrix containing content information and position information;
[0026] S233. Encode the vector matrix using the encoder in the pre-trained Transformer model to obtain the encoded matrix, and define it as the input matrix.
[0027] S234. The target test case data corresponding to the input control logic structured text requirements are processed through the same data preprocessing and embedding operations to obtain the output matrix;
[0028] S235. The input matrix and output matrix are decoded using a decoder to construct a feature mapping relationship between the input control logic structured text requirements and the target test case data based on the decoding results; subsequently, the target test cases are generated in real time based on the feature mapping relationship.
[0029] Furthermore, in step S231, the data preprocessing process includes:
[0030] Extract the relevant elements from the structured text of the control logic. The elements include all conditions, signals, and results.
[0031] Then, the elements are categorized into four types: initial state, input condition, condition judgment, and output result.
[0032] Finally, a unique numerical identifier is assigned to each distinct element.
[0033] Furthermore, in step S232, the content embedding process is as follows: Define a content embedding matrix E with a dimension of V×d, where V is the total number of all identified element numbers and d is the content embedding dimension. For each number in the number matrix, the corresponding word vector is obtained by searching the content embedding matrix E.
[0034] Position embedding: Define a position embedding matrix P with dimension L×d, where L is the maximum length of the sequence and d is the position embedding dimension. The elements in the position embedding matrix P are calculated based on the position and dimension. Then, in each word vector in the matrix after content embedding, position embedding is added according to its position in the sequence, and finally a vector matrix is obtained.
[0035] Furthermore, in step S233, the encoder in the Transformer model contains N structurally identical encoding blocks, each encoding block containing two sub-layers: a self-attention layer and a feedforward neural network layer, and a layer normalization operation is performed between the two sub-layers.
[0036] When processing an input sequence, the self-attention layer focuses on different positions in the sequence. For structured text requirements, the self-attention layer can understand the relationship between each element and other elements and determine the importance of each condition when deciding on the test object.
[0037] The feedforward neural network layer is used to perform non-linear transformations on the data processed by the self-attention layer, further mining deeper logical relationships and features from the input structured text;
[0038] Layer normalization is used to normalize the input data for each layer.
[0039] After encoding by N identical coding blocks, the deep feature representation of the input control logic structured text requirements is fully extracted, resulting in the encoded information matrix, i.e. the encoded matrix, which is defined as the input matrix.
[0040] Furthermore, in step S235, the decoder in the Transformer model contains N structurally identical decoding blocks. Each decoding block contains three sub-layers: a self-attention layer, an encoder-decoder attention layer, and a feedforward neural network layer. Layer normalization operations are performed before and after each sub-layer.
[0041] The roles of self-attention layers, feedforward neural network layers, and layer normalization in the decoded block are the same as those in the encoded block;
[0042] The encoder-decoder attention layer ensures that the decoder can incorporate information from the structured text requirements of the input when generating test cases;
[0043] The encoder-decoder attention layer controls the structured text requirements and target test case data to form a deeper feature representation. After decoding, the corresponding first and second features are obtained, and then the feature mapping relationship between the two is established.
[0044] Furthermore, in step S3, the case retrieval module first uses the built-in logical judgment for retrieval of test case IDs to crawl and save the test case IDs of all test cases, and generates a test case number storage variable to store the test case numbers of all test cases; when faced with a new test case, the case retrieval module crawls the test case number in the storage variable during test runtime. If a new test case number is crawled, the corresponding test case is obtained and the test script is automatically generated.
[0045] The parsing module then parses the content line by line, storing each test case as an independent object. The parsing module uses the `read_Excel` function from the pandas library to read the Excel file, extracting key information about the test cases and saving it as an array. This key information includes the test number, test type, initial conditions, test steps, and test results. The `Test_Precondition` array stores the textual information of the initial conditions. When parsing each row of data, the parsing module uses string manipulation methods to separate multiple operation steps within each cell.
[0046] The sequence definition module is then used to define the format of the test script in the host computer, which creates a test sequence template structure based on the test script format in the host computer.
[0047] The mapping and conversion module then uses mapping rules to convert the field content: it converts the test steps in Excel into operation instructions for the test script, and can replace the string content according to the mapping rules during the conversion.
[0048] Finally, the generation module generates test scripts and stores them in segments according to modules or test cases, outputting script files. The generation module contains the open function and the write function. The open function is used to create or open a file to write test script content. The write function writes the generated test script content to the file.
[0049] On the other hand, this invention proposes an automated testing device for a vehicle body controller, which includes a host computer, a communication module, a simulation and signal generation module, a vehicle body controller unit, and an external power supply module, wherein...
[0050] The host computer executes the aforementioned automated test case generation method to generate automated test cases; then the script generation module inside the host computer converts the test cases into test scripts.
[0051] The simulation and signal generation module integrates a power management module, an analog I / O module, and a digital I / O module. The power management module is connected to the body controller unit and can simulate the power signals of a real vehicle. The analog I / O module contains multiple analog output channels and analog measurement channels, which are used to simulate analog signal input or measure analog signal output. The analog signals include various sensor signals. The digital I / O module contains multiple digital input / output channels, which are used to simulate digital signal input or measure digital signal output. The digital I / O module can simulate the digital sensors or actuators of the body controller to input the on / off signal of the body controller or output the status of the signal lights driven by the body controller.
[0052] The communication module communicates with external devices via CAN, LIN, or Ethernet communication, and connects to the host computer via USB or Ethernet interface.
[0053] The external power supply module is a programmable power supply that powers the power management module. The external power supply module supports multiple channels, and each power output can simulate a type of real vehicle power supply. The external power supply module is connected to the host computer via serial communication, Ethernet communication, and analog control.
[0054] Furthermore, the script generation module in the host computer includes: a case retrieval module, a parsing module, a sequence definition module, a mapping conversion module, and a generation module, among which,
[0055] The case retrieval module has built-in logical judgment for retrieving test case IDs. It can crawl and save the test case IDs of all test cases and generate a test case number storage variable to store the test case numbers of all test cases. When a new test case is added, the case retrieval module crawls the test case number in the storage variable during test runtime. If a new test case number is crawled, the corresponding test case is obtained and the test script is automatically generated.
[0056] The parsing module parses the content line by line, storing each test case as an independent object. It uses the `read_Excel` function from the pandas library to read the Excel file, extracting key information about the test cases and saving it as an array. This key information includes the test number, test type, initial conditions, test steps, and test results. The `Test_Precondition` array stores the textual information of the initial conditions. When parsing each row of data, the parsing module uses string manipulation methods to separate multiple operation steps within each cell.
[0057] The sequence definition module is used to define the format of the test script in the host computer. It creates a test sequence template structure based on the test script format in the host computer.
[0058] The mapping conversion module uses mapping rules to convert field content: it converts test steps in Excel into operation instructions for test scripts, and can replace string content according to mapping rules during the conversion.
[0059] The generation module generates test scripts and stores them in segments according to modules or test cases, outputting script files. The generation module includes the open function and the write function. The open function is used to create or open a file to write the test script content. The write function writes the generated test script content to the file.
[0060] The beneficial effects of this invention are as follows:
[0061] This invention optimizes the automated testing process for vehicle body controllers: by using a test case generation method for vehicle body controllers, the functional requirement specification document during the development process of the vehicle body controller can be converted into test cases in Excel format. Combined with the script generation module of this invention, the generation of test cases into test scripts is finally realized, saving time and effort and optimizing the automated testing process.
[0062] This invention expands the scope of automated testing for vehicle body controllers: through an automated testing device for vehicle body controllers, various signals involved in real vehicle conditions can be accurately simulated, greatly expanding the testing coverage, enabling composite function testing in multiple scenarios, and comprehensively evaluating the performance of vehicle body controllers under complex operating conditions.
[0063] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description
[0064] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein:
[0065] Figure 1 This is a schematic diagram of the structured text processing process for the control logic of the low beam headlights of the present invention;
[0066] Figure 2 This is a schematic diagram of the Transformer model of the present invention;
[0067] Figure 3 This is a schematic diagram of the structure of the automated testing device of the present invention;
[0068] Figure 4 This is a schematic diagram of the script generation module in the host computer of the automated testing device of the present invention.
[0069] Figure 5 This is a schematic diagram of the overall processing flow of the automated testing device of the present invention.
[0070] Figure reference numerals: 101-Host computer; 102-Communication module; 103-External power supply; 104-Simulation and signal generation module; 1041-Power management module; 1042-Analog I / O module; 1043-Digital I / O module; 105-Body controller; 601-Case retrieval module; 602-Parsing module; 603-Sequence definition module; 604-Mapping conversion module; 605-Generation module. Detailed Implementation
[0071] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0072] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual pictures. They should not be construed as limiting the invention. To better illustrate the embodiments of the invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0073] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "front," and "rear" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present invention. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.
[0074] Please see Figures 1-5 This relates to an automated testing method and apparatus for vehicle body controllers.
[0075] This invention first provides an automated testing method for a vehicle body controller, which includes the following steps:
[0076] S1. The functional requirements specification text of the vehicle body controller is transformed into a structured text of control logic using the Large Language Model (LLM).
[0077] S2. Use the Transformer model to convert the structured text of the control logic into test cases in Excel format;
[0078] Step S1 includes the following sub-steps:
[0079] S11. The large language model LLM is pre-trained using textual knowledge from the automotive field and functional specifications of the vehicle body controller.
[0080] S111. Perform corpus-based structuring on the functional requirements specification of the vehicle body controller, decomposing it into long functional texts. Combined with the functional standards of the vehicle body controller, generate a knowledge graph of the vehicle body controller and construct a functional requirements specification corpus. Obtain the structured control logic text written in the functional requirements specification from the review use case table records.
[0081] S112. Map the structured control logic text to a functional requirements specification corpus, and embed a word segmenter in the functional requirements specification corpus to establish a mapping relationship between the product functional requirements specification document and the structured control logic text. This includes: identifying the initial state, actions, and conditions contained in the structured control logic text through recognition.
[0082] S113. Input the established mapping relationship into the body controller knowledge graph to form the reasoning context of the control logic structured text; model based on the mapping relationship corresponding to the reasoning context of the control logic structured text, and obtain the LLM large language model after training;
[0083] S12. Input the functional specifications for the body controller to be tested into a pre-trained large language model using natural language. The model extracts the functional requirement document corpus contained in the functional requirement specifications, performs semantic analysis on the functional requirement document corpus, and outputs the structured text of the control logic.
[0084] Step S2 includes the following sub-steps:
[0085] S21. Pre-list all relevant test cases based on the structured text of the control logic.
[0086] S22. Perform data preprocessing on the control logic structured text and test case data respectively to obtain the control logic structured text training set and the test case training set;
[0087] The preprocessing process includes: cleaning the structured text requirements of the control logic to remove noise from the data, such as redundant punctuation marks, special characters, and inconsistent capitalization; then preprocessing the cleaned data to obtain the training set of structured text requirements of the control logic; and performing the same data preprocessing operation on the test case data corresponding to the input structured text requirements of the control logic to obtain the test case training set.
[0088] S23. Establish a Transformer model, pre-train the Transformer model using a control logic structured text training set and a test case training set, and process the control logic structured text to be executed using the pre-trained Transformer model to obtain the corresponding test cases.
[0089] The established Transformer model includes at least an encoder and a decoder, which processes the structured text of control logic according to the following steps:
[0090] S231. Preprocess the input control logic structured text requirements to obtain a digital matrix.
[0091] S232. Perform content embedding and position embedding processing on the digital matrix to obtain a vector matrix from which content information and position information have been extracted.
[0092] S233. Encode the vector matrix using the encoder in the trained Transformer model to obtain the encoded matrix, and define it as the input matrix.
[0093] S234. The target test case data corresponding to the input control logic structured text requirements are processed using the same data preprocessing and embedding operations to obtain the output matrix.
[0094] S235. Use a decoder to decode the input matrix and the output matrix respectively, so as to construct the feature mapping relationship between the input control logic structured text requirements and the target test case data based on the decoding results, and then generate the target test cases based on the feature mapping relationship.
[0095] The test case generation method of this invention is applicable to various tests, including tests of vehicle headlights, doors, windows, vehicle anti-theft devices, rearview mirrors, windshield wipers, horns, and locks for the vehicle body controller. This embodiment takes the low beam headlight in the headlight test as an example, and provides a detailed description of the test case generation for the low beam headlight.
[0096] For step S1, the input data for this method is the functional requirement specification description of the low beam headlights in the vehicle body controller system. The model needs to extract key information from the specification description and finally generate a structured text requirement for the control logic of the test target function according to predetermined syntax rules. The following is a specification text describing the functional requirements of the low beam headlights in the vehicle body controller, where Table 1 is the low beam headlight input signal table and Table 2 is the low beam headlight output signal table:
[0097] Table 1
[0098]
[0099] Table 2
[0100]
[0101] (1) After turning on the ignition switch, the headlight switch type is configured as hard wire. When the high beam switch is in the off state, the low beam lights up when the low beam manual switch is turned on; when the low beam manual switch is turned off, the low beam lights go out.
[0102] (2) The low beam headlights will enter working mode when the following conditions are met simultaneously:
[0103] ① Ignition switch on
[0104] ② The headlight switch type is configured as hard wire.
[0105] ③ Turn on the low beam headlight switch
[0106] The low beam headlights will exit the low beam mode when any of the following conditions are met:
[0107] ① Ignition switch off
[0108] ② Configure the light switch type as virtual.
[0109] ③ Low beam headlights off
[0110] Step S1 transforms the functional requirements specification expressed in natural language into a structured text requirement for control logic, which includes nodes such as initial state, input and output signals, functional logic judgment expressions, and expected output results. Figure 1 This is an example diagram of the structured text requirements for the low beam headlight control logic. The entire generation process involves multiple inference subtasks, including extracting the vehicle's initial state, extracting input and output signals, inferring functional logic, and semi-structured data transformation. The flowchart symbols involved are shown in Table 3.
[0111] Table 3
[0112]
[0113] Table 3 uses standardized symbols to describe the data. Each block diagram contains specific attribute information of the output data, including nodes such as initial state, input signal, functional logic judgment expression, and expected output result, providing basic data for subsequent test case generation.
[0114] Compared to step S2, where, as Figure 2 As shown, in step S231, the input control logic structured text requirements are preprocessed to convert them into a corresponding numerical matrix. Data preprocessing: First, elements are extracted from the flowchart: The structured text requirements for the low beam headlight control logic are carefully analyzed to extract all conditions, signals, and results. The extracted elements are then categorized into initial state, input condition, condition judgment, and output result categories. Each distinct element is then assigned a unique numerical number. For example: System connection normal: number 1; Ignition switch off: number 2; Headlight switch type not configured: number 3; Low beam switch not on: number 4; Ignition switch signal: number 5; Headlight switch type configured: number 6; High beam switch signal: number 7; Low beam switch signal: number 8; Ignition switch on: number 9; Headlight switch type configured as hardwired: number 10; High beam switch off: number 11; Low beam switch on: number 12; Low beam on: number 13; Low beam off: number 14. Logic &: number 15. Then, a matrix is constructed based on the logical relationships in the diagram, including an initial state matrix, a signal input matrix, a judgment condition matrix, and a result matrix. These matrices are integrated according to the low beam control logic flow to form a complete digital matrix, facilitating the Transformer model's processing and analysis of the low beam control function.
[0115] In step S232, the digital matrix is processed by content embedding and position embedding to obtain a vector matrix from which content information and position information have been extracted.
[0116] Content embedding: Define a content embedding matrix E with dimensions V×d, where V is the total number of element numbers and d is the content embedding dimension. For each number in the above numerical matrix, the corresponding word vector is obtained by looking up the content embedding matrix E.
[0117] Positional embedding: Define a positional embedding matrix P with dimensions L×d, where L is the maximum length of the sequence (depending on the length of the longest submatrix in the aforementioned numeric matrix), and d is the positional embedding dimension (the same as the content embedding dimension). The elements of the positional embedding matrix P are typically calculated based on position and dimension using a function (such as sine and cosine functions). Then, for each word vector in the content-embedded matrix, a positional embedding is added based on its position in the sequence, ultimately resulting in a vector matrix.
[0118] In step S233, the encoder in the Transformer model contains N structurally identical encoding blocks. Each encoding block typically contains two sub-layers: a self-attention layer and a feedforward neural network layer. Layer normalization is performed between these two sub-layers. The self-attention layer allows the model to focus on different positions within the input sequence when processing it. For structured text requirements (e.g., various switch states and conditions in vehicle headlight control logic), it helps the model understand the relationship between each element and other elements, determining the importance of each condition in deciding whether the low beam is on. The feedforward neural network layer performs a non-linear transformation on the data processed by the self-attention layer to further extract features. It can extract deeper logical relationships and features from the input structured text. In this embodiment, it helps the model learn more complex logic, such as how to correctly generate test cases under various combinations of conditions (different combinations of ignition switch, headlight switch type configuration, high beam switch, and low beam switch states). Layer normalization normalizes the input data for each layer, helping to stabilize the model training process and accelerate convergence. In the process of generating test cases for vehicle lights, it can avoid the problems of gradient vanishing or gradient exploding during multi-layer network processing.
[0119] After encoding N identical coding blocks, the deep feature representation of the input control logic structured text requirements is fully extracted, and the encoded information matrix, i.e. the encoded matrix, is obtained, which is defined as the input matrix.
[0120] In step S234, the target test case data corresponding to the input control logic structured text requirements are subjected to the same data preprocessing and embedding operations to obtain the output matrix.
[0121] In step S235, the decoder in the Transformer model contains N structurally identical decoding blocks. Each decoding block typically contains three sub-layers: a self-attention layer, an encoder-decoder attention layer, and a feedforward neural network layer. Layer normalization operations are performed before and after each sub-layer. The roles of the self-attention layer, feedforward neural network layer, and layer normalization in the decoding block are similar to those in the encoding block described above, and will not be elaborated upon here. The encoder-decoder attention layer is used to make the decoder focus on the encoder's output. It enables the decoder to incorporate information from the structured text requirements of the input when generating test cases.
[0122] After decoding, a deeper feature representation between the input control logic structured text requirements and the target test case data can be extracted. After decoding, the corresponding decoded first feature and second feature can be obtained, and the feature mapping relationship between the two is also better modeled. Based on the feature mapping relationship, the corresponding target test cases are generated according to the input control logic structured text requirements.
[0123] On the other hand, the present invention also provides an automated testing device for a vehicle body controller, such as... Figure 3 As shown, it includes: a host computer 101, a communication module 102, a simulation and signal generation module 104, a body controller 105, and an external power supply module 103. The simulation and signal generation module includes a power management module 1041, an analog I / O module 1042, and a digital I / O module 1043. The host computer 101 generates test cases according to the aforementioned automated test case generation method for the body controller, and the script generation module inside the host computer 101 converts the test cases into test scripts.
[0124] In this embodiment, the simulation and signal generation module can be implemented as a baseboard on which multiple function cards can be integrated, and each of them can be implemented as a function card and configured to be integrated on the baseboard of the simulation and signal generation module.
[0125] The power supply unit comprises a power management module and an external power supply module. The power management module can be implemented as a power function card, which connects to the KL15 of the body control unit and can simulate real vehicle power signals, such as ignition switch signals. The external power supply module can be implemented as a programmable power supply to power the power management module. This programmable power supply, as the external power source for the power function card, supports multiple channels, with each power output simulating a different type of real vehicle power supply. It communicates with the host computer via serial communication, Ethernet communication, and analog control. The power supply unit communicates externally via CAN bus and can be configured to provide power signals with the required voltage and current values in response to bus commands from the host computer.
[0126] The various signals required by the body controller can be implemented by combining different input signals according to different test operations using multiple modules included in the simulation and signal generation module. In this embodiment, the analog I / O module can be implemented as an analog function card, containing multiple analog output channels and analog measurement channels, used to simulate analog signal input or measure analog signal output, and capable of simulating various sensor signals, such as the output signals of temperature, pressure, and liquid level sensors. The digital I / O module can be implemented as a digital function card, containing multiple digital input / output channels, used to simulate digital signal input or measure digital signal output, and can simulate the digital sensors or actuators of the body controller, used for the switching signal input of the body controller or the signal light status output driven by the body controller. The base plate and multiple function cards can be connected via hardwired connections. In this embodiment, the communication module can be implemented as a CAN communication card, LIN communication card, and Ethernet communication card. The communication module connects to the host computer using a USB or Ethernet interface.
[0127] like Figure 4 As shown, the script generation module includes:
[0128] The case retrieval module 601 has built-in logical judgment for retrieving test case IDs. It can crawl and save the test case IDs of all test cases, generating a test case number storage variable to store the test case numbers of all test cases. Furthermore, when a new test case is added, the test runtime will crawl the test case number in the storage variable. If a new test case number is crawled, the corresponding test case is obtained, and the test script is automatically generated. This enables the automatic generation of test scripts for newly added test cases, improving testing efficiency.
[0129] The parsing module 602 can parse content line by line, storing each test case as an independent object. The parsing module includes Python pandas functions, using the `read_Excel` function from the pandas library to read Excel files, extract key information about the test cases from the Excel files, and save it as an array. Furthermore, the key information in the test cases includes the test number, test type, initial condition, test steps, and test result. The `Test_Precondition` array stores the textual information of the initial condition, and the `Test_Procedure` array stores the textual information of the test steps. When parsing each row of data, the parsing module needs to separate the multiple operation steps that may be contained in each cell. This can be achieved using string manipulation methods. For example, the `split` function can be used to split the string.
[0130] The sequence definition module 603 is used to define the format of the test scripts in the host computer. A test sequence template structure can be created based on the test script format in the host computer. For example, a dictionary can be used to represent each test step.
[0131] The mapping conversion module 604 uses mapping rules to convert field content: it converts test steps in Excel into operation instructions for test scripts. During the conversion, it may be necessary to replace string content according to the mapping rules.
[0132] The generation module 605 is used to generate test scripts adapted for the host computer, and store them in segments according to modules or test cases, outputting script files. The generation module includes the `open` function, used to create or open files to write test script content, and the `write` function, which writes the generated test script content to a file.
[0133] Furthermore, the test script refers to the program code that the vehicle body controller under test needs to run in the process of implementing a certain or multiple sub-functional modules that need to be executed in combination. It includes communication code instructions and code instructions for deploying and triggering the input and output interfaces in the simulation and signal generation module.
[0134] In this embodiment, Figure 5 This invention presents a flowchart of the overall testing process for low beam headlights. First, the functional requirements specification text for the low beam headlights is transformed into structured control logic text requirements using a Large Language Model (LLM). Then, a Transformer model is used to convert the structured control logic text requirements into test cases in Excel format. This test case generation algorithm is then deployed on a host computer and interacts with the script generation module on the host computer to achieve the conversion from test cases to test scripts. The communication module establishes a communication link between the control commands on the host computer and the simulation and signal generation module based on the test scripts, enabling communication between the host computer and the vehicle body controller. After receiving / issuing control commands, the simulation and signal generation module simulates the corresponding control behavior if the command is relevant, achieving the simulation purpose. By organically combining the simulation and signal generation modules through the control commands from the host computer, a virtual test environment is constructed without actual circuitry. This allows for precise control of the behavior of the analog I / O and digital I / O modules, simulating signal transmission and interaction in actual circuits, and effectively performing comprehensive simulation testing of the vehicle body controller.
[0135] In summary, this invention proposes an automated testing method and apparatus for vehicle body controllers. Addressing the problems of low efficiency and incomplete coverage in traditional vehicle body controller testing due to manual test case writing, and the poor flexibility and inability of traditional testing devices to accurately simulate various complex operating conditions, this invention innovatively employs a test case generation method to convert standard functional requirements specifications into test cases in Excel format, and further generates test scripts using a script generation module. This invention also relates to an automated testing apparatus capable of efficiently and comprehensively simulating various complex environments and operating conditions faced by vehicle body controllers in actual vehicle operation, improving test quality and efficiency, powerfully promoting the development of vehicle body controller testing technology in the field of automotive electronics, and enhancing the stability and reliability of automotive electronic systems.
[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. An automated testing method for a vehicle body controller, characterized in that: The method includes the following steps: S1. The functional requirements specification text of the vehicle body controller is transformed into a structured control logic text using a Large Language Model (LLM), which includes: S11. Pre-train the large language model LLM using automotive domain textual knowledge and functional specification data of the body controller; step S11 includes the following steps: S111. Perform corpus structuring on the functional requirements specification of the body controller, generate a body controller knowledge graph, and construct a functional requirements specification corpus; obtain the structured text of the control logic written in the functional requirements specification from the review use case table records. S112. Map the structured text of control logic to the functional requirements specification corpus, and embed a word segmenter in the functional requirements specification corpus to establish a mapping relationship between the product functional requirements specification and the structured text of control logic through the word segmenter. S113. Input the established mapping relationship into the body controller knowledge graph to form the reasoning context of the control logic structured text; model based on the mapping relationship corresponding to the reasoning context of the control logic structured text, and obtain the LLM large language model after training; S12. Input the enterprise specifications, standard functional specifications, and experience scenarios to be tested for the body controller into the pre-trained large language model in natural language, and output the structured text of the control logic. S2. Test cases that convert the structured text of control logic into Excel format using the Transformer model, including: S21. Pre-list all relevant test cases based on the structured text of the control logic. S22. Perform data preprocessing on the control logic structured text and test case data respectively to obtain the control logic structured text training set and the test case training set; S23. Establish a Transformer model. Pre-train the Transformer model using a control logic structured text training set and a test case training set. Process the control logic structured text to be executed using the pre-trained Transformer model to obtain the corresponding test cases. In step S23, the established Transformer model includes at least an encoder and a decoder, which processes the control logic structured text according to the following steps: S231. Preprocess the input control logic structured text requirements to obtain a digital matrix; S232. Perform content embedding and position embedding processing on the digital matrix to obtain a vector matrix containing content information and position information; S233. Encode the vector matrix using the encoder in the pre-trained Transformer model to obtain the encoded matrix, and define it as the input matrix. S234. The target test case data corresponding to the input control logic structured text requirements are processed through the same data preprocessing and embedding operations to obtain the output matrix; S235. The input matrix and output matrix are decoded using a decoder to construct a feature mapping relationship between the input control logic structured text requirements and the target test case data based on the decoding results; subsequently, the target test cases are generated in real time based on the feature mapping relationship. S3. The obtained test cases are converted into test scripts through the script generation module for automated testing.
2. The automated testing method for a vehicle body controller according to claim 1, characterized in that: In step S231, the data preprocessing process includes: Extract the relevant elements from the structured text of the control logic. The elements include all conditions, signals, and results. Then, the elements are categorized into four types: initial state, input condition, condition judgment, and output result. Finally, a unique numerical identifier is assigned to each distinct element.
3. The automated testing method for a vehicle body controller according to claim 2, characterized in that: In step S232, the content embedding process is as follows: Define a content embedding matrix E with a dimension of V×d, where V is the total number of all element numbers identified and d is the content embedding dimension. For each number in the number matrix, the corresponding word vector is obtained by looking up the content embedding matrix E. Position embedding: Define a position embedding matrix P with dimensions L×d, where L is the maximum length of the sequence and d is the position embedding dimension; The elements in the position embedding matrix P are calculated based on position and dimension. Then, position embeddings are added to each word vector in the content embedding matrix according to its position in the sequence, finally resulting in a vector matrix.
4. The automated testing method for a vehicle body controller according to claim 3, characterized in that: In step S233, the encoder in the Transformer model contains N structurally identical encoding blocks. Each encoding block contains two sub-layers: a self-attention layer and a feedforward neural network layer. A layer normalization operation is performed between the two sub-layers. When processing an input sequence, the self-attention layer focuses on different positions in the sequence. For structured text requirements, the self-attention layer can understand the relationship between each element and other elements and determine the importance of each condition in deciding the test object. The feedforward neural network layer is used to perform non-linear transformations on the data processed by the self-attention layer, further mining deeper logical relationships and features from the input structured text; Layer normalization is used to normalize the input data for each layer. After encoding N identical coding blocks, the deep feature representation of the input control logic structured text requirements is fully extracted, resulting in the encoded information matrix, i.e. the encoded matrix, which is defined as the input matrix.
5. The automated testing method for a vehicle body controller according to claim 4, characterized in that: In step S235, the decoder in the Transformer model contains N structurally identical decoding blocks. Each decoding block contains three sub-layers: a self-attention layer, an encoder-decoder attention layer, and a feedforward neural network layer. Layer normalization operations are performed before and after each sub-layer. The roles of self-attention layers, feedforward neural network layers, and layer normalization in the decoded block are the same as those in the encoded block; The encoder-decoder attention layer ensures that the decoder can incorporate information from the structured text requirements of the input when generating test cases; The encoder-decoder attention layer controls the structured text requirements and target test case data to form a deeper feature representation. After decoding, the corresponding first and second features are obtained, and then the feature mapping relationship between the two is established.
6. The automated testing method for a vehicle body controller according to claim 1, characterized in that: In step S3, the case retrieval module first uses its built-in logic to retrieve test case IDs, crawls and saves the test case IDs of all test cases, and generates a test case number storage variable to store the test case numbers of all test cases. When a new test case is added, the case retrieval module retrieves the test case number from the storage variable during test execution. If a new test case number is retrieved, the corresponding test case is obtained, and the test script is automatically generated. The parsing module then parses the content line by line, storing each test case as an independent object. The parsing module uses the read_Excel function in the pandas library to read the Excel file, crawls the key information of the test cases in the Excel file and saves it in the form of an array. The key information includes the test number, test type, initial conditions, test steps and test results. The Test_Precondition array is used to store the text information of the initial conditions; when parsing each row of data, the parsing module uses string manipulation methods to separate the multiple operation steps in each cell; The sequence definition module is then used to define the format of the test script in the host computer, which creates a test sequence template structure based on the test script format in the host computer. The mapping and conversion module then uses mapping rules to convert the field content: it converts the test steps in Excel into operation instructions for the test script, and can replace the string content according to the mapping rules during the conversion. Finally, the generation module generates test scripts, stores them in segments according to modules or test cases, and outputs script files; The generated module contains the `open` and `write` functions; the `open` function is used to create or open a file to write test script content. The write function writes the generated test script content to a file.
7. An automated testing device for a vehicle body controller, characterized in that: It includes a host computer, a communication module, a simulation and signal generation module, a body controller unit, and an external power supply module. The host computer executes the automated testing method described in any one of claims 1-6 to obtain a test script; The simulation and signal generation module integrates a power management module, an analog I / O module, and a digital I / O module. The power management module is connected to the body controller unit and can simulate the power signals of a real vehicle. The analog I / O module contains multiple analog output channels and analog measurement channels, which are used to simulate analog signal input or measure analog signal output. The analog signals include various sensor signals. The digital I / O module contains multiple digital input / output channels, which are used to simulate digital signal input or measure digital signal output. The digital I / O module can simulate the digital sensors or actuators of the body controller to input the on / off signal of the body controller or output the status of the signal lights driven by the body controller. The communication module communicates with external devices via CAN, LIN, or Ethernet communication, and connects to the host computer via USB or Ethernet interface. The external power supply module is a programmable power supply that powers the power management module. The external power supply module supports multiple channels, and each power output can simulate a type of real vehicle power supply. The external power supply module is connected to the host computer via serial communication, Ethernet communication, and analog control.
8. An automated testing device for a vehicle body controller according to claim 7, characterized in that: The script generation module in the host computer includes: a case retrieval module, a parsing module, a sequence definition module, a mapping conversion module, and a generation module. The case retrieval module has built-in logical judgment for retrieving test case IDs. It can crawl and save the test case IDs of all test cases and generate a test case number storage variable to store the test case numbers of all test cases. When a new test case is added, the case retrieval module crawls the test case number in the storage variable during test runtime. If a new test case number is crawled, the corresponding test case is obtained and the test script is automatically generated. The parsing module parses the content line by line, storing each test case as an independent object. It uses the `read_Excel` function from the pandas library to read the Excel file, extracting key information about the test cases and saving it as an array. This key information includes the test number, test type, initial conditions, test steps, and test results. The `Test_Precondition` array stores the textual information of the initial conditions. When parsing each row of data, the parsing module uses string manipulation methods to separate multiple operation steps within each cell. The sequence definition module is used to define the format of the test script in the host computer. It creates a test sequence template structure based on the test script format in the host computer. The mapping conversion module uses mapping rules to convert field content: it converts test steps in Excel into operation instructions for test scripts, and can replace string content according to mapping rules during the conversion. The generation module generates test scripts and stores them in segments according to modules or test cases, outputting script files. The generation module includes the open function and the write function. The open function is used to create or open a file to write the test script content. The write function writes the generated test script content to the file.
Citation Information
Patent Citations
CAN bus network management test system and method
CN104734911A
Self-aware superintelligence (SI)
WO2024182824A1