Vehicle testing method and device, vehicle, electronic equipment and storage medium
Through mutation processing and automated execution of test cases, the time-consuming and labor-intensive problem of manually writing test cases in vehicle micro-control unit software testing is solved, automatic generation and automatic optimization of test cases are realized, improving testing efficiency and reducing costs.
Patent Information
- Application Number
- CN202310200189.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-28
- Publication Date
- 2024-08-30
AI Technical Summary
In the existing technology, vehicle-mounted microcontrol unit software testing requires manual writing of a large number of test cases, resulting in high manpower and time costs.
By obtaining target test cases from the preset storage path, performing mutation processing, generating mutation test cases, and executing them in the micro-control unit, detecting abnormal data and code coverage, automatically optimizing test cases, and realizing automatic generation and automation of test cases.
It improves the testing efficiency of microcontroller chips, reduces labor costs, and realizes the automation and optimization of test cases.
Smart Images

Figure CN118567321A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of vehicle technology, and in particular to a vehicle testing method, device, vehicle, electronic equipment and storage medium. Background Art
[0002] With the development of vehicle technology, microcontroller units (MCUs) are increasingly used in vehicles. Whether it is turning on or off wipers and windows, adjusting seats, or in-vehicle entertainment or assisted driving, MCUs are indispensable. Therefore, in order to ensure the safety of drivers and passengers, it is necessary to test the MCU software and eliminate faults in a timely manner.
[0003] At present, in the testing of vehicle-mounted microcontroller unit software, it is usually necessary to manually write a large number of test cases, and judge the execution effect of the test cases by observing the program execution results or collecting code coverage information, and constantly adjust the test cases manually or add new test cases based on the test results.
[0004] Although the above method can realize the testing of the vehicle-mounted micro control unit software, this method requires manual writing of a large number of test cases, which will consume a lot of manpower and time costs. Summary of the invention
[0005] The present disclosure provides a vehicle testing method, device, vehicle, electronic device and storage medium, the main purpose of which is to realize automatic generation of test cases in the testing of vehicle-mounted micro control unit software.
[0006] According to a first aspect of the present disclosure, a vehicle testing method is provided, comprising:
[0007] Obtain target test cases from a preset storage path in order, and perform mutation processing on the target test cases to obtain at least one mutated test case;
[0008] Selecting a mutation test case from the at least one mutation test case, inputting it into the vehicle micro control unit and executing the mutation test case;
[0009] Detecting whether abnormal data occurs during the execution of the variation test case by the microcontroller unit;
[0010] If it is determined that no abnormal data occurs during the execution of the mutation test case by the microcontroller, determining whether there is untested code in the code path covered by the mutation test case;
[0011] If it is determined that the untested code exists in the code path covered by the mutation test case, the mutation test case is stored in the preset storage path in sequence as a target test case, and the vehicle test steps are continued.
[0012] Optionally, determining whether there is untested code in the code path covered by the mutation test case includes:
[0013] Calling a preset tracking function to obtain tracking data for executing the mutation test case;
[0014] Parsing the tracking data to obtain the code path covered by the mutation test case;
[0015] Determine whether there is untested code in the code path covered by the mutation test case.
[0016] Optionally, before storing the variant test cases as target test cases in sequence in the preset storage path, the method includes:
[0017] Analyze the code paths covered by each variant test case and generate code coverage data;
[0018] Determine whether the code coverage data meets a test termination condition, wherein the test termination condition is that the code coverage data meets a preset threshold or no longer changes;
[0019] If the test end condition is met, the test on the vehicle micro control unit is ended.
[0020] Optionally, storing the variant test cases as target test cases in sequence in the preset storage path includes:
[0021] If the test end condition is not met, the variant test case is stored in the preset storage path in sequence as a target test case.
[0022] Optionally, the method comprises:
[0023] If it is determined that abnormal data occurs during the execution of the variation test case by the microcontroller, the current execution data of the variation test case is saved and the test of the vehicle microcontroller unit is stopped, wherein the current execution data includes at least one of the variation test case and execution path information.
[0024] Optionally, the method comprises:
[0025] If it is determined that the untested code does not exist in the code path covered by the mutation test case, the mutation test case is discarded.
[0026] Optionally, before sequentially acquiring the target test cases from the preset storage path, the method includes:
[0027] A tracing address range of the preset tracing function is set in the vehicle micro control unit, and the tracing address range is determined according to a test range of the vehicle micro control unit.
[0028] According to a second aspect of the present disclosure, there is provided a vehicle testing device, comprising:
[0029] An acquisition unit, used for sequentially acquiring target test cases from a preset storage path;
[0030] A processing unit, configured to perform mutation processing on the target test case to obtain at least one mutated test case;
[0031] A selection unit, configured to select a mutation test case from the at least one mutation test case, input the mutation test case into the vehicle micro control unit, and execute the mutation test case;
[0032] A detection unit, used to detect whether abnormal data appears during the execution of the variation test case by the microcontroller unit;
[0033] A first determining unit is used to determine whether there is untested code in the code path covered by the mutation test case when it is determined that no abnormal data occurs during the execution of the mutation test case by the micro control unit;
[0034] An input unit, configured to store the mutation test case as a target test case in the preset storage path in order when it is determined that the untested code exists in the code path covered by the mutation test case;
[0035] The execution unit is used to continue executing the vehicle test steps according to the storage order under the preset storage path after the variant test case is determined as the target test case.
[0036] Optionally, the first determining unit includes:
[0037] An acquisition module, used to acquire the code path covered by the mutation test case;
[0038] The determination module is used to determine whether there is untested code in the code path covered by the mutation test case.
[0039] Optionally, the device comprises:
[0040] A generating unit, configured to parse the code paths covered by each variant test case and generate code coverage data before the input unit sequentially stores the variant test case as a target test case in the preset storage path;
[0041] A judging unit, used to judge whether the code coverage data satisfies a test termination condition, wherein the test termination condition is that the code coverage data satisfies a preset threshold or no longer changes;
[0042] The test ending unit is used to end the test on the vehicle micro control unit when the test ending condition is met.
[0043] Optionally, the input unit is also used to:
[0044] When the test end condition is not met, the variant test cases are stored in the preset storage path in sequence as target test cases.
[0045] Optionally, the device comprises:
[0046] A stop unit is used to save current execution data of the variant test case and stop testing the vehicle micro control unit when it is determined that abnormal data occurs during the execution of the variant test case by the micro control unit, wherein the current execution data includes at least one of the variant test case and execution path information.
[0047] Optionally, the device comprises:
[0048] The second determining unit is configured to discard the mutation test case when it is determined that the untested code does not exist in the code path covered by the mutation test case.
[0049] Optionally, the acquisition module includes:
[0050] A first acquisition submodule is used to call a preset tracking function to obtain the tracking data of executing the mutation test case;
[0051] The second acquisition submodule is used to parse the tracking data and obtain the code path covered by the mutation test case.
[0052] Optionally, the device comprises:
[0053] The setting unit is used to set the tracking address range of the preset tracking function in the vehicle micro control unit before the acquisition unit sequentially acquires the target test case from the preset storage path, and the tracking address range is determined according to the test range of the vehicle micro control unit.
[0054] Optionally, the end test unit includes:
[0055] The code coverage data is greater than or equal to a preset code coverage threshold, or the code coverage data does not change in a preset number of tests.
[0056] According to a third aspect of the present disclosure, a vehicle is provided, comprising the vehicle testing device according to the second aspect.
[0057] According to a fourth aspect of the present disclosure, there is provided an electronic device, including:
[0058] at least one processor; and
[0059] a memory communicatively connected to the at least one processor; wherein,
[0060] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.
[0061] According to a fifth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect.
[0062] According to a sixth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0063] The vehicle testing method, device, vehicle, electronic device and storage medium provided by the present disclosure mainly include: obtaining target test cases in sequence from a preset storage path, and performing mutation processing on the target test cases to obtain at least one mutation test case; selecting a mutation test case from the at least one mutation test case and inputting it into a vehicle microcontroller unit; detecting whether abnormal data appears in the process of the microcontroller unit executing the mutation test case; if no abnormal data appears in the process of the microcontroller unit executing the mutation test case, determining whether there is untested code in the code path covered by the mutation test case; if it is determined that the untested code exists in the code path covered by the mutation test case, if it is determined that the untested code exists in the code path covered by the mutation test case, the mutation test case is stored in the preset storage path as a target test case in sequence, and the vehicle testing steps are continued. Compared with the related art, the embodiment of the present application mutates the test cases, inputs the mutated test cases into the microcontroller unit for testing, inputs the mutated test cases that cover the untested code into a preset storage path, mutates again according to the mutated test cases, and executes the test for the microcontroller unit based on the mutated test cases obtained by the further mutation, thereby realizing automatic generation and automatic optimization of test cases, improving the testing efficiency of the microcontroller chip, and reducing labor costs.
[0064] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0066] Figure 1 A schematic diagram of a flow chart of a vehicle testing method provided by an embodiment of the present disclosure;
[0067] Figure 2 A flowchart of a method for obtaining code paths covered by the variant test cases provided by an embodiment of the present disclosure;
[0068] Figure 3 A flowchart of a method for determining whether a condition for ending a test is met provided by an embodiment of the present disclosure;
[0069] Figure 4 A schematic diagram of the structure of a vehicle testing device provided in an embodiment of the present disclosure;
[0070] Figure 5 A schematic diagram of the structure of another vehicle testing device provided by an embodiment of the present disclosure;
[0071] Figure 6 A schematic block diagram of an exemplary electronic device provided for an embodiment of the present disclosure. DETAILED DESCRIPTION
[0072] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0073] The following describes a vehicle testing method, an apparatus, a vehicle, an electronic device, and a storage medium according to embodiments of the present disclosure with reference to the accompanying drawings.
[0074] Figure 1 A schematic flow chart of a vehicle testing method provided in an embodiment of the present disclosure.
[0075] like Figure 1 As shown, the method comprises the following steps:
[0076] Step 101, obtaining target test cases from a preset storage path in order, and performing mutation processing on the target test cases to obtain at least one mutated test case.
[0077] Before executing this step, a certain number of test cases are first manually edited and stored in a preset storage path. When the vehicle test is executed, a test case is extracted from the preset storage path as the target test case. For example, 10 or 15 test cases can be edited, etc., which is not limited to this embodiment of the present application.
[0078] When mutating the target test case, different mutation strategies and methods can be determined according to different business scenarios, such as bit flipping or byte flipping, etc., which can be determined according to needs. The embodiments of the present application do not limit the mutation strategies and mutation methods of the test case.
[0079] Step 102 : Select a mutation test case from the at least one mutation test case, input it into the vehicle micro control unit, and execute the mutation test case.
[0080] When selecting mutation test cases, they may be selected in the order in which the mutations occur, or they may be selected randomly, which is not limited in the embodiments of the present application.
[0081] Step 103, detecting whether abnormal data occurs during the execution of the variation test case by the microcontroller unit.
[0082] Abnormal data includes abnormal operation conditions such as program deadlock, automatic power-off of the microcontroller unit, etc., which are not limited in the embodiments of the present application.
[0083] Step 104: If it is determined that no abnormal data occurs during the execution of the mutation test case by the microcontroller, it is determined whether there is untested code in the code path covered by the mutation test case.
[0084] When testing a microcontroller unit, the test must be as comprehensive as possible and able to test all the code to prevent the possibility of anomalies in untested code, which may pose a safety hazard to the vehicle. Therefore, after the execution of the mutation test case is completed and no anomalies occur in the vehicle's microcontroller unit, the operation of the microcontroller unit is paused, the code path generated by the current mutation test case is collected, and it is detected whether there is untested code in the code path. It should be noted that since the mutation test case is obtained by random mutation, there may be a situation where there is no untested code in the code path covered by the mutation test case.
[0085] Step 105: If it is determined that the untested code exists in the code path covered by the variant test case, the variant test case is stored in the preset storage path in sequence as a target test case, and after the variant test case is determined as a target test case, the vehicle test steps are continued to be executed according to the storage order in the preset storage path.
[0086] When it is determined that there is untested code in the code path covered by the mutation test case, it means that this mutation test case is a valid mutation. If mutation is performed again on the basis of this mutation test case, the possibility that there is untested code in the code path covered by the obtained sub-mutation test case is relatively high. Therefore, for the mutation test case with untested code in the covered code path, it is re-entered into the preset storage path, and the mutation is performed in the order of storage, and the vehicle is tested. It should be noted that a target test case in the preset storage path may obtain multiple mutation test cases after mutation processing. After the vehicle is tested with multiple mutation test cases, a target test case is selected in the preset storage path according to the storage order to mutate again, and the test of the vehicle continues.
[0087] The vehicle testing method provided by the present disclosure includes the following main technical solutions: obtaining target test cases in sequence from a preset storage path, and performing mutation processing on the target test cases to obtain at least one mutation test case; selecting a mutation test case from the at least one mutation test case and inputting it into a vehicle microcontroller unit; detecting whether abnormal data appears in the process of the microcontroller unit executing the mutation test case; if abnormal data does not appear in the process of the microcontroller unit executing the mutation test case, determining whether there is untested code in the code path covered by the mutation test case; if it is determined that there is untested code in the code path covered by the mutation test case, storing the mutation test case as the target test case in sequence under the preset storage path, and continuing to execute the vehicle test steps. Compared with the related art, the embodiment of the present application performs mutation processing on the test case, inputs the mutation test case obtained by mutation into the microcontroller unit for testing, and inputs the mutation test case covering the untested code into the preset storage path, mutates again according to the mutation test case, and performs the test on the microcontroller unit based on the mutation test case obtained by the mutation, thereby realizing the automatic generation and automatic optimization of the test case, improving the test efficiency of the microcontroller chip, and reducing the labor cost.
[0088] In one implementable method of the embodiment of the present application, when it is determined that the untested code does not exist in the code path covered by the mutation test case, the mutation test case is discarded; when there is no untested code in the code path covered by the mutation test case, if a mutation is performed on the basis of this mutation test case, the code path covered by the mutated sub-mutation test case may not contain untested code, and therefore this part of the mutation test case is discarded.
[0089] In one implementable method of the embodiment of the present application, when abnormal data occurs during the execution of the mutation test case by the microcontroller unit, the current execution data of the mutation test case is saved, and the test of the vehicle microcontroller unit is stopped, wherein the current execution data includes at least one of the mutation test case and execution path information; the data at the time of the error is saved for stack backtracing during manual review, and the error code or logic is corrected.
[0090] In one possible implementation of the embodiment of the present application, when determining whether there is untested code in the code path covered by the mutation test case, firstly, the code path covered by the mutation test case is obtained; see Figure 2 , Figure 2 A flowchart of a method for obtaining code paths covered by the variant test cases provided in an embodiment of the present application includes:
[0091] Step 201, calling a preset tracking function to obtain tracking data of executing the mutation test case.
[0092] When executing data tracking of mutation test cases, tracking can be performed according to methods such as Trace. In the embodiment of the present application, the preset tracking function is Trace as an example for explanation, but this description method is not limited to a specific preset tracking function.
[0093] Step 202: Obtain the code path covered by the mutation test case.
[0094] By parsing the trace data collected by Trace, you can obtain the code paths covered by the mutation test cases.
[0095] In one implementable method of an embodiment of the present application, when collecting path information of a variant test case through Trace, if the complete path information is collected, the amount of data will be too large, thereby affecting the test speed. Therefore, when testing a vehicle, for the code data in the microcontroller unit to be tested, a tracing address range of the preset tracing function in the vehicle microcontroller unit is set, and the tracing address range is determined according to the test range of the vehicle microcontroller unit; that is, only the code path within the tracing address range is recorded through Trace.
[0096] Before inputting the mutation test case into the preset storage path, it is necessary to determine whether the condition for ending the vehicle test is met at this time according to the code test situation of the microcontroller unit; please refer to Figure 3 , Figure 3 A flowchart of a method for determining whether a condition for ending a test is met is provided in an embodiment of the present application, including:
[0097] Step 301, parse the code paths covered by each variant test case to generate code coverage data.
[0098] The code coverage data is a metric that describes the degree of testing of the micro-control unit, that is, the ratio of the tested code path to all code paths. For the specific method of calculating the code coverage data, please refer to any implementation method in the prior art, and the embodiments of this application will not be described one by one here.
[0099] Step 302, determining whether the code coverage data satisfies a test termination condition, wherein the test termination condition is that the code coverage data satisfies a preset threshold or no longer changes.
[0100] The test end conditions include: the code coverage data is greater than or equal to a preset code coverage threshold, or the code coverage data does not change in a preset number of tests.
[0101] Since the test cases are randomly mutated during mutation processing, their mutation direction is uncontrollable, and some code paths may not be tested. Therefore, in actual applications, the code coverage threshold can be set to 70% or 80%. The specific setting can be based on actual needs, and the embodiments of the present application do not limit this.
[0102] When the code coverage rate has not been improved in multiple rounds of testing, it means that the current code coverage rate is good enough; to prevent errors caused by the variation direction of a single test case, the preset number of times can be set slightly larger, for example, it can be set to 20 times or 25 times. The embodiment of the present application does not limit the preset number of times.
[0103] Step 303: If the test end condition is met, then the test on the vehicle micro control unit is ended.
[0104] Step 304: If the test end condition is not met, the mutated test case is stored in the preset storage path in sequence as a target test case.
[0105] After confirming that the test end condition is not met, the mutated test cases covering the untested code are input into a preset storage path, and the vehicle micro control unit is continuously tested based on the test cases in the storage path.
[0106] Corresponding to the above-mentioned vehicle testing method, the present invention also provides a vehicle testing device. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment, and will not be repeated in the present invention.
[0107] Figure 4 A schematic diagram of the structure of a vehicle testing device provided by an embodiment of the present disclosure is shown in FIG. Figure 4 As shown, including:
[0108] An acquisition unit 41 is used to sequentially acquire target test cases from a preset storage path;
[0109] A processing unit 42 is used to perform mutation processing on the target test case to obtain at least one mutated test case;
[0110] A selection unit 43, configured to select a variation test case from the at least one variation test case, input the variation test case into the vehicle micro control unit, and execute the variation test case;
[0111] A detection unit 44, used to detect whether abnormal data appears during the execution of the variation test case by the micro control unit;
[0112] A first determining unit 45 is used to determine whether there is untested code in the code path covered by the mutation test case when no abnormal data appears during the execution of the mutation test case by the micro control unit;
[0113] An input unit 46, configured to store the mutation test case as a target test case in the preset storage path in order when it is determined that the untested code exists in the code path covered by the mutation test case;
[0114] The execution unit 47 is used to continue executing the vehicle test steps according to the storage order under the preset storage path after determining that the variant test case is determined to be the target test case.
[0115] The vehicle testing device provided by the present disclosure has a main technical scheme including: obtaining target test cases in sequence from a preset storage path, and performing mutation processing on the target test cases to obtain at least one mutation test case; selecting a mutation test case from the at least one mutation test case and inputting it into a vehicle microcontroller unit; detecting whether abnormal data appears in the process of the microcontroller unit executing the mutation test case; if abnormal data does not appear in the process of the microcontroller unit executing the mutation test case, determining whether there is untested code in the code path covered by the mutation test case; if it is determined that there is untested code in the code path covered by the mutation test case, storing the mutation test case as the target test case in sequence under the preset storage path, and continuing to execute the vehicle test steps. Compared with the related art, the embodiment of the present application performs mutation processing on the test case, inputs the mutation test case obtained by mutation into the microcontroller unit for testing, and inputs the mutation test case covering the untested code into the preset storage path, mutates again according to the mutation test case, and performs the test on the microcontroller unit based on the mutation test case obtained by the mutation, thereby realizing the automatic generation and automatic optimization of the test case, improving the test efficiency of the microcontroller chip, and reducing the labor cost.
[0116] Furthermore, in a possible implementation of this embodiment, as Figure 5 As shown, the first determining unit 45 includes:
[0117] An acquisition module 451 is used to acquire the code path covered by the mutation test case;
[0118] The determination module 452 is used to determine whether there is untested code in the code path covered by the mutation test case.
[0119] Furthermore, in a possible implementation of this embodiment, as Figure 5 As shown, the device comprises:
[0120] A generating unit 48, configured to parse the code paths covered by each variant test case and generate code coverage data before the input unit 46 stores the variant test case as a target test case in sequence in the preset storage path;
[0121] A judging unit 49, configured to judge whether the code coverage data satisfies a test termination condition, wherein the test termination condition is that the code coverage data satisfies a preset threshold or no longer changes, wherein the condition of satisfying the preset threshold includes being greater than or equal to a preset code coverage threshold;
[0122] The test ending unit 410 is used to end the test on the vehicle micro control unit when the test ending condition is met.
[0123] Furthermore, in a possible implementation of this embodiment, as Figure 5 As shown, the input unit 46 is also used for:
[0124] When the test end condition is not met, the variant test cases are stored in the preset storage path in sequence as target test cases.
[0125] Furthermore, in a possible implementation of this embodiment, as Figure 5 As shown, the device comprises:
[0126] The stopping unit 411 is used to save the current execution data of the variant test case and stop the test of the vehicle micro control unit when it is determined that abnormal data occurs during the execution of the variant test case by the micro control unit, wherein the current execution data includes at least one of the variant test case and execution path information.
[0127] Furthermore, in a possible implementation of this embodiment, as Figure 5 As shown, the device comprises:
[0128] The second determining unit 412 is configured to discard the mutation test case when it is determined that the untested code does not exist in the code path covered by the mutation test case.
[0129] Furthermore, in a possible implementation of this embodiment, as Figure 5 As shown, the acquisition module 451 includes:
[0130] The first acquisition submodule 4511 is used to call a preset tracking function to obtain the tracking data of executing the mutation test case;
[0131] The second acquisition submodule 4512 is used to parse the tracking data and obtain the code path covered by the mutation test case.
[0132] Furthermore, in a possible implementation of this embodiment, as Figure 5 As shown, the device comprises:
[0133] The setting unit 413 is used to set the tracking address range of the preset tracking function in the vehicle micro control unit before the acquisition unit 41 sequentially acquires the target test case from the preset storage path, and the tracking address range is determined according to the test range of the vehicle micro control unit.
[0134] Furthermore, in a possible implementation of this embodiment, the end test unit 410 includes:
[0135] The code coverage data is greater than or equal to a preset code coverage threshold, or the code coverage data does not change in a preset number of tests.
[0136] It should be noted that the above explanation of the method embodiment is also applicable to the device of this embodiment, and the principle is the same, which is not limited in this embodiment.
[0137] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0138] Figure 6 A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0139] like Figure 6 As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 502 or a computer program loaded from a storage unit 508 to a RAM (Random Access Memory) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An I / O (Input / Output) interface 505 is also connected to the bus 504.
[0140] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0141] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as a vehicle testing method. For example, in some embodiments, the vehicle testing method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the aforementioned vehicle testing method in any other appropriate manner (eg, by means of firmware).
[0142] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0143] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0144] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0145] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0146] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
[0147] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0148] It should be noted that artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0149] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0150] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A vehicle testing method, characterized in that: The test steps include: Obtain target test cases from a preset storage path in order, and perform mutation processing on the target test cases to obtain at least one mutated test case; Selecting a mutation test case from the at least one mutation test case, inputting it into the vehicle micro control unit and executing the mutation test case; Detecting whether abnormal data occurs during the execution of the variation test case by the microcontroller unit; If it is determined that no abnormal data occurs during the execution of the mutation test case by the microcontroller, determining whether there is untested code in the code path covered by the mutation test case; If it is determined that the untested code exists in the code path covered by the mutation test case, the mutation test case is stored in the preset storage path as a target test case in sequence, and the step of obtaining the target test case in sequence from the preset storage path is continued.
2. The method according to claim 1, characterized in that Determining whether there is untested code in the code path covered by the mutation test case includes: Calling a preset tracking function to obtain tracking data for executing the mutation test case; Parsing the tracking data to obtain the code path covered by the mutation test case; Determine whether there is untested code in the code path covered by the mutation test case.
3. The method according to claim 2, characterized in that Before storing the variant test cases as target test cases in sequence in the preset storage path, the method includes: Analyze the code paths covered by each variant test case and generate code coverage data; Determine whether the code coverage data meets a test termination condition, wherein the test termination condition is that the code coverage data meets a preset threshold or no longer changes; If the test end condition is met, the test on the vehicle micro control unit is ended.
4. The method according to claim 3, characterized in that The storing the variant test cases as target test cases in the preset storage path in sequence comprises: If the test end condition is not met, the variant test case is stored in the preset storage path in sequence as a target test case.
5. The method according to claim 1, characterized in that The method comprises: If it is determined that abnormal data occurs during the execution of the variation test case by the microcontroller, the current execution data of the variation test case is saved and the test of the vehicle microcontroller unit is stopped, wherein the current execution data includes at least one of the variation test case and execution path information.
6. The method according to claim 1, characterized in that The method comprises: If it is determined that the untested code does not exist in the code path covered by the mutation test case, the mutation test case is discarded.
7. The method according to claim 1, characterized in that Before sequentially acquiring target test cases from a preset storage path, the method includes: A tracing address range of the preset tracing function is set in the vehicle micro control unit, and the tracing address range is determined according to a test range of the vehicle micro control unit.
8. A vehicle testing device, characterized in that: The following test equipment is included: An acquisition unit, used for sequentially acquiring target test cases from a preset storage path; A processing unit, configured to perform mutation processing on the target test case to obtain at least one mutated test case; A selection unit, configured to select a mutation test case from the at least one mutation test case, input the mutation test case into the vehicle micro control unit, and execute the mutation test case; A detection unit, used to detect whether abnormal data appears during the execution of the variation test case by the microcontroller unit; A first determining unit is used to determine whether there is untested code in the code path covered by the mutation test case when it is determined that no abnormal data occurs during the execution of the mutation test case by the micro control unit; An input unit, configured to store the mutation test case as a target test case in the preset storage path in order when it is determined that the untested code exists in the code path covered by the mutation test case; The execution unit is used to continue executing the vehicle test steps according to the storage order under the preset storage path after the variant test case is determined as the target test case.
9. A vehicle, characterized in that: The vehicle comprises the vehicle testing device as claimed in claim 8.
10. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
11. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.
12. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 7.
