Program testing method, device and equipment and computer medium

By using json file and function registration information in vehicle applications to obtain and fill the target parameter values, the problem of low program testing efficiency in C++ language is solved, and more efficient test coverage and flexible parameter adjustment are achieved.

CN120066950APending Publication Date: 2025-05-30NEUSOFT REACH AUTOMOBILE TECH (SHENYANG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411958025.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

During the development of on-board applications, when using C++ language for program testing, the efficiency of integration testing is low, it is difficult to cover all scenarios in vehicle states, and parameter adjustments are cumbersome.

Method used

By obtaining the target vehicle status, determining the corresponding target parameter value, and filling it into the json file, using the function registration information of the preset programming language and the content of the json file for testing, simplifying the program testing process.

Benefits of technology

It improves the efficiency and flexibility of program testing, and can quickly adjust parameters for testing in different vehicle states, covering more scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066950A_ABST
    Figure CN120066950A_ABST
Patent Text Reader

Abstract

The invention discloses a program testing method, device and equipment and a computer medium. The method comprises the steps of obtaining a current target vehicle state; determining a value of a corresponding target parameter based on the target vehicle state; filling the value of the target parameter into initial json file content corresponding to the target vehicle state to obtain target json file content corresponding to the target vehicle state; and testing a target program corresponding to the target vehicle state based on the function registration information of a programming language for a preset programming language and the target json file content. The test efficiency of testing the program can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of software testing, and particularly relates to a program testing method, device, equipment and computer medium. Background Art

[0002] In the related art, during the development of in-vehicle applications, the currently mainly used development language is the C++ language, which is an object-oriented language. A class can be defined, with different member variables and member functions in the class. The member functions can process different member variables. A class can call the member functions defined in the class by declaring an object. Classes can also reference each other. In the actual development process, although unit testing tools such as gtest can be used to test the functions of each class's member functions, in the integration test, in the scenario where classes are nested with each other and methods call each other, it is difficult to cover the actual test scenario in gtest. In the real vehicle environment, the vehicle has different vehicle states, and different programs need to be executed under different vehicle states. When testing the program, the gtest testing software is often not installed. When member functions call each other, there are some cascading scenarios where the parameters need to be continuously adjusted and then the program is compiled, resulting in troublesome testing of the program, and some scenarios are difficult to cover, and the testing efficiency of the program is relatively low. Summary of the Invention

[0003] The embodiments of this application provide an implementation scheme different from the prior art to solve the technical problem of relatively low testing efficiency for testing programs.

[0004] In a first aspect, this application provides a program testing method, including: obtaining the current target vehicle state; determining the value of the corresponding target parameter based on the target vehicle state; filling the value of the target parameter into the initial json file content corresponding to the target vehicle state to obtain the target json file content corresponding to the target vehicle state; testing the target program corresponding to the target vehicle state based on the function registration information with the preset programming language and the target json file content.

[0005] In a second aspect, this application provides a program testing device, including:

[0006] An obtaining unit, configured to obtain the current target vehicle state;

[0007] A determining unit, configured to determine the value of the corresponding target parameter based on the target vehicle state;

[0008] A filling unit, configured to fill the value of the target parameter into the content of the initial json file corresponding to the target vehicle state to obtain the content of the target json file corresponding to the target vehicle state; A testing unit, configured to test the target program corresponding to the target vehicle state based on the function registration information with a preset programming language and the content of the target json file.

[0009] In a third aspect, the present application provides an electronic device, including:

[0010] A processor; and

[0011] A memory, configured to store executable instructions of the processor;

[0012] Wherein, the processor is configured to execute any method in the first aspect or any possible implementation manner of the first aspect by executing the executable instructions.

[0013] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements any method in the first aspect or any possible implementation manner of the first aspect.

[0014] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements any method described in the first aspect or any possible implementation manner of the first aspect.

[0015] The program testing method provided by the present application includes: obtaining the current target vehicle state; determining the value of the corresponding target parameter based on the target vehicle state; filling the value of the target parameter into the content of the initial json file corresponding to the target vehicle state to obtain the content of the target json file corresponding to the target vehicle state; testing the target program corresponding to the target vehicle state based on the function registration information with a preset programming language and the content of the target json file. When testing the program triggered and executed by the vehicle in a certain vehicle state, only the corresponding json file content needs to be modified, and by using the pre-registered function registration information and the json file content, the corresponding program can be tested, improving the testing efficiency of the program. Description of the Drawings

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. In the drawings:

[0017] Figure 1 A schematic flowchart of a program testing method provided by an embodiment of the present application;

[0018] Figure 2 A schematic structural diagram of a program testing device provided by an embodiment of the present application;

[0019] Figure 3 A schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0020] The embodiments of the present application will be described in detail below. The examples of the embodiments are shown in the accompanying drawings. The embodiments described below by referring to the accompanying drawings are exemplary and are intended to explain the present application, and should not be construed as a limitation to the present application.

[0021] Terms such as "first" and "second" in the description, claims and drawings of the embodiments of the present application are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances, so that the embodiments of the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily need to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0022] First, some terms in the embodiments of the present application will be explained below to facilitate the understanding of those skilled in the art.

[0023] In programming, a class is a template or blueprint for defining the attributes and behaviors of an object. It is one of the core concepts of object-oriented programming (OOP), allowing developers to create objects with specific attributes and methods. A class consists of attributes and methods. Among them, attributes: also known as member variables or fields, which are used to store the state or data of an object. For example, a class representing a person may have attributes such as name, age, and gender. Methods: also known as member functions or behaviors. They define the operations or functions that an object can perform. For example, a class representing a person may have methods such as speaking, walking, and eating.

[0024] Member variables of a class, also known as attributes or fields, are variables defined inside the class. They are used to store the state or data of instances (i.e., objects) of the class. Member variables can be of any valid data type, including primitive data types (such as integers, floating-point numbers, characters, etc.) and user-defined data types (such as other classes or structures).

[0025] In object-oriented programming (OOP), member functions (simply called methods) in a class refer to functions or subroutines defined inside the class that describe the behavior of an object. Methods are one of the core components of a class and, together with member variables (or attributes), constitute the complete structure of the class. Methods define the operations or tasks that an object can perform.

[0026] A class can also include:

[0027] Constructor: A special method used to initialize the attributes of an object when creating the object.

[0028] Destructor: In some programming languages, it is used to perform cleanup operations when an object is destroyed.

[0029] In object-oriented programming (OOP), creating an object of a class usually involves the following steps:

[0030] Define the class:

[0031] First, you need to define a class. A class is a blueprint or template that describes the attributes and methods of an object. When defining a class, you specify the name of the class, its attributes (member variables), and methods (member functions).

[0032] Create an object:

[0033] Once the class is defined, you can create an object through the class's constructor (also known as the initialization method or constructor). The constructor is a special method that is automatically called when creating an object and is used to initialize the object's attributes.

[0034] Use the object:

[0035] After creating an object, you can access its attributes and methods through the object. This is usually achieved through the dot operator (.).

[0036] In programming, a static global variable is a special type of variable that combines the scope characteristics of a global variable and the lifetime characteristics of a static variable. Regarding the MakeTables you mentioned, assuming it is a function or procedure for creating or initializing a certain table structure, the static global variable may play a key role in this process.

[0037] A structure variable is created based on a structure type and is used to store specific data. The declaration and initialization of a structure variable can be carried out in the same way as other basic type variables.

[0038] In related technologies, during the development process of in-vehicle applications, the currently mainly used development language is C++. C++ is an object-oriented language. A class can be defined, which has different member variables and member functions. The member functions can process different member variables. An object can be declared for a class, and the member functions defined in the class can be called through the object. Classes can also reference each other. During the actual development process, although unit test tools such as gtest can be used to test the functions of the member functions of each class, in the case of integration testing, when classes are nested with each other and methods call each other, it is very difficult to cover the actual test scenarios in gtest. In a real vehicle environment, the vehicle will have different vehicle states, and different programs need to be executed under different vehicle states. When testing the program, the gtest test software is often not installed. When member functions call each other, there are some serial scenarios where parameters need to be continuously adjusted and then the program is compiled, resulting in troublesome testing of the program, some scenarios being difficult to cover, and low testing efficiency for the program.

[0039] The following will specifically describe the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems with specific embodiments. These several specific embodiments below can be combined with each other, and concepts or processes that are the same or similar may not be repeated in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.

[0040] Figure 1Schematic flowchart of a program testing method provided by an exemplary embodiment of the present application. Optionally, this method can be applied to any computer device, which can be a terminal or a server, etc. The terminal can be a tablet computer or a laptop computer. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery network (CDN), and big data and artificial intelligence platforms. Optionally, the method includes the following steps S101 - S104:

[0041] S101. Obtain the current target vehicle state;

[0042] Optionally, the target vehicle state may refer to the vehicle state of the vehicle for which the corresponding program to be tested is.

[0043] Optionally, the vehicle state is a comprehensive term used to describe various operating and physical conditions of the vehicle at a specific moment. The following is a detailed analysis of the vehicle state:

[0044] I. Basic state

[0045] Start and stop: Whether the vehicle has started or is in a stopped state.

[0046] Driving state: Whether the vehicle is in motion, or in a stationary, parked state, etc.

[0047] Location and direction: The current geographical location and driving direction of the vehicle.

[0048] II. Mechanical state

[0049] Engine state:

[0050] Operating condition: Whether the engine is operating normally, and whether there are abnormal phenomena such as abnormal noises and vibrations.

[0051] Temperature and pressure: Whether the temperature of the engine coolant, oil pressure, etc. are within the normal range.

[0052] Chassis and suspension:

[0053] Suspension system: Whether the suspension system is in good condition and whether the shock absorbers are effective.

[0054] Steering system: Whether the steering is flexible and whether the steering wheel has abnormal vibrations or offsets.

[0055] Braking system:

[0056] Braking performance: Whether the braking effect is good, and whether the brake pads and brake discs are severely worn.

[0057] Brake fluid: Whether the brake fluid is sufficient and whether there is any leakage.

[0058] III. Electrical status

[0059] Battery status:

[0060] Voltage and current: Whether the battery voltage and current are within the normal range and whether the battery is fully charged. Battery life: The service life of the battery and whether it needs to be replaced.

[0061] Circuit system:

[0062] Line connection: Whether the circuit connection is firm and whether there are any faults such as open circuits or short circuits.

[0063] Electrical components: Whether all electrical components are working properly, such as lights, horns, air conditioners, etc.

[0064] IV. Safety and fault status

[0065] Safety system:

[0066] Seat belt: Whether the seat belt is worn and whether it is damaged.

[0067] Airbag: Whether the airbag is intact and whether it can pop up normally when needed.

[0068] Fault indicator light:

[0069] Fault code: Whether there is a fault code and what the specific problem indicated by the fault code is.

[0070] Warning lights: Whether various warning lights (such as engine fault light, ABS fault light, etc.) are on.

[0071] V. Other status

[0072] Fuel status:

[0073] Fuel quantity: The remaining fuel quantity in the fuel tank.

[0074] Fuel economy: The fuel consumption of the vehicle and whether it is fuel-efficient.

[0075] Emission status:

[0076] Tail gas emission: Whether the vehicle's tail gas emission meets the environmental protection standards.

[0077] Emission system: Whether the emission system is intact and whether there is any leakage.

[0078] VI. Intelligent status (for modern intelligent vehicles)

[0079] Intelligent Driving Assistance System:

[0080] Adaptive Cruise Control: Whether the adaptive cruise control function is turned on and whether it is working properly.

[0081] Lane Keeping: Whether the lane keeping function is effective and whether the vehicle deviates from the lane.

[0082] Vehicle Internet of Things and Remote Monitoring:

[0083] Network Connection: Whether the vehicle is connected to the vehicle Internet of Things system properly.

[0084] Remote Monitoring: Whether it is possible to view vehicle status, location and other information through remote monitoring.

[0085] In summary, the vehicle status is a complex and comprehensive concept that covers multiple aspects and levels of the vehicle. For vehicle owners and maintenance personnel, understanding the vehicle status is of great significance for ensuring driving safety, detecting and solving problems in a timely manner.

[0086] The aforementioned target vehicle status is one of the multiple vehicle statuses that a vehicle can have.

[0087] S102. Determine the value of the corresponding target parameter based on the target vehicle status;

[0088] Specifically, the corresponding parameters can be different when the vehicle is in different vehicle statuses.

[0089] Optionally, the target parameter corresponding to the target vehicle status can refer to the parameter of the function in the program triggered when the vehicle status is the target vehicle status, and this function can be a member function in a class.

[0090] Optionally, the correspondence between the target vehicle status and the target parameter, and the correspondence between the value of the target parameter and the target parameter can be set in advance.

[0091] S103. Fill the value of the target parameter into the initial json file content corresponding to the target vehicle status to obtain the target json file content corresponding to the target vehicle status;

[0092] Wherein, the target json file content refers to the initial json file content filled with the value of the target parameter.

[0093] In some alternative embodiments of the present application, in S103, filling the value of the target parameter into the initial json file content corresponding to the target vehicle status includes the following S1031 - S1033:

[0094] S1031. Obtain the initial json file;

[0095] Optionally, the content of the JSON files corresponding to multiple vehicle states of the vehicle may be included in the same JSON file, and this JSON file may be the initial JSON file.

[0096] S1032. Query the content of the initial JSON file corresponding to the target vehicle state from the initial JSON file;

[0097] Among them, the content of the initial JSON file corresponding to the target vehicle state is a part of the content in the initial JSON file.

[0098] S1033. Fill the value of the target parameter into the content of the initial JSON file corresponding to the target vehicle state.

[0099] Filling the value of the target parameter into the content of the initial JSON file corresponding to the target vehicle state means: assigning the value of the target parameter to the target parameter in the content of the initial JSON file corresponding to the target vehicle state.

[0100] Optionally, the content of the initial JSON file corresponding to the target vehicle state refers to: the content of the JSON file corresponding to the program triggered when the vehicle state of the vehicle is the target vehicle state. Among them, the triggered program is the source program.

[0101] In some alternative embodiments of the present application, in the foregoing S103, filling the value of the target parameter into the content of the initial JSON file corresponding to the target vehicle state includes the following S31 - S32:

[0102] S31. Determine the initial JSON file corresponding to the target vehicle state from multiple JSON files;

[0103] Optionally, different vehicle states correspond to different initial JSON files, and the initial JSON file corresponding to the target vehicle state is one of the foregoing multiple JSON files.

[0104] S32. Fill the value of the target parameter into the content of the initial JSON file in the initial JSON file. Among them, the content of the initial JSON file here is the content in the initial JSON file.

[0105] Filling the value of the target parameter into the content of the initial JSON file corresponding to the target vehicle state means: assigning the value of the target parameter to the target parameter in the content of the initial JSON file corresponding to the target vehicle state.

[0106] S104. Test the target program corresponding to the target vehicle state based on the function registration information with the preset programming language and the content of the target JSON file.

[0107] In some alternative embodiments of the present application, the preset programming language is the C++ language.

[0108] In some alternative embodiments of the present application, in S104, testing the target program corresponding to the target vehicle state based on the function registration information with the preset programming language and the content of the target json file includes the following S1041 - S1043:

[0109] S1041. Determine the target registration information corresponding to the target vehicle state from the function registration information with the preset programming language.

[0110] In some alternative embodiments of the present application, the target registration information may refer to the registration information of the class, member variables under the class, and member functions in the program triggered to execute when the state of the vehicle is the target vehicle state.

[0111] S1042. Determine the parameter values of the parameters in the target registration function corresponding to the target vehicle state in the target registration information based on the content of the target json file, and obtain the target information corresponding to the target registration information.

[0112] Optionally, in the foregoing S1042, determining the parameter values of the parameters in the target registration function corresponding to the target vehicle state in the target registration information based on the content of the target json file includes the following steps S421 - S423:

[0113] S421. Determine the target registration function corresponding to the target function in the target registration information based on the target function corresponding to the target vehicle state in the content of the target json file.

[0114] S422. Query and obtain the parameter values of the parameters of the target function from the content of the target json file.

[0115] S423. Use the parameter values of the parameters of the target function as the parameter values of the parameters in the target registration function.

[0116] Among them, in the foregoing S423, during the process of assigning values to the parameters in the target registration function, the function name of the target function needs to be the same as the function name of the target registration function, and the corresponding parameter names are also the same.

[0117] When the number of parameters of the target function is multiple, the parameter values of each parameter of the target function can be assigned to the corresponding parameters. Optionally, the parameters of the target function and the parameters in the target registration function correspond one by one.

[0118] Optionally, the foregoing objective function may further include member variables. Correspondingly, the objective registration function is also a member variable. The parameter value of the parameter of the member variable refers to the value of the member variable. The parameter of the member variable refers to the member variable itself.

[0119] Optionally, when the objective registration function is a member function and / or a member variable under a certain class, the class name of the class where the objective registration function is located is the same as the class name of the class where the objective function is located in the content of the objective json file.

[0120] S1043. Test the target program corresponding to the target vehicle state based on the foregoing target information.

[0121] Among them, the target information refers to the target registration information in which the parameters in the included target registration function have been assigned values.

[0122] The target program corresponding to the foregoing target vehicle state is a partial source program among the source programs corresponding to multiple target vehicle states.

[0123] For each vehicle state, the source program corresponding to the vehicle state refers to the program triggered and executed by the vehicle in this vehicle state.

[0124] Optionally, the foregoing source program may be a program in an application installed in the ECU.

[0125] In some alternative embodiments of the present application, the method further includes the following steps S01-S03:

[0126] S01. Obtain the program to be tested, where the program to be tested includes source programs corresponding to multiple vehicle states;

[0127] S02. Obtain the function information to be registered in the program to be tested, where the function information to be registered includes at least one class, and member variables and member functions under each class in the at least one class;

[0128] S03. Register the function information to be registered to obtain the function registration information.

[0129] Optionally, the foregoing program to be tested is the same as the function information to be registered.

[0130] Optionally, the function information to be registered may be as follows:

[0131] static void Maketables(){

[0132] reflect::AddClass <classname1>("ClassName1")

[0133] .AddMemberVar("variables1", variables1)

[0134] .AddMemberFunc("function1", &ClassName1::function1(args...))

[0135] .AddMemberFunc("function2", &ClassName1::function2(args...));

[0136] reflect::AddClass <classname2>("ClassName2")

[0137] .AddMemberFunc("function1",&ClassName2::function1(args...))

[0138] .AddMemberFunc("function2",&ClassName2::function2(args...));

[0139] }

[0140] In some optional embodiments of the present application, in S03, registering the to-be-registered function information to obtain the function registration information includes the following S031 - S033:

[0141] S031. Registering the various classes into Maketables through the AddClass method;

[0142] S032. Registering the member variables of the various classes into Maketables through AddMemberVar;

[0143] S033. Registering the member functions of the various classes into Maketables through the AddMemberFunc method.

[0144] Optionally, in the static global variable Maketables, registering all the classes in the program to be tested into Maketables through the AddClass method, where the class name can be included in double quotes, and the class name in the double quotes needs to be consistent with the class name of the corresponding class in the initial json file;

[0145] Registering the member variables of the class into Maketables through AddMemberVar, and the name of the class member variable can be included in double quotes, and the name of the class member variable in the double quotes needs to be consistent with the name of the corresponding class member variable in the initial json file;

[0146] Registering the member functions (functions with function parameters) of the class into Maketables through the AddMemberFunc method, and the name of the class member function can be included in double quotes, and the name of the class member function in the double quotes needs to be consistent with the name of the corresponding class member function in the initial json file.

[0147] It should be noted that if the parameter of the member function in the class is a structure variable, then register this structure variable as a class without member functions in Maketables, and the class registration method can refer to the foregoing content.

[0148] Among them, the aforementioned initial JSON file contains the content of the JSON files corresponding to multiple vehicle states of the vehicle.

[0149] Optionally, the classes, member variables of the classes, and member functions in the class included in the initial JSON file can be configured and written into the initial JSON file by handwriting or through the configuration of the host computer. If the member variable or the parameter of the member function of a certain class is also a class or a structure (a structure is regarded as a class with only member variables), and it is required to assign a value to it, then it is required to define this class or structure in the JSON.

[0150] Optionally, in this solution, for multiple vehicle states to be tested, the classes, member variables of the classes, and member functions in the programs triggered and executed under each vehicle state can be written into the table Maketables, list the classes that need to run in the actual test, assign values to the member variables and member functions of the classes based on the content of the target JSON file, and list the member functions to be called and the input parameter values of the member functions.

[0151] Optionally, when the state of the test vehicle is the target vehicle state and triggering the class in the executed program, the class name of this class can be found from Maketables, construct an object of this class, and then read the values of the parameters under this class in the content of the target JSON file. Use the object constructed by the current class to call the member functions that need to run in the content of the target JSON file and execute them, so as to realize the test of the program triggered and executed when the state of the vehicle is the target vehicle state.

[0152] Optionally, when the state of the vehicle is the target vehicle state and the program triggered and executed includes multiple classes, the classes can be tested one by one until all classes are tested.

[0153] The solution of this application can be executed when the vehicle is actually used, or can be executed in the driving scenario of a simulated vehicle. In this regard, this application does not make a limit.

[0154] Through the solution of this application, when the vehicle states of the vehicle are different, or different member functions of different classes need to be run, only modify the parameter values of the vehicle state or the member functions of the classes that need to run in the JSON file, and then start the test of the corresponding program, then the program can be tested. In this application, only relying on the modification of the content in the JSON file, the programs corresponding to different vehicle states can be tested, which improves the test efficiency and increases the correctness of program verification.

[0155] Through function registration and JSON file configuration, this application can flexibly call the function methods of different classes and assign different parameter values in different environments, that is, different vehicle states, for different member functions of different classes, improving the flexibility of testing and increasing the correctness of program operation verification.

[0156] The program testing method provided by this application includes: obtaining the current target vehicle state; determining the value of the corresponding target parameter based on the target vehicle state; filling the value of the target parameter into the initial JSON file content corresponding to the target vehicle state to obtain the target JSON file content corresponding to the target vehicle state; testing the target program corresponding to the target vehicle state based on the function registration information with the preset programming language and the target JSON file content. When testing the program triggered by a vehicle in a certain vehicle state, only the corresponding JSON file content needs to be modified, and the corresponding program test can be realized by using the pre-registered function registration information and the JSON file content, improving the test efficiency of program testing.

[0157] Figure 2 It is a schematic structural diagram of a program testing device provided by an exemplary embodiment of this application; wherein, the device includes:

[0158] An acquisition unit 21, configured to acquire the current target vehicle state;

[0159] A determination unit 22, configured to determine the value of the corresponding target parameter based on the target vehicle state;

[0160] A filling unit 23, configured to fill the value of the target parameter into the initial JSON file content corresponding to the target vehicle state to obtain the target JSON file content corresponding to the target vehicle state;

[0161] A testing unit 24, configured to test the target program corresponding to the target vehicle state based on the function registration information with the preset programming language and the target JSON file content.

[0162] Optionally, when the foregoing device is used to fill the value of the target parameter into the initial JSON file content corresponding to the target vehicle state, it is specifically configured to:

[0163] Acquire the initial JSON file;

[0164] Query the initial JSON file content corresponding to the target vehicle state from the initial JSON file;

[0165] Fill the value of the target parameter into the initial JSON file content corresponding to the target vehicle state.

[0166] Optionally, when the foregoing device is used to fill the value of the target parameter into the initial JSON file content corresponding to the target vehicle state, it is specifically used for:

[0167] Determine the initial JSON file corresponding to the target vehicle state from multiple JSON files;

[0168] Fill the value of the target parameter into the initial JSON file content in the initial JSON file.

[0169] Optionally, when the foregoing device is used to test the target program corresponding to the target vehicle state based on the function registration information with a preset programming language and the target JSON file content, it is specifically used for:

[0170] Determine the target registration information corresponding to the target vehicle state from the function registration information with a preset programming language;

[0171] Based on the target JSON file content, determine the parameter values of the parameters in the target registration function corresponding to the target vehicle state in the target registration information, and obtain the target information corresponding to the target registration information;

[0172] Test the target program corresponding to the target vehicle state based on the target information.

[0173] Optionally, the foregoing device is further used for:

[0174] Obtain a program to be tested, where the program to be tested includes source programs corresponding to multiple vehicle states;

[0175] Obtain the function information to be registered in the program to be tested, where the function information to be registered includes at least one class, and member variables and member functions under each class in the at least one class;

[0176] Register the function information to be registered to obtain the function registration information.

[0177] Optionally, when the foregoing device is used to register the function information to be registered to obtain the function registration information, it is specifically used for:

[0178] Register the various classes into Maketables through the AddClass method;

[0179] Register the member variables of the various classes into Maketables through AddMemberVar;

[0180] Register the member functions of the various classes into Maketables through the AddMemberFunc method.

[0181] Optionally, the preset programming language is the C++ language.

[0182] It should be understood that the device embodiments and the method embodiments can correspond to each other, and similar descriptions can refer to the method embodiments. To avoid repetition, they will not be elaborated here. Specifically, the device can execute the above method embodiments, and the foregoing and other operations and / or functions of each module in the device respectively correspond to the corresponding processes in each method in the above method embodiments. For the sake of brevity, they will not be elaborated here.

[0183] The device of the embodiments of the present application has been described above from the perspective of functional modules. It should be understood that the functional modules can be implemented in the form of hardware, or in the form of instructions in software, or in a combination of hardware and software modules. Specifically, the steps of the method embodiments in the present application can be completed by the integrated logic circuit in the hardware in the processor and / or instructions in software. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps in the above method embodiments.

[0184] Figure 3 is a schematic block diagram of an electronic device provided by an embodiment of the present application. The electronic device may include:

[0185] A memory 301 and a processor 302. The memory 301 is used to store a computer program and transmit the program code to the processor 302. In other words, the processor 302 can call and run the computer program from the memory 301 to implement the method in the embodiments of the present application.

[0186] For example, the processor 302 can be used to execute the above method embodiments according to the instructions in the computer program.

[0187] In some embodiments of the present application, the processor 302 may include, but is not limited to:

[0188] General-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like.

[0189] In some embodiments of the present application, the memory 301 includes, but is not limited to:

[0190] Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synch link DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0191] In some embodiments of the present application, the computer program can be divided into one or more modules, and the one or more modules are stored in the memory 301 and executed by the processor 302 to complete the method provided by the present application. The one or more modules can be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device.

[0192] As Figure 3 shown, the electronic device may further include:

[0193] A transceiver 303, which can be connected to the processor 302 or the memory 301.

[0194] Among them, the processor 302 can control the transceiver 303 to communicate with other devices. Specifically, it can send information or data to other devices, or receive information or data sent by other devices. The transceiver 303 can include a transmitter and a receiver. The transceiver 303 can further include an antenna, and the number of antennas can be one or more.

[0195] It should be understood that each component in the electronic device is connected through a bus system. Among them, the bus system includes, in addition to the data bus, a power bus, a control bus, and a status signal bus.

[0196] This application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a computer, the computer can execute the methods in the above method embodiments. Or rather, this application embodiment also provides a computer program product containing instructions. When the instructions are executed by a computer, the computer executes the methods in the above method embodiments.

[0197] When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of this application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from a website, a computer, a server, or a data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access or a data storage device such as a server or a data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital video disc (DVD)), or a semiconductor medium (such as a solid state disk (SSD)).

[0198] Those of ordinary skill in the art will realize that the modules and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A professional technician can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of this application.

[0199] In several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the devices or modules can be in an electrical, mechanical, or other form.

[0200] The modules described as separate components may or may not be physically separated. The components shown as modules may or may not be physical modules, that is, they can be located in one place, or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. For example, in each embodiment of this application, the functional modules can be integrated into one processing module, or each module can exist physically alone, or two or more modules can be integrated into one module.

[0201] The above is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed in this application can easily think of changes or substitutions, which should all be covered within the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims

1. A program testing method, characterized in that: include: Get the current target vehicle status; Determining a value of a corresponding target parameter based on the target vehicle state; Fill the value of the target parameter into the initial json file content corresponding to the target vehicle state to obtain the target json file content corresponding to the target vehicle state; The target program corresponding to the target vehicle state is tested based on the function registration information of the preset programming language and the target json file content.

2. The method according to claim 1, characterized in that Fill the value of the target parameter into the initial json file content corresponding to the target vehicle state, including: Get the initial json file; From the initial json file, query the initial json file content corresponding to the target vehicle state; Fill the value of the target parameter into the initial json file content corresponding to the target vehicle state.

3. The method according to claim 1, characterized in that Fill the value of the target parameter into the initial json file content corresponding to the target vehicle state, including: Determine an initial json file corresponding to the target vehicle state from multiple json files; Fill the value of the target parameter into the initial JSON file content in the initial JSON file.

4. The method according to claim 1, characterized in that: Testing the target program corresponding to the target vehicle state based on the function registration information of the preset programming language and the target json file content, including: Determine the target registration information corresponding to the target vehicle state from the function registration information whose programming language is a preset programming language; Determine the parameter value of the parameter in the target registration function corresponding to the target vehicle state in the target registration information based on the target json file content, and obtain the target information corresponding to the target registration information; A target program corresponding to the target vehicle state is tested based on the target information.

5. The method according to claim 1, characterized in that The method further comprises: Acquire a program to be tested, wherein the program to be tested includes source programs corresponding to a plurality of vehicle states; Acquire information of functions to be registered in the program to be tested, wherein the information of functions to be registered includes at least one class, and member variables and member functions under each class in the at least one class; Register the function information to be registered to obtain the function registration information.

6. The method according to claim 5, characterized in that Registering the function information to be registered to obtain the function registration information includes: Register the above classes to Maketables through AddClass method; Register the member variables of each class to Maketables through AddMemberVar; The member functions of each class are registered in Maketables through the AddMemberFunc method.

7. The method according to claim 1, characterized in that The preset programming language is C++.

8. A program testing device, characterized in that: include: An acquisition unit, used to acquire the current state of the target vehicle; a determination unit, configured to determine a value of a corresponding target parameter based on the target vehicle state; A filling unit, used to fill the value of the target parameter into the initial json file content corresponding to the target vehicle state, to obtain the target json file content corresponding to the target vehicle state; A testing unit is used to test a target program corresponding to the target vehicle state based on function registration information of a preset programming language and the target json file content.

9. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 7 by executing the executable instructions.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.