A test script generation method, device, electronic device and storage medium

By receiving test cases and HIL platform types, and calling the target conversion library to convert it into a general test script, solving the commonality problem of different platforms in HIL testing and improving testing efficiency.

CN118760615BActive Publication Date: 2025-01-14DONGFENG MOTOR GRP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411253650.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-09
Publication Date
2025-01-14
Estimated Expiration
2044-09-09

AI Technical Summary

Technical Problem

In the HIL test of automotive electronic controller systems, the characteristics of different models and controllers are different, resulting in the need for targeted testing solutions and parameter settings. During the traditional HIL testing process, separate test cases are required for each manufacturer's HIL platform. , resulting in waste of resources and inefficiency, how to improve the universality of test cases in different HIL platforms is an urgent problem.

Method used

By receiving test cases and HIL platform types, obtaining parameter variables, and calling the target conversion library in the preset script conversion library, converting the test cases into candidate test scripts, determining the signal source address based on the HIL platform types and parameter variables, and writing to the test In scripts, the universality of test scripts is realized.

Benefits of technology

This avoids the need for testers to write separate test cases for different HIL platforms, improves the universality of test cases on different HIL platforms, and improves the testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760615B_ABST
    Figure CN118760615B_ABST
Patent Text Reader

Abstract

The present application discloses a test script generation method, device, electronic device and storage medium, and relates to the technical field of script generation. The method comprises: receiving a test case and a HIL platform type, and obtaining parameter variables in the test case; calling a target conversion library in a preset script conversion library according to the HIL platform type, and converting the test case into a candidate test script through the target conversion library; determining a signal source address of the parameter variable based on the HIL platform type and the parameter variable, and writing the signal source address into the candidate test script to obtain a test script, wherein the signal source address is an address for generating a test signal in the HIL platform, thereby improving the versatility of the test case in HIL tests performed using different HIL platforms.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of script generation, and in particular to a test script generation method, device, electronic device and storage medium. Background Art

[0002] HIL (Hardware-in-the-Loop) testing plays a vital role in the development of automotive electronic controller systems. It can simulate controller behavior in real environments, detect potential problems in advance, and ensure system stability and performance. However, with the increase in vehicle models and controller types, the characteristics of various controllers in different vehicle models are different, requiring targeted test plans and parameter settings. However, the HIL platform resources used for HIL testing are limited, and HIL platforms from different manufacturers also have different test environments and parameter configurations. In the traditional HIL testing process, testers need to write separate test cases for each manufacturer's HIL platform based on the controller to be tested. This high degree of coupling means that if the HIL platform is replaced, the test cases need to be rewritten, which consumes a lot of testers' time and energy and is inefficient.

[0003] Therefore, how to improve the versatility of test cases in HIL tests using different HIL platforms is a problem that needs to be solved urgently. Summary of the invention

[0004] The main purpose of the present application is to provide a test script generation method, device, electronic device and storage medium, aiming to solve the technical problem of how to improve the versatility of test cases in HIL tests performed using different HIL platforms.

[0005] To achieve the above object, the present application proposes a test script generation method, which is applied to a test script generation system, wherein the system is used to generate a test script running in a hardware-in-the-loop (HIL) platform, and the method comprises:

[0006] Receiving a test case and a HIL platform type, and obtaining parameter variables in the test case;

[0007] Calling a target conversion library in a preset script conversion library according to the HIL platform type, and converting the test case into a candidate test script through the target conversion library;

[0008] Based on the HIL platform type and the parameter variable, a signal source address of the parameter variable is determined, and the signal source address is written into the candidate test script to obtain a test script, wherein the signal source address is an address for generating a test signal in the HIL platform.

[0009] In one embodiment, the test script generation system includes at least a variable mapping dictionary, wherein the variable mapping dictionary records a mapping relationship between a parameter variable and a signal source address, and the step of determining the signal source address of the parameter variable based on the HIL platform type and the parameter variable includes:

[0010] Determining a target parameter variable in the variable mapping dictionary based on the HIL platform type and the parameter variable;

[0011] The target parameter variable is mapped through the variable mapping dictionary to obtain a target signal source address corresponding to the target parameter variable, and the target signal source address is used as the signal source address of the parameter variable.

[0012] In one embodiment, the variable mapping dictionary further records a mapping relationship between a parameter variable, a HIL platform type, and a signal source address, and the step of determining a target parameter variable in the variable mapping dictionary based on the HIL platform type and the parameter variable comprises:

[0013] Determine a candidate range of the variable mapping dictionary based on the HIL platform type;

[0014] The target parameter variable is determined based on the parameter variable within the candidate range.

[0015] In one embodiment, the step of receiving a test case and a HIL platform type, and obtaining parameter variables in the test case includes:

[0016] Receiving a test case and a HIL platform type, wherein the data format of the HIL platform type is a configuration file format;

[0017] The signal type of the parameter variable in the test case, the read-write property of the parameter variable and the signal meaning of the parameter variable are obtained.

[0018] In one embodiment, the signal type includes at least any one of a hardware pin signal, a communication message signal, an A2L calibration signal, a model calculation signal and a test system environment variable, and the read-write attribute includes at least any one of a read attribute and a write attribute.

[0019] In one embodiment, the step of converting the test case into a candidate test script through the target conversion library includes:

[0020] Running a preset conversion code configured in the target conversion library, wherein the preset conversion code is developed based on the HIL platform type and is packaged in the form of a dynamic link library;

[0021] The test case is converted into a candidate test script by using the preset conversion code.

[0022] In one embodiment, the step of converting the test case into a candidate test script by using the preset conversion code includes:

[0023] Parsing the test case to obtain the test content of the test case, wherein the test content at least includes an input signal, an output signal, and an execution action;

[0024] The test content is converted into the candidate test script by using the preset conversion code.

[0025] In addition, to achieve the above-mentioned purpose, the present application also proposes a test script generation device, which is used to generate a test script running in a hardware-in-the-loop test HIL platform, and the test script generation device includes:

[0026] A receiving module, used for receiving an input test case and a HIL platform type, and obtaining parameter variables in the test case;

[0027] A conversion module, used for calling a target conversion library in a preset script conversion library according to the HIL platform type, and converting the test case into a candidate test script through the target conversion library;

[0028] The address module is used to determine the signal source address of the parameter variable based on the HIL platform type and the parameter variable, and write the signal source address into the candidate test script to obtain a test script, wherein the signal source address is the address of the test signal generated in the HIL platform.

[0029] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the test script generation method described above.

[0030] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the test script generation method described above are implemented.

[0031] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the test script generation method described above are implemented.

[0032] The present application proposes a test script generation method, which first receives an input test case and a HIL platform type, and obtains parameter variables in the test case to obtain a test case that needs to be script converted, and learns the HIL platform type on which the test script converted from the test case runs; calls a target conversion library in a preset script conversion library according to the HIL platform type, and converts the test case into a candidate test script through the target conversion library to convert the test case into a candidate test script that can run in the HIL platform; determines a signal source address of the parameter variable based on the HIL platform type and writes the signal source address into the candidate test script to obtain a test script, thereby providing a valid signal source address for the smooth running of the candidate test script in the HIL platform.

[0033] To summarize, the present application calls the script conversion library corresponding to the HIL platform type according to the HIL platform type used for HIL testing, converts the same test case into a test script that can be run under the HIL platform, and adds a signal source address to the test script, thereby avoiding the need for testers to write separate test cases for different HIL platforms, and improving the versatility of test cases in HIL tests using different HIL platforms. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0036] Figure 1 A flowchart of the first embodiment of the test script generation method of the present application is provided;

[0037] Figure 2 A flowchart of the second embodiment of the test script generation method of the present application is provided;

[0038] Figure 3 A schematic diagram of a scenario of a test script generation method provided in Embodiment 2 of the present application;

[0039] Figure 4 This is a schematic diagram of the module structure of the test script generating device according to an embodiment of the present application;

[0040] Figure 5This is a schematic diagram of the device structure of the hardware operating environment involved in the test script generation method in the embodiment of the present application.

[0041] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0042] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0043] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0044] The main solution of the embodiment of the present application is: receiving an input test case and a HIL platform type, and obtaining parameter variables in the test case; calling a target conversion library in a preset script conversion library according to the HIL platform type, and converting the test case into a candidate test script through the target conversion library; determining a signal source address of the parameter variable based on the HIL platform type and the parameter variable, and writing the signal source address into the candidate test script to obtain a test script, wherein the signal source address is the address of the test signal generated in the HIL platform.

[0045] In the traditional HIL testing process, testers need to write separate test cases for each manufacturer's HIL platform according to the controller to be tested. This high degree of coupling means that if the HIL platform is changed, the test cases need to be rewritten, which consumes a lot of testers' time and energy and is inefficient. Therefore, how to improve the versatility of test cases in HIL testing using different HIL platforms is a problem that needs to be solved urgently.

[0046] The present application provides a solution, which calls a script conversion library corresponding to the HIL platform type according to the HIL platform type used for HIL testing, converts the same test case into a test script that can be run under the HIL platform, and adds a signal source address to the test script, thereby avoiding the need for testers to write separate test cases for different HIL platforms, and improving the versatility of test cases in HIL tests using different HIL platforms.

[0047] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, etc. The following takes an electronic device as an example to illustrate this embodiment and the following embodiments.

[0048] Based on this, the present application embodiment provides a test script generation method, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the test script generation method of the present application.

[0049] In this embodiment, the test script generation method includes steps S10 to S30:

[0050] Step S10, receiving a test case and a HIL platform type, and obtaining parameter variables in the test case;

[0051] It should be noted that the test case refers to the text data written by the user for HIL testing, the HIL platform type refers to the type of HIL platform configured by the user to indicate the type of HIL platform used for HIL testing, and the parameter variable refers to the field named based on a unified rule in the test case.

[0052] It is understandable that, since the test script running in the HIL platform needs to know the address of the test signal generated in the HIL platform, performing step S10 provides an effective data basis for obtaining the address of the test signal generated in the HIL platform.

[0053] In a feasible implementation manner, the parameter variable consists of a signal type, a read / write attribute, and a signal meaning, and step S10 may include steps S11-S12:

[0054] Step S11, receiving a test case and a HIL platform type, wherein the data format of the HIL platform type is a configuration file format;

[0055] It is understandable that in the traditional HIL testing process, after replacing the HIL platform used for HIL testing, the tester needs to reconfigure the test environment according to the replaced HIL platform, so step S11 is performed. After replacing the HIL platform used for HIL testing, it is only necessary to change the configuration items in the configuration file of the HIL platform type, thereby avoiding the operation of reconfiguring the complex test environment and improving the efficiency of HIL testing.

[0056] Step S12, obtaining the signal type of the parameter variable in the test case, the read-write property of the parameter variable and the signal meaning of the parameter variable.

[0057] It should be noted that the signal type defines the representation and transmission method of the parameter variable, the read / write attribute describes whether the parameter variable can be read or written, and the signal meaning describes the specific meaning and purpose of the parameter variable.

[0058] In a feasible implementation manner, the signal type includes at least any one of a hardware pin signal, a communication message signal, an A2L calibration signal, a model calculation signal and a test system environment variable, and the read-write attribute includes at least any one of a read attribute and a write attribute.

[0059] It should be noted that the hardware pin signal refers to the signal transmitted through the physical hardware interface, the communication message signal refers to the data packet transmitted through the network or bus, the A2L calibration signal refers to the signal used to calibrate and configure the electronic control unit ECU, the model calculation signal refers to the signal generated by the simulation model, the test system environment variable refers to the variable defined in the HIL test environment, the read attribute is used to describe the parameter variable can be read in the HIL test, and the write attribute is used to describe the parameter variable can be written in the HIL test.

[0060] Step S12 may include steps S121 to S123:

[0061] Step S121, obtaining any one of a hardware pin signal of the parameter variable in the test case, a communication message signal of the parameter variable, an A2L calibration signal of the parameter variable, a model calculation signal of the parameter variable, and a test system environment variable of the parameter variable;

[0062] It is understandable that since the test script needs to know the type of signal that the parameter variables used in the test need to generate when running in the HIL platform, step S121 is performed to obtain the signal type in the test case, thereby providing effective signal type information for generating the test script.

[0063] Step S122, obtaining any one of a read attribute of the parameter variable and a write attribute of the parameter variable in the test case;

[0064] It is understandable that since the test script needs to know the type of read and write operations required for the parameter variables used in the test when running in the HIL platform, step S122 is performed to provide effective read and write attribute information for generating the test script by obtaining the read and write attributes in the test case.

[0065] Step S123, obtaining the meaning of the signal in the test case.

[0066] It is understandable that since the test script needs to know the specific operations to be performed on the parameter variables used in the test when running in the HIL platform, step S123 is performed to obtain the signal meaning in the test case, thereby providing effective signal meaning information for generating the test script.

[0067] In this implementation, by obtaining the signal type, read-write properties and signal meaning of the parameter variables in the test case, an effective data basis is provided for generating the test script.

[0068] Step S20, calling a target conversion library in a preset script conversion library according to the HIL platform type, and converting the test case into a candidate test script through the target conversion library;

[0069] It should be noted that the preset script conversion library refers to a plurality of script conversion libraries that are used to convert test cases into test scripts that can be run on a variety of different HIL platforms; the target conversion library refers to a test script that is used to convert test cases into test scripts that can be run on the HIL platform specified by the received HIL platform type; and the candidate test script refers to a test script that does not contain a signal source address.

[0070] In a feasible implementation manner, the test script generation system at least includes a variable mapping dictionary, in which the mapping relationship between parameter variables and signal source addresses is recorded. Step S20 may include steps S21-S22:

[0071] Step S21, determining a target parameter variable in the variable mapping dictionary based on the HIL platform type and the parameter variable;

[0072] It should be noted that the variable mapping dictionary refers to a mapping table that records the mapping relationship between multiple parameter variables and multiple signal source addresses, and the target parameter variable refers to the data corresponding to the parameter variable in the variable mapping dictionary.

[0073] In a feasible implementation manner, the variable mapping dictionary also records the mapping relationship between parameter variables, HIL platform types and signal source addresses, and step S21 may include steps S211-S212:

[0074] Step S211, determining a candidate range of the variable mapping dictionary based on the HIL platform type;

[0075] It should be noted that the range to be selected refers to the data range in the variable mapping dictionary that is consistent with the received HIL platform type.

[0076] It can be understood that, since there are mapping relationships in the variable mapping dictionary where the same parameter variable corresponds to different HIL platform types, step S211 is performed to improve the accuracy of determining the target data corresponding to the parameter variable in the variable mapping dictionary by determining the candidate range of the variable mapping dictionary.

[0077] Step S212: determining the target parameter variable based on the parameter variable within the candidate range.

[0078] In this implementation, by determining the target parameter variable corresponding to the parameter variable in the test case within the candidate range, an effective way is provided for determining accurate mapping data.

[0079] Step S22, mapping the target parameter variable through the variable mapping dictionary to obtain the target signal source address corresponding to the target parameter variable, and using the target signal source address as the signal source address of the parameter variable.

[0080] It should be noted that the target signal source address refers to the data in the variable mapping dictionary that has a mapping relationship with the target parameter variable.

[0081] In this implementation manner, the signal source address required by the test script is obtained through the created variable mapping dictionary, thereby providing valid signal source address data for generating a complete test script.

[0082] Step S30, based on the HIL platform type and the parameter variable, determine the signal source address of the parameter variable, and write the signal source address into the candidate test script to obtain a test script, wherein the signal source address is the address of the test signal generated in the HIL platform.

[0083] It should be noted that the test script refers to a program that can be executed in the HIL platform.

[0084] In this embodiment, according to the type of HIL platform used for HIL testing, the script conversion library corresponding to the HIL platform type is called to convert the same test case into a test script that can be run under the HIL platform, and the signal source address is added to the test script, thereby avoiding the need for testers to write separate test cases for different HIL platforms, thereby improving the versatility of test cases in HIL testing using different HIL platforms.

[0085] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 2 , Figure 2 This is a flow chart of the second embodiment of the test script generation method of the present application. The step of converting the test case into a candidate test script by using the target conversion library in step S20 may include steps S201-S202:

[0086] Step S201, running the preset conversion code configured in the target conversion library, wherein the preset conversion code is developed based on the HIL platform type and is packaged in the form of a dynamic link library;

[0087] It is understandable that since the preset conversion code in the target conversion library needs to be highly flexible and reusable, step S201 is performed to improve the system performance of running the preset conversion code by running the preset conversion code encapsulated by the dynamic link library in the target conversion library.

[0088] Step S202: converting the test case into a candidate test script by using the preset conversion code.

[0089] In a feasible implementation, step S202 may include steps S01-S02:

[0090] Step S01, parsing the test case to obtain the test content of the test case, wherein the test content at least includes an input signal, an output signal and an execution action;

[0091] It should be noted that the test content refers to the content of the HIL test required as recorded in the test case, the input signal refers to the external input applied to the controller under test during the HIL test, the output signal refers to the response generated by the controller under test after receiving the input signal, and the execution action refers to the specific action that the HIL platform needs to perform during the HIL test.

[0092] Step S02: converting the test content into the candidate test script through the preset conversion code.

[0093] In this implementation, the test content is obtained by parsing the test case, and the test content is converted by converting the code to obtain the test script, which provides an effective way to convert the test case into a candidate test script.

[0094] In this embodiment, the test case is converted into a candidate test script through the conversion code in the script conversion library, so that the same test case can be converted into a test script that can be run in the specified HIL platform.

[0095] For example, to help understand the implementation process of the test script generation method obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 3 , Figure 3 A scenario intention of a test script generation method is provided, specifically:

[0096] The received test case is input into the test script conversion unit in the script conversion tool chain. In the test script conversion unit, according to the platform configuration item, i.e., the received HIL platform type, the script conversion library corresponding to the platform configuration item is called to convert the test case to obtain a candidate test script. Based on the test case and the platform configuration item, the signal source path is determined through the variable mapping dictionary, and the signal source path is written into the candidate test script to obtain an automated test script, i.e., a test script.

[0097] Further, please refer to Table 1 below:

[0098]

[0099] Table 1

[0100] The variable mapping dictionary in Table 1 consists of three parts, namely, the variable name, i.e., the parameter variable, the Type field, i.e., the HIL platform type, and the model book path, i.e., the signal source path. The variable name in the variable mapping dictionary consists of three fields, including the signal type, the read / write attributes, and the abbreviation of the signal meaning. The signal types include hardware pin signals (HW), communication message signals (COMM), A2L calibration signals (CALI), model calculation signals (MDL), and test system environment variables (ENV). The read / write attributes include read attributes (RD) and write attributes (WT). The Type field is the abbreviation of each HIL platform. For example, the Type field corresponding to NI's VeriStand is (VS). Take serial number 1 as an example: variable number 1 in the variable mapping dictionary is HWWT_IDL_CDL_Lock_SW_WU, indicating the hardware output interface for controlling the central locking switch. The model tree path 1 corresponding to variable number 1 under the Type field (VS) in the variable mapping dictionary is Targets / Controller / Custom Devices / TB2810 / Output / DigitalOut / D05. This path 1 indicates that the parameter variable is a switch-type digital input signal for the controller to be tested, and the signal is simulated and sent by channel 5 of the digital output board TB2810 inside the HIL platform.

[0101] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the test script generation method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0102] This application also provides a test script generation device, please refer to Figure 4 , the device is used to generate a test script running in a hardware-in-the-loop HIL platform, and the test script generating device includes:

[0103] The receiving module 10 is used to receive the input test case and HIL platform type, and obtain the parameter variables in the test case;

[0104] A conversion module 20, configured to call a target conversion library in a preset script conversion library according to the HIL platform type, and convert the test case into a candidate test script through the target conversion library;

[0105] The address module 30 is used to determine the signal source address of the parameter variable based on the HIL platform type and the parameter variable, and write the signal source address into the candidate test script to obtain a test script, wherein the signal source address is the address of the test signal generated in the HIL platform.

[0106] Optionally, the test script generation system at least includes a variable mapping dictionary, in which a mapping relationship between parameter variables and signal source addresses is recorded, and the address module 30 is further used to:

[0107] Determining a target parameter variable in the variable mapping dictionary based on the HIL platform type and the parameter variable;

[0108] The target parameter variable is mapped through the variable mapping dictionary to obtain a target signal source address corresponding to the target parameter variable, and the target signal source address is used as the signal source address of the parameter variable.

[0109] Optionally, the variable mapping dictionary also records the mapping relationship between parameter variables, HIL platform types and signal source addresses, and the address module 30 is further used to:

[0110] Determine a candidate range of the variable mapping dictionary based on the HIL platform type;

[0111] The target parameter variable is determined based on the parameter variable within the candidate range.

[0112] Optionally, the parameter variable consists of a signal type, a read / write attribute, and a signal meaning, and the receiving module 10 is further used for:

[0113] Receiving a test case and a HIL platform type, wherein the data format of the HIL platform type is a configuration file format;

[0114] Obtain the signal type, the read / write properties, and the signal meaning in the test case.

[0115] Optionally, the signal type includes at least any one of a hardware pin signal, a communication message signal, an A2L calibration signal, a model calculation signal and a test system environment variable, and the read-write attribute includes at least any one of a read attribute and a write attribute.

[0116] Optionally, the conversion module 20 is further used for:

[0117] Running a preset conversion code configured in the target conversion library, wherein the preset conversion code is developed based on the HIL platform type and is packaged in the form of a dynamic link library;

[0118] The test case is converted into a candidate test script by using the preset conversion code.

[0119] Optionally, the conversion module 20 is further used for:

[0120] Parsing the test case to obtain the test content of the test case, wherein the test content at least includes an input signal, an output signal, and an execution action;

[0121] The test content is converted into the candidate test script by using the preset conversion code.

[0122] The test script generation device provided by the present application adopts the test script generation method in the above embodiment, which can solve the technical problem of how to improve the versatility of test cases in HIL tests using different HIL platforms. Compared with the prior art, the beneficial effects of the test script generation device provided by the present application are the same as the beneficial effects of the test script generation method provided by the above embodiment, and other technical features in the test script generation device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0123] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the test script generation method in the above-mentioned embodiment one.

[0124] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application. The electronic devices in the embodiments of the present application may include but are not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions: tablet computers), PMPs (Portable Media Players: portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0125] like Figure 5As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0126] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0127] The electronic device provided by the present application adopts the test script generation method in the above embodiment, which can solve the technical problem of how to improve the versatility of test cases in HIL tests using different HIL platforms. Compared with the prior art, the beneficial effects of the electronic device provided by the present application are the same as the beneficial effects of the test script generation method provided by the above embodiment, and the other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0128] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0129] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0130] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the test script generating method in the above-mentioned embodiment.

[0131] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0132] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0133] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by an electronic device, the electronic device: receives a test case and a HIL platform type, and obtains parameter variables in the test case; calls a target conversion library in a preset script conversion library according to the HIL platform type, and converts the test case into a candidate test script through the target conversion library; determines the signal source address of the parameter variable based on the HIL platform type and the parameter variable, and writes the signal source address into the candidate test script to obtain a test script, wherein the signal source address is the address of generating a test signal in the HIL platform.

[0134] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0135] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0136] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0137] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned test script generation method, and can solve the technical problem of how to improve the versatility of test cases in HIL tests using different HIL platforms. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the test script generation method provided in the above-mentioned embodiment, and will not be repeated here.

[0138] The present application also provides a computer program product, including a computer program, which implements the steps of the test script generation method as described above when executed by a processor.

[0139] The computer program product provided by the present application can solve the technical problem of how to improve the versatility of test cases in HIL tests using different HIL platforms. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the test script generation method provided by the above embodiment, which will not be repeated here.

[0140] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A test script generation method, characterized in that: Applied to a test script generation system, the system is used to generate a test script running in a hardware-in-the-loop (HIL) platform, the test script generation system at least includes a variable mapping dictionary, the variable mapping dictionary records the mapping relationship between parameter variables, HIL platform types and signal source addresses, the method includes: Receiving a test case and a HIL platform type, and obtaining parameter variables in the test case, wherein the data format of the HIL platform type is a configuration file format; Calling a target conversion library in a preset script conversion library according to the HIL platform type, and running a preset conversion code configured in the target conversion library, wherein the preset conversion code is developed based on the HIL platform type and is packaged in the form of a dynamic link library; Converting the test case into a candidate test script by using the preset conversion code; Determine a candidate range of the variable mapping dictionary based on the HIL platform type, and determine a target parameter variable within the candidate range based on the parameter variable, wherein the candidate range is a data range in the variable mapping dictionary corresponding to the HIL platform type; Mapping the target parameter variable through the variable mapping dictionary to obtain a target signal source address corresponding to the target parameter variable, and using the target signal source address as the signal source address of the parameter variable; Writing the signal source address into the candidate test script to obtain a test script, wherein the signal source address is an address for generating a test signal in the HIL platform; The step of converting the test case into a candidate test script by using the preset conversion code comprises: Parsing the test case to obtain the test content of the test case, wherein the test content at least includes an input signal, an output signal, and an execution action; The test content is converted into a candidate test script that can be run under the HIL platform corresponding to the HIL platform type through the preset conversion code.

2. The method according to claim 1, characterized in that The step of receiving a test case and a HIL platform type, and obtaining parameter variables in the test case includes: A test case and a HIL platform type are received, and a signal type of the parameter variable in the test case, a read-write property of the parameter variable, and a signal meaning of the parameter variable are obtained.

3. The method according to claim 2, characterized in that The signal type includes at least any one of a hardware pin signal, a communication message signal, an A2L calibration signal, a model calculation signal and a test system environment variable, and the read-write attribute includes at least any one of a read attribute and a write attribute.

4. A test script generating device, characterized in that: The device is used to generate a test script running in a hardware-in-the-loop test HIL platform. The device at least includes a variable mapping dictionary, and the variable mapping dictionary records the mapping relationship between parameter variables, HIL platform types and signal source addresses. The device includes: A receiving module, used for receiving an input test case and a HIL platform type, and obtaining parameter variables in the test case, wherein the data format of the HIL platform type is a configuration file format; A conversion module, used to call a target conversion library in a preset script conversion library according to the HIL platform type, and run a preset conversion code configured in the target conversion library, wherein the preset conversion code is developed based on the HIL platform type and is encapsulated in the form of a dynamic link library; convert the test case into a candidate test script through the preset conversion code; the step of converting the test case into a candidate test script through the preset conversion code comprises: parsing the test case to obtain the test content of the test case, wherein the test content at least includes an input signal, an output signal and an execution action; converting the test content into a candidate test script that can be run under the HIL platform corresponding to the HIL platform type through the preset conversion code; An address module is used to determine a candidate range of the variable mapping dictionary based on the HIL platform type, and determine a target parameter variable within the candidate range based on the parameter variable, wherein the candidate range is a data range corresponding to the HIL platform type in the variable mapping dictionary; map the target parameter variable through the variable mapping dictionary to obtain a target signal source address corresponding to the target parameter variable, and use the target signal source address as the signal source address of the parameter variable; write the signal source address into the candidate test script to obtain a test script, wherein the signal source address is an address for generating a test signal in the HIL platform.

5. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the test script generating method according to any one of claims 1 to 3.

6. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the test script generation method according to any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • HIL test method and device for CAN communication interface, and electronic equipment

    CN114201346A

  • Battery management system HIL automatic test method and system

    CN114546873A