Test method and test device of controller can interface, electronic equipment and medium
By using automated testing methods and mapping file and script generation technology, the problem of low testing efficiency of the controller CAN interface was solved, achieving efficient and accurate testing, reducing the overall vehicle development cost, and improving the quality of controller software and the reliability of the testing system.
Patent Information
- Application Number
- CN202311346677.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-17
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2043-10-17
AI Technical Summary
Existing testing methods for controller CAN interfaces are inefficient, prone to errors during manual operation, and have low testing efficiency.
An automated testing method is adopted, which generates mapping files and scripts, uses the CANoe and CANape engineering environment to perform input and output tests, uses CAPL and CASL scripts to assign and parse signals, and combines time synchronization signals to determine whether the transmission link is normal and generate a visual report.
It improved testing efficiency, reduced human error, ensured test quality, lowered vehicle development costs, and improved controller software quality and test system reliability.
Smart Images

Figure CN119854187B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electronic testing, and in particular to a controller CAN interface testing method, a testing device, an electronic device and a medium. BACKGROUND
[0002] With the increasing intelligentization of various industries, the number of control units is increasing, and the functions are becoming more and more complex. At present, the signal interaction and communication between various control units, especially between vehicle-mounted controllers in the automotive field, are mainly realized through CAN (Controller Area Network). Therefore, the testing of the controller CAN interface is an important part of the controller development process and testing. Moreover, with the increasing integration of various functional software in the controller, the amount of code to be tested and the number of CAN signals to be tested increase by tens of times. Therefore, how to quickly and high-quality automatically test the CAN interface signals is an urgent problem to be solved.
[0003] The current interface testing based on CAN bus communication requires test personnel to manually write code, manually debug code, design test cases one by one, and carry out corresponding testing work. Such a testing method has large programming workload, large debugging workload, low testing efficiency, and manual operation is prone to errors. SUMMARY
[0004] The purpose of the present application is to solve the problem of low testing efficiency of the controller CAN interface testing method in the prior art.
[0005] To solve the above problems, an embodiment of the present application discloses a controller CAN interface testing method, which includes input testing and output testing. The input testing includes:
[0006] A database file of CAN signals corresponding to the controller and internal variable information of software integrated in the controller are obtained, and a mapping file about CAN signals-internal variables is generated according to the database file and the internal variable information; a first script suitable for a controller area network testing environment and a second script suitable for calibration measurement engineering are generated according to the mapping file; the first script is used as a test case for input testing, the controller area network testing environment is used, and the first script is used to assign values on the CAN bus to obtain an assignment result, and the assignment result is sent to the controller; the second script is used as a verification script for input testing, the calibration measurement engineering is used, and the second script is used to analyze the internal signals generated by the controller according to the assignment result to obtain an analysis result, and whether the input transmission link of the controller is normal is judged according to the analysis result and the assignment result.
[0007] Moreover, the output testing includes:
[0008] The database file of the CAN signal corresponding to the controller and the internal variable information of the software integrated in the controller are acquired, and a mapping file about the CAN signal-internal variable is generated according to the database file and the internal variable information; a first script suitable for a controller area network test environment and a second script suitable for a calibration measurement project are generated according to the mapping file; the second script is taken as a test case of output test, the calibration measurement project is passed through, and the internal signal of the controller is valued by using the second script to obtain a valuation result, and the valuation result is sent to the CAN bus; the first script is taken as a verification script of output test, the controller area network test environment is passed through, and the signal generated by the controller according to the valuation result is parsed on the CAN bus by using the first script to obtain a parsing result, and whether the output transmission link of the controller is normal is judged according to the parsing result and the valuation result.
[0009] By using the above scheme, the human cost is saved through the automatic test of the interface, the production efficiency is greatly improved, the misoperation and abnormal omission caused by manual operation are avoided, and the quality of the test is effectively ensured. Further, when the test method is used for CAN interface test of the whole vehicle, the number of real vehicle road tests can be reduced, the development time is shortened, the cost is reduced, the software quality of the controller is improved, and the risk of the whole vehicle is reduced. Further, the sufficiency of the test can be ensured, the valuation information and the test result are displayed in real time on the CANoe or CANape software interface of the upper computer, the test efficiency and the test quality are improved, and the reliability of the test system is improved.
[0010] According to another specific embodiment of the application, the test method of the controller CAN interface disclosed in the embodiment of the application, the controller area network is a CANoe project, and the first script is a CAPL script used for the CANoe project; the calibration measurement project is a CANape project, and the second script is a CASL script used for the CANape project.
[0011] By using the above scheme, when the input test is performed, the CAPL script is taken as the test case, so that the processing process of the valuation on the CAN bus is simpler; the CASL script is taken as the verification script, so that the efficiency of the internal signal analysis of the controller is higher. Moreover, when the output test is performed, the CASL script is taken as the test case, so that the accuracy of the valuation in the controller is higher, and the CAPL script is taken as the verification script, so that the processing process of the analysis on the CAN bus is simpler and more convenient.
[0012] According to another specific embodiment of the present application, the controller CAN interface testing method disclosed by the embodiments of the present application includes: in the input test, assigning values on the CAN bus through the CAN bus testing environment and using the first script, including: assigning values on the CAN bus through the CAN bus testing environment and using the first script to simulate CAN signals, and assigning minimum values, maximum values and intermediate values to each CAN signal respectively; and at the same time of sending the assignment results to the controller, also including: sending a first flag signal to the controller; wherein the first flag signal is used for time synchronization; and through the calibration measurement project and using the second script, analyzing the internal signals of the controller generated according to the assignment results to obtain analysis results, including: after the controller receives the first flag signal, through the calibration measurement project and using the second script, analyzing the internal signals of the controller to obtain analysis results.
[0013] According to the above scheme, the controller only analyzes the internal signals of the controller after receiving the time-synchronized first flag signal. The signals analyzed by the controller and the signals assigned on the CAN bus are clock-synchronized, ensuring the accuracy of the analysis results, and thus improving the test precision.
[0014] According to another specific embodiment of the present application, the controller CAN interface testing method disclosed by the embodiments of the present application includes: in the output test, assigning values to the internal signals of the controller through the calibration measurement project and using the second script, including: assigning minimum values, maximum values and intermediate values to each internal signal of the controller through the calibration measurement project, using the second script and using the calibration measurement protocol; and at the same time of sending the assignment results to the CAN bus, also including: sending a second flag signal to the CAN bus; wherein the second flag signal is used for time synchronization; and through the CAN bus testing environment and using the first script, analyzing the signals generated by the CAN bus according to the assignment results sent by the controller on the CAN bus to obtain analysis results, including: after the CAN bus receives the second flag signal, through the CAN bus testing environment and using the first script, analyzing the signals generated by the CAN bus according to the assignment results sent by the controller on the CAN bus to obtain analysis results.
[0015] According to the above scheme, the CAN bus only analyzes the signals generated according to the assignment results sent by the controller on the CAN bus after receiving the time-synchronized second flag signal. The signals analyzed by the CAN bus and the signals assigned by the controller are clock-synchronized, ensuring the accuracy of the analysis results, and thus improving the test precision.
[0016] According to another specific embodiment of the present application, the test method of the controller CAN interface disclosed by the embodiment of the present application further comprises: shielding the module with the automatic assignment function when assigning the internal signals of the controller.
[0017] By shielding the module with the automatic assignment function, the assignment error when assigning the controller can be prevented, and the influence of the assignment error on the interface test accuracy can be avoided.
[0018] According to another specific embodiment of the present application, the test method of the controller CAN interface disclosed by the embodiment of the present application utilizes the Python script to generate the mapping file in the input test and the output test; utilizes the Python script to generate the first script and the second script in the input test and the output test; the calibration measurement protocol is the XCP protocol; and the database file is the DBC file.
[0019] According to another specific embodiment of the present application, the test method of the controller CAN interface disclosed by the embodiment of the present application judges whether the input transmission link of the controller is normal according to the analysis result and the assignment result, and comprises:
[0020] If the analysis result is the same as the assignment result, the input transmission link of the controller is normal.
[0021] If the analysis result is different from the assignment result, the input transmission link of the controller is not normal.
[0022] Further, the test method judges whether the output transmission link of the controller is normal according to the analysis result and the assignment result, and comprises:
[0023] If the analysis result is the same as the assignment result, the output transmission link of the controller is normal.
[0024] If the analysis result is different from the assignment result, the output transmission link of the controller is not normal.
[0025] Further, after judging whether the input transmission link or the output transmission link of the controller is normal, the test method further comprises:
[0026] According to the judgment result, a visual test report is generated.
[0027] By the above scheme, the interface test method can generate a visual test report, which is convenient for monitoring the test process and processing the interface fault in time.
[0028] The embodiment of the present application discloses a testing device of controller CAN interface, comprising: a first acquisition module, the first acquisition module acquires database files of CAN signals corresponding to the controller and internal variable information of software integrated in the controller; a first processing module, the first processing module is in communication connection with the first acquisition module, generates a mapping file about CAN signals-internal variables according to the database files and the internal variable information; generates a first script suitable for controller local area network testing environment and a second script suitable for calibration measurement engineering according to the mapping file; takes the first script as a test case of input testing, performs assignment on the CAN bus through the controller local area network testing environment and by using the first script to obtain an assignment result, and sends the assignment result to the controller; takes the second script as a verification script of input testing, performs parsing on internal signals generated by the controller according to the assignment result through the calibration measurement engineering and by using the second script to obtain a parsing result, and judges whether the input transmission link of the controller is normal according to the parsing result and the assignment result; a second acquisition module, the second acquisition module acquires database files of CAN signals corresponding to the controller and internal variable information of software integrated in the controller; a second processing module, the second processing module is in communication connection with the second acquisition module, generates a mapping file about CAN signals-internal variables according to the database files and the internal variable information; generates a first script suitable for controller local area network testing environment and a second script suitable for calibration measurement engineering according to the mapping file; takes the second script as a test case of output testing, performs assignment on internal signals of the controller through the calibration measurement engineering and by using the second script to obtain an assignment result, and sends the assignment result to the CAN bus; takes the first script as a verification script of output testing, performs parsing on signals generated by the CAN bus according to the assignment result of the controller on the CAN bus through the controller local area network testing environment and by using the first script to obtain a parsing result, and judges whether the output transmission link of the controller is normal according to the parsing result and the assignment result.
[0029] The embodiment of the present application discloses an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the testing method of controller CAN interface as described in any of the above embodiments when executing the program.
[0030] The embodiment of the present application discloses a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement the testing method of controller CAN interface as described in any of the above embodiments.
[0031] The present application has the following beneficial effects:
[0032] The test method of the controller CAN interface provided in the application saves the labor cost through the automation test of the interface, greatly improves the production efficiency, avoids the misoperation and abnormal omission caused by manual operation, and effectively guarantees the test quality. Further, when the test method is used for the CAN interface test of the whole vehicle, the number of real vehicle road tests can be reduced, the software quality of the controller is improved, the development time is shortened, the cost is reduced, and the whole vehicle risk is reduced. Further, the sufficiency of the test can be guaranteed, the assignment information and the test result are displayed in real time on the CANoe or CANape software interface of the upper computer, the test efficiency and the test quality are improved, and the reliability of the test software system is improved. BRIEF DESCRIPTION OF DRAWINGS
[0033] Figure 1 is a flowchart of the input test of the test method of the controller CAN interface provided in the embodiment of the application;
[0034] Figure 2 is a flowchart of the output test of the test method of the controller CAN interface provided in the embodiment of the application;
[0035] Figure 3 is a structural schematic diagram of the test device of the controller CAN interface provided in the embodiment of the application;
[0036] Figure 4 is a structural schematic diagram of the electronic device provided in the embodiment of the application.
[0037] Legend of the drawings:
[0038] 111, first acquisition module; 112, first processing module; 113, second acquisition module; 114, second processing module; 121, transceiver; 122, processor; 123, memory. DETAILED DESCRIPTION
[0039] Embodiment 1:
[0040] To solve the problem of low test efficiency of the test method of the controller CAN interface in the prior art, the embodiment of the application provides a test method of the controller CAN interface. Specifically, the test method includes input test and output test.
[0041] Reference Figure 1 The input test includes the following steps:
[0042] S11: acquiring a database file of a CAN signal corresponding to a controller and internal variable information of software integrated in the controller, and generating a mapping file about the CAN signal-internal variable according to the database file and the internal variable information;
[0043] S12: generating a first script suitable for a controller area network test environment and a second script suitable for a calibration measurement project according to the mapping file;
[0044] S13: taking the first script as a test case for input test, performing assignment on the CAN bus by the controller area network test environment and using the first script to obtain an assignment result, and sending the assignment result to the controller;
[0045] S14: taking the second script as a verification script for input test, performing analysis on internal signals generated by the controller according to the assignment result by the calibration measurement project and using the second script to obtain an analysis result, and judging whether the input transmission link of the controller is normal according to the analysis result and the assignment result.
[0046] Reference Figure 2 , the output test comprises:
[0047] S21: obtaining a database file of CAN signals corresponding to the controller and internal variable information of software integrated in the controller, and generating a mapping file about CAN signals-internal variables according to the database file and the internal variable information;
[0048] S22: generating a first script suitable for a controller area network test environment and a second script suitable for a calibration measurement project according to the mapping file;
[0049] S23: taking the second script as a test case for output test, performing assignment on internal signals of the controller by the calibration measurement project and using the second script to obtain an assignment result, and sending the assignment result to the CAN bus;
[0050] S24: taking the first script as a verification script for output test, performing analysis on signals generated by the CAN bus according to the assignment result sent by the controller on the CAN bus by the controller area network test environment and using the first script to obtain an analysis result, and judging whether the output transmission link of the controller is normal according to the analysis result and the assignment result.
[0051] Specifically, in the above input test and output test, the database file is also called a network matrix file, and is specifically a DBC (Data Base CAN) file, which is a file for describing information of each logical node in the CAN network. The obtaining of the database file and the internal variable information and the generation of the mapping file can be realized by using a script.
[0052] The test case script file is used for test operation. Test personnel decompose test cases according to requirements, design test scripts according to the test cases, debug the test scripts, and then run the test scripts. The test script is a program code for automatic test.
[0053] With the steps, compared with the method that the tester designs test cases one by one and carries out corresponding test work by manual, the method can automatically generate scripts according to the mapping file, and the way of automatically generating scripts costs less time than manual writing; and the automatically generated scripts do not need to be debugged, which reduces the time of manual debugging and saves the labor cost, thereby improving the test efficiency. Moreover, the accuracy of automatically generating scripts is higher, and the method can also avoid the misoperation and abnormal omission caused by manual operation, effectively ensuring the quality of the test. Further, the method can automatically generate test scripts in multiple languages, and can be applied to test projects in different environments. When the method is used for testing the CAN interface of the whole vehicle, the number of road tests of the real vehicle can also be reduced, which shortens the development cost of the whole vehicle, reduces the cost, improves the software quality of the controller, and reduces the risk of the whole vehicle. Further, the method can display the assignment information and the test result on the CANoe or CANape software interface of the host computer in real time, which improves the test efficiency and the test quality, and improves the reliability of the test software system.
[0054] Further, in the test method of the controller CAN interface according to the application, the controller area network is a CANoe (CAN Open Environment, controller area network test environment) project, and the first script is a CAPL script for the CANoe project. Moreover, the calibration measurement project is a CANape (CAN Application Programming Environment) project, and the second script is a CASL script for the CANape project. That is to say, if the CANoe project is used as the test project, in order to meet the use needs of the CANoe project, the generated test script must use the CANoe project script language, that is, the CAPL test script. If the CANape project is used as the test project, in order to meet the use needs of the CANape project, the generated test script must use the CANape project script language, that is, the CASL test script.
[0055] Specifically, CAPL is an event-oriented programming language, i.e. program nodes are used to specify events and when to execute and react, which has the advantages of low coupling and high initiative. CASL is a signal-oriented language, which has the advantages of high execution accuracy and high efficiency. In the input test, the CAPL script is used as the test case, so that the assignment process on the CAN bus is simpler; the CASL script is used as the verification script, so that the efficiency of analyzing the internal signals of the controller is higher. In the output test, the CASL script is used as the test case, so that the accuracy of assigning values in the controller is higher, and the CAPL script is used as the verification script, so that the assignment process on the CAN bus is simpler and more convenient.
[0056] Further, in the controller CAN interface test method according to the application, in the input test, the assignment on the CAN bus is performed by using the first script in the controller area network test environment, comprising: performing the assignment on the CAN bus by using the first script to simulate the CAN signals in the controller area network test environment, and assigning minimum value, maximum value and intermediate value to each CAN signal respectively. Specifically, the minimum value, the maximum value and the intermediate value of the CAN signal refer to the maximum, the minimum and the intermediate value of the physical value of the CAN signal.
[0057] Further, in the controller CAN interface test method according to the application, in the input test, the assignment result is sent to the controller, and the first flag signal is also sent to the controller. The first flag signal is used for time synchronization. Specifically, the first flag signal can be sent in the form of a message, which is mainly used to indicate time synchronization.
[0058] Further, in the controller CAN interface test method according to the application, in the input test, the assignment result is sent to the controller, and the first flag signal is also sent to the controller. The first flag signal is used for time synchronization. Specifically, the first flag signal can be sent in the form of a message, which is mainly used to indicate time synchronization.
[0059] Further, in the controller CAN interface testing method according to the present application, in the output test, the controller internal signals are assigned by using the second script based on the calibration measurement project, including: the minimum value, the maximum value and the intermediate value of each internal signal of the controller are respectively assigned by using the second script based on the calibration measurement project and the calibration measurement protocol. Specifically, the minimum value, the maximum value and the intermediate value of the internal signal refer to the maximum, minimum and intermediate values of the internal signal definition range mapped with the CAN signal. More specifically, the calibration measurement protocol is the XCP protocol (Universal Calibration Protocol, Universal Calibration and Measurement Protocol).
[0060] Further, in the controller CAN interface testing method according to the present application, in the output test, the second flag signal is sent to the CAN bus at the same time when the assignment result is sent to the CAN bus. The second flag signal is used for time synchronization. Specifically, the second flag signal can be sent in the form of a message, which is mainly used to indicate time synchronization.
[0061] Further, in the controller CAN interface testing method according to the present application, in the output test, the CAN bus signal generated by the controller assignment result is parsed on the CAN bus by using the first script based on the CAN bus test environment to obtain the parsing result, including: after the CAN bus receives the second flag signal, the CAN bus signal generated by the controller assignment result is parsed on the CAN bus by using the first script based on the CAN bus test environment to obtain the parsing result. That is, the CAN bus parses the signal generated by the controller assignment result on the CAN bus only after receiving the second flag signal for time synchronization. The signal parsed by the CAN bus is clock-synchronized with the signal assigned by the controller, which ensures the accuracy of the parsing result and improves the test accuracy.
[0062] Further, in the controller CAN interface testing method according to the present application, when the controller internal signals are assigned, the module with automatic assignment function is shielded. Specifically, the corresponding module can be shielded by cutting off the signal transmission between the module and the outside. Shielding the module with automatic assignment function can prevent assignment errors when assigning the controller, thereby avoiding the influence of assignment errors on the interface test accuracy.
[0063] Further, in the controller CAN interface test method according to the present application, the mapping file is generated by Python script in the input test and the output test. Specifically, the internal variable information of the CAN signal and the internal variable information of the integrated software in the controller are obtained by the function processing of the database file of the CAN signal and the text file of the integrated software in the controller by the Python script, and the mapping file about the two information is generated.
[0064] Further, in the controller CAN interface test method according to the present application, the first script and the second script are generated by Python script in the input test and the output test. The Python script can automatically generate the test script required by the test, thereby improving the test efficiency.
[0065] Further, in the controller CAN interface test method according to the present application, whether the input transmission link of the controller is normal is judged according to the analysis result and the assignment result, comprising:
[0066] If the analysis result is the same as the assignment result, the input transmission link of the controller is normal.
[0067] If the analysis result is different from the assignment result, the input transmission link of the controller is not normal.
[0068] Further, in the controller CAN interface test method according to the present application, whether the output transmission link of the controller is normal is judged according to the analysis result and the assignment result, comprising:
[0069] If the analysis result is the same as the assignment result, the output transmission link of the controller is normal.
[0070] If the analysis result is different from the assignment result, the output transmission link of the controller is not normal.
[0071] Further, in the controller CAN interface test method according to the present application, after judging whether the input transmission link or the output transmission link of the controller is normal, the method further comprises: generating a visual test report according to the judgment result. Specifically, the test report is a Hyper Text Markup Language (HTML) test report.
[0072] Next, a specific input test method is described:
[0073] Firstly, according to the controller under test and the integrated software version of the controller, a mapping file of CAN signals-internal variables is automatically generated based on the DBC file of the CAN signals and the internal variables of the integrated software by using a Python script. The CAN signals correspond to the internal signals of the controller. Then, according to the generated mapping file, a CAPL script for the CANoe project and a CASL script for the CANape project are automatically generated based on the automated script written in Python. Then, the CAPL script is taken as an input interface test case to simulate the assignment of the CAN signals on the CAN bus, and the minimum value, the maximum value and the intermediate value are respectively assigned to each CAN signal, while a flag bit signal for time synchronization is sent on the CAN bus. Then, the CASL script is taken as a verification script, and the internal signals of the controller are parsed by using, for example, the XCP protocol in the CANape project, and the signal values assigned by the CAN signals are compared with the signal values assigned by the internal signals after the controller receives the flag bit signal, so as to determine whether the input transmission link is normal.
[0074] Next, a specific output test method is described as follows:
[0075] Firstly, according to the controller under test and the integrated software version of the controller, a mapping file of internal variables-CAN signals is automatically generated based on the DBC file of the CAN signals and the internal variables of the integrated software by using a Python script, wherein the internal signals of the controller correspond to the CAN signals. Then, according to the generated mapping file, a CAPL script for the CANoe project and a CASL script for the CANape project are automatically generated based on the automated script written in Python. Next, the CASL script is taken as an output interface test case, and the internal signals of the controller are assigned by using, for example, the XCP protocol in the CANape project, and the minimum value, the maximum value and the intermediate value are respectively assigned to each internal signal, while a flag bit signal for time synchronization is sent in the controller, and if the module to which the assigned signal belongs automatically assigns the signal, the module needs to be shielded. Then, the CAPL script is taken as a verification script, and the signals sent by the controller on the CAN bus are parsed, and the signal values assigned by the internal signals are compared with the signal values assigned by the CAN signals after the CAN bus receives the flag bit signal, so as to determine whether the output transmission link is normal.
[0076] Embodiment 2
[0077] Based on the above-described test method of the controller CAN interface, the embodiment provides a test device of the controller CAN interface. Referring to Figure 3 The test device includes a first acquisition module 111, a first processing module 112, a second acquisition module 113 and a second processing module 114.
[0078] Specifically, the first obtaining module 111 obtains a database file of a CAN signal corresponding to the controller and internal variable information of software integrated in the controller.
[0079] The first processing module 112 is in communication connection with the first obtaining module 111, generates a mapping file about the CAN signal-internal variable according to the database file and the internal variable information, generates a first script applicable to a controller local area network test environment and a second script applicable to a calibration measurement project according to the mapping file, takes the first script as a test case for input test, performs assignment on the CAN bus by using the first script through the controller local area network test environment to obtain an assignment result, and sends the assignment result to the controller, takes the second script as a verification script for input test, analyzes the internal signal generated by the controller according to the assignment result by using the second script through the calibration measurement project to obtain an analysis result, and judges whether the input transmission link of the controller is normal according to the analysis result and the assignment result.
[0080] The second obtaining module 113 obtains a database file of a CAN signal corresponding to the controller and internal variable information of software integrated in the controller.
[0081] The second processing module 114 is in communication connection with the second obtaining module 113, generates a mapping file about the CAN signal-internal variable according to the database file and the internal variable information, generates a first script applicable to a controller local area network test environment and a second script applicable to a calibration measurement project according to the mapping file, takes the second script as a test case for output test, performs assignment on the internal signal of the controller by using the second script through the calibration measurement project to obtain an assignment result, and sends the assignment result to the CAN bus, takes the first script as a verification script for output test, analyzes the signal generated by the CAN bus according to the assignment result issued by the controller on the CAN bus by using the first script through the controller local area network test environment to obtain an analysis result, and judges whether the output transmission link of the controller is normal according to the analysis result and the assignment result.
[0082] The test device for the CAN interface of the controller provided in this embodiment can perform the test method for the CAN interface of the controller provided in the method embodiments, has the function modules and beneficial effects corresponding to the execution method. The implementation principles and technical effects of this embodiment are similar to those of the above method embodiments, which will not be described here one by one.
[0083] Embodiment 3:
[0084] Based on the above test method for the CAN interface of the controller, this embodiment provides an electronic device. Referring to Figure 4 The electronic device can include a transceiver 121, a processor 122, and a memory 123.
[0085] The processor 122 executes computer-executed instructions stored in the memory, so that the processor 122 performs the solutions in the above-described embodiments. The processor 122 can be a general-purpose processor, including a central processing unit CPU, a network processor NP, etc.; can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0086] The memory 123 is connected with the processor 122 through the system bus and completes mutual communication, and the memory 123 is used for storing computer program instructions.
[0087] The transceiver 121 can be used to obtain a to-be-run task and configuration information of the to-be-run task.
[0088] The system bus can be a peripheral component interconnect (PCI) bus or 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 convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus. The transceiver is used to realize the communication between the database access device and other computers (for example, a client, a read-write library and a read-only library). The memory can include a random access memory (RAM), and can also include a non-volatile memory (NVM).
[0089] The electronic device provided by the embodiment of the application can be the terminal device of the above-described embodiment.
[0090] The embodiment of the application further provides a computer readable storage medium, which stores computer instructions, and when the computer instructions run on a computer, the computer instructions make the computer execute the technical solutions of the test method of the CAN interface of the controller described in the above-described embodiments.
[0091] The embodiment of the application further 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 the at least one processor executes the computer program, the technical solutions of the test method of the CAN interface of the controller described in the above-described embodiments can be realized.
[0092] While the application has been illustrated and described in connection with certain preferred embodiments thereof, it will be readily apparent to those of ordinary skill in the art that various changes in form and detail can be made therein without departing from the spirit and scope of the application. It is intended to encompass all such changes and alterations in the details thereof.
Claims
1. A method of testing a controller CAN interface, characterized by, The input test and the output test are included. Wherein The input test includes: obtaining the database file of the CAN signal corresponding to the controller and the internal variable information of the integrated software in the controller, and generating a mapping file about the CAN signal-internal variable according to the database file and the internal variable information; generating a first script suitable for the controller local area network test environment and a second script suitable for the calibration measurement engineering according to the mapping file; taking the first script as the test case of the input test, passing the controller local area network test environment, and assigning values on the CAN bus by using the first script to obtain the assignment result, and sending the assignment result to the controller; taking the second script as the verification script of the input test, passing the calibration measurement engineering, and analyzing the internal signal generated by the controller according to the assignment result by using the second script to obtain the analysis result, and judging whether the input transmission link of the controller is normal according to the analysis result and the assignment result; and The output test includes: obtaining the database file of the CAN signal corresponding to the controller and the internal variable information of the integrated software in the controller, and generating the mapping file about the CAN signal-internal variable according to the database file and the internal variable information; generating the first script suitable for the controller local area network test environment and the second script suitable for the calibration measurement engineering according to the mapping file; taking the second script as the test case of the output test, passing the calibration measurement engineering, and assigning values to the internal signal of the controller by using the second script to obtain the assignment result, and sending the assignment result to the CAN bus; taking the first script as the verification script of the output test, passing the controller local area network test environment, and analyzing the signal generated by the CAN bus according to the assignment result issued by the controller on the CAN bus by using the first script to obtain the analysis result, and judging whether the output transmission link of the controller is normal according to the analysis result and the assignment result.
2. The controller CAN interface test method of claim 1, wherein The controller local area network is a CANoe engineering, The first script is a CAPL script for the CANoe engineering; The calibration measurement engineering is a CANape engineering, The second script is a CASL script for the CANape engineering.
3. The method of testing a controller CAN interface of claim 2, wherein, In the input test, assigning values on the CAN bus by using the first script through the controller local area network test environment includes: Assigning values on the CAN bus by simulating CAN signals by using the first script through the controller local area network test environment, and assigning minimum value, maximum value and intermediate value to each CAN signal respectively; and When sending the assignment result to the controller, it also includes: sending a first flag signal to the controller; wherein the first flag signal is used for time synchronization; and The internal signal of the controller is assigned a value through the calibration measurement project and by using the second script, and the internal signal of the controller is parsed to obtain a parsing result, comprising: After the controller receives the first flag signal, the internal signal of the controller is parsed through the calibration measurement project and by using the second script to obtain the parsing result.
4. The method of testing a controller CAN interface of claim 2, wherein, In the output test, the internal signal of the controller is assigned a value through the calibration measurement project and by using the second script, comprising: Each internal signal of the controller is respectively assigned a minimum value, a maximum value and an intermediate value through the calibration measurement project, by using the second script and by using a calibration measurement protocol; and When the assignment result is sent to the CAN bus, it further comprises: A second flag signal is sent to the CAN bus; wherein the second flag signal is used for time synchronization; and The signal generated by the CAN bus according to the assignment result issued by the controller is parsed on the CAN bus through the controller area network test environment and by using the first script to obtain a parsing result, comprising: After the CAN bus receives the second flag signal, the signal generated by the CAN bus according to the assignment result issued by the controller is parsed on the CAN bus through the controller area network test environment and by using the first script to obtain the parsing result.
5. The method of testing a controller CAN interface of claim 4, wherein, When the internal signal of the controller is assigned a value, it further comprises: The module with the automatic assignment function is shielded.
6. The method of testing a controller CAN interface according to claim 3 or 5, wherein, In the input test and the output test, the mapping file is generated by using a Python script; and In the input test and the output test, the first script and the second script are generated by using a Python script; and The calibration measurement protocol is an XCP protocol; The database file is a DBC file.
7. The method of testing a controller CAN interface of claim 6, wherein, Whether the input transmission link of the controller is normal is judged according to the parsing result and the assignment result, comprising: If the parsing result is the same as the assignment result, the input transmission link of the controller is normal; If the parsing result is different from the assignment result, the input transmission link of the controller is not normal; and Whether the output transmission link of the controller is normal is judged according to the parsing result and the assignment result, comprising: If the parsing result is the same as the assignment result, the output transmission link of the controller is normal; If the parsing result is different from the assignment result, the output transmission link of the controller is not normal; and After judging whether the input transmission link or the output transmission link of the controller is normal, it further comprises: A visual test report is generated according to the judgment result.
8. A test apparatus for a controller CAN interface, characterized by Comprising: A first acquisition module, the first acquisition module acquires a database file of a CAN signal corresponding to a controller and internal variable information of integrated software in the controller; A first processing module, the first processing module is in communication connection with the first acquisition module, generates a mapping file about CAN signal-internal variable according to the database file and the internal variable information; According to the mapping file, a first script suitable for a controller area network test environment and a second script suitable for a calibration measurement project are generated; the first script is taken as a test case of input test, and is used to assign values on a CAN bus through the controller area network test environment to obtain an assignment result, and the assignment result is sent to the controller; the second script is taken as a verification script of the input test, and is used to analyze internal signals generated by the controller according to the assignment result through the calibration measurement project to obtain an analysis result, and whether an input transmission link of the controller is normal is judged according to the analysis result and the assignment result; a second acquisition module, which acquires the database file of the CAN signal corresponding to the controller and the internal variable information of the integrated software in the controller; a second processing module, which is in communication connection with the second acquisition module, generates the mapping file about the CAN signal-internal variable according to the database file and the internal variable information, and generates the first script suitable for the controller area network test environment and the second script suitable for the calibration measurement project according to the mapping file; the second script is taken as a test case of output test, and is used to assign values to internal signals of the controller through the calibration measurement project to obtain an assignment result, and the assignment result is sent to the CAN bus; the first script is taken as a verification script of the output test, and is used to analyze signals generated by the CAN bus according to the assignment result sent by the controller on the CAN bus through the controller area network test environment to obtain an analysis result, and whether an output transmission link of the controller is normal is judged according to the analysis result and the assignment result. 9.An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the test method of the controller CAN interface according to any one of claims 1-7 when executing the program. 10.A computer readable storage medium having a computer program stored thereon, wherein the program implements the test method of the controller CAN interface according to any one of claims 1-7 when executed by a processor.
Citation Information
Patent Citations
Controller area network signal transmission verifying method and system for automobile controller
CN104657302A
Electric vehicle controller CAN interface HIL automatic test method
CN114460925A