Vehicle MCU test method and device, electronic equipment and storage medium
By obtaining standard MCU test cases, we can achieve automated testing from white box to black box, solving the problems of frequent manual intervention and high costs in vehicle MCU testing and improving the accuracy and stability of the test.
Patent Information
- Application Number
- CN202510808269.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-10-03
AI Technical Summary
In the existing technology, hardware and software testing of vehicle MCUs requires a lot of manual intervention, resulting in mismatched test results, high testing costs, low accuracy and stability, and test bench construction consumes a lot of engineering resources.
By obtaining standard MCU software test cases and hardware test cases, we can realize automated testing from white box to black box, use software test cases and programs to perform software testing, determine the hardware test type based on the demand information, use hardware test cases to perform corresponding hardware testing, and realize automated testing of software and hardware.
It reduces vehicle MCU testing costs, improves the accuracy and stability of hardware and software testing, and reduces manual intervention and repetitive work.
Smart Images

Figure CN120743641A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of MCU testing technology, and in particular to a vehicle MCU testing method, device, electronic device, and storage medium. Background Art
[0002] The operating system model in the vehicle tends to be stable. Each OEM only needs to adapt the operating system and conduct secondary development based on the operating system model before putting it into use. However, due to the different needs of the OEMs, the MCU test cases and test environment are different.
[0003] Currently, both hardware and software testing of vehicle MCUs require a lot of manual intervention, resulting in the clearing of mismatched test results. Furthermore, the construction of a test bench for vehicle MCUs requires a large amount of engineering resources and involves a lot of repetitive work, which increases the testing cost of vehicle MCUs and reduces the accuracy and stability of hardware and software testing of vehicle MCUs. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a testing method, device, electronic device and storage medium for a vehicle MCU, and to realize all tests from white box to black box by obtaining standard MCU software test cases and hardware test cases. When performing software testing on the MCU, the software test cases and software test programs are used to perform software testing on the MCU respectively, and when performing hardware testing on the MCU, the test type of the hardware test on the MCU is determined based on the demand information, and then the hardware test case is used to perform hardware testing on the MCU under the test type, and the corresponding software test results and hardware test results of the MCU are determined, thereby realizing automated software and hardware testing of the MCU, reducing the testing cost of the vehicle MCU, and improving the accuracy and stability of the hardware testing and software testing of the vehicle MCU respectively.
[0005] The present invention provides a method for testing a vehicle MCU, the method comprising:
[0006] In response to receiving requirement information for testing an MCU in a vehicle, obtaining software test cases and / or hardware test cases for testing the MCU according to the requirement information;
[0007] In response to the requirement information indicating the need for performing software testing on the MCU, performing software testing on the MCU using the software test case and a preset software test program, and determining a software test result corresponding to the MCU;
[0008] In response to the requirement information indicating that the MCU is to be hardware tested, based on the requirement information, a test type for the hardware test of the MCU is determined, and the hardware test under the test type is performed on the MCU using the hardware test case to determine the hardware test result corresponding to the MCU.
[0009] Furthermore, the testing method further includes:
[0010] In response to detecting that software problem information corresponding to the MCU exists in the software test result, performing a hardware verification test on the MCU based on the software problem information to obtain a hardware verification test result of the MCU under the software problem information;
[0011] In response to detecting that hardware problem information corresponding to the MCU exists in the hardware test result, a software verification test is performed on the MCU based on the hardware problem information to obtain a software verification test result of the MCU under the hardware problem information.
[0012] Further, performing software testing on the MCU in response to the requirement information instruction, performing software testing on the MCU using the software test case and a preset software test program, and determining a software test result corresponding to the MCU, includes:
[0013] In response to the requirement information indicating that software testing is to be performed on the MCU, a target software testing program for unit testing the MCU is generated based on a preset software testing program;
[0014] Performing unit testing on the MCU using the target software test program, determining the unit test results in the software test report corresponding to the MCU, and generating a test report corresponding to the unit test results;
[0015] In response to the unit test report being generated, the MCU is subjected to module interaction testing using the software test case, and the module interaction test result in the software test report corresponding to the MCU is determined to generate a test report corresponding to the module interaction test result.
[0016] Furthermore, the generating of a target software test program for unit testing the MCU based on a preset software test program includes:
[0017] Based on a preset software testing program, a preset dynamic link library tool is used to generate a software testing file corresponding to the software testing program;
[0018] Determining test function information for performing unit testing on the MCU in the software test file;
[0019] Based on the test function information, a target software test program for performing unit testing on the MCU is generated.
[0020] Furthermore, the test type includes a hardware environment load test; and performing a hardware test on the MCU under the test type using the hardware test case to determine a hardware test result corresponding to the MCU includes:
[0021] Connecting the MCU to the control load and the programmable power supply respectively;
[0022] The control load and the programmable power supply are respectively controlled to perform functional tests on the MCU corresponding to the load test cases in the hardware test cases, and the hardware environment load test results in the hardware test results corresponding to the MCU are determined to generate a test report corresponding to the hardware environment load test results.
[0023] Furthermore, the test type includes a module communication test; and performing a hardware test on the MCU under the test type using the hardware test case to determine a hardware test result corresponding to the MCU includes:
[0024] The module communication test case in the hardware test case is used to perform a module communication test on the MCU, and the module communication test result in the hardware test report corresponding to the MCU is determined to generate a test report corresponding to the module communication test result.
[0025] The present application also provides a vehicle MCU test device, the test device comprising:
[0026] a test case module, configured to, in response to receiving requirement information for testing an MCU in a vehicle, obtain software test cases and / or hardware test cases for testing the MCU according to the requirement information;
[0027] a software testing module, configured to perform software testing on the MCU in response to the requirement information instruction, perform software testing on the MCU using the software test case and a preset software testing program, and determine a software test result corresponding to the MCU;
[0028] A hardware testing module is used to perform hardware testing on the MCU in response to the requirement information indication, determine the test type of the hardware test on the MCU based on the requirement information, and use the hardware test case to perform hardware testing on the MCU under the test type to determine the hardware test result corresponding to the MCU.
[0029] Furthermore, the testing device further includes a test verification module, which is configured to:
[0030] In response to detecting that software problem information corresponding to the MCU exists in the software test result, performing a hardware verification test on the MCU based on the software problem information to obtain a hardware verification test result of the MCU under the software problem information;
[0031] In response to detecting that hardware problem information corresponding to the MCU exists in the hardware test result, a software verification test is performed on the MCU based on the hardware problem information to obtain a software verification test result of the MCU under the hardware problem information.
[0032] Furthermore, when the software testing module is used to perform software testing on the MCU in response to the requirement information instruction, perform software testing on the MCU using the software test case and the preset software testing program respectively, and determine the software test result corresponding to the MCU, the software testing module is used to:
[0033] In response to the requirement information indicating that software testing is to be performed on the MCU, a target software testing program for unit testing the MCU is generated based on a preset software testing program;
[0034] Performing unit testing on the MCU using the target software test program, determining the unit test results in the software test report corresponding to the MCU, and generating a test report corresponding to the unit test results;
[0035] In response to the unit test report being generated, the MCU is subjected to module interaction testing using the software test case, and the module interaction test result in the software test report corresponding to the MCU is determined to generate a test report corresponding to the module interaction test result.
[0036] Furthermore, when the software testing module is used to generate a target software testing program for unit testing the MCU based on a preset software testing program, the software testing module is used to:
[0037] Based on a preset software testing program, a preset dynamic link library tool is used to generate a software testing file corresponding to the software testing program;
[0038] Determining test function information for performing unit testing on the MCU in the software test file;
[0039] Based on the test function information, a target software test program for performing unit testing on the MCU is generated.
[0040] Furthermore, the test type includes a hardware environment load test; when the hardware test module is used to perform a hardware test under the test type on the MCU using the hardware test case and determine the hardware test result corresponding to the MCU, the hardware test module is used to:
[0041] Connecting the MCU to the control load and the programmable power supply respectively;
[0042] The control load and the programmable power supply are respectively controlled to perform functional tests on the MCU corresponding to the load test cases in the hardware test cases, and the hardware environment load test results in the hardware test results corresponding to the MCU are determined to generate a test report corresponding to the hardware environment load test results.
[0043] Furthermore, the test type includes a module communication test; when the hardware test module is used to perform a hardware test under the test type on the MCU using the hardware test case and determine the hardware test result corresponding to the MCU, the hardware test module is used to:
[0044] The module communication test case in the hardware test case is used to perform a module communication test on the MCU, and the module communication test result in the hardware test report corresponding to the MCU is determined to generate a test report corresponding to the module communication test result.
[0045] An embodiment of the present application also provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the vehicle MCU testing method as described above are performed.
[0046] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the vehicle MCU testing method as described above are executed.
[0047] The embodiments of the present application provide a testing method, device, electronic device and storage medium for a vehicle MCU. The testing method includes: in response to receiving requirement information for testing the MCU in a vehicle, obtaining software test cases and / or hardware test cases for testing the MCU according to the requirement information; in response to the requirement information indicating that the MCU is to be software tested, using the software test case and a preset software test program to perform software testing on the MCU respectively, and determining the software test results corresponding to the MCU; in response to the requirement information indicating that the MCU is to be hardware tested, determining the test type for performing hardware testing on the MCU based on the requirement information, and performing hardware testing on the MCU under the test type using the hardware test case to determine the hardware test results corresponding to the MCU.
[0048] Compared with the existing method that requires a lot of manual intervention and construction of test benches for both hardware and software testing of vehicle MCUs, this method achieves full testing from white box to black box by obtaining standard software test cases and hardware test cases of MCUs. When performing software testing on the MCU, the software test cases and software test programs are used to perform software testing on the MCU respectively. When performing hardware testing on the MCU, the test type of the hardware test on the MCU is determined based on the demand information, and then the hardware test cases are used to perform hardware testing on the MCU under the test type, and the corresponding software and hardware test results of the MCU are determined, thereby realizing automated software and hardware testing of the MCU, reducing the testing cost of the vehicle MCU and improving the accuracy and stability of the hardware and software testing of the vehicle MCU respectively.
[0049] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0051] Figure 1 One of the flow charts of a vehicle MCU testing method provided in an embodiment of the present application;
[0052] Figure 2 This is a second flow chart of a vehicle MCU testing method provided in an embodiment of the present application;
[0053] Figure 3 This is a schematic diagram of a vehicle MCU test device provided in an embodiment of the present application;
[0054] Figure 4 This is a second structural diagram of a vehicle MCU testing device provided in an embodiment of the present application;
[0055] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application for which protection is claimed, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work falls within the scope of protection of the present application.
[0057] Research has found that the operating system model in the vehicle tends to be stable. Each OEM only needs to adapt the operating system and conduct secondary development based on the operating system model before putting it into use. However, due to the different needs of the OEMs, the MCU test cases and test environments are different.
[0058] Currently, both hardware and software testing of vehicle MCUs require a lot of manual intervention, resulting in the clearing of mismatched test results. Furthermore, the construction of a test bench for vehicle MCUs requires a large amount of engineering resources and involves a lot of repetitive work, which increases the testing cost of vehicle MCUs and reduces the accuracy and stability of hardware and software testing of vehicle MCUs.
[0059] Among them, current software testing can be combined with testing tools to perform model-level simulation testing. For example, both AUTOSAR CP and AP support software testing, especially in the testing of MCAL (microcontroller abstraction layer) and BSW (basic software) modules; and hardware testing almost all has a mature test platform that can perform functional verification of ECUs. Hardware testing is gradually integrated with automation frameworks (for example, Python+dSPACEControlDesk and Vector CANoe).
[0060] Based on this, an embodiment of the present application provides a testing method for a vehicle MCU. By obtaining standard software test cases and hardware test cases of the MCU, all tests from white box to black box are realized. When performing software testing on the MCU, the software test cases and software test programs are used to perform software testing on the MCU respectively. When performing hardware testing on the MCU, the test type of the hardware test on the MCU is determined based on the demand information, and then the hardware test case is used to perform hardware testing on the MCU under the test type, and the corresponding software test results and hardware test results of the MCU are determined, thereby realizing automated software and hardware testing of the MCU, reducing the testing cost of the vehicle MCU, and improving the accuracy and stability of hardware testing and software testing of the vehicle MCU.
[0061] See also Figure 1 , Figure 1 This is one of the flow charts of a vehicle MCU testing method provided in an embodiment of the present application. Figure 1 As shown in , the vehicle MCU testing method provided by the embodiment of the present application includes:
[0062] S101 : In response to receiving requirement information for testing an MCU in a vehicle, obtaining software test cases and / or hardware test cases for testing the MCU according to the requirement information.
[0063] In an embodiment of the present application, the test performed on the MCU in the vehicle includes hardware testing and software testing.
[0064] Among them, hardware testing includes a hardware-in-the-loop test (SIL). Hardware-in-the-loop testing combines real hardware devices (for example, MCU, sensors, and actuators, etc.) with a virtual simulation environment, and simulates real scenarios (for example, vehicle dynamics, sensor input, etc.) through real-time simulation models to verify the behavior and performance of hardware in complex environments.
[0065] Software testing includes a type of software-in-the-loop (SIL) testing. Software-in-the-loop testing runs the code to be tested (for example, embedded software or control algorithms) in a pure software environment, simulates the hardware and external environment through simulation models, and verifies whether the code logic and functions meet the design requirements.
[0066] In this step, during the specific implementation, first, the requirement information for testing the MCU in the vehicle is received; then, it is determined to perform hardware testing and / or hardware testing on the MCU in the vehicle; finally, according to the requirement information, software test cases and / or hardware test cases for testing the MCU are obtained in the preset standardized testing document.
[0067] It should be noted that during the software release phase of testing the MCU, a Pipeline script is created using the Jenkins tool, and the corresponding test pipeline script is written and integrated into CI / CD to automatically build the test program, thereby achieving automated testing of the entire process of testing the MCU.
[0068] S102 : performing software testing on the MCU in response to the requirement information instruction, performing software testing on the MCU using the software test case and a preset software test program, and determining a software test result corresponding to the MCU.
[0069] In the embodiment of the present application, the software testing performed on the MCU may include unit testing and module interaction testing.
[0070] Among them, unit testing is the testing of the smallest testable unit in the software (for example, function, method or class), with the purpose of verifying whether these basic building blocks work as expected; module interaction testing is to combine multiple modules that have passed unit testing together for testing to verify whether the interface, communication, data flow and collaborative behavior between them meet the design requirements.
[0071] In one possible implementation of the present application, during specific implementation, step S102 may include:
[0072] S1021 . In response to the requirement information indicating that software testing is to be performed on the MCU, a target software testing program for unit testing the MCU is generated based on a preset software testing program.
[0073] In one possible implementation of the present application, during specific implementation, step S1021 may include:
[0074] S10211. Based on a preset software testing program, a preset dynamic link library tool is used to generate a software testing file corresponding to the software testing program.
[0075] Exemplarily, a dynamic link library tool (ctypes) is used to generate a software test file (.dll file) corresponding to the software test program (Python code).
[0076] Here, since the ctypes tool in Python itself cannot directly generate a .dll file, ctypes is a module for calling a dynamic link library written in C language. Therefore, a .dll file is generated in the Python code, the Python code is converted into a form that can be understood by C / C++, and then packaged into a .dll file through the compiler.
[0077] S10212. Determine test function information for performing unit testing on the MCU in the software test file.
[0078] In the embodiment of the present application, the test function information includes but is not limited to the function name, function parameters, and function return value.
[0079] S10213. Based on the test function information, generate a target software test program for unit testing the MCU.
[0080] In this step, a preset Python tool is used to generate a target software test program for unit testing the MCU based on test function information such as function name, function parameters, and function return value.
[0081] S1022: Perform unit testing on the MCU using the target software test program, determine the unit test results in the software test report corresponding to the MCU, and generate a test report corresponding to the unit test results.
[0082] In this step, the MCU is unit tested using the target software test program to determine the unit test results in the software test report corresponding to the MCU, and the python-cov tool is used to generate a test report corresponding to the unit test results including code coverage.
[0083] S1023. In response to the unit test report being generated, perform module interaction testing on the MCU using the software test case, determine the module interaction test results in the software test report corresponding to the MCU, and generate a test report corresponding to the module interaction test results.
[0084] In an embodiment of the present application, the Python tool is combined with the CANoe tool, and Python internal packages (including python-can, cantools, and udsoncan, etc.) are used to control the CANoe tool to send module interaction test signals to the host computer and receive signals from the host computer to verify whether the data of the module interaction test is correct and whether the module interaction function meets the interaction requirements between the test modules, so as to determine the module interaction test results in the software test report corresponding to the MCU, and finally generate a test report corresponding to the module interaction test results.
[0085] S103. In response to the requirement information indicating that a hardware test is to be performed on the MCU, a test type for performing the hardware test on the MCU is determined based on the requirement information, and a hardware test under the test type is performed on the MCU using the hardware test case to determine a hardware test result corresponding to the MCU.
[0086] In the embodiment of the present application, the software test performed on the MCU may include a hardware environment load test and a module communication test.
[0087] Among them, the hardware environment load test refers to evaluating the performance of the hardware system under different loads by simulating actual load conditions (for example, high concurrency, high data volume and long-term operation, etc.); the module communication test refers to verifying the communication protocol, signal transmission and data integrity between hardware modules to ensure that the interaction between modules complies with the design specifications.
[0088] In this step, based on the project requirements and project scale conditions included in the demand information, determine whether it is necessary to simulate the actual vehicle environment to perform hardware environment load testing on the MCU. If necessary, the hardware environment load test is performed on the MCU; if not, the module communication test is performed on the MCU to determine the test type for the hardware test of the MCU, and then perform corresponding hardware tests for each test type.
[0089] In one possible implementation of the present application, in a specific implementation, when the test type is a hardware environment load test, step S103 may include:
[0090] S1031. Connect the MCU to the control load and the programmable power supply respectively.
[0091] In this step, the programmable power supply and load are controlled through the Python built-in function package serial, and the power supply voltage and current are controlled to turn the load and programmable power supply on and off in real time.
[0092] S1032. Control the control load and the programmable power supply respectively to perform functional tests on the MCU corresponding to the load test cases in the hardware test cases, determine the hardware environment load test results in the hardware test results corresponding to the MCU, and generate a test report corresponding to the hardware environment load test results.
[0093] In this step, based on the load test case in the hardware test case, the load and the programmable power supply are controlled to set the preset voltage and current to perform functional tests on the MCU including current protection / overload protection, DTC test and power-on verification, and the hardware environment load test results in the hardware test results corresponding to the MCU are determined, and then a test report corresponding to the hardware environment load test results is generated.
[0094] In one embodiment of the present application, when the test type is a module communication test, step S103 may include:
[0095] S1033. Perform a module communication test on the MCU using the module communication test case in the hardware test case, determine the module communication test result in the hardware test report corresponding to the MCU, and generate a test report corresponding to the module communication test result.
[0096] In this step, by using Python's internal function packages pyserial, pyVISA, pySide, etc. and the communication tool canoe, the module communication test case in the hardware test case is used to perform module communication testing on the MCU to receive and send signals of the MCU. After the requirements analysis and processing of the hardware test case, the module communication test results in the hardware test report corresponding to the MCU are obtained, and the communication between modules, the diagnostic function, and the TP function are verified to determine whether the module communication test results meet expectations, and then determine the success or failure of the test, and generate a test report corresponding to the module communication test results.
[0097] Optional, see Figure 2 , Figure 2 This is a second flow chart of a vehicle MCU testing method provided in an embodiment of the present application. Figure 2 As shown in , in addition to the vehicle MCU testing method described in steps S101 to S103, the embodiment of the present application also includes steps S104 to S105. Specifically, steps S104 to S105 are used to illustrate the verification method of the test feasibility to ensure the uniformity of the results required on the software testing side and the hardware testing side.
[0098] S104 . In response to detecting that software problem information corresponding to the MCU exists in the software test result, perform a hardware verification test on the MCU based on the software problem information to obtain a hardware verification test result of the MCU under the software problem information.
[0099] S105 . In response to detecting that hardware problem information corresponding to the MCU exists in the hardware test result, perform a software verification test on the MCU based on the hardware problem information to obtain a software verification test result of the MCU under the hardware problem information.
[0100] The vehicle MCU testing method provided in the embodiment of the present application realizes all tests from white box to black box by obtaining standard MCU software test cases and hardware test cases. When performing software testing on the MCU, the software test cases and software test programs are used to perform software testing on the MCU respectively. When performing hardware testing on the MCU, the test type of the hardware test on the MCU is determined based on the demand information, and then the hardware test case is used to perform hardware testing on the MCU under the test type, and the corresponding software test results and hardware test results of the MCU are determined, thereby realizing automated software and hardware testing of the MCU, reducing the testing cost of the vehicle MCU, and improving the accuracy and stability of the hardware testing and software testing of the vehicle MCU respectively.
[0101] See also Figure 3 、 Figure 4 , Figure 3 This is one of the structural diagrams of a vehicle MCU testing device provided in an embodiment of the present application. Figure 4 This is a second structural diagram of a vehicle MCU testing device provided in an embodiment of the present application. Figure 3 As shown in FIG, the testing device 300 includes:
[0102] A test case module 310 is configured to, in response to receiving a requirement for testing an MCU in a vehicle, obtain software test cases and / or hardware test cases for testing the MCU according to the requirement;
[0103] A software testing module 320 is configured to perform software testing on the MCU in response to the requirement information, perform software testing on the MCU using the software test case and a preset software testing program, and determine a software test result corresponding to the MCU;
[0104] The hardware testing module 330 is used to perform hardware testing on the MCU in response to the requirement information indication, determine the test type of the hardware test on the MCU based on the requirement information, and use the hardware test case to perform hardware testing on the MCU under the test type to determine the hardware test result corresponding to the MCU.
[0105] Further, such as Figure 4 As shown in FIG, the testing device 300 further includes a test verification module 340, and the test verification module 340 is used to:
[0106] In response to detecting that software problem information corresponding to the MCU exists in the software test result, performing a hardware verification test on the MCU based on the software problem information to obtain a hardware verification test result of the MCU under the software problem information;
[0107] In response to detecting that hardware problem information corresponding to the MCU exists in the hardware test result, a software verification test is performed on the MCU based on the hardware problem information to obtain a software verification test result of the MCU under the hardware problem information.
[0108] Furthermore, when the software testing module 320 is used to perform software testing on the MCU in response to the requirement information instruction, perform software testing on the MCU using the software test case and the preset software test program respectively, and determine the software test result corresponding to the MCU, the software testing module 320 is used to:
[0109] In response to the requirement information indicating that software testing is to be performed on the MCU, a target software testing program for unit testing the MCU is generated based on a preset software testing program;
[0110] Performing unit testing on the MCU using the target software test program, determining the unit test results in the software test report corresponding to the MCU, and generating a test report corresponding to the unit test results;
[0111] In response to the unit test report being generated, the MCU is subjected to module interaction testing using the software test case, and the module interaction test result in the software test report corresponding to the MCU is determined to generate a test report corresponding to the module interaction test result.
[0112] Furthermore, when the software testing module 320 is used to generate a target software testing program for unit testing the MCU based on a preset software testing program, the software testing module 320 is used to:
[0113] Based on a preset software testing program, a preset dynamic link library tool is used to generate a software testing file corresponding to the software testing program;
[0114] Determining test function information for performing unit testing on the MCU in the software test file;
[0115] Based on the test function information, a target software test program for performing unit testing on the MCU is generated.
[0116] Furthermore, the test type includes a hardware environment load test; when the hardware test module 330 is used to perform a hardware test under the test type on the MCU using the hardware test case and determine the hardware test result corresponding to the MCU, the hardware test module 330 is used to:
[0117] Connecting the MCU to the control load and the programmable power supply respectively;
[0118] The control load and the programmable power supply are respectively controlled to perform functional tests on the MCU corresponding to the load test cases in the hardware test cases, and the hardware environment load test results in the hardware test results corresponding to the MCU are determined to generate a test report corresponding to the hardware environment load test results.
[0119] Furthermore, the test type includes a module communication test; when the hardware test module 330 is used to perform a hardware test under the test type on the MCU using the hardware test case and determine the hardware test result corresponding to the MCU, the hardware test module 330 is used to:
[0120] The module communication test case in the hardware test case is used to perform a module communication test on the MCU, and the module communication test result in the hardware test report corresponding to the MCU is determined to generate a test report corresponding to the module communication test result.
[0121] The vehicle MCU testing device provided in the embodiment of the present application realizes all tests from white box to black box by obtaining standard MCU software test cases and hardware test cases. When performing software testing on the MCU, the software test cases and software test programs are used to perform software testing on the MCU respectively. When performing hardware testing on the MCU, the test type of the hardware test on the MCU is determined based on the demand information, and then the hardware test case is used to perform hardware testing on the MCU under the test type, and the corresponding software test results and hardware test results of the MCU are determined, thereby realizing automated software and hardware testing of the MCU, reducing the testing cost of the vehicle MCU, and improving the accuracy and stability of the hardware testing and software testing of the vehicle MCU respectively.
[0122] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown in FIG, the electronic device 500 includes a processor 510, a memory 520 and a bus 530.
[0123] The memory 520 stores machine-readable instructions executable by the processor 510. When the electronic device 500 is running, the processor 510 communicates with the memory 520 via the bus 530. When the machine-readable instructions are executed by the processor 510, the above-mentioned Figure 1 as well as Figure 2 The steps of the vehicle MCU testing method in the method embodiment shown are specifically implemented in accordance with the method embodiment and will not be described in detail here.
[0124] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 1 as well as Figure 2 The steps of the vehicle MCU testing method in the method embodiment shown are specifically implemented in accordance with the method embodiment and will not be described in detail here.
[0125] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0126] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. There may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some communication interface, indirect coupling or communication connection of devices or units, which may be electrical, mechanical or other forms.
[0127] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0128] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0129] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0130] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The scope of protection of the present application is not limited thereto. Although the present application has been described in detail with reference to the above-mentioned embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-mentioned embodiments within the technical scope disclosed in the present application, or perform equivalent replacements for some of the technical features thereof. These modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A vehicle MCU testing method, characterized in that: The test method includes: In response to receiving requirement information for testing an MCU in a vehicle, obtaining software test cases and / or hardware test cases for testing the MCU according to the requirement information; In response to the requirement information indicating the need for performing software testing on the MCU, performing software testing on the MCU using the software test case and a preset software test program, and determining a software test result corresponding to the MCU; In response to the requirement information indicating that the MCU is to be hardware tested, based on the requirement information, a test type for the hardware test of the MCU is determined, and the hardware test under the test type is performed on the MCU using the hardware test case to determine the hardware test result corresponding to the MCU.
2. The method according to claim 1, characterized in that The test method further comprises: In response to detecting that software problem information corresponding to the MCU exists in the software test result, performing a hardware verification test on the MCU based on the software problem information to obtain a hardware verification test result of the MCU under the software problem information; In response to detecting that hardware problem information corresponding to the MCU exists in the hardware test result, a software verification test is performed on the MCU based on the hardware problem information to obtain a software verification test result of the MCU under the hardware problem information.
3. The method according to claim 1, characterized in that The step of performing software testing on the MCU in response to the requirement information instruction, performing software testing on the MCU using the software test case and a preset software test program, and determining a software test result corresponding to the MCU includes: In response to the requirement information indicating that software testing is to be performed on the MCU, a target software testing program for unit testing the MCU is generated based on a preset software testing program; Performing unit testing on the MCU using the target software test program, determining the unit test results in the software test report corresponding to the MCU, and generating a test report corresponding to the unit test results; In response to the unit test report being generated, the MCU is subjected to module interaction testing using the software test case, and the module interaction test result in the software test report corresponding to the MCU is determined to generate a test report corresponding to the module interaction test result.
4. The method according to claim 3, characterized in that The step of generating a target software test program for unit testing the MCU based on a preset software test program includes: Based on a preset software testing program, a preset dynamic link library tool is used to generate a software testing file corresponding to the software testing program; Determining test function information for performing unit testing on the MCU in the software test file; Based on the test function information, a target software test program for performing unit testing on the MCU is generated.
5. The method according to claim 1, wherein The test type includes a hardware environment load test; and performing a hardware test on the MCU under the test type using the hardware test case to determine a hardware test result corresponding to the MCU includes: Connecting the MCU to the control load and the programmable power supply respectively; The control load and the programmable power supply are respectively controlled to perform functional tests on the MCU corresponding to the load test cases in the hardware test cases, and the hardware environment load test results in the hardware test results corresponding to the MCU are determined to generate a test report corresponding to the hardware environment load test results.
6. The method according to claim 1, characterized in that The test type includes a module communication test; and performing a hardware test on the MCU under the test type using the hardware test case to determine a hardware test result corresponding to the MCU includes: The module communication test case in the hardware test case is used to perform a module communication test on the MCU, and the module communication test result in the hardware test report corresponding to the MCU is determined to generate a test report corresponding to the module communication test result.
7. A vehicle MCU testing device, characterized in that: The testing device comprises: a test case module, configured to, in response to receiving requirement information for testing an MCU in a vehicle, obtain software test cases and / or hardware test cases for testing the MCU according to the requirement information; a software testing module, configured to perform software testing on the MCU in response to the requirement information instruction, perform software testing on the MCU using the software test case and a preset software testing program, and determine a software test result corresponding to the MCU; A hardware testing module is used to perform hardware testing on the MCU in response to the requirement information indication, determine the test type of the hardware test on the MCU based on the requirement information, and use the hardware test case to perform hardware testing on the MCU under the test type to determine the hardware test result corresponding to the MCU.
8. The device according to claim 7, characterized in that The testing device further includes a test verification module, which is configured to: In response to detecting that software problem information corresponding to the MCU exists in the software test result, performing a hardware verification test on the MCU based on the software problem information to obtain a hardware verification test result of the MCU under the software problem information; In response to detecting that hardware problem information corresponding to the MCU exists in the hardware test result, a software verification test is performed on the MCU based on the hardware problem information to obtain a software verification test result of the MCU under the hardware problem information.
9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the memory communicate through the bus. When the machine-readable instructions are run by the processor, the steps of the vehicle MCU testing method as described in any one of claims 1 to 6 are executed.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the vehicle MCU testing method according to any one of claims 1 to 6 are executed.