HIL test automatic execution method
By formulating interface interaction specifications and designing test case files, the existing HIL testing tools cannot work in parallel and lack of a division of labor and cooperation mechanism is solved, and the separation of test case design and engineering configuration is achieved, and testing efficiency and intuitiveness are improved.
Patent Information
- Application Number
- CN202210331324.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-30
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2042-03-30
AI Technical Summary
The existing HIL testing tools cannot carry out work in parallel, and lack an effective division of labor and cooperation mechanism, resulting in inefficient testing and manual writing of test scripts are large and unintuitive, which is not conducive to review and exchange.
Formulate interface interaction specifications, set consistent variables between test case files and test projects, and agree on the ECU hardware channel pointed to by the test device board that executes the variable. Design test case files, including the action types and specific execution contents of variables in the interface interaction specification, and add alias maps associated with the test cases when testing engineering configuration.
It realizes the separation of test case design and test engineering configuration, improves testing efficiency, supports parallel work, simplifies test script writing, and improves the intuitiveness of review and communication.
Smart Images

Figure CN114816999B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of automobile testing, and in particular to a method for automatically executing a HIL test. Background Art
[0002] Hardware-in-the-Loop (HIL) is a development and testing technology for complex device controllers. Through HIL testing, the physical part of the machine or system is replaced by a simulator and is widely used in the development of automotive controllers. In the development of ECU (Electronic Control Unit), the system software and mechanical hardware structure are usually designed in parallel. Testing can only be carried out after integration. If some serious safety bugs are found after integration, it may cause personal injury, damage to equipment and project delays. In order to reduce the occurrence of these bugs, HIL testing has received widespread attention.
[0003] At present, the automotive testing industry mainly implements automated testing by writing test programs in "HIL automated testing software". This method is a general method recommended by major HIL manufacturers.
[0004] Generally speaking, HIL manufacturers provide test configuration software and automated test software. The former is used to configure the HIL test system, and the latter is used to perform automated testing.
[0005] The technical solution provided by the HIL supplier specifically includes the following steps:
[0006] The first step is to use the test configuration software to configure a complete test project, including various hardware boards, closed-loop models, necessary protocol stacks, etc., which is called "Project 1".
[0007] The second step is to use the automated testing software to read the "Project 1" configured in the previous step and obtain the variables in the project.
[0008] The third step is to write the test program in the programming environment provided by the automated test software, using these variables according to the read and write properties of the variables and the functional definition of the ECU under test.
[0009] The fourth step is to perform automated testing and generate a test report.
[0010] In the above solution, the test project needs to be configured first, and then the project can be read into the automated test software and variables can be obtained, and then the automated test program or script can be written.
[0011] In actual work, the test program (or test script) belongs to the design category of test cases; the configuration of the test project belongs to the development category of test tools.
[0012] On the basis of agreeing on certain rules, the two can be carried out in parallel. Parallel development is more conducive to division of labor and cooperation, and is more conducive to capacity improvement and knowledge accumulation.
[0013] However, this method provided by the supplier is obviously not suitable for parallel cooperation, which makes the HIL testing work relatively closed and inefficient, and it is difficult to fully play its due role. Summary of the invention
[0014] The present invention aims at the defects that the automated testing tools provided by HIL manufacturers in the prior art cannot carry out work in parallel and have no effective division of labor and cooperation mechanism. If the test scripts are written manually, the workload is large, the test scripts are not intuitive, and the test scripts are not conducive to review and communication. The present invention provides a method for automatically executing HIL tests.
[0015] The technical solution adopted by the present invention is:
[0016] A method for automatically executing a HIL test is provided, comprising the following steps:
[0017] The first step is to formulate interface interaction specifications, specifically set consistent variables between test case files and test projects, and agree on the ECU hardware channel pointed to by the test equipment board that executes the variable;
[0018] The second step is to design a test case file according to the interface interaction specification. The test case file includes the action type and specific execution content corresponding to the variables in the interface interaction specification. At the same time, complete the test project configuration, including adding an alias mapping associated with the variables in the test case. The alias mapping contains the variable name and the corresponding hardware channel in the test project.
[0019] The third step is to parse and execute the test case. Specifically, the test case file content is read, and the variables in the test case correspond to the hardware channels in the alias mapping, and the corresponding ActiveX read and write functions are called to execute the test case.
[0020] Following the above technical solution, the test case includes four "action types": control signal Control, check signal Check, delay control Delay and wait signal value CheckUntil;
[0021] The Control type action is a control signal. If its time parameter is not 0, time control is performed at the same time.
[0022] Actions of type Check check the signal.
[0023] The CheckUntil type action waits for the signal value to meet the expected requirements, and its time parameter is the maximum waiting time.
[0024] The Delay type action is a delay.
[0025] Following the above technical solution, when parsing the test case, for the Control type action, all corresponding parameter values are obtained to form an association between the variable name and the variable value, and the response parameters are controlled by the variable name;
[0026] For actions of type Check or CheckUntil, get all corresponding parameter values;
[0027] For Delay type actions, get the variable value.
[0028] Following the above technical solution, when executing the test case, for the Control type action, WriteChannelValue(channelpath,channelvalue) is used to execute. Specifically, the real channel path channelpath is found from the interface interaction specification file according to the variable name of the test case, and the corresponding function is called;
[0029] For Check type actions, the function ReadChannelValue(channelpath) is used for execution. The way to find the channel path channelpath is similar to that of the Control action.
[0030] For delay commands, ordinary delay functions are used for execution;
[0031] For the CheckUntil command, ReadChannelValue(channelpath) of the timeout loop structure is used for execution.
[0032] Following the above technical solution, the test case file is written in Excel format.
[0033] Following the above technical solution, when executing the test case, the read and write results are used for analysis and judgment. If the output meets the expectations, the test is marked as passed, otherwise, it is marked as failed.
[0034] The present invention also provides a computer storage medium, which stores a computer program that can be executed by a processor, and the computer program executes the HIL test automatic execution method described in the above technical solution.
[0035] The beneficial effects of the present invention are as follows: the present invention specifically sets the consistent variables between the test case file and the test project by formulating the interface interaction specification, and stipulates the ECU hardware channel pointed to by the test equipment board that executes the variable, and designs the test case file on this basis, and the test case file includes the action type and specific execution content corresponding to the variable in the interface interaction specification. The test project configuration can be completed while designing the test case file, and the alias mapping associated with the variable in the test case is added during configuration, and the alias mapping contains the variable name and the corresponding hardware channel in the test project. Based on the same mapping rule, the present invention can carry out the test case design and test project configuration work respectively, and then directly carry out automated testing. It can be seen that the present invention can separate the configuration and debugging work of the test equipment and the test case design work, which is conducive to division of labor, modularization, and automation to carry out related work, thereby further improving efficiency.
[0036] Furthermore, test cases can adopt file formats with lower thresholds (such as Excel), which makes it easier for test case engineers to directly discuss, share, and execute modularly. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0038] Figure 1 It is a flow chart of a method for automatically executing HIL test according to an embodiment of the present invention. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0040] Definitions of Abbreviations and Key Terms:
[0041] HIL testing: A method of testing ECUs in a laboratory.
[0042] ActiveX: A software call interface technology.
[0043] HIL automated testing software: operating software running on the HIL host computer, mainly responsible for editing test cases and executing tests.
[0044] HIL test configuration software: A software system that runs on the HIL host computer and is downloaded to the HIL slave computer during execution. It is mainly responsible for the integration of the HIL system and the software and hardware configuration.
[0045] Protocol stack: A communication function module with various special functions encapsulated on the basis of basic communication.
[0046] The functional design of ECU must first have a functional definition, which clearly describes what functions the ECU is to achieve. After receiving the functional definition document, the component supplier completes the development of related software and hardware. The functional definition document is also the basis for acceptance criteria in testing work and the basis for designing test cases.
[0047] The functions to be achieved by the embodiment of the present invention are mainly: the ECU detects the voltage of the hard-wired accelerator pedal signal, and then sends the signal "ACC_pedal_deepth" of the ID 0x262 of the BCAN to the bus.
[0048] In order to realize the functions of the above-mentioned embodiment, the HIL test automatic execution method of the preferred embodiment of the present invention mainly includes the following steps:
[0049] The first step is to formulate the interface interaction specification. This specification file is a bridge between test case design and test execution. On the one hand, it can be used in the test case design phase. During the test case design process, only the variables listed in the "Interface Interaction Specification" can be used. On the other hand, the "Interface Interaction Specification" stipulates the ECU hardware channel pointed to by the test equipment board. During the test project configuration process, the test equipment and the device under test are connected in combination with the hardware resource situation.
[0050] The following table shows the interface interaction specification file:
[0051] Table 1: Example of an "Interface Interaction Specification" file
[0052]
[0053] At this point, "Pin_Accpedal_deepth" and "CAN_0x262_pedal_depth" and their meanings serve as a bridge for communication between the test case design phase and the test tool construction phase. Both parties can carry out their work separately based on this specification.
[0054] The second step is to design test cases according to the interface interaction specifications. The test cases are in Excel format, as shown in Table 2 below:
[0055] Table 2: Test case examples
[0056]
[0057] The work of test engineering configuration can be carried out simultaneously with the design of test cases. The conventional configuration work of the test engineering is the same as the configuration method currently prevalent in the industry and is not the focus of the present invention.
[0058] According to the present invention, after completing the configuration of the conventional test project, it is necessary to add an alias mapping to the mapping relationship.
[0059] For example, in the test tool, the AO_01 channel of the analog output board is connected to PIN11 of the ECU, and the alias mapping is shown in Table 3 below:
[0060] Table 3: Alias mapping
[0061] Alias Name Hardware Channels in Test Engineering Pin_Accpedal_depth Controller / Hardware / AO / 01
[0062] At this point, when the variable name "Pin_Accpedal_deepth" is filled in the test case and controlled, the voltage received by PIN11 of the ECU will change accordingly.
[0063] The third step is test case analysis.
[0064] For the Excel test cases in the second step, they are classified into four "action types": control signal (Control), check signal (Check), delay control (Delay), and wait signal value (CheckUntil), which are located in the "action type" column.
[0065] The control type action is a control signal. If its time parameter is not 0, the time control is executed at the same time. Therefore, in the Excel test case, the command with line number 2 means that through "Pin_Accpedal_deepth", the output voltage of the device board corresponding to the ECU voltage acquisition pin is controlled to 2.8V, and then a delay of 500ms is performed.
[0066] The action of the Check type is to check the signal. Therefore, the meaning of the second line is to check whether the physical value (pedal depth percentage) of the signal sent by the ECU is between 56 and 59 (the theoretical value is 57.5) through "CAN_0x262_pedal_depth".
[0067] CheckUntil means waiting for the signal value to meet the expected requirements, and its time parameter is the maximum waiting time.
[0068] Delay means delay.
[0069] The input signal and output signal are distinguished by the key character "time parameter". The part before "time parameter" and after "single-line description" is the input signal of the ECU; the part after "time parameter" is the output signal of the ECU.
[0070] The "Single-line description" column is a detailed description of the action in this row; the "Multi-line description" column is a general summary description of multiple single-line names.
[0071] The test case parsing method is as follows: first read the Excel file content, and determine the type of action to be performed through the characters in its "Action Type" column. For Control type actions, obtain all parameter values in the input area (between the "Single Line Description" column and the "Time Parameter" column), and remove empty cells to form an association between the variable name and the variable value, and then control the response parameters through the variable name. For Check or CheckUntil type actions, obtain all parameter values in the output area (after the "Time Parameter" column). For pure delay (Delay), obtain the variable value (time, unit ms) in the "Time Parameter" column of its row.
[0072] The fourth step is to execute the parsed test cases.
[0073] To execute the test cases, use the ActiveX interface of the test configuration software and call the corresponding methods to execute.
[0074] For Control type actions, use WriteChannelValue
[0075] (channelpath, channelvalue). Taking the test case number 2 in the second step as an example, you need to first find the real channelpath "Controller / Hardware / AO / 01" from the "Interface Interaction Specification" file based on the variable name "Pin_Accpedal_deepth" in the input area of the test case, and call the above function. The specific format is:
[0076] WriteChannelValue("Controller / Hardware / AO / 01",2.8) realizes the input voltage control of ECU input channel PIN11.
[0077] For Check type actions, ReadChannelValue(channelpath) is used for execution. The way to find channelpath is similar to that of Control action.
[0078] For delay commands, ordinary delay functions are used for execution.
[0079] For the CheckUntil command, ReadChannelValue(channelpath) of the timeout loop structure is used for execution.
[0080] The read and write results are used for analysis and judgment. If the output meets expectations, the test is marked as passed, otherwise, it is marked as failed.
[0081] The present invention also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, and the program realizes corresponding functions when executed by a processor. The computer-readable storage medium of this embodiment is used to realize the HIL test automatic execution method of the method embodiment when executed by a processor.
[0082] It should be understood that those skilled in the art can make improvements or changes based on the above description, and all these improvements and changes should fall within the scope of protection of the appended claims of the present invention.
Claims
1. A method for automatically executing a HIL test, characterized in that: The following steps are involved: The first step is to formulate interface interaction specifications, specifically set consistent variables between test case files and test projects, and agree on the ECU hardware channel pointed to by the test equipment board that executes the variable; The second step is to design a test case file according to the interface interaction specification. The test case file includes the action type and specific execution content corresponding to the variables in the interface interaction specification. At the same time, complete the test project configuration, including adding an alias mapping associated with the variables in the test case. The alias mapping contains the variable name and the corresponding hardware channel in the test project. The third step is to parse and execute the test case. Specifically, the test case file content is read, and the variables in the test case correspond to the hardware channels in the alias mapping, and the corresponding ActiveX read and write functions are called to execute the test case.
2. The HIL test automatic execution method according to claim 1, characterized in that: The test case includes four "action types": control signal Control, check signal Check, delay control Delay and wait signal value CheckUntil; The Control type action is a control signal. If its time parameter is not 0, time control is performed at the same time. The action of type Check is to check the signal; The action of the CheckUntil type is to wait for the signal value to meet the expected requirements, and its time parameter is the maximum waiting time; The Delay type action is a delay.
3. The HIL test automatic execution method according to claim 2, characterized in that: When parsing test cases, for Control type actions, obtain all corresponding parameter values, form associations between variable names and variable values, and control the response parameters through variable names; For actions of type Check or CheckUntil, get all corresponding parameter values; For Delay type actions, get the variable value.
4. The HIL test automatic execution method according to claim 2, characterized in that: When executing a test case, for a Control type action, use WriteChannelValue (channelpath,channelvalue) is executed. Specifically, the real channel path channelpath is found from the interface interaction specification file according to the variable name of the test case, and the corresponding function is called; For Check type actions, the function ReadChannelValue(channelpath) is used for execution. The way to find the channel path channelpath is similar to that of the Control action. For delay commands, ordinary delay functions are used for execution; For the CheckUntil command, use the ReadChannelValue with a timeout loop structure (channelpath) execution.
5. The HIL test automatic execution method according to claim 1, characterized in that: The test case file is written in Excel format.
6. The HIL test automatic execution method according to claim 1, characterized in that: When executing a test case, the read and write results are used for analysis and judgment. If the output meets expectations, the test is marked as passed, otherwise, it is marked as failed.
7. A computer storage medium, characterized in that: A computer program executable by a processor is stored therein, and the computer program executes the HIL test automatic execution method according to any one of claims 1 to 6.
Citation Information
Patent Citations
ECU automatic test method and system, storage medium and device
CN112068530A