Automatic test method and device for vehicle body controller

By converting the functional requirements specifications of the body controller into control logic structured text, and using the Transformer model to generate test cases and scripts, combined with the automated test device, the problems of low efficiency and incomplete coverage of traditional test methods are solved, and efficient and comprehensive automated testing of the body controller is achieved.

CN119987331AActive Publication Date: 2025-05-13CHONGQING UNIV OF POSTS & TELECOMM
View PDF 15 Cites 0 Cited by

Patent Information

Application Number
CN202510055372.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-05-13
Estimated Expiration
2045-01-14

AI Technical Summary

Technical Problem

Traditional body controller testing methods are inefficient and incomplete, difficult to accurately simulate complex working conditions, and lack automated testing frameworks and tools.

Method used

The large language model is used to convert the functional requirements specification text of the body controller into control logic structured text, and it is converted into test cases in Excel through the Transformer model, and finally generates the test script using the script generation module. At the same time, an automated testing device was designed, including a computer, a communication module, a simulation and signal generation module, which could efficiently simulate various complex environments and working conditions of the body controller in actual vehicle operation.

Benefits of technology

It realizes efficient, comprehensive and flexible automated testing of the body controller, improves the accuracy and efficiency of the test, and can conduct composite functional testing in multiple scenarios to comprehensively evaluate the performance of the body controller.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987331A_ABST
    Figure CN119987331A_ABST
Patent Text Reader

Abstract

The invention relates to an automatic test method and device for a vehicle body controller, and belongs to the technical field of automotive electronics. According to the method, a function requirement specification text of the vehicle body controller is converted into a control logic structured text by adopting a large language model (LLM), the control logic structured text is converted into a test case in an Excel form through a Transform model, and then the case is converted into a test script for testing. The device comprises an upper computer, a communication module, a simulation and signal generation module, a vehicle body controller unit and an external power supply module, and the upper computer executes the automatic test case generation method to generate an automatic test case; and a script generation module in the upper computer converts the test case into a test script, and all the modules are connected through a standardized interface and work cooperatively. According to the invention, the test efficiency and accuracy of the vehicle body controller are obviously improved, and an efficient and reliable solution is provided for intelligent test.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of automobile electronic technology, relates to a testing technology of a vehicle body controller, and in particular to an automatic testing method and device for a vehicle body controller. Background Art

[0002] With the rapid development of automotive electronic technology, the functions of body control modules (BCM) in vehicles are becoming increasingly complex, covering multiple aspects such as door control, window lifting, and light adjustment, etc. This makes the testing of body control modules more important and challenging.

[0003] In the traditional vehicle body controller testing process, test cases are mainly written manually by testers, which is inefficient. Testers need to spend a lot of time and energy to sort out complex functional logic and various possible input and output situations from a large number of standard functional specifications and convert them into test cases. This process is cumbersome and prone to human omissions and errors, making it difficult to ensure the integrity and accuracy of test cases.

[0004] With the continuous evolution of body controller products, they have developed rapidly in terms of functional richness, processing power improvement, and system integration, which also brings challenges to traditional testing methods and test equipment. Traditional testing methods usually use physical hardware equipment to build a test environment, and simulate the actual operating status of the vehicle by directly connecting various real sensors and actuators. On the one hand, this method has poor flexibility and it is difficult to quickly adjust the test scenarios and parameters. In addition, due to the coupling of the functions of each module, the testing difficulty increases. During the test process, efficient resource scheduling and synchronous control cannot be achieved, and it is difficult to accurately simulate the various complex environments and working conditions faced by the body controller in actual vehicle operation. On the other hand, there is currently a lack of effective testing frameworks and tools to integrate the test process. Manually writing test scripts and injecting test signals are prone to errors, resulting in a lack of systematicity and coherence in the test process, and a low degree of automation in the test process.

[0005] In summary, the existing manual writing of test cases for body controllers and traditional testing devices have been unable 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 device for a vehicle body controller, which, through the innovative integration of software and hardware technologies, can accurately and efficiently perform complex functional tests on all functional modules of the vehicle body controller in multiple scenarios.

[0007] In order to achieve the above object, the present invention provides the following technical solutions:

[0008] An automated testing method for a vehicle body controller, the method comprising the following steps:

[0009] S1. Use the large language model (LLM) to convert the functional requirement specification text of the body controller into a control logic structured text, which includes:

[0010] S11. Pre-train the large language model LLM using textual knowledge in the automotive field and functional specification data of the body controller;

[0011] S12, inputting the enterprise specifications, standard functional specifications, and experience scenarios of the to-be-executed tests for the vehicle body controller into the pre-trained large language model in natural language, and outputting a control logic structured text;

[0012] S2. Transform the control logic structured text into a test case in Excel format through the Transformer model, which includes:

[0013] S21. Pre-list all relevant test cases according to the control logic structured text;

[0014] S22, performing data preprocessing on the control logic structured text and the test case data respectively to obtain a control logic structured text training set and a test case training set;

[0015] S23. Establish a Transformer model, use the control logic structured text training set and the test case training set to pre-train the Transformer model, use the pre-trained Transformer model to process the control logic structured text to be executed, and obtain the corresponding test case.

[0016] S3. Convert the obtained test cases into test scripts through the script generation module for automated testing.

[0017] Further, in step S11,

[0018] S111. Perform corpus structure processing on the functional requirement specification of the body controller, generate a knowledge graph of the body controller, and build a functional requirement specification corpus. Obtain the control logic structured text written by reading the functional requirement specification recorded in the review case table;

[0019] S112, mapping the control logic structured text to a functional requirement specification corpus, and embedding a word segmenter in the functional requirement specification corpus, and establishing a mapping relationship between the product functional requirement specification and the control logic structured text through the word segmenter;

[0020] S113, inputting the constructed mapping relationship into the body controller knowledge graph to form the reasoning context of the control logic structured text; modeling is performed based on the mapping relationship corresponding to the reasoning context of the control logic structured text, and an LLM large language model is obtained through training;

[0021] Further, in step S111, the product function requirement specification document is decomposed into function long texts, and combined with the function standards of the body controller, a body controller knowledge graph is generated;

[0022] Further, in step S112, the product function requirement specification document and the control logic structured text are mapped by the word segmenter, including: identifying the control logic structured text to obtain the initial state, action and condition contained in the control logic structured text;

[0023] Further, 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, preprocessing the input control logic structured text requirement to obtain a digital matrix;

[0025] S232, performing content embedding and position embedding processing on the digital matrix to obtain a vector matrix containing content information and position information;

[0026] S233, using the encoder in the pre-trained Transformer model to encode the vector matrix to obtain an encoded matrix, and define it as an input matrix;

[0027] S234, subjecting the target test case data corresponding to the input control logic structured text requirements to the same data preprocessing and embedding operations to obtain an output matrix;

[0028] S235. Decode the input matrix and the output matrix respectively using a decoder to construct a feature mapping relationship between the input control logic structured text requirements and the target test case data according to the decoding results; and subsequently generate the target test case in real time based on the feature mapping relationship.

[0029] Further, in step S231, the data preprocessing process includes:

[0030] Extract corresponding elements from the control logic structured text, including all conditions, signals and results;

[0031] Then classify the elements according to the starting state class, input condition class, condition judgment class and output result class;

[0032] Finally, a unique number is assigned to each different element.

[0033] Further, in step S232, the content embedding process is as follows: define a content embedding matrix E, whose dimension is V×d, where V is the total number of all element numbers of the identifier, and d is the content embedding dimension, and for each number in the digital matrix, obtain the corresponding word vector by searching the content embedding matrix E;

[0034] Position embedding: Define a position embedding matrix P with a dimension of 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, and then the position embedding is added to each word vector in the matrix after content embedding processing according to its position in the sequence, finally obtaining a vector matrix.

[0035] Further, in step S233, the encoder in the Transformer model includes N encoding blocks with the same structure, each encoding block includes 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, wherein,

[0036] The self-attention layer focuses on different positions in the sequence when processing the input 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 determining the test object;

[0037] The feedforward neural network layer is used to perform nonlinear transformation on the data processed by the self-attention layer, and further mine deeper logical relationships and features from the input structured text;

[0038] Layer normalization, used to normalize the input data of each layer;

[0039] After encoding by N coding blocks with the same structure, the deep feature representation of the input control logic structured text requirement is fully extracted to obtain the encoding information matrix, namely the encoded matrix, which is defined as the input matrix.

[0040] Further, in step S235, the decoder in the Transformer model includes N decoding blocks with the same structure, each decoding block includes three sublayers: a self-attention layer, an encoder-decoder attention layer, and a feedforward neural network layer, and there is a layer normalization operation before and after each sublayer, where:

[0041] The self-attention layers, feedforward neural network layers, and layer normalization in the decoding block work in the same way as the self-attention layers, feedforward neural network layers, and layer normalization in the encoding block;

[0042] The encoder-decoder attention layer ensures that the decoder can incorporate information from the input structured text requirements when generating test cases;

[0043] The encoder-decoder attention layer controls the deeper feature representation between the logical structured text requirements and the target test case data, and obtains the corresponding decoded first feature and second feature after decoding, and then establishes a feature mapping relationship between the two.

[0044] Further, in step S3, the case retrieval module first crawls and saves the case IDs of all the test cases through the built-in logic judgment for the case ID retrieval, and generates a case number storage variable to save the case numbers of all the test cases; when facing a new test case, the case retrieval module grabs the case number in the storage variable during the test run, and if a new case number is grabbed, the corresponding test case is obtained to automatically generate a test script;

[0045] The parsing module is then used to parse the content row by row, and each test case is stored as an independent object. The parsing module uses the read_Excel function in the pandas library to read the Excel file, crawl the key information of the test case in the Excel file and save it in the form of an array, where the key information includes the test sequence number, test type, initial condition, test steps and test results. The Test_Precondition array is used to save the text information of the initial condition. When parsing each row of data, the parsing module uses string operation methods to separate multiple operation steps in each cell.

[0046] The sequence definition module is then used to define the format of the test script in the host computer, and a test sequence template structure is created according to the test script format in the host computer;

[0047] The mapping conversion module then uses the mapping rules to convert the field content: convert the test steps in Excel into the operation instructions of the test script. During the conversion, the string content can be replaced according to the mapping rules.

[0048] Finally, the generation module generates the test script, stores it in segments by module or use case, and outputs the script file; the generation module contains open function and 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.

[0049] On the other hand, the present invention proposes an automatic test 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; the script generation module inside the host computer then 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 signal of the real vehicle. The analog I / O module includes multiple analog output channels and analog measurement channels, which are used to simulate analog signal input or measure analog signal output. The analog signal includes various sensor signals. The digital I / O module includes multiple digital input and output channels, which are used to simulate digital signal input or measure digital signal output. The digital I / O module can simulate the digital sensor or actuator of the body controller to input the light-on signal of the body controller or output the signal light status driven by the body controller.

[0052] The communication module communicates with external devices using CAN communication, LIN communication or Ethernet communication, and is connected to the host computer using a USB or Ethernet interface;

[0053] The external power supply module is a programmable power supply, which supplies power to the power management module. The external power supply module supports multiple channels, and each power output can simulate a real vehicle power type; the external power supply module is connected to the host computer through 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, wherein:

[0055] The case retrieval module has built-in logical judgment for case ID retrieval, which can crawl and save the case IDs of all test cases, and generate case number storage variables to save the case numbers of all test cases. When facing new test cases, the case retrieval module grabs the case number in the storage variable during test runtime. If a new case number is grabbed, the corresponding test case is obtained to automatically generate a test script.

[0056] The parsing module parses the content row by row and stores each test case as an independent object. The parsing module uses the read_Excel function in the pandas library to read the Excel file, crawl the key information of the test case in the Excel file and save it in the form of an array, where the key information includes the test sequence number, test type, initial condition, test steps and test results. The Test_Precondition array is used to save the text information of the initial condition. When parsing each row of data, the parsing module uses string operation methods to separate multiple operation steps in each cell.

[0057] The sequence definition module is used to define the format of the test script in the host computer, and it creates a test sequence template structure according to the test script format in the host computer;

[0058] The mapping conversion module uses mapping rules to convert field content: convert the test steps in Excel into operation instructions of the test script. When converting, the string content can be replaced according to the mapping rules;

[0059] The generation module generates a test script, stores it in segments by module or use case, and outputs a script file; the generation module includes an open function and a 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 a file.

[0060] The beneficial effects of the present invention are:

[0061] The present invention optimizes the automated testing process of the vehicle body controller: through a test case generation method for the vehicle body controller, the functional requirement specification document in the development process of the vehicle body controller can be converted into a test case in Excel format. In combination with the script generation module of the present invention, the generation from test cases to test scripts is finally realized, which saves time and energy and optimizes the automated testing process.

[0062] The present invention expands the scope of automated testing of the vehicle body controller: through an automated testing device for the vehicle body controller, various signals involved in actual vehicle conditions can be accurately simulated, greatly expanding the test coverage, enabling composite functional testing in multiple scenarios, and being able to comprehensively evaluate the performance of the vehicle body controller under complex working conditions.

[0063] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:

[0065] Figure 1 It is a schematic diagram of the structured text processing process of the control logic of the low beam lamp of the present invention;

[0066] Figure 2 It is a structural diagram of the Transformer model of the present invention;

[0067] Figure 3 It is a structural schematic diagram of the automatic testing device of the present invention;

[0068] Figure 4 It is a structural schematic diagram of a script generation module in a host computer of an automated testing device of the present invention;

[0069] Figure 5 It is a schematic diagram of the overall processing flow of the automatic testing device of the present invention.

[0070] Figure 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-analysis module; 603-sequence definition module; 604-mapping conversion module; 605-generation module. DETAILED DESCRIPTION

[0071] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways 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 only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.

[0072] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.

[0073] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.

[0074] See also Figure 1 to Figure 5 , which is an automatic testing method and device for a vehicle body controller.

[0075] The present invention first provides an automated testing method for a vehicle body controller, which comprises the following steps:

[0076] S1. Use the large language model (LLM) to convert the functional requirement specification text of the body controller into the control logic structured text;

[0077] S2, convert the control logic structured text into test cases in Excel format through the Transformer model;

[0078] Wherein, step S1 includes the following sub-steps:

[0079] S11. Use automotive domain text knowledge and body controller functional specification data to pre-train the large language model LLM, where:

[0080] S111. Perform corpus structure processing on the functional requirement specification of the body controller, decompose it into functional long text, generate the body controller knowledge graph in combination with the functional standard of the body controller, and build the functional requirement specification corpus. Obtain the control logic structured text written by reading the functional requirement specification recorded in the review case table;

[0081] S112, mapping the control logic structured text to the functional requirement specification corpus, and embedding a word segmenter in the functional requirement specification corpus, and establishing a mapping relationship between the product functional requirement specification document and the control logic structured text through the word segmenter. Including: by identifying the control logic structured text, obtaining the initial state, action and condition contained in the control logic structured text

[0082] S113, inputting the constructed mapping relationship into the body controller knowledge graph to form the reasoning context of the control logic structured text; modeling is performed based on the mapping relationship corresponding to the reasoning context of the control logic structured text, and an LLM large language model is obtained through training;

[0083] S12. Input the functional specifications of the tests to be performed on the vehicle body controller into the pre-trained large language model in 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 a control logic structured text.

[0084] Step S2 includes the following sub-steps:

[0085] S21. Pre-list all relevant test cases according to the control logic structured text;

[0086] S22, performing data preprocessing on the control logic structured text and the test case data respectively to obtain a control logic structured text training set and a test case training set;

[0087] The preprocessing process includes: cleaning the control logic structured text requirements to remove noise in the data, such as unnecessary punctuation, special characters, inconsistent upper and lower case, etc.; then preprocessing the cleaned data to obtain a control logic structured text requirement training set; and performing the same data preprocessing operation on the test case data corresponding to the input control logic structured text requirements to obtain a test case training set.

[0088] S23. Establish a Transformer model, use the control logic structured text training set and the test case training set to pre-train the Transformer model, use the pre-trained Transformer model to process the control logic structured text to be executed, and obtain the corresponding test case.

[0089] The established Transformer model includes at least an encoder and a decoder, which processes control logic structured text according to the following steps:

[0090] S231. Preprocess the input control logic structured text requirements to obtain a digital matrix.

[0091] S232, performing content embedding and position embedding processing on the digital matrix, so as to obtain a vector matrix from which content information and position information are extracted.

[0092] S233. Use the encoder in the trained Transformer model to encode the vector matrix to obtain the encoded matrix, which is defined as the input matrix.

[0093] S234, subjecting the target test case data corresponding to the input control logic structured text requirements to the same data preprocessing and embedding operations to obtain an output matrix.

[0094] S235. Decode the input matrix and the output matrix respectively using a decoder to construct a feature mapping relationship between the input control logic structured text requirements and the target test case data according to the decoding results, and then generate the target test case based on the feature mapping relationship.

[0095] The test case generation method of the present invention is aimed at multiple tests, including tests of vehicle body controllers such as vehicle lights, doors, windows, vehicle body anti-theft, rearview mirrors, wipers, horns, and locks. This embodiment takes the low beam in the vehicle light test as an example, and describes the test case generation for the low beam in detail as follows.

[0096] For step S1, the input data of this method is the specification description of the low beam function requirements in the body controller system. The model needs to extract the key information in the specification description and finally generate the control logic structured text requirements of the test target function according to the established grammatical rules. The following shows a section of the specification text describing the low beam function requirements in the body controller, where Table 1 is the low beam input signal table and Table 2 is the low beam 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 line. When the high beam switch is in the off state, when the low beam manual switch is turned on, the low beam lights are on; when the low beam manual switch is turned off, the low beam lights are off.

[0102] (2) When the following conditions are met at the same time, the low beam headlights enter the low beam working mode:

[0103] ①Ignition switch on

[0104] ②Headlight switch type is configured as hard wire

[0105] ③ Turn on the low beam switch

[0106] When any of the following conditions is met, exit the low beam working mode:

[0107] ①Ignition switch off

[0108] ②The light switch type is configured as virtual

[0109] ③ Turn off the low beam switch

[0110] Step S1 converts the functional requirement specification expressed in natural language into a control logic structured text requirement including 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 control logic. The entire generation process involves multiple reasoning subtasks, including extracting the initial state of the vehicle, extracting input and output signals, reasoning functional logic, and semi-structured data conversion. The process symbols involved in the structured flow chart are shown in Table 3:

[0111] Table 3

[0112]

[0113] In Table 3, uniformly specified standard symbols are used for description. 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] Compare step S2, where, Figure 2 As shown, in step S231, the input control logic structured text requirements are preprocessed and converted into a corresponding digital matrix. Data preprocessing: First, extract elements from the flow chart: First, carefully analyze the control logic structured text requirements of the low beam, and extract all elements such as conditions, signals and results. The extracted elements are classified into the starting state class, input condition class, condition judgment class and output result class. Then, a unique digital number is assigned to each different element. For example: the system is connected normally: numbered 1; the ignition switch is off: numbered 2; the headlight switch type is not configured: numbered 3; the low beam switch is not connected: numbered 4; the ignition switch signal: numbered 5; the headlight switch type is configured: numbered 6; the high beam switch signal: numbered 7; the low beam switch signal: numbered 8; the ignition switch is on: numbered 9; the headlight switch type is configured as hard wire: numbered 10; the high beam switch is off: numbered 11; the low beam switch is on: numbered 12; the low beam is on: numbered 13; the low beam is not on: numbered 14. Logic &: numbered 15. Then, a matrix is ​​constructed according to the logical relationship of the figure, including the starting state matrix, the signal input matrix, the judgment condition matrix and the result matrix. The above matrices are integrated according to the low beam control logic process to form a complete digital matrix, which is convenient for the Transformer model to process and analyze the low beam control function.

[0115] In step S232, content embedding and position embedding are performed on the digital matrix to obtain a vector matrix from which content information and position information are extracted.

[0116] Content embedding: Define a content embedding matrix E with dimensions V×d, where V is the total number of all element numbers in the identifier and d is the content embedding dimension. For each number in the above digital matrix, the corresponding word vector is obtained by looking up the content embedding matrix E.

[0117] Position embedding: Define a position 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 above digital matrix) and d is the position embedding dimension (the same as the content embedding dimension). The elements in the position embedding matrix P are usually calculated based on the position and dimension using some function (such as sine and cosine functions). Then, for each word vector in the matrix after content embedding, add the position embedding according to its position in the sequence, and finally get the vector matrix.

[0118] In step S233, the encoder in the Transformer model contains N encoding blocks with the same structure. Each encoding block usually contains two sublayers: a self-attention layer and a feedforward neural network layer. There will also be a layer normalization operation between these two sublayers. Among them, the self-attention layer enables the model to pay attention to different positions in the sequence when processing the input sequence. For structured text requirements (such as various switch states and conditions in the headlight control logic), it can help the model understand the relationship between each element and other elements, and determine the importance of each condition in determining whether the low beam is on. The feedforward neural network layer is used to perform nonlinear transformation on the data processed by the self-attention layer to further extract features. It can dig out deeper logical relationships and features from the input structured text. In this embodiment, it can help the model learn more complex logic, such as how to correctly generate test cases under multiple combinations of conditions (ignition switch, headlight switch type configuration, different state combinations of high beam switch and low beam switch). Layer normalization is used to normalize the input data of each layer, which helps to stabilize the model training process and accelerate convergence. In the process of generating car light test cases, it can avoid the problem of gradient vanishing or gradient exploding in the multi-layer network processing.

[0119] After encoding by N coding blocks with the same structure, the deep feature representation of the input control logic structured text requirements is fully extracted, and the encoding information matrix, that is, the encoded matrix, can be 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 requirement is subjected to the same data preprocessing and embedding operations to obtain an output matrix.

[0121] In step S235, the decoder in the Transformer model contains N decoding blocks with the same structure. Each decoding block usually contains three sublayers: a self-attention layer, an encoder-decoder attention layer, and a feedforward neural network layer. There are layer normalization operations before and after each sublayer. The role of the self-attention layer, the feedforward neural network layer, and the layer normalization in the decoding block is similar to that in the above-mentioned encoding block, and will not be elaborated here. The encoder-decoder attention layer is used to allow the decoder to pay attention to the output of the encoder. It enables the decoder to combine the information in the input structured text requirements when generating test cases.

[0122] After decoding, a deeper feature representation between the input control logic structured text requirement 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 case is generated according to the input control logic structured text requirement.

[0123] On the other hand, the present invention also provides an automatic 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, wherein the host computer 101 generates test cases according to the aforementioned automatic 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 may be implemented as a baseboard on which a plurality of function cards may be integrated, and each of them may 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 includes a power management module and an external power supply module, wherein the power management module can be implemented as a power function card, which is connected to the KL15 of the body controller unit and can simulate the power signal of the actual vehicle, such as the ignition switch signal. The external power supply module can be implemented as a programmable power supply to supply power to the power management module. The programmable power supply serves as an external power supply for the power function card and supports multiple channels. Each power output can simulate a type of power supply for an actual vehicle. It communicates with the host computer through serial communication, Ethernet communication and analog quantity control. The power supply unit uses CAN bus communication for external communication and can be configured to provide a power signal with the voltage and current values ​​required for the test in response to a bus command from the host computer.

[0126] For various signals required by the vehicle body controller, the multiple modules included in the simulation and signal generation module can be implemented according to different test operations and combined with different input signals. In this embodiment, the analog I / O module can be implemented as an analog function card, including multiple analog output channels and analog measurement channels, which are used to simulate analog signal input or measure analog signal output, and can simulate various sensor signals, such as the output signals of sensors such as temperature, pressure, and liquid level. The digital I / O module can be implemented as a digital function card, including multiple digital input and output channels, which are used to simulate digital signal input or measure digital signal output, and can simulate the digital sensor or actuator of the vehicle body controller, which is used for the switch signal input of the vehicle body controller or the signal light status output driven by the vehicle body controller. The base plate and multiple function cards can be connected by hard wires. In this embodiment, the communication module can be implemented as a CAN communication card, a LIN communication card, and an Ethernet communication card. The communication module is connected to the host computer using a USB or Ethernet interface.

[0127] like Figure 4 As shown, the script generation module contains:

[0128] The case retrieval module 601 has built-in logical judgment for use case ID (Test ID) retrieval, which can crawl and save the use case IDs of all use cases, generate use case number storage variables, and use them to save the use case numbers of all test cases; further, when facing the situation of adding new test cases, the use case number in the storage variable will be captured during the test runtime. If a new use case number is captured, the corresponding test case is obtained, and the test script is automatically generated. This can realize the operation of automatically generating test scripts for new test cases, thereby improving test efficiency.

[0129] The parsing module 602 can parse the content by row and store each test case as an independent object; the parsing module includes the pandas function in Python, uses the read_Excel function in the pandas library to read the Excel file, crawls out the key information of the test case in the Excel file and saves it in the form of an array. Furthermore, the key information in the test case includes the test sequence number, test type, initial conditions, test steps and test results. The Test_Precondition array is used to save the text information of the initial conditions, and the Test_Procedure array is used to save the text information of the test steps. When the parsing module parses each row of data, because each cell may contain multiple operation steps, they need to be separated. This can be achieved using string operation methods. For example, use the split function to split the string.

[0130] The sequence definition module 603 is used to define the format of the test script in the host computer. A test sequence template structure can be created according to 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: convert the test steps in Excel into operation instructions of the test script. When converting, it may be necessary to replace the string content according to the mapping rules.

[0132] The generation module 605 is used to generate a test script suitable for the host computer, store it in sections according to modules or use cases, and output the script file. The generation module includes an open function: used to create or open a file to write the test script content, and a write function, which writes the generated test script content into a file.

[0133] Furthermore, the test script refers to the program code that needs to be run when the vehicle body controller under test implements a certain item or multiple sub-functional modules that need to be executed in combination, including communication code instructions and code instructions for deploying and triggering input and output interfaces in simulation and signal generation modules.

[0134] In this embodiment, Figure 5 The overall test flow chart of a low beam lamp of the present invention is as follows. First, the functional requirement specification text of the low beam lamp is converted into the control logic structured text requirement through the large language (LLM) model. Then, the control logic structured text requirement is converted into a test case in the form of Excel through a Transformer model, and the test case generation algorithm is deployed in the host computer, and then interacts with the script generation module in the host computer to realize the conversion from the test case to the test script. The communication module can establish a communication link between the control instruction in the host computer and the simulation and signal generation module according to the test script, and realize the communication between the host computer and the vehicle body controller through the communication link. After the simulation and signal generation module receives / issues the control instruction, if the control instruction is related to it, the corresponding control behavior is simulated to achieve the purpose of simulation. Through the control instruction of the host computer, the simulation and signal generation module are organically combined, and a virtual test environment is constructed without an actual circuit, and the behavior of the analog I / O module and the digital I / O module is accurately controlled, and the signal transmission and interaction in the actual circuit are simulated, so as to effectively perform a comprehensive simulation test on the vehicle body controller.

[0135] In summary, the invention proposes an automated testing method and device for a vehicle body controller. Aiming at the problems of low efficiency and incomplete coverage of manually written test cases in traditional vehicle body controller testing, as well as poor flexibility of traditional testing devices and difficulty in accurately simulating various complex working conditions, an innovative test case generation method is adopted to realize the conversion from natural language input of standard functional requirements specifications to test cases in Excel format, and a script generation module is used to further generate test scripts. The present invention also relates to an automated testing device that can efficiently, comprehensively and accurately simulate various complex environments and working conditions faced by vehicle body controllers in actual vehicle operation, improve test quality and efficiency, effectively promote the development of vehicle body controller testing technology in the field of automotive electronic technology, and enhance 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 solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in 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 comprises the following steps: S1. Use the large language model (LLM) to convert the functional requirement specification text of the body controller into a control logic structured text, which includes: S11. Pre-train the large language model LLM using textual knowledge in the automotive field and functional specification data of the body controller; S12, inputting the enterprise specifications, standard functional specifications, and experience scenarios of the to-be-executed tests for the vehicle body controller into the pre-trained large language model in natural language, and outputting a control logic structured text; S2. Transform the control logic structured text into a test case in Excel format through the Transformer model, which includes: S21. Pre-list all relevant test cases according to the control logic structured text; S22, performing data preprocessing on the control logic structured text and the test case data respectively to obtain a control logic structured text training set and a test case training set; S23, establishing a Transformer model, using the control logic structured text training set and the test case training set to pre-train the Transformer model, using the pre-trained Transformer model to process the control logic structured text to be executed, and obtaining corresponding test cases; S3. Convert the obtained test cases 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 S11, the following steps are included: S111. Perform corpus structured processing on the functional requirement specification of the vehicle body controller, generate a knowledge graph of the vehicle body controller, and construct a functional requirement specification corpus; obtain the control logic structured text written by reading the functional requirement specification recorded in the review case table; S112, mapping the control logic structured text to the functional requirement specification corpus, and embedding a word segmenter in the functional requirement specification corpus, and establishing a mapping relationship between the product functional requirement specification and the control logic structured text through the word segmenter; S113, inputting the constructed mapping relationship into the body controller knowledge graph to form the reasoning context of the control logic structured text; modeling is performed based on the mapping relationship corresponding to the reasoning context of the control logic structured text, and the LLM large language model is obtained through training.

3. The automated testing method for a vehicle body controller according to claim 1, characterized in that: 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, preprocessing the input control logic structured text requirement to obtain a digital matrix; S232, performing content embedding and position embedding processing on the digital matrix to obtain a vector matrix containing content information and position information; S233, using the encoder in the pre-trained Transformer model to encode the vector matrix to obtain an encoded matrix, and define it as an input matrix; S234, subjecting the target test case data corresponding to the input control logic structured text requirements to the same data preprocessing and embedding operations to obtain an output matrix; S235. Decode the input matrix and the output matrix respectively using a decoder to construct a feature mapping relationship between the input control logic structured text requirements and the target test case data according to the decoding results; and subsequently generate the target test case in real time based on the feature mapping relationship.

4. The automatic testing method of a vehicle body controller according to claim 3, characterized in that: In step S231, the data preprocessing process includes: Extract corresponding elements from the control logic structured text, including all conditions, signals and results; Then classify the elements according to the starting state class, input condition class, condition judgment class and output result class; Finally, a unique number is assigned to each different element.

5. The automatic testing method of a vehicle body controller according to claim 4, characterized in that: In step S232, the content embedding process is as follows: define a content embedding matrix E, whose dimension is V×d, where V is the total number of all element numbers of the identifier, and d is the content embedding dimension. For each number in the digital matrix, the corresponding word vector is obtained by searching the content embedding matrix E; Position embedding: Define the position embedding matrix P, whose dimension is 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, and then the position embedding is added to each word vector in the matrix after content embedding according to its position in the sequence, and finally the vector matrix is ​​obtained.

6. The automatic testing method of a vehicle body controller according to claim 5, characterized in that: In step S233, the encoder in the Transformer model includes N encoding blocks with the same structure, each encoding block includes 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, wherein, The self-attention layer focuses on different positions in the sequence when processing the input 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 determining the test object; The feedforward neural network layer is used to perform nonlinear transformation on the data processed by the self-attention layer, and further mine deeper logical relationships and features from the input structured text; Layer normalization, used to normalize the input data of each layer; After encoding by N coding blocks with the same structure, the deep feature representation of the input control logic structured text requirement is fully extracted to obtain the encoding information matrix, namely the encoded matrix, which is defined as the input matrix.

7. The automatic testing method of a vehicle body controller according to claim 6, characterized in that: In step S235, the decoder in the Transformer model contains N decoding blocks with the same structure. Each decoding block contains three sublayers: a self-attention layer, an encoder-decoder attention layer, and a feedforward neural network layer. There are layer normalization operations before and after each sublayer, where: The self-attention layers, feedforward neural network layers, and layer normalization in the decoding block work in the same way as the self-attention layers, feedforward neural network layers, and layer normalization in the encoding block; The encoder-decoder attention layer ensures that the decoder can incorporate information from the input structured text requirements when generating test cases; The encoder-decoder attention layer controls the deeper feature representation between the logical structured text requirements and the target test case data, and obtains the corresponding decoded first feature and second feature after decoding, and then establishes a feature mapping relationship between the two.

8. The automatic testing method of a vehicle body controller according to claim 1, characterized in that: In step S3, first, the case retrieval module uses the built-in logic judgment for the case ID retrieval to crawl and save the case IDs of all the test cases, and generates a case number storage variable to save the case numbers of all the test cases; when facing a new test case, the case retrieval module grabs the case number in the storage variable during the test run, and if a new case number is grabbed, the corresponding test case is obtained to automatically generate a test script; The parsing module is then used to parse the content row by row, and each test case is stored as an independent object. The parsing module uses the read_Excel function in the pandas library to read the Excel file, crawl the key information of the test case in the Excel file and save it in the form of an array. The key information includes the test sequence 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 operation methods to separate 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, and a test sequence template structure is created according to the test script format in the host computer; The mapping conversion module then uses the mapping rules to convert the field content: convert the test steps in Excel into the operation instructions of the test script. During the conversion, the string content can be replaced according to the mapping rules. Finally, the test script is generated by the generation module, and is stored in sections according to modules or use cases, and the script file is output; The generation module includes open function and 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 a file.

9. An automatic test 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, among which: The host computer executes the automated testing method described in any one of claims 1 to 7 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 signal of the real vehicle. The analog I / O module includes multiple analog output channels and analog measurement channels, which are used to simulate analog signal input or measure analog signal output. The analog signal includes various sensor signals. The digital I / O module includes multiple digital input and output channels, which are used to simulate digital signal input or measure digital signal output. The digital I / O module can simulate the digital sensor or actuator of the body controller to input the light-on signal of the body controller or output the signal light status driven by the body controller. The communication module communicates with external devices using CAN communication, LIN communication or Ethernet communication, and is connected to the host computer using a USB or Ethernet interface; The external power supply module is a programmable power supply, which supplies power to the power management module. The external power supply module supports multiple channels, and each power output can simulate a real vehicle power type; the external power supply module is connected to the host computer through serial communication, Ethernet communication and analog control.

10. The automatic testing device for a vehicle body controller according to claim 9, characterized in that: The script generation module in the host computer includes: case retrieval module, parsing module, sequence definition module, mapping conversion module and generation module, among which, The case retrieval module has built-in logical judgment for case ID retrieval, which can crawl and save the case IDs of all test cases, and generate case number storage variables to save the case numbers of all test cases. When facing new test cases, the case retrieval module grabs the case number in the storage variable during test runtime. If a new case number is grabbed, the corresponding test case is obtained to automatically generate a test script. The parsing module parses the content row by row and stores each test case as an independent object. The parsing module uses the read_Excel function in the pandas library to read the Excel file, crawl the key information of the test case in the Excel file and save it in the form of an array, where the key information includes the test sequence number, test type, initial condition, test steps and test results. The Test_Precondition array is used to save the text information of the initial condition. When parsing each row of data, the parsing module uses string operation methods to separate multiple operation steps in each cell. The sequence definition module is used to define the format of the test script in the host computer, and it creates a test sequence template structure according to the test script format in the host computer; The mapping conversion module uses mapping rules to convert field content: convert the test steps in Excel into operation instructions of the test script. When converting, the string content can be replaced according to the mapping rules; The generation module generates a test script, stores it in segments by module or use case, and outputs a script file; the generation module includes an open function and a 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 a file.

Citation Information

Patent Citations

  • CAN bus network management test system and method

    CN104734911A

  • A method and system for realizing automatic software testing based on a vehicle body electronic module

    CN109446106A

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

    CN116974943A

  • Vehicle-mounted application test method and system, electronic equipment and storage medium

    CN117076316A

  • Method and device for generating automated test case script and medium

    CN117112408A