Software integration testing method and system based on piling and storage medium
By adopting the software integration test method based on piling in the integration test in the field of intelligent driving, generating stub functions and performing bus simulation, the problem of low accuracy in complex communication link testing is solved and efficient and accurate test coverage is achieved.
Patent Information
- Application Number
- CN202410605406.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2024-08-30
AI Technical Summary
In integrated testing in the field of intelligent driving, existing methods are difficult to test complex communication links efficiently and accurately, and existing integrated testing methods have low accuracy in complex systems.
Adopting a software integration testing method based on piling, it generates test cases by analyzing the communication link interface, generates stub functions, performs bus simulation and automated piling testing, and uses callback functions to dynamically adjust the parameter model to achieve multiple dynamic tests of the communication link. .
It improves the accuracy and efficiency of integration testing, enables accurate testing of communication links at the interface data level, and enhances the test coverage and reliability of communication links.
Smart Images

Figure CN118567974A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent driving, and in particular to a software integration testing method, system and storage medium based on piling. Background Art
[0002] In the field of intelligent driving, the middleware of the intelligent driving system plays a vital role in the automotive software architecture, which can realize the decoupling of software and hardware. In the intelligent driving software integration test, the test of the middleware communication is the most core part of the communication link test process. By accurately testing the communication link interface level, the correctness of the entire integrated system can be greatly guaranteed. When performing the integrated test, since the unit module being tested cannot constitute an operational integrated software system alone, it is necessary to develop corresponding stub functions (Stubbing Function, Stub) for the unit module. These stub functions can make the communication link of the integrated software pass data between the modules of the communication link according to the test verification needs, and then output the test results during the transmission process, so as to analyze whether the test results meet expectations, and then achieve the test of the communication link of the integrated system, thereby greatly improving the correctness of the integrated test.
[0003] However, it is difficult to locate problems in the module interaction process during integration testing. In practice, the breakpoint method provided by Lauterbach's Trace32 tool is often used manually to view variables in the tracking process to locate the corresponding problems, but this method consumes a lot of manpower. In addition, as the complexity of the system increases, it is difficult for the existing integration testing method to achieve high accuracy.
[0004] At the same time, the pile testing method is usually applied to unit testing in the communication field. It is difficult to test complex communication links and has low efficiency. In addition, the existing integrated testing method has the disadvantage of low accuracy in complex systems. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a software integration test method, system and storage medium based on piling, which can simplify the test scheme and improve the test efficiency and accuracy.
[0006] To solve the above technical problems, as one aspect of the present invention, a software integration testing method based on stubbing is provided, which comprises the following steps:
[0007] Analyze the communication link interface to be tested in the integration test and generate test cases for the communication link test;
[0008] Generate corresponding pile function according to the original function in the source code of the tested module connected according to described communication link, and set input and output in each pile function according to test case;
[0009] Constructing a parameter model according to the communication link interface to be tested, calling the parameter model to generate a bus signal, and realizing bus simulation;
[0010] In the bus simulation environment, the test script is used to perform automated stub testing, and each original function in each test case is replaced with the corresponding stub function for automated testing, and the original function is restored after the test is completed;
[0011] According to the test results, the callback function pre-set in the pile driving function is used to dynamically select the parameter model, trigger the next round of pile function and perform automatic pile driving test.
[0012] The step of analyzing the communication link interface to be tested in the integrated test and generating a test case for the communication link test further includes:
[0013] According to the communication link interface set to be tested in the integration test, taking the data structure on the communication link as a unit, all variables to be tested involved in each data structure are obtained, and a test case for the communication link test is generated.
[0014] Among them, constructing a parameter model according to the communication link interface to be tested, calling the parameter model to generate a bus signal, and realizing bus simulation, including:
[0015] Establishing a CAN matrix corresponding to the communication link interface to be tested, wherein the CAN matrix includes the name, ID, data length and value range of each CAN signal;
[0016] According to the CAN signal values defined by the CAN matrix, the CAPL script is used to build discrete parameter models and continuous parameter models. The discrete parameter model is used for spot inspection of the communication link path, and the continuous parameter model is used to verify the correctness and boundaries of the internal logic of the module to be tested.
[0017] Start the CANoe simulation environment, use the CAPL script to call the discrete parameter model or the continuous parameter model to generate CAN signals, and send the CAN signals to the virtual bus.
[0018] Among them, in the bus simulation environment, the test script is used to perform automated stub testing, each original function in each test case is replaced with a corresponding stub function for automated testing, and the original function is restored after the test is completed; including:
[0019] Run the pre-written automated stub script to automatically replace the original function interface in each module under test in the test case with the corresponding stub function and perform the test;
[0020] After the test is completed, each stub function will be restored to its corresponding original function.
[0021] Among them, according to the test results, the callback function pre-set in the pile driving function is used to dynamically select the parameter model to trigger the next round of automatic pile driving test of the pile function, including:
[0022] CANoe is connected to the serial port of the test bench and analyzes the results by reading the serial port output;
[0023] Different pile function callback functions are triggered according to the test results obtained by the analysis, and the parameter model is dynamically adjusted using the callback function to trigger the next round of pile function automatic pile driving test.
[0024] Accordingly, as another aspect of the present invention, a software integration test system based on piling is also provided, which at least includes:
[0025] The interface analysis module is used to analyze the communication link interface to be tested in the integration test and generate test cases for the communication link test;
[0026] The pile function acquisition module is used for generating corresponding pile functions according to the original function in the source code of the tested module connected according to the communication link, and setting input and output in each pile function according to the test case;
[0027] A bus simulation module is used to construct a parameter model according to the communication link interface to be tested, call the parameter model to generate a bus signal, and realize bus simulation;
[0028] The automatic pile test module is used to perform automatic pile test using test scripts in a bus simulation environment, replace each original function in each test case with the corresponding pile function for automatic testing, and restore the original function after the test is completed;
[0029] The callback processing module is used to dynamically select the parameter model according to the test results, use the callback function pre-set in the pile driving function, trigger the next round of pile function and perform automatic pile driving test.
[0030] Wherein, the interface analysis module is further used for:
[0031] According to the communication link interface set to be tested in the integration test, taking the data structure on the communication link as a unit, all variables to be tested involved in each data structure are obtained, and a test case for the communication link test is generated.
[0032] Wherein, the bus simulation module comprises:
[0033] A CAN matrix establishing unit, used to establish a CAN matrix corresponding to the communication link interface to be tested, wherein the CAN matrix includes the name, ID, data length and value range of each CAN signal;
[0034] The parameter model acquisition unit is used to obtain the value of the CAN signal defined by the CAN matrix, and use the CAPL script to build a discrete parameter model and a continuous parameter model. The discrete parameter model is used for the inspection of the communication link path, and the continuous parameter model is used to verify the correctness and boundary of the internal logic of the module to be tested;
[0035] The CAN signal simulation unit is used to start the CANoe simulation environment, use the CAPL script to call the discrete parameter model or the continuous parameter model to generate the CAN signal, and send the CAN signal to the virtual bus.
[0036] Wherein, the automatic piling test module includes:
[0037] The stub function replacement unit is used to run the pre-written automatic stub script to automatically replace the original function interface in each module to be tested in the test case with the corresponding stub function and perform the test;
[0038] The original function recovery unit is used to restore each stub function to the corresponding original function after the test is completed.
[0039] Wherein, the callback processing module includes:
[0040] A serial port result analysis unit, used to connect to the serial port of the test bench and analyze the results output by reading the serial port;
[0041] The parameter model adjustment unit triggers different pile function callback functions according to the test results obtained by analysis, and dynamically adjusts the parameter model using the callback function to trigger the next round of pile function automatic pile driving test.
[0042] As another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned method are implemented.
[0043] The implementation of the embodiments of the present invention has the following beneficial effects:
[0044] The present invention provides a software integration test method, system and storage medium based on piling. In the integrated test process in the field of intelligent driving, a corresponding pile function is developed for the communication middleware module, and the middleware in the integrated software system is automatically tested through the pile function. And by setting a set of callback functions for each pile function, the test results of the original pile function are analyzed, thereby triggering the callback functions of different pile functions, and performing dynamic parameter model selection, so that complex communication links can be dynamically piled multiple times, thereby verifying the integrity of the communication link and the correctness of the interface; it can achieve precise testing at the interface data level and complete coverage of the communication link, thereby improving the accuracy and reliability of integrated software testing;
[0045] In the present invention, by script realization automation pile driving, for each version to be tested, only need to run automation pile driving script, just can easily generate the pile function of all test cases, simplify the test process of communication link in integrated test, and improve test efficiency.The present invention, with the dimension of communication interface, can be accurate to the flow direction of each variable data on the communication link, greatly improves the accuracy of integrated test by this method of testing.The present invention makes integrated test more automated by dynamically selecting parameter model and pile function callback, makes communication link test coverage higher. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For a person skilled in the art, other drawings obtained based on these drawings still belong to the scope of the present invention without creative labor.
[0047] Figure 1 A schematic diagram of the main process of an embodiment of a software integration testing method based on piling provided by the present invention;
[0048] Figure 2 A schematic diagram of an application environment of the method provided by the present invention;
[0049] Figure 3 A more detailed flow chart of an embodiment of the method provided by the present invention;
[0050] Figure 4 A schematic diagram of the structure of an embodiment of a software integration test system based on piling provided by the present invention;
[0051] Figure 5 for Figure 4 The structural diagram of the bus simulation module;
[0052] Figure 6 for Figure 4 The structural diagram of the automatic pile driving test module;
[0053] Figure 7 for Figure 4 Schematic diagram of the structure of the callback processing module. DETAILED DESCRIPTION
[0054] In order to make the objectives, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings.
[0055] like Figure 1 FIG. 1 is a schematic diagram showing the main flow of an embodiment of a software integration testing method based on stubbing provided by the present invention. Figure 2 and Figure 3 As shown, in this embodiment, the method at least includes the following steps:
[0056] Step S10, analyzing the communication link interface to be tested in the integration test, and generating a test case for the communication link test;
[0057] In a specific example, the step S10 further includes:
[0058] According to the communication link interface set to be tested in the integration test, taking the data structure on the communication link as a unit, all variables to be tested involved in each data structure are obtained, and a test case for the communication link test is generated.
[0059] It is understandable that the test case contains input data and expected output results. Using a test framework (such as Python's unittest, Java's JUnit, or JavaScript's Jest, etc.) to run these test cases, you can compare whether the actual output matches the expected output. If the two do not match, the test fails, indicating that there is a problem in the code.
[0060] Step S11, generates corresponding stub functions according to the original function in the source code of the tested module connected to the communication link, and sets input and output in each stub function according to the test case; wherein, in a specific example, the original function in the source code of the tested module refers to Figure 2 The original function in the middleware of the MCU chip or SOC chip.
[0061] It is understandable that pile functions are widely used in automated unit testing, and their main purpose is to replace associated code or unimplemented code so that the behavior of these codes can be simulated or controlled during the test. Pile functions are usually used to isolate the tested code so that it does not rely on external systems or components, thereby being able to more accurately test the logic of the tested code.
[0062] Generally, the prototype of the stub function should be consistent with the original function in the module source code to ensure that the test code can be correctly linked to the stub function. The original function refers to the function that actually exists in the module source code and is replaced by the stub function. The naming, parameter list and return type of the stub function should be consistent with the original function so that the original function can be seamlessly replaced during testing.
[0063] Setting input and output in pile function according to test case is to define different input parameters and corresponding output results in pile function according to the specific requirements of test case. Like this, when test code calls pile function, pile function can return corresponding output results according to preset input parameters, thereby simulating or controlling the behavior of tested code.
[0064] Step S12, constructing a parameter model according to the communication link interface to be tested, calling the parameter model to generate a bus signal, and realizing bus simulation; the parameter model includes a discrete parameter model and a continuous parameter model;
[0065] In a specific example, the step S12 further includes:
[0066] Step S120, establishing a CAN matrix corresponding to the communication link interface to be tested, wherein the CAN matrix includes the name, ID, start bit, data type, data length and value range of each CAN signal;
[0067] Step S121, according to the CAN signal values defined by the CAN matrix, a discrete parameter model and a continuous parameter model are constructed using a CAPL script. Different parameter models are used to cover the test of the entire communication link. The discrete parameter model is used for spot inspection of the communication link path, and the continuous parameter model is used for the correctness and boundary verification of the internal logic of the module to be tested.
[0068] Step S122, start the CANoe simulation environment, use the CAPL script to call the discrete parameter model or the continuous parameter model to generate a CAN signal, and send the CAN signal to the virtual bus. Specifically, the CANOE-based script programming language CAPL (Communication Access Programming Language) script is used to call the discrete parameter model or the continuous parameter model to generate a CAN signal, and the bus message simulation is realized through the IL interaction layer of CANoe.
[0069] CANoe is a development, analysis and simulation tool for CAN and CAN FD networks developed by Vector Informatik. The CANoe platform can be used to create a network simulation environment in which nodes, messages, signals and their interactions can be defined. Figure 2 As shown in the figure, in CANoe, it is equipped with a Python module, and the Simulation Setup function can be used to create a new simulation environment. In the simulation environment, you can add the required ECU nodes and configure the messages sent and received for each node. And you can define the structure and content of the CAN message according to the CAN matrix or database file (such as DBC file). Use CAPL to write scripts to control the behavior of the node, such as sending messages, processing received messages, etc. After configuring the simulation environment, you can start running the simulation and observe the behavior of the CAN network.
[0070] In the present invention, a parameter model can be constructed according to the CAN signal values defined in the CAN matrix corresponding to the communication link interface to be tested. According to these definitions, a parameter model can be constructed.
[0071] For discrete parameter models, you can create an enumeration or constant for each gear value and then use these values in the CAPL script to set or check the state of a signal; for example, in one example, there is a signal representing the gear position, whose values can be "P" (park), "R" (reverse), "N" (neutral), and "D" (drive).
[0072] For a continuous parameter model, for example, a signal representing engine speed has a value range from 0 to 6000 rpm. In this case, you can define a variable in the CAPL script to store the value of the engine speed and update the value of this variable when needed. You can also use mathematical functions or algorithms to simulate changes in engine speed.
[0073] In the CAPL script, you can use functions and variables to generate CAN signals. Specifically, you can use the canWrite function to send a CAN message, in which case you need to specify the message ID, message content, and the channel to send it. Before sending a message, you can use the variables in the CAPL script to set the values of each signal in the message. If you need to send a message at a fixed time, you can use the timer function in CAPL to achieve this. Through bus simulation based on CANoe, you can develop and test CAN networks more efficiently, reducing the risks and costs in the actual hardware development process.
[0074] Step S13, under bus simulation environment, adopt test script to carry out automatic pile test, replace each original function in each test case with corresponding pile function to carry out automatic test, and restore the original function after the test ends;
[0075] In a specific example, the step S13 further includes:
[0076] Run the automated stub script written in Python to automatically replace the original function interface in each module under test in the test case with the corresponding stub function and perform the test;
[0077] After the test is completed, each stub function will be restored to its corresponding original function.
[0078] In the present invention, can use python script when testing, automation repeatedly replaces original function with pile function to each test case and tests, after test ends, restores original function.Particularly, in Python script, realize automation stubbing and replace original function and test, and the function of restoring original function after test ends, can usually be accomplished by using such as unittest.mock module.unittest.mock provides the powerful function that Python object is simulated and replaced.
[0079] In the present invention, in order to facilitate reuse and automated testing needs, the stub function is developed into a reusable code module according to the test case. The present invention automatically generates the stub function into the module to be tested through a python script, thereby facilitating multiple retest verifications of the version and greatly improving the test efficiency.
[0080] Step S14, according to the test results, using the callback function pre-set in the pile driving function, dynamically select the parameter model, trigger the next round of pile function and perform automatic pile driving test;
[0081] In a specific example, the step S14 further includes:
[0082] Step S140, CANoe uses ssh to connect to the serial port of the test bench by calling the python module, analyzes the test results by reading the results of the serial port output in real time, triggers the callback function of the pile function according to different test results, dynamically adjusts the parameter model in the callback function of the pile function, such as adjusting from a discrete parameter model to a continuous parameter model, and further observes and judges the link to be tested; it can be understood that in the test environment of the intelligent driving system, the bench is usually a test platform that simulates the actual vehicle environment and hardware components. It may include various sensors, actuators, controllers and other electronic devices, which are all connected to the bench through wiring harnesses and interfaces. Testers can simulate the behavior of vehicles under different working conditions through the bench and verify the performance and function of the system under various conditions. In the communication link test, the test system needs to be able to read the data output by each device on the bench in order to analyze the test results. Through the serial port connection, CANoe and Python modules can obtain data from the bench in real time, and these data may include messages, sensor readings, actuator states, etc. on the CAN bus. The Python module can write scripts to parse these data and compare them with the expected results to determine whether the system works as expected.
[0083] Step S141, triggering different pile function callback functions according to the test results obtained by analysis, using the callback functions to dynamically adjust the parameter model, triggering the next round of pile function automatic pile driving test.
[0084] It can be understood that in an embodiment of the present invention, according to the complexity of the test case and the test link, a set of callback functions are set for the pile driving function, and the parameter model (discrete parameter model or continuous parameter model) will be dynamically selected in the callback function according to the test results. The callback function triggers the next round of automatic pile driving test of the pile function, so that complex communication links can be dynamically piled multiple times to complete the test coverage of the entire communication link.
[0085] In complex test cases and test links, the main reason for setting callback functions is to achieve dynamic and flexible test processes. Callback functions do not directly change the content of the stubbing function, but determine the next test behavior based on test results or other conditions. They provide a mechanism that enables the test process to be dynamically adjusted based on previous test results, thereby more realistically simulating complex communication links in actual scenarios.
[0086] In one embodiment of the present invention, step S15 is further included, in which after the test is completed, the obtained output result is compared with the expected output result to form a test report for each test case.
[0087] It is understandable that the present invention will contain the module of pile function and move on the rack, gather the output of pile function by serial ports, then output result is carried out script analysis, generate test report then, can locate rapidly by test report and be that the data of which communication link are wrong, thereby locate the problem quickly.Simultaneously, can cover all communication link data flow to greatest extent test.
[0088] In order to further understand the principle of the method of the present invention, Figure 3 The details of each step of the method of the present invention are described with a specific example:
[0089] First, conduct test requirements analysis, analyze the communication link interface to be tested in the integration test, and generate test cases for the communication link test;
[0090] Suppose you need to test the CAN communication link between the radar module and the decision control module in an intelligent driving system. First, you need to analyze the communication protocol between the two modules and determine key information such as the communication interface, data format, and transmission frequency. Then, based on this information, you can generate a series of test cases, such as:
[0091] Test case 1: The radar module sends normal data, and the decision control module should be able to receive and process it correctly.
[0092] Test case 2: The data sent by the radar module exceeds the normal range, and the decision control module should have an exception handling mechanism.
[0093] Then, develop stub functions based on test cases;
[0094] For the radar module, a stub function needs to be developed to simulate its behavior of sending CAN messages. The prototype of the stub function should be consistent with the actual sending function of the radar module so that it can be seamlessly replaced during integration testing. The stub function will set the input data according to the requirements of the test case and send it out through CANoe.
[0095] Next, select the parameter model and implement bus simulation based on CANoe;
[0096] According to the definition of the CAN matrix, it is necessary to build a discrete parameter model and a continuous parameter model for the communication between the radar module and the decision control module. For test case 1, it is necessary to use a discrete parameter model to generate data within the normal range; for test case 2, it is necessary to use a continuous parameter model to generate data outside the normal range. Use CAPL scripts to call these models to generate CAN signals and simulate bus transmission through the IL interaction layer of CANoe.
[0097] Then, the module to be tested is automatically piled and the communication link test is carried out on the test bench.
[0098] At this point, you need to use Python scripts to write automated stub scripts. Before the test begins, the script replaces the stub function into the radar module source code. Then, according to the requirements of the test case, the script calls the stub function multiple times to send CAN messages and monitor the response of the decision control module. After the test is completed, the script replaces the stub function back to the original function for the next round of testing.
[0099] Next, determine whether the callback function conditions are met, and dynamically adjust the parameter model if they are met;
[0100] A set of callback functions is set in the pile function. When the decision control module responds, CANoe sends the response result to the Python module through the serial port for analysis. According to the analysis result, the Python module triggers the corresponding callback function. For example, if the decision control module correctly handles the data within the normal range (test case 1), the callback function does not perform any operation; if the decision control module fails to correctly handle the data beyond the normal range (test case 2), the callback function adjusts the parameter model from discrete to continuous, and triggers the next round of pile function automatic pile driving test to further observe and judge the behavior of the link.
[0101] Finally, after all tests are completed, a test report is generated. After the test is completed, the Python module will compare the output of each test case with the expected output and generate a detailed test report. The report will list the execution status, test results, error messages and other key information of each test case so that developers can quickly locate and fix problems.
[0102] like Figure 4 FIG. 1 is a schematic diagram showing a structure of an embodiment of a software integration test system based on piling provided by the present invention. Figures 5 to 7 As shown, the software integration test system 1 based on piling includes at least:
[0103] The interface analysis module 10 is used to analyze the communication link interface to be tested in the integration test and generate test cases for the communication link test; wherein the interface analysis module is further used to: based on the communication link interface set to be tested in the integration test, take the data structure on the communication link as a unit, obtain all the variables to be tested involved in each data structure, and generate test cases for the communication link test.
[0104] Stub function acquisition module 11 is used for generating corresponding stub function according to the original function in the source code of the module under test that described communication link is connected, and in each stub function, input and output are set according to test case;
[0105] The bus simulation module 12 is used to construct a parameter model according to the communication link interface to be tested, call the parameter model to generate a bus signal, and realize bus simulation;
[0106] Automatic pile driving test module 13, for under bus simulation environment, adopts test script to carry out automation pile driving test, replaces each original function in each test case with corresponding pile function to carry out automation test, and recovers original function after test finishes;
[0107] The callback processing module 14 is used to dynamically select the parameter model according to the test results, use the callback function pre-set in the pile driving function, trigger the next round of pile function and perform automatic pile driving test.
[0108] In one embodiment of the present invention, it may further include: a test report obtaining unit 15, which is used to compare the obtained output result with the expected output result after the test is completed, and form a test report for each test case.
[0109] like Figure 5 As shown, in a specific example, the bus simulation module 12 includes:
[0110] A CAN matrix establishing unit 120 is used to establish a CAN matrix corresponding to the communication link interface to be tested, wherein the CAN matrix includes the name, ID, data length and value range of each CAN signal;
[0111] The parameter model obtaining unit 121 is used to obtain the value of the CAN signal defined by the CAN matrix, and to construct a discrete parameter model and a continuous parameter model using a CAPL script. The discrete parameter model is used for checking the communication link path, and the continuous parameter model is used for verifying the correctness and boundary of the internal logic of the module to be tested.
[0112] The CAN signal simulation unit 122 is used to start the CANoe simulation environment, use the CAPL script to call the discrete parameter model or the continuous parameter model to generate the CAN signal, and send the CAN signal to the virtual bus.
[0113] like Figure 6 As shown, in a specific example, the automatic piling test module 13 further includes:
[0114] The pile function replacement unit 130 is used to run the automated pile driving script written in advance using Python, automatically replaces the original function interface in each module to be tested in the test case with the corresponding pile function, and tests;
[0115] The original function recovery unit 131 is used to restore each stub function to the corresponding original function after the test is completed.
[0116] like Figure 7As shown, in a specific example, the callback processing module 14 further includes:
[0117] The serial port result analysis unit 140 is used to call the python module, connect to the serial port of the test bench, and analyze the results by reading the serial port output;
[0118] The parameter model adjustment unit 141 triggers different pile function callback functions according to the test results obtained by analysis, and dynamically adjusts the parameter model using the callback function to trigger the next round of pile function automatic pile driving test.
[0119] For more details, please refer to and combine the above Figures 1 to 3 The description is not repeated here.
[0120] As another aspect of the present invention, there is also provided a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the above-mentioned Figures 1 to 3 For more details, please refer to and combine with the above Figures 1 to 3 The description is not repeated here.
[0121] The implementation of the embodiments of the present invention has the following beneficial effects:
[0122] The present invention provides a software integration test method, system and storage medium based on piling. In the integrated test process in the field of intelligent driving, a corresponding pile function is developed for the communication middleware module, and the middleware in the integrated software system is automatically tested through the pile function. And by setting a set of callback functions for each pile function, the test results of the original pile function are analyzed, thereby triggering the callback functions of different pile functions, and performing dynamic parameter model selection, so that complex communication links can be dynamically piled multiple times, thereby verifying the integrity of the communication link and the correctness of the interface; it can achieve precise testing at the interface data level and complete coverage of the communication link, thereby improving the accuracy and reliability of integrated software testing;
[0123] In the present invention, by script realization automation pile driving, for each version to be tested, only need to run automation pile driving script, just can easily generate the pile function of all test cases, simplify the test process of communication link in integrated test, and improve test efficiency.The present invention, with the dimension of communication interface, can be accurate to the flow direction of each variable data on the communication link, greatly improves the accuracy of integrated test by this method of testing.The present invention makes integrated test more automated by dynamically selecting parameter model and pile function callback, makes communication link test coverage higher.
[0124] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0125] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0126] The above disclosure is only a preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A software integration testing method based on piling, characterized in that: The following steps are involved: Analyze the communication link interface to be tested in the integration test and generate test cases for the communication link test; Generate corresponding pile function according to the original function in the source code of the tested module connected according to described communication link, and set input and output in each pile function according to test case; Constructing a parameter model according to the communication link interface to be tested, calling the parameter model to generate a bus signal, and realizing bus simulation; In the bus simulation environment, the test script is used to perform automated stub testing, and each original function in each test case is replaced with the corresponding stub function for automated testing, and the original function is restored after the test is completed; According to the test results, the callback function pre-set in the pile driving function is used to dynamically select the parameter model, trigger the next round of pile function and perform automated pile driving testing.
2. The method according to claim 1, characterized in that The analyzing the communication link interface to be tested in the integrated test and generating a test case for the communication link test further includes: According to the communication link interface set to be tested in the integration test, taking the data structure on the communication link as a unit, all variables to be tested involved in each data structure are obtained, and a test case for the communication link test is generated.
3. The method according to claim 2, characterized in that Constructing a parameter model according to the communication link interface to be tested, calling the parameter model to generate a bus signal, and realizing bus simulation, including: Establishing a CAN matrix corresponding to the communication link interface to be tested, wherein the CAN matrix includes the name, ID, data length and value range of each CAN signal; According to the CAN signal values defined by the CAN matrix, a discrete parameter model and a continuous parameter model are constructed using CAPL scripts; the discrete parameter model is used for spot inspection of the communication link path, and the continuous parameter model is used to verify the correctness and boundaries of the internal logic of the module to be tested; Start the CANoe simulation environment, use the CAPL script to call the discrete parameter model or the continuous parameter model to generate CAN signals, and send the CAN signals to the virtual bus.
4. The method according to claim 3, characterized in that: In the bus simulation environment, the test script is used to perform automated stub testing, replacing each original function in each test case with the corresponding stub function for automated testing, and restoring the original function after the test; including: Run the pre-written automated stub script to automatically replace the original function interface in each module under test in the test case with the corresponding stub function and perform the test; After the test is completed, each stub function will be restored to its corresponding original function.
5. The method according to claim 4, characterized in that: According to the test results, the callback function pre-set in the pile driving function is used to dynamically select the parameter model to trigger the next round of automatic pile driving test of the pile function, including: CANoe is connected to the serial port of the test bench and analyzes the results by reading the serial port output; Different pile function callback functions are triggered according to the test results obtained by the analysis, and the parameter model is dynamically adjusted using the callback function to trigger the next round of pile function automatic pile driving test.
6. A software integration test system based on piling, characterized in that: At least: The interface analysis module is used to analyze the communication link interface to be tested in the integration test and generate test cases for the communication link test; The pile function acquisition module is used for generating corresponding pile functions according to the original function in the source code of the tested module connected according to the communication link, and setting input and output in each pile function according to the test case; A bus simulation module is used to construct a parameter model according to the communication link interface to be tested, call the parameter model to generate a bus signal, and realize bus simulation; The automatic pile test module is used to perform automatic pile test using test scripts in a bus simulation environment, replace each original function in each test case with the corresponding pile function for automatic testing, and restore the original function after the test is completed; The callback processing module is used to dynamically select the parameter model according to the test results, use the callback function pre-set in the pile driving function, trigger the next round of pile function and perform automated pile driving testing.
7. The system according to claim 6, characterized in that The interface analysis module is further used for: According to the communication link interface set to be tested in the integration test, taking the data structure on the communication link as a unit, all variables to be tested involved in each data structure are obtained, and a test case for the communication link test is generated.
8. The system according to claim 7, characterized in that The bus simulation module comprises: A CAN matrix establishing unit, used to establish a CAN matrix corresponding to the communication link interface to be tested, wherein the CAN matrix includes the name, ID, data length and value range of each CAN signal; The parameter model acquisition unit is used to obtain the value of the CAN signal defined by the CAN matrix, and use the CAPL script to build a discrete parameter model and a continuous parameter model; the discrete parameter model is used for the inspection of the communication link path, and the continuous parameter model is used to verify the correctness and boundary of the internal logic of the module to be tested; The CAN signal simulation unit is used to start the CANoe simulation environment, use the CAPL script to call the discrete parameter model or the continuous parameter model to generate the CAN signal, and send the CAN signal to the virtual bus.
9. The system according to claim 8, characterized in that The automatic piling test module includes: The stub function replacement unit is used to run the pre-written automatic stub script to automatically replace the original function interface in each module to be tested in the test case with the corresponding stub function and perform the test; The original function recovery unit is used to restore each stub function to the corresponding original function after the test is completed.
10. The system according to claim 9, characterized in that: The callback processing module includes: The serial port result analysis unit is used to connect CANoe to the serial port of the test bench and analyze the results by reading the serial port output; The parameter model adjustment unit triggers different pile function callback functions according to the test results obtained by analysis, and dynamically adjusts the parameter model using the callback function to trigger the next round of pile function automatic pile driving test.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Cited By
Simulation verification method for recoverable rocket software algorithm and electronic equipment
CN122412268A
