Controller area network communication interface test method, device, equipment and vehicle

By generating a virtual controller area network in a virtual environment and executing automated test scripts, the problem that CAN communication interface test relies on the real hardware environment in the prior art is solved, and a low-cost and high-flexibility test effect is achieved.

CN119449650AActive Publication Date: 2025-02-14CHINA FAW CO LTD

Patent Information

Application Number
CN202411506638.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-02-14
Estimated Expiration
2044-10-28

AI Technical Summary

Technical Problem

In the prior art, the testing of CAN communication interfaces requires relying on the real hardware environment, resulting in high testing costs and poor flexibility.

Method used

Create data by receiving the controller area network, generate a virtual controller area network in the virtual environment, and execute automated test scripts based on the virtual controller area network and simulator to achieve testing of the CAN communication interface.

Benefits of technology

It reduces the testing cost of CAN communication interface, improves the flexibility and portability of testing, and can fully cover test scenarios and conditions, avoids equipment damage and security risks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119449650A_ABST
    Figure CN119449650A_ABST
Patent Text Reader

Abstract

The invention discloses a controller area network communication interface test method, device and equipment and a vehicle, and relates to the technical field of automotive electronics, the controller area network communication interface test method comprises the following steps: firstly, receiving controller area network creation data; then, generating a virtual controller area network in the virtual environment through the controller area network creation data; and finally, executing an automatic test script based on the virtual controller area network and the simulator so as to test the communication interface of the controller area network. Wherein the automatic test script is used for controlling the communication process of the simulator and the controller area network, and the simulator is used for simulating the real communication environment and communication behavior of the controller area network. According to the technical scheme, the test is executed through the automatic test script without depending on a real hardware environment, so that the equipment cost and the test labor cost can be reduced. Therefore, the test cost of the CAN communication interface can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of automotive electronic technology, and in particular to a controller area network communication interface testing method, device, equipment and vehicle. Background Art

[0002] Controller Area Network (CAN) is a message-based protocol designed to provide reliable communication for multiple electronic control units (ECUs). This network is mainly used for internal vehicle networks. The CAN protocol is widely used in various vehicle systems, such as engine control units, transmission control units, and body control modules, by simplifying the connection of electronic devices in the vehicle.

[0003] The testing method of the CAN communication interface in the related art usually needs to rely on the real hardware environment, resulting in a high testing cost of the CAN communication interface. Summary of the invention

[0004] The main purpose of the embodiments of the present application is to provide a controller area network communication interface testing method, device, equipment and vehicle, aiming to reduce the testing cost of the CAN communication interface.

[0005] To achieve the above object, one aspect of an embodiment of the present application provides a controller area network communication interface testing method, comprising the following steps:

[0006] receiving controller area network creation data;

[0007] generating a virtual controller area network in a virtual environment by using the controller area network creation data;

[0008] Executing an automated test script based on the virtual CAN and the simulator to implement testing of the CAN communication interface;

[0009] The automated test script is used to control the communication process between the simulator and the controller area network, and the simulator is used to simulate the real communication environment and communication behavior of the controller area network.

[0010] In some embodiments, generating a virtual controller area network in a virtual environment by using the controller area network creation data includes:

[0011] The virtual nodes, virtual connections and communication parameters of the controller area network are generated through the controller area network creation data.

[0012] In some embodiments, the executing an automated test script based on the virtual CAN and the simulator to implement the test of the CAN communication interface includes:

[0013] Generate the automated test script according to the automated test case;

[0014] Loading the automated test script into a test environment of the controller area network, the test environment comprising the virtual controller area network and the simulator;

[0015] The automated test script is controlled to test the CAN communication interface based on the virtual CAN and the simulator.

[0016] In some embodiments, the controlling the automated test script to test the controller area network communication interface based on the virtual controller area network and the simulator includes:

[0017] The automated test script controls the simulator to generate and receive signal frames of the virtual controller area network according to the virtual nodes, virtual connections and communication parameters of the virtual controller area network, so as to simulate the communication process of different nodes in the controller area network.

[0018] In some embodiments, the executing the automated test script based on the virtual controller area network and the simulator includes:

[0019] Monitoring the communication process of different nodes in the controller area network through the virtual environment and recording the communication data;

[0020] A test report is generated based on the communication data.

[0021] In some embodiments, generating the automated test script according to the automated test case includes:

[0022] Extracting interface data and transmission data of the controller area network through the automated test case;

[0023] generating a data table based on the interface data and the transmission data;

[0024] Parsing the data table to obtain multiple test items;

[0025] Generate a corresponding plurality of test scripts according to a plurality of the test items;

[0026] Merge multiple test scripts to obtain the automated test script.

[0027] In some embodiments, the controller area network communication interface testing method further includes:

[0028] Integrate the automated test scripts into the continuous integration and continuous deployment process;

[0029] The automated test scripts are continuously verified and rapidly iterated through the continuous integration and continuous deployment.

[0030] To achieve the above object, another aspect of an embodiment of the present application provides a controller area network communication interface test device, the controller area network communication interface test device comprising:

[0031] A receiving module, used for receiving controller area network creation data;

[0032] A generating module, configured to generate a virtual controller area network in a virtual environment by using the controller area network creation data;

[0033] An execution module, configured to execute an automated test script based on the virtual controller area network and the simulator to implement a test on the controller area network communication interface;

[0034] The automated test script is used to control the communication process between the simulator and the controller area network, and the simulator is used to simulate the real communication environment and communication behavior of the controller area network.

[0035] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the controller area network communication interface testing method of the above-mentioned embodiment is implemented.

[0036] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application proposes a vehicle, in which a controller area network communication interface in the vehicle is tested by the controller area network communication interface testing method of the above-mentioned embodiment, by the controller area network communication interface testing device of the above-mentioned embodiment, or by the electronic device of the above-mentioned embodiment.

[0037] The embodiments of the present application include at least the following beneficial effects:

[0038] The present application provides a controller area network communication interface testing method, device, equipment and vehicle. In the embodiment of the present application, first, controller area network creation data is received; then, a virtual controller area network is generated in a virtual environment through the controller area network creation data; finally, an automated test script is executed based on the virtual controller area network and the simulator to implement the test of the controller area network communication interface; wherein, the automated test script is used to control the communication process between the simulator and the controller area network, and the simulator is used to simulate the communication environment and communication behavior of the real controller area network. In the embodiment of the present application, since a virtual controller area network is generated in a virtual environment, and an automated test script is executed based on the virtual controller area network and the simulator to implement the test of the CAN communication interface, it is not necessary to rely on the real hardware environment, and the cost increase caused by the purchase, layout and maintenance of the real hardware environment can be solved to reduce the equipment cost; the test of the CAN communication interface is implemented based on the automated test script, which can reduce the test manpower cost. Therefore, the embodiment of the present application can reduce the test cost of the CAN communication interface.

[0039] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0041] Figure 1 is a flow chart of a controller area network communication interface testing method provided by some embodiments of the present application;

[0042] Figure 2 is another flow chart of a controller area network communication interface testing method provided by some embodiments of the present application;

[0043] Figure 3 is a schematic block diagram of modules of a controller area network communication interface testing device provided by some embodiments of the present application;

[0044] Figure 4 It is a schematic diagram of the hardware structure of an electronic device provided in some embodiments of the present application. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the reference to "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. The appearance of this phrase in various positions in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.

[0046] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".

[0047] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0049] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0050] In order to make the inventive concept of the present application easy to understand, before describing the embodiments of the present application in detail, the English abbreviations (terms) / related concepts involved in the embodiments of the present application are first described. The English abbreviations (terms) / related concepts involved in the embodiments of the present application are subject to the following explanations.

[0051] CAN: CAN stands for Controller Area Network, a message-based protocol designed to provide reliable communication for multiple electronic control units (ECUs). This network is mainly used for internal vehicle networks. The CAN protocol replaces the previous complex and expensive multi-point connection harness system by simplifying the connection method of electronic devices in the vehicle. The CAN protocol is based on message passing, allowing each node on the network to send and receive messages. The protocol is designed to maintain stability and reliability of communication in harsh automotive environments. In the CAN network, any node can become a master node without central control. The CAN protocol has error detection and correction functions to ensure data integrity.

[0052] A2L file: A2L file is a commonly used file format in automotive electronic control unit (ECU) calibration. It is a text-based description file that is used to describe in detail the ECU's communication parameters, calibration variables, addresses of observed variables, and calculation formulas for physical values.

[0053] CI / CD: CI / CD stands for Continuous Integration / Continuous Deployment, which is usually interpreted as continuous integration and continuous deployment. It is an important part of modern software development and helps improve development efficiency, software quality and delivery speed.

[0054] Controller Area Network (CAN) is a message-based protocol designed to provide reliable communication for multiple electronic control units (ECUs). This network is mainly used for internal vehicle networks. The CAN protocol is widely used in various vehicle systems, such as engine control units, transmission control units, and body control modules, by simplifying the connection of electronic devices in the vehicle.

[0055] After research, it was found that, on the one hand, the test method of the CAN communication interface in the relevant technology usually needs to rely on the real hardware environment. For example, it is necessary to establish a real CAN communication environment based on real network equipment; special test equipment is required, such as the CAN analyzer VN1640, which is directly connected to the CAN network through the CAN analyzer to capture and analyze data in real time. Testing the CAN communication interface through a real hardware environment will not only limit the flexibility and portability of the test, but also increase the cost of testing. In addition, testing on actual vehicles or equipment may involve complex configuration and safety issues. Once a failure occurs due to configuration or testing problems, it may cause equipment damage or safety risks, further increasing costs.

[0056] On the other hand, even if there are software testing tools, these software testing tools often need to be used in conjunction with hardware testing tools. Therefore, not only do they fail to reduce testing costs, but because software testing tools usually can only cover software-level tests and cannot fully simulate hardware behavior, situations that do not match expectations may occur in the actual usage environment, thereby affecting the accuracy and reliability of the test results.

[0057] On the other hand, it may be difficult to cover all possible scenarios and conditions when testing in an actual environment. At the same time, the test results may be affected by environmental factors and difficult to repeat, which makes it difficult to locate and solve problems.

[0058] In view of this, the present application proposes a controller area network communication interface test method, device, equipment and vehicle, the scheme receives controller area network creation data; then, generates a virtual controller area network in a virtual environment through the controller area network creation data; finally, executes an automated test script based on the virtual controller area network and the simulator to realize the test of the controller area network communication interface; wherein, the automated test script is used to control the communication process between the simulator and the controller area network, and the simulator is used to simulate the communication environment and communication behavior of the real controller area network. In the embodiment of the present application, since the virtual controller area network is generated in the virtual environment, and the automated test script is executed based on the virtual controller area network and the simulator to realize the test of the CAN communication interface, it is not necessary to rely on the real hardware environment, and the cost increase caused by the purchase, layout and maintenance of the real hardware environment can be solved to reduce the equipment cost; the test of the CAN communication interface is realized based on the automated test script, which can reduce the test labor cost, and can also improve the flexibility and portability of the test, can fully cover the test scenarios and test conditions, improve the test efficiency, and can also avoid the damage of the equipment and the security risks caused by the configuration problems.

[0059] The method provided in the embodiment of the present application can be applied to the electronic device provided in the embodiment of the present application, wherein the electronic device can be a terminal or a server.

[0060] The terminal may be a tablet computer, a laptop computer, a desktop computer, etc., but is not limited thereto.

[0061] The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, as well as big data and artificial intelligence platforms.

[0062] The following will describe in detail the implementation steps of a controller area network communication interface testing method provided by an embodiment of the present application in conjunction with the accompanying drawings.

[0063] Please refer to Figure 1 , Figure 1 A flowchart of a controller area network communication interface test method provided for some embodiments of the present application. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and, although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0064] The method of the embodiment of the present application comprises the following steps:

[0065] Step 101: Receive controller area network creation data;

[0066] Step 102: Generate a virtual controller area network in a virtual environment through controller area network creation data;

[0067] Step 103: Execute an automated test script based on the virtual CAN and the simulator to implement testing of the CAN communication interface;

[0068] The automated test script is used to control the communication process between the simulator and the controller area network, and the simulator is used to simulate the communication environment and communication behavior of the real controller area network.

[0069] In steps 101 to 103 shown in the embodiment of the present application, a virtual controller area network is generated in a virtual environment, and an automated test script is executed based on the virtual controller area network and the simulator to implement the test of the CAN communication interface. This does not require reliance on a real hardware environment, and can solve the problem of increased costs associated with purchasing, arranging, and maintaining a real hardware environment, thereby reducing equipment costs. Implementing the test of the CAN communication interface based on an automated test script can reduce testing labor costs, improve test flexibility and portability, fully cover test scenarios and test conditions, improve test efficiency, and avoid equipment damage and security risks caused by configuration issues.

[0070] The specific implementation methods of the above steps are introduced below.

[0071] In step 101 , controller area network creation data is received.

[0072] CAN network creation data generally includes the necessary data for creating a CAN network. These data may include data for determining the physical and logical topology of the CAN network, and node definition data of the CAN network. The node definition data of the CAN network is used to define the various nodes in the network, including their functions, the types of messages sent and received, and their roles in the network.

[0073] CAN network creation data also includes parameters of the transmission signal, such as: signal name, signal ID, signal length (number of bits), signal type (for example: integer, floating point), transmission cycle, sending node, receiving node and verification method (for example: CRC), etc.

[0074] The CAN network creation data also includes network configuration data, which includes baud rate (bit rate), MAC address or similar identifier of the network node and connection relationship between nodes, etc. This application does not impose any restrictions on this.

[0075] The embodiment provided in the present application creates data by receiving a CAN network, thereby providing a data basis for the subsequent generation of a CAN network.

[0076] In step 102 , a virtual controller area network is generated in a virtual environment by using CAN network creation data.

[0077] A virtual environment is a software solution for developing and testing CAN networks. It usually has a visual interface to facilitate testers to input network data, monitor and manage the test process. At the same time, a virtual controller area network can be generated based on the received CAN network creation data through the virtual environment.

[0078] It should be understood that the virtual environment can also receive input CAN network creation data through the user interaction interface provided by the virtual environment and the controls in the user interaction interface.

[0079] The virtual environment that can be used to create a virtual CAN network can be Vector Tools, which includes a comprehensive test, simulation and development environment that can be used for testing and simulation of CAN, LIN, FlexRay, Ethernet and other networks, and also includes tools that can be used to measure, analyze and test CAN networks. The virtual environment can also be SocketCAN, which is based on the Linux kernel module and allows users to create a virtual CAN network interface and monitor data on the CAN bus. The virtual environment can also be LabVIEW, which includes the NI-CAN toolkit in the LabVIEW software development environment and can be used to create and test CAN networks. This application does not limit this.

[0080] Virtual CAN network is a solution that uses software to simulate the actual CAN network. It can be used to test applications related to CAN bus and communication interface. In virtual CAN network, no physical CAN hardware interface is required, and all CAN nodes are simulated by software. Through virtual CAN network, it is easy to add or remove CAN nodes and quickly modify network parameters to improve test flexibility and test efficiency. Through virtual CAN network, large and complex CAN networks can be simulated without purchasing supporting physical CAN hardware, thereby reducing test costs.

[0081] A virtual CAN network may be created based on a virtual environment. It should be understood that the methods for creating a virtual CAN network may differ based on different virtual environments.

[0082] For example, you can click Create in the user interface menu in the virtual environment, add a new CAN channel in the pop-up configuration window, then select "Virtual Channel" as the interface type, configure the channel parameters such as baud rate, network name, etc., and click "OK" to save the settings. In this way, a virtual CAN network can be established.

[0083] In some implementations, virtual nodes, virtual connections, and communication parameters of a controller area network may be generated using the acquired CAN network creation data.

[0084] The CAN network creation data obtained in step 101 includes data for determining the physical and logical topology of the CAN network, node definition data of the CAN network, parameters of the transmission signal, and network configuration data. Based on these data, virtual nodes, virtual connections, and communication parameters of the CAN can be generated through a virtual environment.

[0085] Virtual nodes usually refer to software-simulated nodes that can simulate the behavior of actual hardware nodes in the CAN network. These virtual nodes can be used for network communication, protocol testing, software development and debugging without using actual hardware.

[0086] Virtual connection refers to simulating the physical connection in the CAN network in a network simulation or test environment. This connection is not achieved through the actual CAN bus hardware, but through software to simulate the communication of CAN nodes. In the development process of automotive electronics or industrial automation systems, virtual connection can be used to test CAN protocol stacks, applications and communication protocols without using physical hardware.

[0087] Communication parameters are key parameters that define the communication characteristics of the CAN network. These parameters ensure correct communication between the nodes on the network.

[0088] The embodiments provided in the present application generate a virtual controller area network in a virtual environment through CAN network creation data, which can easily add or remove CAN nodes and quickly modify network parameters to improve test flexibility and test efficiency. The virtual CAN network can also simulate large and complex CAN networks without the need to purchase supporting physical CAN hardware, thereby reducing testing costs.

[0089] In step 103, an automated test script may be executed based on the virtual CAN network and the simulator to implement testing of the CAN communication interface.

[0090] The simulator is a software simulator or hardware simulator that can simulate the behavior of the CAN communication interface. It can simulate the real CAN network environment, including the behavior of the CAN controller, physical layer and data link layer. The simulator can generate and receive CAN frames and simulate the communication process of different nodes.

[0091] An automated test script is a code used to automate the testing of software applications. These scripts can be used for various types of testing, including unit testing, integration testing, end-to-end testing, and performance testing.

[0092] The automated test script is usually determined according to the project to be tested. Specifically, the test case designed by the user can be implemented through a software language. The specific software language type can be determined according to the selected test framework. The test framework can be JUnit, and the corresponding software language can be Java. The test framework can also be NUnit, and the corresponding software language can be .NET. The test framework can also be pytest, and the corresponding software language can be Python, etc., which is not limited in this application.

[0093] For example, based on Vector CAN, automated test scripts can be written in Communication Access Programming Language (CAPL), which can control the behavior of the simulator and virtual environment, such as sending CAN messages, simulating faults, etc. Automated test scripts are written in CAPL to implement test cases, define test steps, and output expected results.

[0094] In some implementations, an automated test script may be generated based on an automated test case, and then the automated test script may be loaded into a CAN test environment, wherein the test environment includes a virtual controller area network and a simulator, and the automated test script may be controlled to test the controller area network communication interface based on the virtual controller area network and the simulator.

[0095] In the test of CAN communication interface, in order to improve the test efficiency and reliability, a series of detailed automated test cases can be designed according to the specific test requirements and specifications. These cases cover various normal operation scenarios and potential abnormal situations of CAN communication interface. Then, professional script writing tools or programming languages ​​(such as CAPL) can be used to generate corresponding automated test scripts according to these automated test cases.

[0096] Afterwards, these automated test scripts can be loaded into a test environment designed for CAN communication. This test environment can include the following key components: virtual CAN network, which can simulate the real CAN network behavior without relying on physical hardware, allowing R&D personnel to test and verify the communication protocol in the early stages of product development; simulator, which can simulate each node in the CAN network, which can send, receive and process CAN messages to simulate the behavior of real devices.

[0097] In the test environment, the automated test script will be executed according to the preset logic and steps to test the CAN communication interface based on the virtual CAN network and simulator.

[0098] These tests may include: basic functional testing of the interface, including the ability to send and receive messages; network performance testing, such as message transmission delays and packet loss rates; abnormal situation handling capability testing, such as performance when the network load is too high or a node fails; compatibility testing; long-term operation stability testing to verify the reliability and durability of the system, etc. This application does not impose any restrictions on this.

[0099] In some implementations, an automated test script may be used to control a simulator to generate and receive signal frames of a CAN based on virtual nodes, virtual connections, and communication parameters of the virtual CAN to simulate the communication process of different nodes in the CAN.

[0100] Through the designed automated test scripts, the virtual nodes, virtual connections and communication parameters in the virtual CAN network can be precisely controlled, so as to generate and receive signal frames of the controller area network on the simulator.

[0101] In the automated test process, the test script can carefully manipulate the virtual CAN network environment according to the preset test scenarios and parameters. This can be achieved by loading the automated test script into the test environment designed for CAN communication and calling the simulator in the test environment and the application program interface of the virtual environment. During the test, the simulator will simulate the real CAN communication environment, generate and receive CAN frames. The virtual environment will monitor the test process and record the test results.

[0102] For example, the automated test script will first configure virtual nodes according to the test requirements, which simulate the physical devices in the actual CAN network at the software level. After that, the script will then establish connections between virtual nodes, which simulate the physical lines on the CAN bus. In order to ensure the correct transmission of signal frames, the script will set communication parameters according to the requirements of the test case. These parameters may include the length of the data frame, the request of the remote frame, the generation of the error frame, and the processing of the overload frame. The script will control the simulator to generate various types of CAN signal frames, such as data frames, remote frames, error frames, etc., to simulate the communication behavior of different nodes in the network. These frames can carry specific data for testing data processing and response in the network. At the same time, the script will also configure the simulator to receive signal frames from other nodes in the virtual network, and parse and process them. This process can verify whether the node can correctly receive, parse and respond to messages on the network. Through the operation of these scripts, the communication process of different nodes in the CAN network can be simulated, including functions such as synchronous communication between nodes, event triggering, error handling and network management.

[0103] This highly automated testing method not only simulates complex network interactions, but also ensures that the communication interface of the controller area network can work stably and efficiently in a variety of test scenarios.

[0104] In some implementations, the communication process of different nodes in the CAN network can also be monitored through a virtual environment, and the communication data can be recorded, and a test report can be generated through the communication data.

[0105] This can be done by deploying monitoring tools in the virtual environment that can capture and analyze data flows in the network.

[0106] These monitoring tools can be used to monitor the communication activities of all nodes in the CAN network in real time and record key information during the communication process. The communication activities of nodes in the CAN network include data frames, remote frames, error frames, overload frames, etc. Key information during the communication process includes frame ID, data content, send timestamp, receive timestamp, frame type, etc.

[0107] The monitored communication data can be stored in log files, and the log files can be analyzed to check whether the communication meets the expected protocols and standards. Identify abnormal situations in the communication process, such as communication interruption, frequent error frames, long response time, etc. And generate a detailed test report based on the analysis results.

[0108] In some implementations, the interface data and transmission data of the CAN network can be extracted through automated test cases, and then a data table can be generated based on the interface data and transmission data. The data table is parsed to obtain multiple test items, and corresponding multiple test scripts are generated based on the multiple test items. The multiple test scripts are merged to obtain an automated test script.

[0109] It should be understood that in an automated test case, input data, verification process and output data for a test item are usually defined, and these data can be stored in the form of files, such as DBC files and ARXML files.

[0110] Exemplarily, the interface variables and transmission data variables can be extracted by traversing the DBC file and ARXML file, and these extracted variables can be input into the test generation tool. The test generation tool generates a test input table based on the extracted variables. The test input table defines the input data and expected output of the test. By parsing the content in this table, the corresponding test script can be generated according to the test items. The generated test scripts can be merged through the test script generation tool to finally generate a CAPL automated test script.

[0111] DBC file is a file format used to describe message communication on the Controller Area Network (CAN). It defines the signals, messages, frame formats, nodes (controllers) and the communication relationships between them on the CAN network. In the automotive industry, DBC files are often used for the communication protocol definition of ECU (Electronic Control Unit).

[0112] ARXML files are XML description file formats of the AUTOSAR (AUTomotive Open System ARchitecture) standard. AUTOSAR is a global automotive industry alliance that aims to create and promote an open, standardized software architecture for automotive electronic control units (ECUs) and in-vehicle networks. ARXML files are used to describe the software architecture of ECUs, including configuration, parameters, interfaces, and data exchange formats.

[0113] Through the above method of generating test scripts, multiple corresponding test scripts can be generated according to the test cases, and multiple test scripts can be merged to improve the test efficiency. The above test script generation method can improve the flexibility of the test.

[0114] In some implementations of the present application, the automated test scripts can also be integrated into the continuous integration and continuous deployment process; the automated test scripts can be continuously verified and quickly iterated through continuous integration and continuous deployment.

[0115] Continuous Integration (CI) and Continuous Deployment (CD) are important components of modern software development, which help improve development efficiency, software quality and delivery speed.

[0116] CI can be used for version control, that is, using a version control system (such as Git) to manage source code to ensure that all developers are on the same page. CI can also be used for automated testing, that is, writing unit tests, integration tests, and end-to-end tests, and ensuring that these tests can be run automatically, and implementing an automated build process. It encourages developers to frequently integrate code into the main branch to reduce merge conflicts and integration issues.

[0117] CD can be used to script the deployment process so that it can be automated and use blue-green deployment or canary release strategies to reduce deployment risks and allow for rapid rollbacks.

[0118] Use CI / CD tools to automate the deployment process, eliminating the need for manual intervention from build to deployment, thereby speeding up software development and delivery and maintaining or improving software quality.

[0119] The following is a detailed description and explanation of the solution of the embodiment of the present invention in conjunction with a specific application example:

[0120] In an embodiment of the present application, a CAN communication interface testing method is provided, which is used to test the CAN network interface of a vehicle.

[0121] For the specific test process, please refer to Figure 2 , Figure 2 This is another flow chart of a controller area network communication interface testing method provided by some embodiments of the present application. Figure 2 In the process, firstly, the simulator and the virtual environment are configured, and the software system of the virtual CAN network is deployed, which may include setting the creation data of the virtual CAN network through the user interface provided by the virtual environment. Then, according to the creation data, the corresponding virtual CAN network is generated in the virtual environment, and the virtual nodes and communication parameters are configured.

[0122] According to the test requirements, use a scripting language (such as CAPL) to write an automated test script. The script can define multiple test cases, each of which contains a series of test steps and expected results.

[0123] After the virtual CAN network is created, import the A2L and CAPL test scripts. The A2L file is a commonly used file format in the calibration of automotive electronic control units (ECUs). It is used to describe in detail the communication parameters, calibration variables, addresses of observed variables, and calculation formulas of physical values ​​of the ECU. The A2L file can be generated by the A2L generation tool based on ELF files and HEX files. The ELF file is used to store program code and data for easy linking and execution. In the automotive field, ELF files usually contain the machine code instructions of the ECU and the data required for program runtime. The HEX file is a file format containing machine code represented in text form, which is often used in the actual firmware burning and updating process.

[0124] Automated testing is performed based on the imported A2L and CAPL test scripts, and test reports are generated. Specifically, the test scripts can be loaded into the test system, and the test tasks can be automatically executed by calling the APIs of the simulator and virtual environment. During the test, the simulator will simulate the real CAN communication environment, generate and receive CAN frames. The virtual environment will monitor the test process and record the test results. This step can be integrated into CI / CD, and the scheduling job can be set to automatically implement it.

[0125] After the test is completed, the system will generate a test report showing the test results and performance data. Testers can analyze the test results based on the report and evaluate the performance and stability of the CAN communication interface.

[0126] The embodiment of the present application executes the test of the CAN network communication interface through an automated test script, which can greatly improve the test efficiency and reduce manual intervention and errors; configuring the virtual CAN network based on the virtual environment can allow testers to flexibly configure the test environment and simulate the CAN communication process in different scenarios; and testing can be performed without actual hardware, which reduces the test cost and shortens the development cycle.

[0127] The above is a description of the implementation method of the controller area network communication interface testing method provided in this application.

[0128] The implementation of the controller area network communication interface testing device provided in the embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0129] For the controller area network communication interface testing method provided in the above embodiment, the present application embodiment also provides a controller area network communication interface testing device for implementing the above method, such as Figure 3 As shown, Figure 3 This is a module schematic block diagram of a controller area network communication interface test device according to an embodiment of the present application. The controller area network communication interface test device 300 includes:

[0130] The receiving module 301 is used to receive controller area network creation data;

[0131] A generating module 302, configured to generate a virtual controller area network in a virtual environment by using controller area network creation data;

[0132] An execution module 303 is used to execute an automated test script based on a virtual controller area network and a simulator to implement a test on a controller area network communication interface;

[0133] The automated test script is used to control the communication process between the simulator and the controller area network, and the simulator is used to simulate the communication environment and communication behavior of the real controller area network.

[0134] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0135] like Figure 4 As shown, the embodiment of the present application further provides an electronic device, the electronic device 400 includes a memory 401, one or more processors 402 ( Figure 4 Only one is shown in the figure) and a computer program stored in the memory 401 and executable on the processor 402. Among them: the memory 401 is used to store software programs and units, and the processor 402 executes various functional applications and data processing by running the software programs and units stored in the memory 401 to obtain the resources corresponding to the above-mentioned preset events. Optionally, the processor 401 implements the above-mentioned controller area network communication interface test method by running the above-mentioned computer program stored in the memory 402.

[0136] The memory 401, as a non-transitory computer-readable medium, can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory 401 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 401 may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor 402 via a network.

[0137] It can be understood that the contents of the above method embodiments are all applicable to the electronic device embodiment, the functions specifically implemented by the electronic device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0138] The embodiment of the present application also provides a vehicle, in which the CAN communication interface in the vehicle is tested by the above-mentioned controller area network communication interface test method, device or the electric drive assembly of the above-mentioned electronic device. Specifically, the vehicle can be a private car, such as a sedan, SUV, MPV or pickup truck. The vehicle can also be an operating vehicle, such as a van, bus, small truck or large trailer. The vehicle can be a gasoline vehicle or a new energy vehicle. When the vehicle is a new energy vehicle, it can be a hybrid vehicle or a pure electric vehicle.

[0139] It can be understood that the contents of the above method embodiments are all applicable to the present vehicle embodiment, the functions specifically implemented by the present vehicle embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0140] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by one or more processors, the steps of the controller area network communication interface testing method can be implemented.

[0141] It can be understood that the contents of the above method embodiments are all applicable to the present computer program product, the functions specifically implemented by the present computer program product embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0142] The controller area network communication interface testing method, device, electronic device, vehicle and computer program product provided in the embodiments of the present application receive controller area network creation data; then, generate a virtual controller area network in a virtual environment through the controller area network creation data; finally, execute an automated test script based on the virtual controller area network and a simulator to implement a test of the controller area network communication interface; wherein the automated test script is used to control the communication process between the simulator and the controller area network, and the simulator is used to simulate the communication environment and communication behavior of a real controller area network. In the embodiments of the present application, by using simulators and virtual environments, there is no need to purchase and maintain a large number of real hardware devices, thereby reducing the testing cost. Simulators and virtual environments allow for rapid creation and configuration of test environments. Automated test scripts reduce manual intervention, thereby shortening the test cycle and improving test efficiency. Testing in a virtual environment can avoid damage and safety risks that may be caused on actual hardware. Simulators and virtual environments can simulate various scenarios and conditions, thereby covering more test cases and improving test coverage. Integrating automated test scripts into the CI / CD process can achieve continuous verification and rapid iteration of code, thereby quickly discovering and fixing problems and improving software quality. Since the test environment is based on simulators and virtual environments, it can be easily copied and expanded, facilitating collaboration between teams and cross-platform testing. The embodiments provided in the present application can improve an efficient, safe and reliable solution for the testing of CAN communication interfaces by constructing simulators and virtual environments and combining automated test scripts, effectively reducing testing costs, improving testing efficiency, enhancing the safety and reliability of testing, and promoting the implementation of continuous integration and continuous deployment.

[0143] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0144] Although specific embodiments are described herein, those of ordinary skill in the art will recognize that many other modifications or alternative embodiments are also within the scope of the present disclosure. For example, any of the functions and / or processing capabilities described in conjunction with a particular device or component may be performed by any other device or component. In addition, although various exemplary implementations and architectures have been described according to embodiments of the present disclosure, those of ordinary skill in the art will recognize that many other modifications to the exemplary implementations and architectures described herein are also within the scope of the present disclosure.

[0145] Some aspects of the present disclosure are described above with reference to the block diagram and flow chart of the system, method, system and / or computer program product according to the exemplary embodiments.It should be understood that the combination of one or more blocks in the block diagram and the flow chart and the blocks in the block diagram and the flow chart can be realized by executing computer executable program instructions respectively.Equally, according to some embodiments, some blocks in the block diagram and the flow chart may not need to be executed in the order shown, or may not need to be executed in full.In addition, additional components and / or operations beyond those components and / or operations shown in the blocks in the block diagram and the flow chart may be present in certain embodiments.

[0146] Therefore, the blocks in the block diagrams and flow charts support the combination of devices for performing the specified functions, the combination of elements or steps for performing the specified functions, and the program instruction devices for performing the specified functions. It should also be understood that each block in the block diagrams and flow charts and the combination of blocks in the block diagrams and flow charts can be implemented by a special-purpose hardware computer system or a combination of special-purpose hardware and computer instructions that performs a specific function, element or step.

[0147] The program modules, applications, etc. described herein may include one or more software components, including, for example, software objects, methods, data structures, etc. Each such software component may include computer-executable instructions that, in response to execution, cause at least a portion of the functionality described herein (e.g., one or more operations of the illustrative methods described herein) to be performed.

[0148] Software components can be encoded with any of various programming languages. An exemplary programming language can be a low-level programming language, such as an assembly language associated with a specific hardware architecture and / or an operating system platform. The software component comprising assembly language instructions may need to be converted to executable machine code by an assembler before being executed by hardware architecture and / or platform. Another exemplary programming language can be a higher-level programming language, which can be transplanted across multiple architectures. The software component comprising a higher-level programming language may need to be converted to an intermediate representation by an interpreter or a compiler before execution. Other examples of programming languages ​​include but are not limited to macro languages, shells or command languages, job control languages, scripting languages, database queries or search languages ​​or report writing languages. In one or more exemplary embodiments, the software component comprising the instruction of one of the above-mentioned programming language examples can be directly executed by an operating system or other software components, without first being converted into another form.

[0149] Software components may be stored as files or other data storage structures. Software components of similar type or related functions may be stored together, such as in a specific directory, folder, or library. Software components may be static (e.g., preset or fixed) or dynamic (e.g., created or modified at execution time).

[0150] The embodiments of the present application are described in detail above in conjunction with the accompanying drawings, but the present application is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the relevant technical field without departing from the purpose of the present application.

Claims

1. A controller area network communication interface testing method, characterized in that: The following steps are involved: receiving controller area network creation data; generating a virtual controller area network in a virtual environment by using the controller area network creation data; Executing an automated test script based on the virtual CAN and the simulator to implement testing of the CAN communication interface; The automated test script is used to control the communication process between the simulator and the controller area network, and the simulator is used to simulate the real communication environment and communication behavior of the controller area network.

2. The controller area network communication interface testing method according to claim 1, characterized in that: The step of generating a virtual controller area network in a virtual environment by using the controller area network creation data includes: The virtual nodes, virtual connections and communication parameters of the controller area network are generated through the controller area network creation data.

3. The controller area network communication interface testing method according to claim 1, characterized in that: The step of executing an automated test script based on the virtual controller area network and the simulator to implement a test on the controller area network communication interface includes: Generate the automated test script according to the automated test case; Loading the automated test script into a test environment of the controller area network, the test environment comprising the virtual controller area network and the simulator; The automated test script is controlled to test the CAN communication interface based on the virtual CAN and the simulator.

4. The controller area network communication interface testing method according to claim 3, characterized in that: The controlling the automated test script to test the controller area network communication interface based on the virtual controller area network and the simulator includes: The automated test script controls the simulator to generate and receive signal frames of the virtual controller area network according to the virtual nodes, virtual connections and communication parameters of the virtual controller area network, so as to simulate the communication process of different nodes in the controller area network.

5. The controller area network communication interface testing method according to claim 1, characterized in that: The step of executing an automated test script based on the virtual controller area network and the simulator includes: Monitoring the communication process of different nodes in the controller area network through the virtual environment and recording the communication data; A test report is generated based on the communication data.

6. The controller area network communication interface testing method according to claim 3, characterized in that: Generating the automated test script according to the automated test case includes: Extracting interface data and transmission data of the controller area network through the automated test case; generating a data table based on the interface data and the transmission data; Parsing the data table to obtain multiple test items; Generate a corresponding plurality of test scripts according to a plurality of the test items; Merge multiple test scripts to obtain the automated test script.

7. The controller area network communication interface testing method according to any one of claims 1 to 6, characterized in that: The method further comprises: Integrate the automated test scripts into the continuous integration and continuous deployment process; The automated test scripts are continuously verified and rapidly iterated through the continuous integration and continuous deployment.

8. A controller area network communication interface testing device, characterized in that: The device comprises: A receiving module, used for receiving controller area network creation data; A generating module, configured to generate a virtual controller area network in a virtual environment by using the controller area network creation data; An execution module, configured to execute an automated test script based on the virtual controller area network and the simulator to implement a test on the controller area network communication interface; The automated test script is used to control the communication process between the simulator and the controller area network, and the simulator is used to simulate the real communication environment and communication behavior of the controller area network.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the controller area network communication interface testing method as claimed in any one of claims 1 to 7 when executing the computer program.

10. A vehicle, characterized in that: The controller area network communication interface in the vehicle is tested by the controller area network communication interface testing method as described in any one of claims 1 to 7, by the controller area network communication interface testing device as described in claim 8, or by the electronic device as described in claim 9.

Citation Information

Patent Citations

  • Network performance test method and device, equipment and storage medium

    CN112968812A

  • VxWorks application software testing method and system and simulator

    CN113821440A

  • Simulation virtualization test method, system and equipment based on controller and medium

    CN115542878A

  • Distributed network test method and device, medium and equipment

    CN115914055A

  • Method and system for testing vehicle-mounted network communication in virtual environment and readable storage medium

    CN117792975A

Cited By

  • Whole vehicle level testing device and method and cloud management platform

    CN116507982A