Communication test method of vehicle-mounted Ethernet, electronic equipment and medium
The test code is generated by automated test scripts and the on-board Ethernet communication test is tested using simulation and calibration systems, which solves the problems of high testing costs and low efficiency in the existing technology, and achieves efficient and accurate testing.
Patent Information
- Application Number
- CN202311605959.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-28
- Publication Date
- 2025-05-30
AI Technical Summary
In the prior art, when conducting on-vehicle Ethernet communication testing, the testing cost is high and the testing efficiency is low, and specific testing tools and manual configuration are required.
Automatic test scripts are used to read Ethernet matrix tables, generate test codes suitable for simulation systems and calibration systems, use these systems for communication testing, and generate test reports.
The automated testing method reduces the testing cost, improves the testing efficiency, avoids the misoperation and abnormal omissions caused by manual configuration, ensures the quality of the test, and reduces the number of actual vehicle road tests.
Smart Images

Figure CN120075087A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of in-vehicle Ethernet testing, and particularly relates to a communication testing method, an electronic device and a medium for in-vehicle Ethernet. Background Art
[0002] With the intelligent development of vehicles, the software in in-vehicle controllers has become increasingly complex, and the Service-Oriented Architecture (SOA) has been widely used in the automotive industry. SOA conducts data interaction between various services through service-oriented communication protocols, such as SOME / IP (Scalable service-Oriented Middlewar Eover IP). SOME / IP is a service-oriented communication middleware technology based on Ethernet, which has the advantages of large data transmission volume and high real-time performance. Currently, the external Ethernet interfaces of many in-vehicle controllers are based on the SOME / IP protocol. Therefore, efficient and comprehensive testing of in-vehicle Ethernet communication based on the SOME / IP protocol is an important part of the research and development of in-vehicle controllers, which is beneficial to improving the research and development efficiency and delivery quality of the controllers.
[0003] Currently, most of the in-vehicle Ethernet communication testing methods based on the SOME / IP protocol use the PREEvision tool to generate an ARXML database file, and then import the file into a simulation system, such as CANoe, to test signal transmission. The ARXML database file defines the structure of the transmitted data and some parameters of SOME / IP communication. CANoe can serialize and deserialize SOME / IP messages according to the ARXML file. This method is simple to implement, but there are two problems: one is that the cost of the PREEvision tool is relatively high, and many engineers or teams do not have the PREEvision software and thus cannot conduct tests through this method; the other is that this method requires manual configuration, and when the data structure is complex or the number of signals is large, the configuration is slow and the efficiency is low.
[0004] In the prior art, specific testing tools are required for in-vehicle Ethernet communication testing, and data is manually configured by humans. Such a testing method has a high cost and low testing efficiency. Summary of the Invention
[0005] The purpose of the present invention is to solve the problems of high testing cost and low testing efficiency in in-vehicle Ethernet communication testing in the prior art.
[0006] To solve the above problems, an embodiment of the present invention discloses a communication test method for in-vehicle Ethernet. The test steps include: S1: According to the in-vehicle communication protocol, obtain the Ethernet matrix table of the controller to be tested; S2: Use an automated test script to read the obtained Ethernet matrix table, and generate simulation test code applicable to the simulation system and calibration test code applicable to the calibration system; S3: Import the simulation test code into the simulation system, import the calibration test code into the calibration system, perform communication tests using the simulation system and the calibration system, and generate a text document about the test results; S4: Use an automated test script to read the text document and output a test report.
[0007] Adopting the above solution, the automated communication test method reduces the test cost, saves labor costs, greatly improves the test efficiency, avoids misoperations and abnormal omissions caused by manual data configuration, and effectively guarantees the test quality. Further, when this test method is used for the communication test of in-vehicle Ethernet of a whole vehicle, the number of real vehicle road tests can be reduced, the software quality and delivery quality of the controller can be improved while shortening the development time and reducing the cost, and the risk of the whole vehicle can be reduced. Furthermore, the sufficiency of the test can be ensured, and the assignment information and test results during the test can be displayed in real time on the interface of the upper computer (such as CANape project or CANoe project), which is convenient for monitoring the test process, timely handling the faults occurring during the test process, improving the test efficiency and test quality, thus enhancing the reliability of the test system. And this test method can generate a visual test report, which is convenient for monitoring the test process and timely handling the faults occurring during the test process. Furthermore, without the ARXML database file, only using CAPL code can realize the serialization and deserialization processing of Ethernet messages, with high test flexibility and low test cost.
[0008] According to another specific embodiment of the present invention, in the input test and output test of the communication test method for in-vehicle Ethernet disclosed in the embodiment of the present invention, the Ethernet matrix table read includes one or more of the communication parameters, data structure, and signal range of the controller to be tested, and the association relationship between the internal signals and Ethernet signals of the controller to be tested. Adopting this technical solution has the effects of a wide test range, being able to avoid repetitive tests and having high test efficiency.
[0009] According to another specific embodiment of the present invention, the in-vehicle Ethernet communication test method disclosed in the embodiment of the present invention, step S2: Use an automated test script to read the obtained Ethernet matrix table, and generate simulation test code applicable to the simulation system and calibration test code applicable to the calibration system, specifically including: S21: Use the automated test script to read the communication parameters in the Ethernet matrix table, and generate simulation test code for configuring the in-vehicle communication protocol according to the communication parameters; S22: Use the automated test script to read the data structure in the Ethernet matrix table, and generate simulation test code for making each structure in the data structure meet a predetermined rule. The predetermined rule is a serialization rule, and the serialization rule includes: big-endian or little-endian rule, and byte alignment rule; wherein, the serialization rule is a rule for converting the sequence of the data structure into a byte sequence; the big-endian or little-endian rule is a rule for the byte arrangement order of the multi-byte data type; the byte alignment rule is a rule for the starting byte position of the members in the data structure; S23: Use the automated test script to extract the table signals related to the methods and / or events in the Ethernet matrix table, as well as the signal ranges of each table signal, and automatically calculate the dynamic arrays in the data structure and the lengths of each structure, and generate simulation test code and calibration test code for each table signal; S24: Use the automated test script to extract the methods and / or events in the Ethernet matrix table, and generate messages for sending and / or receiving according to the methods and / or events, and simulation test code that can be serialized and deserialized; and, the methods in the Ethernet matrix table are the signals in method, and the events in the Ethernet matrix table are the signals in event.
[0010] Adopting the above solution, simulation test code for configuring the in-vehicle communication protocol is generated according to the communication parameters, and each structure in the data structure of the simulation test code meets the predetermined rule, ensuring the validity of the data and improving the accuracy of the data. Further, the table signals related to the methods and / or events in the Ethernet matrix table are extracted by using an automated test script, ensuring the validity of the signals, so as to be able to generate effective test code, improving the accuracy and test efficiency of the test.
[0011] Furthermore, using an automated test script to read the communication parameters, data structure, and signals in the methods and / or events in the Ethernet matrix table to generate test code avoids the situation of low efficiency and easy error when manually configuring data, ensures the accuracy of the data, and improves the test efficiency.
[0012] According to another specific embodiment of the present invention, in the process of using an automated test script to read the data structure in the Ethernet matrix table and generate simulation test code for making each structure in the data structure meet a predetermined rule in the in-vehicle Ethernet communication test method disclosed in the embodiment of the present invention, it further includes: after reading the data structure, adding an array length to the dynamic array in the data structure and adding a structure length to each structure in the data structure, and the predetermined rule is a serialization rule, and the serialization rule includes: big-endian or little-endian rule, and byte alignment rule; wherein, the serialization rule is a rule for converting the sequence of the data structure into a byte sequence; the big-endian or little-endian rule is a rule for the byte arrangement order of multi-byte data types; the byte alignment rule is a rule for the starting byte position of the members in the data structure.
[0013] Adopting the above solution, adding an array length to the dynamic array in the data structure and making the data structure meet certain predetermined rules ensure the validity of the data and improve the accuracy of the data, so as to be able to generate effective test code and improve the accuracy and test efficiency of the test.
[0014] According to another specific embodiment of the present invention, in the in-vehicle Ethernet communication test method disclosed in the embodiment of the present invention, using an automated test script to extract the table signals related to methods and / or events in the Ethernet matrix table includes: extracting the table signals related to methods and / or events and extracting the signals of basic data types to calibrate and compare the expected values of the extracted signals of basic data types one by one during communication testing.
[0015] Adopting the above solution, extracting the signals in the methods and / or events makes the extracted signals be signals of basic data types, which is convenient to calibrate and compare the expected values of the extracted signals of basic data types one by one during communication testing, ensuring the validity of the signals, so as to be able to generate effective test code and improve the accuracy and test efficiency of the test.
[0016] According to another specific embodiment of the present invention, the in-vehicle Ethernet communication test method disclosed in the embodiment of the present invention configures a simulation system and a calibration system. Configuring the simulation system includes: establishing an Ethernet virtual node, obtaining the address parameters representing the address information of the configured nodes in the Ethernet matrix table, and configuring the address parameters of the Ethernet virtual node according to the address parameters, and associating the simulation test code with the Ethernet virtual node; Configuring the calibration system includes: adding the signals related to the Ethernet matrix table inside the controller under test to the database file of the calibration system, and importing the calibration test code into the calibration system; Before performing communication tests using the simulation system and the calibration system, it further includes: connecting the controller under test to the test end through the Ethernet interface of the simulation system, and configuring the Ethernet interface so that the Ethernet virtual node is communicatively connected to the controller under test via Ethernet; Connecting the controller under test to the test end using an Ethernet adapter box and network cable connection, and setting the IP address of the test end and the IP address of the controller under test to the same network segment.
[0017] Adopting the above solution, configuring the simulation system and the calibration system provides a more suitable test environment for the test process, and during the configuration process, the IP address of the test end and the IP address of the controller under test are set to the same network segment so that the calibration system can calibrate or measure the signals inside the controller.
[0018] According to another specific embodiment of the present invention, in step S3 of the in-vehicle Ethernet communication test method disclosed in the embodiment of the present invention, performing communication tests using the simulation system and the calibration system includes input tests and output tests; Among them, the input test includes: using the simulation test code to assign values to each signal in the table signal, and performing serialization processing on each signal to form the load signal in the message of the vehicle communication protocol; Sending the load signal corresponding to the table signal to the controller under test; Using the calibration test code to read the internal signal corresponding to the load signal in the controller under test, and determining whether the signal value of the load signal is the same as the internal signal value of the controller under test.
[0019] The output test includes: using the calibration test code to calibrate each signal in the table signal, after the Ethernet communication module in the controller under test processes the calibrated signal, forming an Ethernet message and sending the Ethernet message to the test end; After the test end receives the Ethernet message, using the simulation test code to perform deserialization processing on the Ethernet message, converting the byte sequence in the Ethernet message into a signal value; And determining whether the signal value in the Ethernet message is the same as the internal signal value of the controller under test.
[0020] With the above solution, the simulation test code forms a message with the signals after assignment. The message contains the complete data information to be sent, ensuring the integrity of the data and enabling fast data transmission. After the test end receives the Ethernet message, the simulation test code deserializes the Ethernet message, that is, converts the byte sequence in the message into signal values, and determines whether the received signal values meet the expectations. When judging consistent data types, the error rate is reduced, thereby improving the test accuracy. The accuracy of the parsing result is ensured, and thus the test accuracy is improved.
[0021] According to another specific embodiment of the present invention, in the in-vehicle Ethernet communication test method disclosed in the embodiment of the present invention, the simulation system is a CANoe project, and the simulation test code is CAPL code for the CANoe project; the calibration system is a CANape project, and the calibration test code is CANape code for the CANape project.
[0022] With the above solution, when performing input tests, the CAPL code is used as a test case, making the process of assigning values and serializing signals on the controller under test simpler; the CANape code is used as a verification case, making the efficiency of reading the internal signal values of the controller higher.
[0023] When performing output tests, the CANape code is used as a test case, making the calibration of the internal signals of the controller more efficient, and the CAPL code is used as a verification case, making the process of parsing and deserializing the messages received by the controller more accurate and convenient. According to another specific embodiment of the present invention, in the in-vehicle Ethernet communication test method disclosed in the embodiment of the present invention, in the input test and the output test, the automated test script is a python script, and moreover, the in-vehicle communication protocol is the SOME / IP protocol; moreover, the simulation system is a CANoe project; the calibration system is a CANape project; and moreover, the test report includes the signal names, expected values, actual values, and test results of the tabular signals.
[0024] With the above solution, this interface test method can generate a visual test report, facilitating the monitoring of the test process and promptly handling interface failures.
[0025] An embodiment of the present invention discloses an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the in-vehicle Ethernet communication test method described in any of the above embodiments.
[0026] An embodiment of the present invention discloses a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the in-vehicle Ethernet communication test method described in any of the above embodiments.
[0027] The beneficial effects of the present invention are as follows:
[0028] The communication test method for in-vehicle Ethernet provided by this application reduces the test cost through an automated communication test method, saves labor costs, greatly improves the test efficiency, avoids misoperations and abnormal omissions caused by manual data configuration, and effectively guarantees the test quality. Further, when this test method is used for the communication test of in-vehicle Ethernet of a whole vehicle, the number of actual vehicle road tests can be reduced, while shortening the development time and reducing costs, improving the software quality and delivery quality of the controller, and reducing the risk of the whole vehicle. Furthermore, the sufficiency of the test can be ensured, and the assignment information and test results during the test can be displayed in real time on the interface of the upper computer (such as CANape project or CANoe project), which is convenient for monitoring the test process, promptly handling the faults occurring during the test process, improving the test efficiency and test quality, thus enhancing the reliability of the test system, and this test method can generate a visual test report, which is convenient for monitoring the test process and promptly handling the faults occurring during the test process. Furthermore, without an ARXML database file, the serialization and deserialization processing of Ethernet messages can be realized only by using CAPL code, with high test flexibility and low test cost. Description of the Drawings
[0029] Figure 1 is a schematic flowchart of the communication test method for in-vehicle Ethernet provided by an embodiment of the present invention;
[0030] Figure 2 is a schematic flowchart of the automated generation of test code by a python script provided by an embodiment of the present invention;
[0031] Figure 3 is another schematic flowchart of the communication test method for in-vehicle Ethernet provided by an embodiment of the present invention;
[0032] Figure 4 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
[0033] Description of the Reference Numerals:
[0034] 121, transceiver; 122, processor; 123, memory. Detailed Embodiments
[0035] Embodiment 1:
[0036] To solve the problems of high test cost and low test efficiency in the prior art when conducting communication tests on in-vehicle Ethernet, an embodiment of the present invention provides a communication test method for in-vehicle Ethernet. Specifically, referring to Figure 1, the test method includes the following steps:
[0037] S1: Obtain the Ethernet matrix table of the controller under test according to the vehicle communication protocol;
[0038] S2: Use an automated test script to read the obtained Ethernet matrix table, and generate simulation test code applicable to the simulation system and calibration test code applicable to the calibration system;
[0039] S3: Import the simulation test code into the simulation system and the calibration test code into the calibration system, perform communication tests using the simulation system and the calibration system, and generate a text document about the test results;
[0040] S4: Use an automated test script to read the text document and output a test report.
[0041] With such steps, compared with the method where testers manually design test cases one by one and carry out corresponding test work, this method can automatically generate scripts according to the mapping file. The way of automatically generating scripts takes less time than manual writing; and the automatically generated scripts do not need to be debugged, reducing the time of manual debugging and saving labor costs, thus improving the test efficiency. Moreover, the automatically generated scripts are more accurate, and this method can also avoid misoperations and abnormal omissions caused by manual operations, effectively ensuring the quality of the test. Further, this method can automatically generate test scripts in multiple languages and can be applied to test projects in different environments. When this method is used for the communication test of in-vehicle Ethernet of a whole vehicle, it can also reduce the number of road tests of the actual vehicle, shortening the development cost of the whole vehicle, reducing costs, and improving the software quality of the controller, thus reducing the risk of the whole vehicle. Furthermore, this method can display the assignment information and test results during the test on the interface of the upper computer (such as CANape project or CANoe project) in real time, facilitating the monitoring of the test process, promptly handling the faults occurring during the test, improving the test efficiency and the quality of the test, thus enhancing the reliability of the test software system, and this test method can generate a visual test report, facilitating the monitoring of the test process and promptly handling the faults occurring during the test. Furthermore, without an ARXML database file, only using CAPL code can realize the serialization and deserialization processing of Ethernet messages, with high test flexibility and low test cost.
[0042] Further, in the communication test method of the in-vehicle Ethernet according to the present invention, in step S1, the Ethernet matrix table of the controller under test includes one or more of the communication parameters, data structure, and signal range of the controller under test, and the association relationship between the internal signals and Ethernet signals of the controller under test.
[0043] Specifically, the Ethernet matrix table is specifically the SOME / IP (Scalable service-Oriented MiddlewarE over IP) Ethernet matrix table. The Ethernet matrix table defines one or more of the parameters of SOME / IP communication, the transmitted data structure, the range of each signal, and the association relationship between the internal signals of the controller under test and the Ethernet signals. SOME / IP, also known as the application layer protocol, provides a service-oriented communication interface for defining data transmission and data content in the in-vehicle communication process. When a request is issued, SOME / IP will send data; otherwise, it will not send data, which can avoid unnecessary data on the bus and reduce the bus load. Adopting this technical solution has the effects of a wide test range, the ability to avoid repetitive tests, and high test efficiency.
[0044] Further, in the communication test method of the in-vehicle Ethernet according to the present invention, specifically, referring to Figure 2 , step S2 includes:
[0045] S21: Use an automated test script to read the communication parameters in the Ethernet matrix table and generate simulation test code for configuring the in-vehicle communication protocol according to the communication parameters;
[0046] S22: Use an automated test script to read the data structure in the Ethernet matrix table and generate simulation test code for making each structure in the data structure meet a predetermined rule;
[0047] S23: Use an automated test script to extract the table signals related to methods and / or events in the Ethernet matrix table, as well as the signal ranges of each table signal, and automatically calculate the dynamic arrays in the data structure and the lengths of each structure, and generate simulation test code and calibration test code for each table signal;
[0048] S24: Use an automated test script to extract the methods and / or events in the Ethernet matrix table, generate messages for sending and / or receiving according to the methods and / or events, and simulation test code that can be serialized and deserialized.
[0049] Specifically, in the above step S21, it includes: the automated test script reads SOME / IP communication parameters and generates simulation test code for SOME / IP configuration. Generating simulation test code for configuring the in-vehicle communication protocol according to the communication parameters, and ensuring that each structure in the data structure of the simulation test code meets a predetermined rule, which guarantees the validity of the data and improves the accuracy of the data. Further, the automated test script extracts table signals related to methods and / or events in the Ethernet matrix table, which guarantees the validity of the signals, so as to be able to generate valid test code, improving the accuracy and efficiency of the test. And using the automated test script to read the communication parameters, table signals, and methods and / or events in the Ethernet matrix table to generate test code avoids the situation of low efficiency and easy errors when manually configuring data, guarantees the accuracy of the data, and improves the test efficiency.
[0050] Further, in the communication test method of the in-vehicle Ethernet according to the present invention, in step S22, after reading the data structure, it further includes: adding an array length to the dynamic array in the data structure, and adding a structure length to each structure in the data structure; and in step S22, the predetermined rule is a serialization rule, and the serialization rule includes: big-endian or little-endian rule, and byte alignment rule; wherein, the serialization rule is a rule for converting the sequence of the data structure into a byte sequence; the big-endian or little-endian rule is a rule for the byte arrangement order of multi-byte data types; the byte alignment rule is a rule for the starting byte position of the members in the data structure.
[0051] Specifically, read the data type definition table in the Ethernet matrix table, and define the structures in the table. The defined structures all satisfy the serialization rules, which include: the big-endian or little-endian rules and the byte alignment rules. The serialization rule is a rule for converting the sequence of a data structure into a byte sequence, including: serialization and deserialization. Serialization is to define different types of data such as structures, data, and unions in the data protocol into corresponding binary data streams according to certain rules during transmission; deserialization is to parse the binary data stream at the receiving end into the same data types as the sending end according to the corresponding rules. The big-endian or little-endian rules are rules for the byte arrangement order of multi-byte data types, including: the big-endian rule is to store the high-order byte at the low address and the low-order byte at the high address; the little-endian rule is to store the low-order byte at the low address and the high-order byte at the high address. The byte alignment rule is a rule for the starting byte position of the members in the data structure. The data structure should be aligned on the natural address boundary as much as possible, so that only one access is required to obtain the data during aligned memory access. In this way, add the array length to the dynamic array in the data structure, and the data structure should satisfy certain predetermined rules, ensuring the validity of the data and improving the accuracy of the data, so as to be able to generate effective test code and improve the accuracy and test efficiency of the test.
[0052] Furthermore, in the communication test method of the in-vehicle Ethernet according to the present invention, in step S23, when reading the table signals related to methods and / or events, it further includes: extracting the table signals related to methods and / or events, so that the extracted signals are signals of basic data types, which is convenient for calibrating and comparing the expected values of the extracted signals of basic data types one by one during communication testing. Specifically, the methods in the Ethernet matrix table are signals in method. Method is generally request-response communication, where the client sends a request message and the server replies with a response message. The events in the Ethernet matrix table are signals in event. The communication mode of event is: after the client subscribes to the server, the server periodically or triggeringly sends data messages to the client. Extracting the signals in methods and / or events so that the extracted signals are signals of basic data types is convenient for calibrating and comparing the expected values of the extracted signals of basic data types one by one during communication testing, ensuring the validity of the signals, so as to be able to generate effective test code and improve the accuracy and test efficiency of the test.
[0053] Further, in the communication test method of the in-vehicle Ethernet according to the present invention, before step S3, it further includes: S2': Configure the simulation system and the calibration system; where configuring the simulation system includes: establishing an Ethernet virtual node, obtaining the address parameters representing the address information of the configured nodes in the Ethernet matrix table, and configuring the address parameters of the Ethernet virtual node according to the address parameters, and associating the simulation test code with the Ethernet virtual node; configuring the calibration system includes: adding the signals related to the Ethernet matrix table inside the controller under test to the database file of the calibration system; and in step S3, before performing the communication test using the simulation system and the calibration system, it further includes: connecting the controller under test to the test end through the Ethernet interface of the simulation system, and configuring the Ethernet interface so that the Ethernet virtual node and the controller under test are communicatively connected via Ethernet; connecting the controller under test to the test end through an Ethernet adapter box and a network cable connection, and setting the IP address of the test end and the IP address of the controller under test to the same network segment.
[0054] Specifically, configuring the simulation system includes: obtaining the address parameters related to the address information of the configured nodes in the Ethernet matrix table, and the address parameters are MAC address, IP address, and VLANID parameters; configuring the calibration system includes: adding the signals related to the Ethernet matrix table inside the controller under test to the database file of the calibration system, and the database file is an A2L file. During the configuration process, the IP address of the test end and the IP address of the controller under test are set to the same network segment so that the calibration system can calibrate or measure the signals inside the controller.
[0055] Further, in the communication test method of the in-vehicle Ethernet according to the present invention, in step S3, performing the communication test using the simulation system and the calibration system includes an input test and an output test; where the input test includes: using the simulation test code to assign values to each signal in the table signal and performing serialization processing on each signal to form the payload signal in the message of the in-vehicle communication protocol; sending the payload signal corresponding to the table signal to the controller under test; using the calibration test code to read the internal signal corresponding to the payload signal in the controller under test and determining whether the signal value of the payload signal is the same as the internal signal value of the controller under test.
[0056] The output test includes: using the calibration test code to calibrate each signal in the table signal, after the Ethernet communication module in the controller under test processes the calibrated signal, forming an Ethernet message and sending the Ethernet message to the test end; after the test end receives the Ethernet message, using the simulation test code to perform deserialization processing on the Ethernet message, converting the byte sequence in the Ethernet message into a signal value; and determining whether the signal value in the Ethernet message is the same as the internal signal value of the controller under test.
[0057] Specifically, the payload signal is "payload". "Payload" is a common computer security term, referring to the part used to carry valid information in a data packet or network request. It is usually used to describe the part that carries valid data (user data) in a communication protocol.
[0058] Specifically, in the input test, through the simulation system, each signal in the table signal is assigned a value using the simulation test code, including: assigning values to the Ethernet-related signals using the simulation test code, and assigning the maximum value, minimum value, and intermediate value to each signal respectively. And using the simulation test code to form a message from the signals in the matrix table, including: using the simulation test code to form the payload signal in the message from the signals in the matrix table, and making each signal meet the data structure and serialization rules defined in the matrix table; when sending the assignment result to the controller, it also includes: the assignment result sent to the controller is a message; and, through the calibration system and using the calibration test code to read the internal signal values of the controller under test, including: after the controller receives the message, using the calibration system and the calibration test code to read the internal signal corresponding to the payload signal (the payload signal is also the message signal) in the controller under test, and determining whether the signal value of the payload signal is the same as the internal signal value of the controller under test, and outputting a text document of the judgment result.
[0059] Specifically, in the output test, the internal signals of the controller are calibrated through the calibration system and using the calibration test code, including: calibrating each signal in the table signal through the calibration system and using the calibration test code, and calibrating each internal signal as the maximum value, minimum value, and intermediate value respectively. After processing the calibrated signals using the Ethernet communication module in the controller under test, an Ethernet message is formed and sent to the test end. And, through the simulation system, the received message is parsed using the simulation test code to obtain the parsing result, including: parsing the received Ethernet message through the simulation system and using the simulation test code to obtain the parsing result, and processing the Ethernet message according to the data structure and deserialization rules defined in the matrix table, converting the byte sequence in the message into a signal value, and determining whether the signal value in the Ethernet message is the same as the internal signal value of the controller under test, and outputting a text document of the judgment result.
[0060] With the above solution, the simulation test code forms a message with the signals after assignment. The message contains the complete data information to be sent, ensuring the integrity of the data and enabling fast data transmission. After the test end receives the Ethernet message, the simulation test code deserializes the Ethernet message, that is, converts the byte sequence in the message into signal values, and determines whether the received signal values meet the expectations. When judging consistent data types, the error rate is reduced, thereby improving the test accuracy. The accuracy of the parsing result is ensured, thereby improving the test accuracy.
[0061] Furthermore, in the communication test method of the in-vehicle Ethernet according to the present invention, the simulation test code is CAPL code, and the calibration test code is CANape code.
[0062] Specifically, CAPL (CAN Access Programming Language) is an event-oriented programming language, that is, the program nodes are used to specify events and when to execute and react, and it has the advantages of low coupling and high initiative. And CANape (CAN Application Programming Environment Language) is a measurement calibration language, which has the advantages of performing automatic calibration and high efficiency. When performing input tests with this method, the CAPL code is used as a test case, making the process of assigning values to signals inside the controller simpler; the CANape code is used as a verification code, making the efficiency of parsing internal signals of the controller higher. Also, when performing output tests, the CANape code is used as a test code, making the accuracy of calibration inside the controller higher, and the CAPL code is used as a verification code, making the process of parsing internal signals of the controller simpler and more convenient.
[0063] Furthermore, in the communication test method of the in-vehicle Ethernet according to the present invention, the automated test script is a Python script; the vehicle communication protocol is the SOME / IP protocol; the simulation system is a CANoe project; the calibration system is a CANape project; and the test report includes the signal name, expected value, actual value, and test result of the tabular signal.
[0064] Specifically, Python is a programming language with concise code, having the advantages of powerful functions, rich databases, being able to cross platforms and run on multiple operating systems. The Python script is used to automatically generate the code required for testing, thereby improving the test efficiency, and this test method can generate a visual test report, specifically a HyperText Markup Language (HTML) test report, which is convenient for monitoring the test process and promptly handling the faults occurring during the test process.
[0065] Specifically, the simulation system is a CANoe (controller area network open environment) project, and the simulation test code is CAPL code for the CANoe project. Moreover, the calibration system is a CANape (CAN Application Programming Environment) project, and the calibration test code is CANape code for the CANape project. That is to say, if the CANoe project is used as the test system, to meet the usage requirements of the CANoe project, the generated test code must use the code language of the CANoe project, namely the controller area network access programming language (CAN access programming language, CAPL) test code. If the CANape project is used as the test system, to meet the usage requirements of the CANape project, the generated test code must use the code language of the CANape project, that is, the CAN Application Programming Environment Language (CANape) test code.
[0066] Next, a specific communication test method for in-vehicle Ethernet will be described. Specifically, refer to Figure 3 .
[0067] First, the python script reads the SOME / IP communication parameters in the Ethernet matrix table to generate CAPL code configured with SOME / IP; reads the data type definition table in the matrix table, and for each structure in the table, generates CAPL structure definition code; extracts the signals in each method or event, and generates CAPL assignment or measurement comparison code, as well as CANape assignment or measurement comparison code for each signal; for each method or event, generates CAPL message serialization and sending code, as well as CAPL message receiving and deserialization code.
[0068] Second, configure the CANoe and CANape projects and import the code into the projects. Configure the CANoe project, establish an Ethernet virtual node, configure parameters such as the MAC address, IP address, and VLAN ID of the node according to the matrix table, and associate the CAPL code with this virtual node. Configure the CANape project, add the Ethernet-related signals inside the controller to the A2L database file of CANape, and import the CANape code into the project.
[0069] Next, connect the hardware and perform tests. Use the Ethernet interface on the hardware CANoe to connect the controller to the computer, and configure the Ethernet interface on the hardware CANoe so that the virtual nodes in the CANoe project can communicate with the controller via Ethernet. Connect the controller to the computer using an Ethernet adapter box and network cable, and set the IP address of the computer and the controller to the same network segment, so that the signals inside the controller can be calibrated or measured using the CANape software on the computer.
[0070] When performing the input communication test, first start simulating the CANoe project. The processing process of the project is as follows: assign values to each signal in each method or event, serialize all the signals in each method or event separately to form the payload part in the SOME / IP message, send the SOME / IP message corresponding to each method or event to the inside of the controller. After the sending is completed, start executing the CANape test code, read the signal values inside the controller, determine whether they meet the expectations, and output the judgment results to a text document. When performing the output communication test, first execute the CANape test code. After all the signals inside the controller are calibrated, the CANoe project starts to simulate. The processing process of the project is as follows: receive the SOME / IP messages output by the controller, deserialize the payload part in the message to obtain the values of each signal in the message, determine whether the signal values meet the expectations, and output the judgment results to a text document.
[0071] Finally, use a Python script to read the text document generated during the test process and automatically generate a test report, which includes information such as the name, expected value, actual value, and test result of each signal.
[0072] Embodiment 2:
[0073] Based on the above communication test method for in-vehicle Ethernet, this embodiment provides an electronic device. Refer to Figure 4 , the electronic device may include: a transceiver 121, a processor 122, and a memory 123.
[0074] The processor 122 executes the computer execution instructions stored in the memory, causing the processor 122 to execute the solution in the above embodiment. The processor 122 may be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it may also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0075] The memory 123 is connected to the processor 122 via the system bus and completes the communication therebetween. The memory 123 is used to store computer program instructions.
[0076] The transceiver 121 can be used to obtain the task to be run and the configuration information of the task to be run.
[0077] The system bus can be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to implement the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include a Random Access Memory (RAM), and may also include a non-volatile memory.
[0078] The electronic device provided by the embodiment of the present application can be a terminal device such as a computer, a host computer, etc.
[0079] The embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are run on a computer, the computer is enabled to execute the technical solution of the communication test method of the in-vehicle Ethernet described in the above embodiment.
[0080] Embodiment 3:
[0081] The embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium, and when at least one processor executes the computer program, the technical solution of the communication test method of the in-vehicle Ethernet described in the above embodiment can be implemented.
[0082] Although the present invention has been illustrated and described by referring to some preferred embodiments of the present invention, those of ordinary skill in the art should understand that the above content is a further detailed description of the present invention in combination with specific embodiments, and it cannot be determined that the specific implementation of the present invention is only limited to these descriptions. Those skilled in the art can make various changes in form and details, including making several simple deductions or substitutions, without departing from the spirit and scope of the present invention.
Claims
1. A communication test method for in-vehicle Ethernet, characterized in that, it includes: S1: According to the in-vehicle communication protocol, obtain the Ethernet matrix table of the controller to be tested; S2: Use an automated test script to read the obtained Ethernet matrix table, and generate simulation test code applicable to the simulation system and calibration test code applicable to the calibration system; S3: Import the simulation test code into the simulation system, import the calibration test code into the calibration system, perform communication tests using the simulation system and the calibration system, and generate a text document regarding the test results; S4: Use the automated test script to read the text document and output a test report.
2. The communication test method for in-vehicle Ethernet according to claim 1, characterized in that, in the step S1, the Ethernet matrix table of the controller to be tested includes one or more of the communication parameters, data structure, and signal range of the controller to be tested, and the association relationship between the internal signals and Ethernet signals of the controller to be tested.
3. The communication test method for in-vehicle Ethernet according to claim 2, characterized in that, the step S2 includes: S21: Use the automated test script to read the communication parameters in the Ethernet matrix table, and generate the simulation test code for configuring the in-vehicle communication protocol according to the communication parameters; S22: Use the automated test script to read the data structure in the Ethernet matrix table, and generate the simulation test code for making each structure in the data structure meet a predetermined rule; S23: Use the automated test script to extract the table signals related to methods and / or events in the Ethernet matrix table, and the signal ranges of each table signal, and automatically calculate the dynamic arrays in the data structure and the lengths of each structure, and generate the simulation test code and the calibration test code for each table signal; S24: Use the automated test script to extract the methods and / or events in the Ethernet matrix table, and generate messages for sending and / or receiving according to the methods and / or events, and the simulation test code that can be serialized and deserialized.
4. The communication test method for in-vehicle Ethernet according to claim 3, characterized in that, in the step S22, after reading the data structure, it further includes: Adding an array length to the dynamic array in the data structure, and adding a structure length to each structure in the data structure; and, in the step S22, the predetermined rule is a serialization rule, and, the serialization rule includes: big-endian or little-endian rule, and byte alignment rule; wherein, the serialization rule is the rule for converting the sequence of the data structure into a byte sequence; the big-endian or little-endian rule is the rule for the byte arrangement order of multi-byte data types; the byte alignment rule is the rule for the starting byte position of the members in the data structure.
5. The communication test method for in-vehicle Ethernet according to claim 3, characterized in that, In the step S23, when reading the table signals related to the method and / or event, it further includes: Extracting the table signals related to the method and / or event, and extracting the signals of the basic data type, and calibrating and comparing the expected values of the extracted signals of the basic data type one by one when performing the communication test.
6. The communication test method of in - vehicle Ethernet according to claim 3, characterized in that, Before the step S3, it further includes: S2': Configuring the simulation system and the calibration system; where Configuring the simulation system includes: Establishing an Ethernet virtual node, obtaining the address parameter representing the address information of the configured node in the Ethernet matrix table in the Ethernet matrix table, and configuring the address parameter of the Ethernet virtual node according to the address parameter; and associating the simulation test code with the Ethernet virtual node; Configuring the calibration system includes: Adding the signals related to the Ethernet matrix table inside the to - be - tested controller to the database file of the calibration system; and In the step S3, before performing the communication test using the simulation system and the calibration system, it further includes: Connecting the to - be - tested controller with the test end through the Ethernet interface of the simulation system, and configuring the Ethernet interface so that the Ethernet virtual node and the to - be - tested controller are communicatively connected via Ethernet; Connecting the to - be - tested controller with the test end through the Ethernet adapter box and the network cable connection, and setting the IP address of the test end and the IP address of the to - be - tested controller to the same network segment.
7. The communication test method of in - vehicle Ethernet according to claim 6, characterized in that, In the step S3, performing the communication test using the simulation system and the calibration system includes an input test and an output test; where The input test includes: Assigning values to each signal in the table signals using the simulation test code, and performing serialization processing on each signal to form the load signal in the message of the vehicle communication protocol; Sending the load signal corresponding to the table signal to the to - be - tested controller; Reading the internal signal corresponding to the load signal in the to - be - tested controller using the calibration test code, and determining whether the signal value of the load signal is the same as the internal signal value of the to - be - tested controller; The output test includes: Calibrating each signal in the table signals using the calibration test code, and after the Ethernet communication module in the to - be - tested controller processes the calibrated signals, forming an Ethernet message and sending the Ethernet message to the test end; After the test end receives the Ethernet message, using the simulation test code to perform deserialization processing on the Ethernet message, converting the byte sequence in the Ethernet message into a signal value; and determining whether the signal value in the Ethernet message is the same as the internal signal value of the to - be - tested controller.
8. The communication test method of in - vehicle Ethernet according to claim 7, characterized in that, The simulation test code is CAPL code, and the calibration test code is CANape code.
9. The communication test method for in-vehicle Ethernet according to any one of claims 8, wherein, the automated test script is a python script; the in-vehicle communication protocol is the SOME / IP protocol; the simulation system is a CANoe project; the calibration system is a CANape project; and the test report includes the signal name, expected value, actual value, and test result of the tabular signal.
10. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, when the processor executes the program, it implements the communication test method for in-vehicle Ethernet according to any one of claims 1-9.
11. A computer-readable storage medium, on which a computer program is stored, wherein, when the program is executed by the processor, it implements the communication test method for in-vehicle Ethernet according to any one of claims 1-9.
Citation Information
Cited By
DDS communication simulation test system and method, electronic equipment and storage medium
CN120896859A