Method, device, equipment and storage medium for generating hardware-in-the-loop test cases

By automatically converting and combining test statements, the hardware-in-loop test cases are generated, which solves the problems of complex test case generation process and high learning cost in the prior art, and improves the testing efficiency.

CN115185726BActive Publication Date: 2025-04-18ROX MOTOR TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210808594.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-11
Publication Date
2025-04-18
Estimated Expiration
2042-07-11

AI Technical Summary

Technical Problem

When using Speedgoat devices for hardware-in-loop (HIL) testing, the prior art requires engineers to manually write matlab functions to generate test cases, resulting in complex generation processes and high learning costs.

Method used

Provides a method for generating hardware-in-ring test cases. By obtaining the original test statement, determining parameter variable operation statements, converting them into statements that can be run by hardware-in-ring test systems, and combining them with other statements and general operation statements to generate test cases.

Benefits of technology

This method reduces the workload of engineers, improves the efficiency of test cases generation, and thus improves the efficiency of hardware in-loop testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115185726B_ABST
    Figure CN115185726B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, equipment and storage medium for generating hardware-in-the-loop test cases, obtaining an original test statement, taking a parameter operation statement in the original test statement as a first statement, taking a statement other than the first statement as a second statement, converting the first statement into a third statement executable by a hardware-in-the-loop test system, combining the first statement, the third statement and a preset general operation statement, and obtaining a test case executable by the hardware-in-the-loop test system. According to an embodiment of the present application, after obtaining the original test statement, the parameter operation statement in the original test statement can be automatically converted into a statement executable by the hardware-in-the-loop test system, without the need for engineers to manually write statements according to functions, thereby reducing the workload of engineers, improving the efficiency of test case generation, and thereby improving the efficiency of hardware-in-the-loop testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to hardware-in-the-loop testing technology, and more particularly to a method, apparatus, device and storage medium for generating hardware-in-the-loop test cases. Background Art

[0002] Hardware in the loop (HIL) testing is a commonly used method for testing controllers in the automotive industry, also known as semi-physical simulation. Compared with real bench testing, HIL testing is carried out in the laboratory, which can test extreme working conditions and is relatively safer and less expensive.

[0003] The HIL test system usually includes a controller, a real-time machine and a host computer. The real-time machine is used to run the simulation model of the virtual controlled object, the controller is used to access the real-time machine to control the virtual controlled object in the real-time machine, and the host computer is used to control the real-time machine and the controller according to the input test case to perform the test and output the test results. Currently, the commonly used real-time machine is the Speedgoat device. When using the Speedgoat device for HIL testing, the host computer usually uses the matlab API method to automatically control the real-time machine. This requires engineers to write the test case in a format that can be run by matlab according to the matlab function. The entire generation process is relatively complicated and the learning cost is high, so the test case generation process needs to be optimized. Summary of the invention

[0004] The embodiments of the present application provide a method, apparatus, device and storage medium for generating hardware-in-the-loop test cases, which can more conveniently write test cases, reduce the workload of engineers, and improve the efficiency of HIL testing.

[0005] In a first aspect, an embodiment of the present application provides a method for generating a hardware-in-the-loop test case, comprising:

[0006] Get the original test statement;

[0007] Determine a first statement and a second statement in the original test statement, wherein the first statement is a parameter operation statement, and the second statement is other statements in the original test statement except the first statement;

[0008] converting the first statement into a third statement executable by the hardware-in-the-loop test system;

[0009] The third statement, the second statement and the preset general operation statement are combined to generate a test case.

[0010] As a possible implementation manner, converting the first statement into a third statement executable by the hardware-in-the-loop test system includes:

[0011] Acquire the statement content corresponding to the first statement from a preset test case management library, wherein the statement content includes an operation function and an absolute path of a parameter variable;

[0012] Determine the value of the parameter in the first statement;

[0013] The statement content and the parameter variable value are combined according to a preset statement format to obtain a third statement.

[0014] As a possible implementation method, obtaining the statement content corresponding to the first statement from a preset test case management library includes:

[0015] Determine the operation information of the first statement, the operation information includes an operation object, an operation type and a parameter variable name, wherein the operation object is a real-time machine or a controller, and the operation type is a value acquisition or a value assignment;

[0016] The statement content corresponding to the first statement is obtained from a preset test case management library according to the operation information.

[0017] As a possible implementation manner, determining the first statement in the original test statement includes:

[0018] For each statement in the original test statement, identify the statement to determine whether the statement contains an operation object identifier, wherein the operation object identifier is a real-time machine identifier or a controller identifier;

[0019] A statement including an operation object identifier is determined as a first statement.

[0020] As a possible implementation manner, determining the operation information of the first statement includes:

[0021] Identify the first sentence to determine whether it contains a preset symbol;

[0022] If it is identified that the first statement contains a preset symbol, determining that the operation type of the first statement is assignment;

[0023] If it is identified that the first statement does not contain a preset symbol, it is determined that the operation type of the first statement is value acquisition.

[0024] As a possible implementation method, the general operation statements include basic operation statements of the real-time machine, basic operation statements of the host computer software, and functions related to script execution.

[0025] In a second aspect, an embodiment of the present application provides a device for generating a hardware-in-the-loop test case, including:

[0026] An acquisition unit, used to acquire the original test statement;

[0027] A statement parsing unit, used to determine a first statement and a second statement in an original test statement, wherein the first statement is a parameter operation statement, and the second statement is other statements in the original test statement except the first statement;

[0028] A statement reconstruction unit, used for converting the first statement into a third statement executable by the hardware-in-the-loop test system;

[0029] The combining unit is used to combine the third statement, the second statement and the preset general operation statement to generate a test case.

[0030] In a third aspect, an embodiment of the present application provides a device for generating hardware-in-the-loop test cases, the device comprising: a processor and a memory storing computer program instructions;

[0031] When the processor executes the computer program instructions, the method for generating a hardware-in-the-loop test case as described in any one of the first aspects is implemented.

[0032] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method for generating hardware-in-the-loop test cases as described in any one of the first aspects is implemented.

[0033] In a fifth aspect, an embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the method for generating hardware-in-the-loop test cases as described in any one of the first aspects.

[0034] The method, device, equipment and computer storage medium for generating hardware-in-the-loop test cases of the embodiments of the present application obtain the original test statement, use the parameter operation statement in the original test statement as the first statement, use the statement other than the first statement as the second statement, convert the first statement into a third statement executable by the hardware-in-the-loop test system, combine the first statement, the third statement and the preset general operation statement, and obtain a test case executable by the hardware-in-the-loop test system. Through the above method, after obtaining the original test statement, the parameter operation statement in the original test statement can be automatically converted into a statement executable by the hardware-in-the-loop test system, without the need for engineers to manually write statements according to functions, reducing the workload of engineers, improving the efficiency of test case generation, and thus improving the efficiency of hardware-in-the-loop testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0036] Figure 1 is a schematic diagram of a HIL automated testing system provided by an embodiment of the present application;

[0037] Figure 2 It is a flowchart of a method for generating a hardware-in-the-loop test case provided by an embodiment of the present application;

[0038] Figure 3 It is a structural schematic diagram of a device for generating hardware-in-the-loop test cases provided by another embodiment of the present application;

[0039] Figure 4 It is a structural diagram of a device for generating hardware-in-the-loop test cases provided by yet another embodiment of the present application. DETAILED DESCRIPTION

[0040] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0041] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0042] Speedgoat is the HIL solution officially recommended by MathWorks. In fact, it is specially designed to be used with the simulation tool Simulink environment, and can achieve seamless connection with Matlab, Simulink Real-Time and other simulation software. For engineers who already use Simulink to develop control strategies for vehicle controllers (VCU), the learning cost is low. However, in the actual use of Speedgoat for HIL testing, there are also the following problems: Matlab comes with the real-time machine management interface Simulink Real Time Explorer, which can only manually change the parameters in the real-time machine and cannot meet the needs of automated testing.

[0043] In order to realize automatic testing, the matlab API is usually used to control the real-time machine using test cases (ie, Testcases), thereby realizing automatic testing.

[0044] See also Figure 1 , is a schematic diagram of a HIL automated test system based on Speedgoat equipment in an embodiment of the present application, wherein the host computer controls the real-time machine and the controller through matlab software and automobile calibration software INCA, and the automated test process corresponding to the above test system mainly includes the following steps:

[0045] 1. The host computer inputs test cases manually or automatically;

[0046] 2. The host computer and the real-time machine communicate using Ethernet;

[0047] 3. The host computer and the controller communicate using the XCP protocol;

[0048] 4. The host computer uses the setparam method to modify the parameters and / or calibration quantities in the real-time machine or controller according to the parameter settings in the test case, and uses the getparam method in real time to read the observed quantities after the execution parameters are modified, determine whether the controller test results meet expectations, and output the test results. Among them, getparam or setparam is a matlab parameter function.

[0049] From the above content, it can be seen that when using the matlab API method for automatic testing, in order to ensure that the host computer can modify the parameters (including parameters and calibration quantities, etc.) of the real-time machine or controller according to the test case, the test case needs to be written in the input format of the getparam or setparam function. Since the absolute path of the parameter in the Simulink model (that is, the simulation model of the virtual object under test) needs to be entered when the function is used, the function is relatively long, so the test case generation process is more cumbersome and the learning cost is high. Therefore, it is necessary to optimize the test case generation method.

[0050] In order to solve the problems of the prior art, the embodiments of the present application provide a method, apparatus, device and computer storage medium for generating hardware-in-the-loop test cases.

[0051] The following first introduces the method for generating hardware-in-the-loop test cases provided in the embodiment of the present application. The method for generating hardware-in-the-loop test cases provided in the embodiment of the present application can be applied to HIL testing of pure electric vehicles, hybrid electric vehicles or traditional fuel vehicles.

[0052] Figure 2 FIG. 1 is a flow chart showing a method for generating a hardware-in-the-loop test case according to an embodiment of the present application. Figure 2 As shown, the method for generating a hardware-in-the-loop test case provided in an embodiment of the present application may include the following steps:

[0053] S21. Obtain the original test statement.

[0054] S22. Determine a first statement and a second statement in the original test statement, wherein the first statement is a parameter operation statement, and the second statement is other statements in the original test statement except the first statement.

[0055] S23. Convert the first statement into a third statement executable by the hardware-in-the-loop test system.

[0056] S24. Combine the third statement, the second statement and the preset general operation statement to generate a test case.

[0057] The method for generating a hardware-in-the-loop test case of an embodiment of the present application obtains an original test statement, uses a parameter operation statement in the original test statement as a first statement, uses statements other than the first statement as a second statement, converts the first statement into a third statement executable by a hardware-in-the-loop test system, and combines the first statement, the third statement, and a preset general operation statement to obtain a test case executable by the hardware-in-the-loop test system. Through the above method, after obtaining the original test statement, the parameter operation statement in the original test statement can be automatically converted into a statement executable by the hardware-in-the-loop test system, without the need for engineers to manually write statements according to functions, thereby reducing the workload of engineers, improving the efficiency of test case generation, and thereby improving the efficiency of hardware-in-the-loop testing.

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

[0059] In some embodiments, in S21, the scripting language used by the original test statement can be a scripting language commonly used by engineers when writing scripts, for example, it can be js language, where js is javascript, a lightweight, interpreted or just-in-time compiled programming language with function priority. For example, as shown in Table 1 below, it is an example of a test case, where the content in the test statement implementation is the original test statement:

[0060] Table 1

[0061]

[0062]

[0063] In one example, when obtaining the original test statement in S11, the test statement written and input by the user (such as an engineer, etc.) according to the test requirements can be obtained as the original test statement. This method can ensure the accuracy of the test statement, and the user can write according to actual needs, which has a wider range of applications.

[0064] In one example, a test case library may be pre-set, and multiple test statements that meet different test requirements may be stored in the library. Based on this, in S11, the corresponding original test statement may be obtained from the test case library according to the test requirements. This method does not require the user to write statements, further reducing the user's workload.

[0065] Because the script language used in the original test statement does not conform to the language specification of the hardware-in-the-loop test system, the statements related to parameter operations cannot be run in the hardware-in-the-loop test system, that is, they cannot be run through MATLAB, resulting in the inability to modify the parameters in the real-time machine and / or controller, thereby making the hardware-in-the-loop test unable to proceed smoothly. Therefore, in order to ensure that the hardware-in-the-loop test can proceed smoothly, it is necessary to convert the parameter operation statements in the original test statement into a script language that can be run by the hardware-in-the-loop test system.

[0066] Based on the above reasons, after the original test statement is obtained, the original test statement can be parsed through S22 to identify the parameter variable operation statement therein, that is, the first statement.

[0067] In one example, a parameter operation statement is a statement used to operate on the parameter variables in the real-time machine and / or the controller, wherein the operations include taking values ​​and assigning values. Therefore, the parameter operation statement may include a statement for taking values ​​of the parameter variables of the real-time machine, a statement for assigning values ​​to the parameter variables of the real-time machine, a statement for taking values ​​of the parameter variables of the controller, and a statement for assigning values ​​to the parameter variables of the controller, etc.

[0068] In one example, because the parameter operation statement operates on a specific parameter in a real-time machine or controller, it usually contains an operation object identifier, which is also a real-time machine identifier and a controller identifier. Based on this, in S22, when determining the first statement in the original test statement, each statement can be identified to determine whether the statement contains an operation object identifier. If the statement contains an operation object identifier, the statement is determined to be the first statement, otherwise it is determined that the statement is not the first statement, but the second statement. In this way, the first statement and the second statement in the original test statement can be quickly identified.

[0069] After the first statement is identified, S23 may be used to convert the first statement into a script language, and convert it into a third statement executable by the hardware-in-the-loop test system, that is, a third statement that complies with the input format of the parameter function.

[0070] In one example, a test case management library can be pre-set, and multiple statement contents can be stored in the test case management library, wherein the statement content may include an operation function and a parameter absolute path, wherein the operation function may be a parameter function of matlab, such as a getparam function or a setparam function, and the parameter absolute path is the specific path of the parameter in the real-time machine or controller. Based on the above content, the statement content can use the matlab m language to directly call the statement content of the parameter of the real-time machine or controller in the form of a global variable, and perform normal value acquisition and assignment operations. Based on this, in S23, when the first statement is converted into a script language, the statement content corresponding to the first statement can be obtained from the preset test case management library, and the parameter value in the first statement is determined, and finally the statement content and the parameter value are combined according to the preset statement format, thereby obtaining the third statement. Wherein, the statement format is the format of the statement that the hardware-in-the-loop test system can run, and for example, the statement format can be: operation function (parameter absolute path, parameter value).

[0071] Furthermore, because different operation functions correspond to different operation types, for example, the getparam function corresponds to a value-taking operation, the setparam function corresponds to an assignment operation, and different parameter absolute paths correspond to different operation objects and parameter variables, when obtaining the statement content corresponding to the first statement from a preset test case library, the operation information of the first statement can be determined first, the operation information including the operation object, operation type and parameter variable name, wherein the operation object is a real-time machine or controller, and the operation type is value-taking or assignment, and then the statement content corresponding to the first statement is obtained from the test case library based on the operation information.

[0072] In one example, the operation object, parameter name and parameter value of the first statement can be directly obtained from the first statement, and when determining the operation type of the first statement, the first statement can be identified to determine whether it contains a preset symbol. If it is identified that the first statement contains a preset symbol, the operation type of the first statement is determined to be assignment. If it is identified that the first statement does not contain a preset symbol, the operation type of the first statement is determined to be value acquisition. The preset symbol is a symbol that can distinguish between assignment operations and value acquisition operations, such as an equal sign, i.e., "=".

[0073] An example: the first statement is "Param1_sg=Value1". By analyzing the statement, it is determined that the operation object identifier contained therein is sg, the parameter name is Param1, and the parameter value is Value1. According to the operation object identifier, the operation object is determined to be a real-time machine. Because it contains "=", the operation type is determined to be assignment. Based on the above content, the operation function in the corresponding statement content obtained from the test case management library is setparam, and the parameter absolute path is Passenger Car / VSUM / PlantModel / Driver / Param1. The third statement obtained by combining the statement content and the parameter value is "tg.setparam('Passenger Car / VSUM / PlantModel / Driver / Param1',Value,Value1)".

[0074] In one example, in order to facilitate the acquisition of the sentence content corresponding to the first sentence, a data dictionary corresponding to the test case library can be pre-set, and then the corresponding sentence content can be acquired from the test case library based on the data dictionary. The data dictionary can store a mapping relationship between operation information and sentence content, based on which, after determining the operation information of the first sentence, the corresponding sentence content can be acquired from the test case library according to the mapping relationship in the data dictionary.

[0075] After all first statements have completed script language conversion and obtained corresponding third statements, all third statements, second statements and preset general operation statements can be combined in S24 to generate test cases.

[0076] In one example, the general operation statements can be stored in a specified location in advance, and the preset general operation statements can be directly obtained from the specified location in S24. The general operation statements are statements common to all test cases, which may include basic operation statements of the real-time machine, basic operation statements of the host computer software, and functions related to script execution.

[0077] In one example, a test case template may be pre-set, based on which, in S24, the third statement, the second statement, and the preset general operation statement may be combined according to the preset test case template to generate a test case. In this way, the combination of statements may be realized quickly, the generation efficiency of the test case is improved, and the standardization of the generated test case is ensured.

[0078] Based on the method for generating a hardware-in-the-loop test case provided in the above embodiment, the present application also provides a specific implementation of a device for generating a hardware-in-the-loop test case. Please refer to the following embodiment.

[0079] See first Figure 3 The hardware-in-the-loop test case generation device provided in the embodiment of the present application includes the following units:

[0080] The acquisition unit 301 is used to acquire the original test statement.

[0081] The statement parsing unit 302 is used to determine a first statement and a second statement in the original test statement, wherein the first statement is a parameter operation statement, and the second statement is other statements in the original test statement except the first statement.

[0082] The statement reconstruction unit 303 is used to convert the first statement into a third statement executable by the hardware-in-the-loop test system.

[0083] The combining unit 304 is used to combine the third statement, the second statement and the preset general operation statement to generate a test case.

[0084] The embodiment of the present application provides a device for generating a hardware-in-the-loop test case, which obtains an original test statement, uses a parameter operation statement in the original test statement as a first statement, uses statements other than the first statement as a second statement, converts the first statement into a third statement executable by a hardware-in-the-loop test system, and combines the first statement, the third statement, and a preset general operation statement to obtain a test case executable by the hardware-in-the-loop test system. According to the embodiment of the present application, after obtaining the original test statement, the parameter operation statement in the original test statement can be automatically converted into a statement executable by the hardware-in-the-loop test system, without the need for engineers to manually write statements according to functions, thereby reducing the workload of engineers, improving the efficiency of test case generation, and thereby improving the efficiency of hardware-in-the-loop testing.

[0085] As a possible implementation manner, the statement reconstruction unit 303 is used to:

[0086] Acquire the statement content corresponding to the first statement from a preset test case management library, wherein the statement content includes an operation function and an absolute path of a parameter variable;

[0087] Determine the value of the parameter in the first statement;

[0088] The statement content and the parameter variable value are combined according to a preset statement format to obtain a third statement.

[0089] As a possible implementation manner, the statement reconstruction unit 303 obtains the statement content corresponding to the first statement from the preset test case management library, including:

[0090] Determine the operation information of the first statement, the operation information includes an operation object, an operation type and a parameter variable name, wherein the operation object is a real-time machine or a controller, and the operation type is a value acquisition or a value assignment;

[0091] The statement content corresponding to the first statement is obtained from a preset test case management library according to the operation information.

[0092] As a possible implementation, the statement parsing unit 302 is used to:

[0093] For each statement in the original test statement, identify the statement to determine whether the statement contains an operation object identifier, wherein the operation object identifier is a real-time machine identifier or a controller identifier;

[0094] A statement including an operation object identifier is determined as a first statement.

[0095] As a possible implementation manner, the statement reconstruction unit 303 determines the operation information of the first statement, including:

[0096] Identify the first sentence to determine whether it contains a preset symbol;

[0097] If it is identified that the first statement contains a preset symbol, determining that the operation type of the first statement is assignment;

[0098] If it is identified that the first statement does not contain a preset symbol, it is determined that the operation type of the first statement is value acquisition.

[0099] As a possible implementation method, the general operation statements include basic operation statements of the real-time machine, basic operation statements of the host computer software, and functions related to script execution.

[0100] Figure 4 A schematic diagram of the hardware structure of a device for generating hardware-in-the-loop test cases provided in an embodiment of the present application is shown.

[0101] The device for generating hardware-in-the-loop test cases may include a processor 401 and a memory 402 storing computer program instructions.

[0102] Specifically, the processor 401 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0103] Memory 402 may include a large capacity memory for data or instructions. By way of example and not limitation, memory 402 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, memory 402 may include a removable or non-removable (or fixed) medium. In appropriate cases, memory 402 may be inside or outside of an integrated gateway disaster recovery device. In a specific embodiment, memory 402 is a non-volatile solid-state memory.

[0104] The memory 402 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage media device, an optical storage media device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory 402 includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.

[0105] The processor 401 implements any one of the methods for generating hardware-in-the-loop test cases in the above embodiments by reading and executing computer program instructions stored in the memory 402 .

[0106] In one example, the hardware-in-the-loop test case generation device may further include a communication interface 403 and a bus 410. Figure 4 As shown, the processor 401, the memory 402, and the communication interface 403 are connected via a bus 410 and communicate with each other.

[0107] The communication interface 403 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0108] Bus 410 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 410 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.

[0109] In addition, in combination with the method for generating a hardware-in-the-loop test case in the above embodiment, the embodiment of the present application may provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any method for generating a hardware-in-the-loop test case in the above embodiment is implemented.

[0110] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0111] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0112] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0113] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0114] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A method for generating a hardware-in-the-loop test case, characterized in that: include: Get the original test statement; Determine a first statement and a second statement in the original test statement, wherein the first statement is a parameter operation statement, and the second statement is other statements in the original test statement except the first statement; Converting the first statement into a third statement executable by the hardware-in-the-loop test system; Combining the third statement, the second statement and a preset general operation statement to generate a test case; The converting of the first statement into a third statement executable by the hardware-in-the-loop test system includes: Acquire the statement content corresponding to the first statement from a preset test case management library, wherein the statement content includes an operation function and an absolute path of a parameter variable; Determine the value of the parameter in the first statement; Combining the statement content and the parameter value according to a preset statement format to obtain a third statement; The acquiring the statement content corresponding to the first statement from the preset test case management library includes: Determine operation information of the first statement, the operation information including an operation object, an operation type and a parameter variable name, wherein the operation object is a real-time machine or a controller, and the operation type is a value acquisition or a value assignment; Acquire the statement content corresponding to the first statement from a preset test case management library according to the operation information; The step of determining the first statement in the original test statement includes: For each statement in the original test statement, identify the statement to determine whether the statement contains an operation object identifier, wherein the operation object identifier is a real-time machine identifier or a controller identifier; A statement including the operation object identifier is determined as the first statement.

2. The method according to claim 1, characterized in that The determining the operation information of the first statement includes: Identify the first sentence to determine whether it contains a preset symbol; If it is identified that the first statement contains a preset symbol, determining that the operation type of the first statement is assignment; If it is identified that the first statement does not contain a preset symbol, it is determined that the operation type of the first statement is value acquisition.

3. The method according to claim 1, characterized in that The general operation statements include basic operation statements of the real-time machine, basic operation statements of the host computer software and functions related to script execution.

4. A device for generating hardware-in-the-loop test cases, characterized in that: include: An acquisition unit, used to acquire the original test statement; A statement parsing unit, used to determine a first statement and a second statement in the original test statement, wherein the first statement is a parameter operation statement, and the second statement is other statements in the original test statement except the first statement; A statement reconstruction unit, used for converting the first statement into a third statement executable by the hardware-in-the-loop test system; A combining unit, used for combining the third statement, the second statement and a preset general operation statement to generate a test case; Wherein, the statement reconstruction unit is specifically used for: Acquire the statement content corresponding to the first statement from a preset test case management library, wherein the statement content includes an operation function and an absolute path of a parameter variable; Determine the value of the parameter in the first statement; Combining the statement content and the parameter value according to a preset statement format to obtain a third statement; The statement reconstruction unit obtains the statement content corresponding to the first statement from a preset test case management library, including: Determine operation information of the first statement, the operation information including an operation object, an operation type and a parameter variable name, wherein the operation object is a real-time machine or a controller, and the operation type is a value acquisition or a value assignment; Acquire the statement content corresponding to the first statement from a preset test case management library according to the operation information; Wherein, the statement parsing unit is specifically used for: For each statement in the original test statement, identify the statement to determine whether the statement contains an operation object identifier, wherein the operation object identifier is a real-time machine identifier or a controller identifier; A statement including the operation object identifier is determined as the first statement.

5. A device for generating hardware-in-the-loop test cases, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the method for generating hardware-in-the-loop test cases as described in any one of claims 1-3.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method for generating a hardware-in-the-loop test case as described in any one of claims 1 to 3 is implemented.

7. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the method for generating hardware-in-the-loop test cases as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Vehicle electric control unit flexible HIL test center and test method

    CN110502430A

  • Test case generation method and device

    CN111475410A