WO2023197128A1 - Test method and control apparatus - Google Patents

Test method and control apparatus Download PDF

Info

Publication number
WO2023197128A1
WO2023197128A1 PCT/CN2022/086219 CN2022086219W WO2023197128A1 WO 2023197128 A1 WO2023197128 A1 WO 2023197128A1 CN 2022086219 W CN2022086219 W CN 2022086219W WO 2023197128 A1 WO2023197128 A1 WO 2023197128A1
Authority
WO
WIPO (PCT)
Prior art keywords
function
external interface
test
module
functional module
Prior art date
Application number
PCT/CN2022/086219
Other languages
French (fr)
Chinese (zh)
Inventor
陈升辉
周慧强
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2022/086219 priority Critical patent/WO2023197128A1/en
Priority to CN202280004994.7A priority patent/CN117222983A/en
Publication of WO2023197128A1 publication Critical patent/WO2023197128A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication

Definitions

  • the present application relates to the field of testing technology, and more specifically, to a testing method and a control device.
  • MCU microcontroller unit
  • CAN controller area network
  • logs logs
  • voltage etc.
  • writing temporary code test stubs to determine whether the test results are in line with expectations.
  • Testers can directly call the external interface function of the functional module without writing corresponding test stubs, and solve the problem that the external interface function of the functional module cannot complete the functional test due to the lack of a caller.
  • This problem solves the problem of difficulty in conducting end-to-end testing of functional modules in the control device that rely on calls from other functional modules; at the same time, it helps improve the testability of the control device.
  • a testing method includes: obtaining function callback information of a functional module.
  • the function callback information includes a calling address of at least one external interface function of the functional module.
  • the testing of the functional module relies on calls from other functional modules.
  • At least one external interface function wherein at least one external interface function is used to test the functional module; obtain a test command line, the test command line includes function call address information, the function call address information is used to indicate at least testing of the above functional module
  • the calling address of an external interface function in response to the above test command line, call at least part of at least one external interface function to test the above functional module.
  • the functional module may be a module integrated in a control device, and the control device may be an MCU.
  • transportation may include one or more different types of transportation vehicles that operate or move on land (e.g., highways, roads, railways, etc.), water (e.g., waterways, rivers, oceans, etc.) or in space Or movable objects.
  • vehicles may include cars, bicycles, motorcycles, trains, subways, airplanes, ships, aircraft, robots, or other types of transportation vehicles or movable objects.
  • the above function callback information may be actively issued during the initialization process of the function module, or may be passively issued by the function module through a request operation after the function module is initialized.
  • the above function callback information can also include additional information, such as the number of input parameters of the external interface function, the data type of the input parameters, the value range information of the input parameters, and the default parameters, etc., for auxiliary function modules A call to at least one external interface function.
  • test command line also includes parameter values that specify the external interface function.
  • the external interface function needs to input corresponding parameters so that the function module can complete the execution of the corresponding function.
  • testers can directly call the external interface function of the functional module without writing corresponding test stubs, solving the problem that the external interface function of the functional module cannot complete the functional test due to the lack of a caller, thus solving the problem. It is difficult to conduct end-to-end testing of functional modules in the control device that rely on calls from other functional modules; at the same time, it helps to improve the testability of the control device.
  • the proxy function is enabled, wherein when the proxy function is enabled, at least one external interface function is called according to the test command line.
  • the function calling address information includes the calling address of the first external interface function; the calling address of the first external interface function matches the calling address of at least one external interface function successfully. Finally, calling at least part of at least one external interface function to test the function module.
  • the first external interface function may be one or more external interface functions that need to be called to test the above functional module, that is, the first external interface function may be an external interface function or a set of external interface functions, where Includes multiple external interface functions.
  • the test command line can be discarded, or stored in a specified location, and then cleared periodically.
  • the matching failure information can also be returned and the matching failure information can be sent to the external access device.
  • the above-mentioned external access device can be a controller area network open environment (controller area network open environment, CANoe), system on chip (system on chip, SOC), etc.
  • controller area network open environment controller area network open environment, CANoe
  • system on chip system on chip, SOC
  • the test command line includes parameter values
  • the parameter value after the calling address of the first external interface function successfully matches the calling address of at least one external interface function, the parameter value also needs to be input into the at least one external interface function.
  • the function call address information includes an identification of the functional module; according to the identification of the functional module, at least one external interface function of the functional module is called to perform the function on the functional module. test.
  • the function call address information includes the identifier of the specified functional module
  • all or part of the external interface functions in at least one external interface function of the functional module can be called directly according to the identifier of the functional module.
  • the call to at least one external interface function of the functional module is not limited to the call based on the calling address of the first external interface function included in the function calling address information. It can also call at least one external interface function of the functional module through the identification of the functional module. An external interface function is called, thereby improving the flexibility of testing the control device; helping to improve the testability of the control device.
  • the function callback information also includes value range information of the input parameters of the first external interface function
  • the test command line includes the parameter values of the first external interface function.
  • the value range information may be a parameter value interval.
  • the above-mentioned parameter value is within the parameter value interval, it means that the above-mentioned parameter value and the above-mentioned value range information are successfully matched, and the above-mentioned at least one external Interface functions are called.
  • the above-mentioned parameter value is outside the parameter value range, it means that the above-mentioned parameter value fails to match the above-mentioned value range information, and the above-mentioned at least one external interface function cannot be called.
  • the accuracy of calling at least one external interface function of the functional module can be improved, and functional module test abnormalities caused by incorrect calling of external interface functions can be reduced.
  • a test command line sent by the external access device is obtained.
  • the above test command line can also be obtained from inside the control device.
  • the control device locally stores the test code, and the code includes the test command line. Therefore, the locally stored test command line can also be obtained to enable the response.
  • the test command line call at least part of at least one external interface function to test the function module.
  • the test command line can be obtained through multiple channels, making the method of testing the control device more flexible.
  • test results of the functional modules are sent to the external access device.
  • test results of the external interface function of the above functional module can be a series of parameter values, or a string presented by printing, for example, the name of the target external interface function, the parameter name and its value output by the function.
  • a control device in a second aspect, includes: a first acquisition unit for acquiring function callback information of a functional module.
  • the function callback information includes the calling address of at least one external interface function of the functional module.
  • the test of the module relies on other functional modules to call at least one external interface function, where at least one external interface function is used to test the functional module;
  • the second acquisition unit is used to obtain a test command line, which includes function call address information , the function call address information is used to indicate the calling address of at least one external interface function for testing the above-mentioned functional module;
  • the test unit is used to respond to the above-mentioned test command line, call at least part of the at least one external interface function to perform the above-mentioned functional module test.
  • the functional module may be a module integrated in a control device, and the control device may be an MCU.
  • the above function callback information may also include additional information, such as the number of input parameters of the external interface function, the data type of the input parameters, the value range information of the input parameters, and the default parameters, etc., for auxiliary functions.
  • additional information such as the number of input parameters of the external interface function, the data type of the input parameters, the value range information of the input parameters, and the default parameters, etc., for auxiliary functions.
  • test command line also includes parameter values that specify the external interface function.
  • the external interface function needs to input corresponding parameters so that the function module can complete the execution of the corresponding function.
  • the above test unit is also used to confirm that the proxy function is enabled, wherein when the proxy function is enabled, at least one external interface function is called according to the test command line.
  • the function calling address information includes the calling address of the first external interface function; the calling address of the first external interface function matches the calling address of at least one external interface function successfully.
  • the above-mentioned test unit is specifically used to call the first external interface function to test the functional module.
  • the first external interface function may be an external interface function that needs to be called to test the above functional module.
  • the first external interface function may be an external interface function or a function set including multiple external interface functions.
  • the test unit can discard the test command line, or store it in a specified location, and then clear it regularly.
  • the test unit can also return matching failure information and send the matching failure information to the external access device.
  • test command line includes parameter values
  • the above-mentioned test unit also needs to input the parameter value to the at least one external interface. in function.
  • the function call address information includes the identification of the functional module; the above-mentioned test unit is specifically used to call the above-mentioned at least one external interface function to perform the function module according to the identification of the functional module. test.
  • the above-mentioned test unit can directly call all or part of the external interfaces in at least one external interface function of the functional module based on the functional module identifier. function.
  • the function callback information also includes value range information of the input parameters of the first external interface function
  • the test command line includes the parameter values of the first external interface function.
  • the above test The unit is specifically configured to determine that the parameter value matches the value range information before calling at least part of the at least one external interface function to test the functional module.
  • the value range information may be a parameter value interval.
  • the above-mentioned parameter value is within the parameter value interval, it means that the above-mentioned parameter value and the above-mentioned value range information are successfully matched, and the above-mentioned test unit can perform the above-mentioned At least one external interface function is called.
  • the above-mentioned parameter value is outside the parameter value range, it means that the above-mentioned parameter value fails to match the above-mentioned value range information, and the above-mentioned test unit cannot call the above-mentioned at least one external interface function.
  • the above-mentioned second obtaining unit is specifically configured to obtain the test command line sent by the external access device.
  • the above-mentioned test command line can also be directly obtained internally from the control device by the second acquisition unit.
  • the control device locally stores the test code, and the code includes the test command line. Therefore, the second acquisition unit can also obtain the locally stored test code.
  • the test command line enables the above test unit to respond to the test command line and call at least part of at least one external interface function to test the functional module.
  • control device further includes a sending unit configured to send test results of the functional module to an external access device.
  • test results of the external interface function of the above functional module can be a series of parameter values, or a string presented by printing, for example, the name of the target external interface function, the parameter name and its value output by the function.
  • a control device including a memory for storing computer instructions; and a processor for executing the computer instructions stored in the memory, so that the device executes any one of the method designs of the first aspect. Methods in possible implementations.
  • a fourth aspect provides a micro control unit, including the control device of the second aspect.
  • a computer storage medium is provided.
  • Computer instructions are stored in the computer storage medium. When the instructions are executed on a computer, they cause the computer to execute the method in any possible implementation of the method design of the first aspect. .
  • a chip including a processor configured to execute the method in any possible implementation of the method design of the first aspect.
  • the chip may be a baseband chip.
  • a seventh aspect provides a computer program product.
  • the computer program code or instructions are executed on a computer, the computer executes the method in any possible implementation of the method design of the first aspect.
  • Figure 1 is a schematic diagram of an existing MCU function module testing logic provided by an embodiment of the present application.
  • Figure 2 is a schematic diagram of the architecture of a control device provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of another control device architecture provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of another control device architecture provided by an embodiment of the present application.
  • Figure 5 is a schematic flow chart of a testing method provided by an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of the proxy module calling the external interface function of the function module provided by the embodiment of the present application.
  • Figure 7 is a schematic diagram of the later maintenance of the agent module provided by the embodiment of the present application.
  • FIG. 8 is a schematic block diagram of a control device 800 provided by an embodiment of the present application.
  • a microcontroller unit also known as a single-chip microcomputer or single-chip microcomputer, appropriately reduces the frequency and specifications of the central processing unit (CPU), and combines memory, counters, and universal serial bus (USB) Peripheral interfaces such as analog-to-digital converters, universal asynchronous receivers and transmitters, programmable logic controllers, and direct memory access controllers are all integrated on a single chip to form a chip-level computer that can perform different combinations of controls for different applications.
  • the characteristic of MCU is that it generally does not support complex systems running multiple tasks. When testing a specific functional module among the multiple interrelated functional modules of a traditional MCU, it is usually necessary to call the external interface functions of other functional modules, or its own external interface functions are called by other functional modules, in order to realize the function of the functional module. test.
  • Secondary development refers to customizing and modifying existing software, extending functions, and realizing the functions required by developers. This process usually does not change the core of the original system. It should be understood that the executor of secondary development can be one party or multiple parties. Taking the above-mentioned MCU functional module development as an example, an MCU including basic functions can be provided to one customer for secondary development and expansion of MCU functions, or it can be provided to multiple customers for secondary development and expansion on top of it. MCU functions, and the functional modules secondary developed by multiple customers are usually related to each other. It can be seen that in this case, the problem of the above-mentioned MCU being unable to implement end-to-end testing of this functional module due to the fact that the interrelated business modules have not yet been developed will be particularly obvious.
  • Hard coding refers to a method of replacing a variable variable with a fixed value. In hard coding, if you want to modify a certain function, you must modify the source code, which lacks flexibility. Therefore, after compiling with hard coding, it is very difficult to change the fixed variable value later.
  • the existing method of testing MCU is that the tester writes the test code through hard coding according to the requirements of the test document and burns it into the MCU to run, so that the MCU function module receives the test command included in the test code when the code is running. Call all external interface functions that need to be called by the test function module. Since the test command needs to be implemented in a hard-coded manner, the input parameters of the external interface function in the test command are all fixed values. If the above-mentioned external interface function input parameters need to be changed, the tester needs to rewrite the test code and change the above-mentioned interface function input parameters. , and then burn the modified test code into the MCU for secondary testing.
  • a stub function refers to a function that replaces the function of the original function, so that the functional module under test can be isolated from the functional modules it depends on during the testing process. For example, in the existing MCU testing method, if this functional module has been developed, but in the process of testing this functional module, it is necessary to call the external interface function of other functional modules to obtain the output results of the external interface function, and other functions If the module has not developed its external interface function, the tester can write a test stub and add a simple implementation of the external interface function to the test stub. When this function module executes the function, the external interface function in the test stub is called to obtain the corresponding The output results are used to assist this functional module in completing the test.
  • Figure 1 is a schematic diagram of an existing MCU function module testing logic provided by an embodiment of the present application.
  • Function module A is a basic function module
  • function module B is an advanced function developed based on the functions of function module A
  • function module C is an advanced function developed based on the functions of function module B.
  • the prerequisite for calling the external interface function of the function module may be: the calling address of the external interface function and the corresponding external interface function input parameters are known.
  • prerequisites to be considered when calling the external interface function of the function module may also include determining the following information: the number of input parameters of the external interface function, parameter type, parameter value range, etc.
  • additional information such as parameter defaults may also be included, which is not limited in this application.
  • the tester should write the test code through hard coding according to the external interface function calling method for the corresponding function of the function module given in the product test manual, and burn the test code into the MCU. During the operation of the MCU, , call the external interface function of the specified function module, so that the function module can perform the corresponding function and realize the test of the function module.
  • the MCU can only implement the functional module A, the functional module B, and the functional module C after they are all developed. Testing of Function Module A or Function Module B, that is, for the above scenario, at this stage, it is not possible to conduct independent end-to-end testing of Function Module A or Function Module B. If you need to test function module A, you need to first execute the corresponding function of function module B to call the external interface function of function module A so that function module A can perform the corresponding function. Furthermore, to execute the corresponding function of function module B, function module C also needs to call the external interface function of function module B. Otherwise, the test of function module A still cannot be implemented.
  • embodiments of the present application provide a testing method that calls the external interface function of the functional module through the proxy module, making each functional module with functional dependencies independent of each other, and solving the problem that the external interface function of the functional module cannot be executed due to the lack of the caller.
  • the corresponding function solves the problem of being unable to complete the test.
  • it enables independent end-to-end testing of functional modules in the MCU that rely on calls from other functional modules; it also helps to improve the testability of the MCU.
  • the channel module parses the test command input by the tester from the external access device, parses it into a test command line that can be recognized by the agent module, and distributes it to the above-mentioned agent module.
  • the above-mentioned agent module performs functions on the functional module based on the test command line. test. Therefore, testers can repeatedly change the MCU external interface function calling sequence, frequency and input parameters by arranging test commands, thereby achieving path coverage testing of MCU functions, avoiding testers from repeatedly modifying the test code and repeatedly burning the test code. The process of recording to MCU.
  • FIG. 2 shows a schematic diagram of the architecture of a control device provided by an embodiment of the present application.
  • the control device includes function modules, agent modules, channel modules and external access equipment.
  • the control device architecture includes multiple functional modules, and each functional module has an agent module corresponding to it.
  • the function module is used to implement specific business functions of the control device, send function callback information to the agent module, and provide its own external interface functions for testing.
  • the above function callback information includes the calling address of the external interface function, and may also include at least one of the following: the number of input parameters of the external interface function, the data type of the input parameters, and the value range of the input parameters. Information, used to assist in calling external interface functions.
  • the functional module may be a functional module that has been developed, or a functional module whose specific functions have not yet been developed. Even if its specific functions have not yet been developed, it can still provide its own external interface functions.
  • the tester can The transmission status of the data stream after calling the external interface function can also complete the preliminary test of the corresponding function.
  • the proxy module is used to obtain the function callback information of the function module, and in response to the test command line, call at least some of the external interface functions of at least one external interface function to test the function module.
  • the test command line includes function calling address information, and the function calling information may include the calling address of the first external interface function.
  • the first external interface function may be one or more external interface functions that need to be called in the functional module.
  • the agent module can call one or more external interface functions of the functional module according to the calling address of the first external interface function to complete the test of the functional module. It should be understood that when specifying that an external interface function needs to pass in parameters, the test command line also needs to include the corresponding parameter values, and the proxy module needs to input the parameter values into the external interface function.
  • agent module can also be used to send the test results output from the function module corresponding to the called external interface function to the channel module, and send the test results to the external access device through the channel module. It should be understood that the agent module can also directly send the above test results to the external access device, depending on the specific control device architecture. For example, if the control device does not have a channel module, the agent module can directly communicate with the external access device. This application The embodiment does not limit this.
  • the agent module can only call one external interface function in the functional module according to the above test command line, or it can call multiple external interface functions in the functional module. That is, the above test command line can be used to call one external interface function. , can also be used to call multiple external interface functions, which is not limited in this application.
  • the channel module is a module that establishes communication with external access devices and is used to receive test commands input by testers through external access devices.
  • the external interface functions and parameter values included in the test commands can be changed based on the tester's wishes. , thus avoiding the process of repeatedly burning test code.
  • the channel module can also be used to parse the test command into a test command line that can be recognized by the agent module, and distribute the test command line to each agent module.
  • test command can be input to the channel module in the form of a string, but the data it carries, such as the parameter value of the external interface function input parameter, actually has a specific data type, such as integer, floating Point type, Boolean type, etc. Therefore, the channel module can parse the test command in the form of a string into a set of test command lines including the external interface function address and specific data type parameters. This test command line can be recognized by the agent module and is used by the agent module to call the external interface of the function module. function.
  • the function of the channel module can be a separately established module as shown in Figure 2, dedicated to real-time communication between the control device and external access equipment, and test command parsing. It may also be a sub-module integrated in the agent module, which is not limited in this application. For convenience of description, the embodiments of this application are described in the form of independent deployment of the agent module and the channel module.
  • the external access device is used to establish contact with the control device and is a device for testers to input test commands to the control device.
  • the external access device can be CANoe, SOC, etc.
  • the external access device can also directly send the above-mentioned test command line to the control device.
  • the above-mentioned channel module does not need to parse the test command line.
  • the test command line can be directly sent to the agent module for function Calling of the external interface function of the module.
  • one agent module can also correspond to multiple functional modules.
  • Figure 3 shows a schematic diagram of another control device architecture provided by an embodiment of the present application
  • Figure 4 shows Another schematic diagram of the control device architecture provided by the embodiment of the present application, or multiple channel modules are added to the above-mentioned control device architecture.
  • the embodiment of the present application does not limit the specific deployment method of each module. For convenience of description, the embodiment of the present application is mainly described based on the control device architecture in FIG. 2 .
  • a bench used for vehicle testing can input test commands to the control device in the above embodiment through the above-mentioned external access device.
  • control device may be an MCU or other control device, which is not limited in this application.
  • the proxy module can directly call the external interface function to prevent the corresponding external interface function of the functional module from being called by other functional modules, causing the problem that the functional module cannot be tested, and it is difficult to Aiming at the problem of end-to-end testing of function modules in control devices that rely on calls from other function modules.
  • This functional module has been developed, and the execution of the corresponding functions of this functional module requires other functional modules to call the designated external interface function of this functional module to complete the functional test.
  • other functional modules have not yet been developed. Therefore, the designated external interface function of this functional module lacks a caller and the test cannot be completed.
  • This functional module has been developed, and the execution of the corresponding functions of this functional module requires other functional modules to call the designated external interface function of this functional module in order to complete the functional test.
  • Other functional modules have been developed, and the test of this functional module Testing must be completed through joint debugging with other functional modules, and end-to-end testing cannot be performed on this functional module alone.
  • Figure 5 shows a schematic flow chart of a testing method provided by an embodiment of the present application.
  • the execution subject of the test method is the above-mentioned control device, and specific functions can be implemented by the agent module and the channel module included in the control device.
  • the function callback information includes the calling address of at least one external interface function of the functional module.
  • the test of the functional module relies on other functional modules to call at least one external interface function.
  • the at least one external interface function Used to test this functional module.
  • test of this functional module depends on other functional modules calling at least one external interface function of this functional module, so that the functional module can execute the corresponding function to complete the functional test.
  • the proxy module obtains the function callback information of the functional module.
  • the functional module actively sends the function callback information to the proxy module, so that the proxy module obtains the function callback information.
  • the agent module can actively request to obtain the function callback information of the functional module during system operation, which is not limited in this application.
  • the proxy module can correspond to one functional module or multiple functional modules, so the proxy module can receive multiple pieces of function callback information from one or more functional modules.
  • the embodiments of the present application do not limit this.
  • the function callback information may also include additional information, such as the number of input parameters of the external interface function, the data type of the input parameters, the value range information of the input parameters, and the default parameters, etc. This application does not limit this. .
  • test command line includes function calling address information, where the function calling address information is used to indicate the calling address of at least one external interface function of the test function module.
  • the obtained test command line may be generated by the channel module parsing the test command sent from the external access device, may be obtained directly from the external access device, or may be obtained from inside the control device.
  • the channel module first obtains the test command from the external access device, and parses the test command into a set of test command lines including the external interface function address and specific data type parameters, and the test command line can be obtained and directly recognized by the agent module .
  • the control device stores test code locally, and the code includes a test command line. Therefore, the agent module can also obtain the locally stored test command line.
  • the external access device directly sends the test command line, so that the agent module can directly obtain the test command line from the external access device.
  • the test command line includes function call address information, or function call address information and parameter values.
  • the function calling address information includes the calling address of the designated external interface function, or the identification of the designated function module.
  • the function calling address information includes the calling address of the first external interface function
  • the first external interface function is one or more external interface functions that need to be called when testing the functional module
  • the function module can be called based on the calling address.
  • the test command line must also include the corresponding parameter values.
  • the proxy module needs to input the parameter values into the external interface function so that the functions corresponding to the external interface function can be executed. , and then complete the test of the functional module.
  • the agent module can directly call all or part of the external interface functions of at least one external interface function of the functional module based on the functional module identifier, This enables the functions corresponding to the external interface functions to be executed, thereby completing the test of the functional module.
  • the proxy module can be a code module in terms of technical implementation, the proxy module can also be a function, and also has a unique calling address, so the proxy module needs to issue its calling address before receiving the test command line.
  • the channel module when the channel module parses the externally input test command into a test command line that can be recognized by the agent module, it can send the test command line to the agent module based on the address information.
  • the agent module before the above S510, the agent module also needs to confirm whether the agent function is turned on.
  • the agent module can receive the test command line from the channel module and call the external interface function specified by the function module, that is, to achieve Each functional module in the control device can be tested individually end-to-end.
  • the agent module cannot receive the test command line from the channel module and cannot call the external interface function specified by the function module. That is, at this time, only the joint debugging test of the function module in the control device can be performed.
  • the information about turning on or off the agent function can also be sent to the channel module together with the calling address of the agent module before the agent module receives the test command line.
  • the channel module distributes the information.
  • testers can control the function of the designated agent module to be turned on or off according to test requirements.
  • the channel module before the channel module sends the test command line to the agent module, the channel module receives the test command sent by the external access device and parses the test command.
  • the process of parsing the test command is the process of converting the test command into a test command line that can be recognized by the agent module.
  • the test command input by the external access device is presented in the form of a string, and the string carried Data usually has special data types, such as integers, floating point, etc. Therefore, after the control device receives the test command, it needs to parse the test command and generate a test command line that can be recognized by the agent module, so that the agent module The specified external interface function of the function module can be called through the test command line.
  • the external access device can also directly send the above test command line to the control device, which is not limited in the embodiments of the present application.
  • agent module and channel module can be integrated into one module, or they can be two independent modules, which is not limited in this application.
  • testers can directly call the external interface function of the functional module without writing corresponding test stubs, solving the problem that the external interface function of the functional module cannot complete the functional test due to the lack of a caller.
  • the channel module enables data communication between the control device and the external access device, that is, the test command can be directly sent to the control device through the external access device, without burning the test code to the control device, so that the control device can obtain Test command.
  • test commands are usually recorded in the test instructions, and the tester sends test commands that meet the requirements of the test case to the channel module through the external access device according to the test case.
  • Test commands can be of the following form:
  • the function module includes a function module that specifies the calling address and parameter value of the external interface function.
  • the test command line generated after parsing by the channel module includes the calling address and parameter values of the first external interface function.
  • the above test command line for calling the external interface function may not include the parameter value, or the parameter value may be empty, for example, "null" or this attribute does not exist accordingly.
  • the data may not include the parameter value, or the parameter value may be empty, for example, "null" or this attribute does not exist accordingly.
  • test command line may also include other additional information, for example, whether the parameter value of the first external interface function in the test command line is consistent with the value range information of the first external interface function input parameter included in the function callback information. Therefore, the additional information can also be used by the proxy module to determine whether the test command line can call the external interface function of the specified function module, which is not limited in this application.
  • the channel module can parse the test command sent from the external access device in the following manner:
  • test command line can be of the following form:
  • the channel module when there are multiple agent modules in the control device, that is, one channel module corresponds to multiple agent modules, the channel module needs to distribute the test command line generated by the above analysis to all corresponding agent modules.
  • the above test command may also include the address information of the designated proxy module.
  • the channel module parses the test command, it can determine whether to receive the parsed and generated test command line. proxy module, thus avoiding the waste of resources caused by sending the parsed test command line to all proxy modules.
  • testers can arrange test commands to arrange the calling sequence, frequency and parameters of the external interface function of the function module, thereby achieving path coverage testing of the function module function and avoiding the need for testing.
  • the personnel repeatedly modified the test code and repeatedly burned the test code into the control device.
  • the agent module After the channel module sends a test command line to the agent module, the agent module needs to determine whether it is necessary to call the specified external interface function of the function module based on various information included in the test command line.
  • FIG. 6 shows a schematic flowchart of the proxy module calling the external interface function of the functional module provided by the embodiment of the present application.
  • the agent module matches the test command line and the function callback information to determine whether the test command line can be used to call the specified external interface function. If the matching is successful, go to S620; if the matching fails, go to S630.
  • the proxy module can generate an external interface function library based on the calling address of at least one external interface function included in the function callback information.
  • the library stores the calling conditions of the at least one external interface function, and the calling conditions are at least It must have the calling address of the external interface function.
  • additional information such as the number of function input parameters, parameter data types, input parameter value ranges, etc. The embodiments of this application do not limit the content of the additional information.
  • S620 The agent module calls the specified external interface function, and inputs the parameter values included in the test command line into the external interface function to complete the calling of the external interface function.
  • the agent module needs to determine whether the parameter value matches the value range information.
  • each parameter value included in the test command line is input into the external interface function, the call of the external interface function is completed, the function module executes the corresponding function, and the test result is output.
  • the proxy module does not need to input parameter values into the external interface function, and the successfully matched test command line in S610 may not include parameter values.
  • S630 The agent module terminates this call to the external interface function of the function module.
  • the agent module when the matching fails, can discard the test command line, or store it in a designated location, and then clear it regularly. This is not limited in the embodiments of this application.
  • the agent module can also return matching failure information and send the matching failure information to the channel module, which transmits it to the external access device through the channel module to prompt the tester to self-check the test command.
  • S640 The agent module receives the test results from the function module and forwards the test results to the channel module.
  • the above matching failure information or test results can be sent to the channel module, and then the channel module sends it to the external access device.
  • the proxy module also has the function of communicating with the external access device, for example, The function of the channel module is integrated in the proxy module, and can also be directly sent to the external access device through the proxy module.
  • the embodiments of this application are not limited to this, but ultimately the above matching failure information or test results are sent to the external access device. equipment.
  • test results can also be directly sent to the channel module through the functional module, which is not limited in this application.
  • test results of the external interface function of the above functional module can be a series of parameter values, or a string presented by printing, for example, the name of the target external interface function, the parameters output by the function and their values.
  • testers can directly call the external interface functions of the functional module without writing corresponding test stubs, solving the problem of the external interface function of the functional module being unable to complete the functional module test due to the lack of a caller, thereby solving the difficulty of testing the functional module. Aiming at the problem of end-to-end testing of functional modules in the control device that rely on calls from other functional modules; at the same time, it helps to improve the testability of the control device.
  • Figure 7 shows a schematic diagram of the later maintenance of the agent module provided by the embodiment of the present application.
  • the function of function module A in Figure 7 needs to be tested.
  • the execution of this function requires function module B to call the external interface function of function module A.
  • function module B since functional module B has not completed development, it is necessary to call the designated external interface function of functional module A according to the test command line through proxy module A, so that functional module A can perform the corresponding functions.
  • the development of functional module B since functional module B can call the designated external interface function of functional module A, and the control device only has these two functional modules, the development of these two functional modules has been completed. At this time, you can Turn off the proxy function of proxy module A, or delete proxy module A directly.
  • control device architecture proposed in the embodiment of the present application is more flexible. According to the development status of each functional module in the control device, designated agent modules can be independently added, deleted, turned on or off.
  • the existing testing method is to jointly debug the interdependent functional modules, and cannot individually target a certain functional module that relies on other functional modules in the function deployment of the control device. Conduct end-to-end testing individually.
  • both functional module A and functional module B have been developed.
  • the function of functional module A is to obtain rainfall, and the function of functional module B is to determine the wiper swing frequency. At this time, the function of function module A needs to be tested.
  • the existing test method is to run the function of function module B to determine the wiper passive frequency.
  • function module B calls the designated external interface function of function module A to make the function Module A turns on the function of obtaining rainfall, and then returns the rainfall value.
  • the proxy module can directly call the designated external interface function of functional module A to test functional module A separately without the need for Conduct joint debugging with function module B.
  • the test process is simplified, and end-to-end testing can be carried out individually for the function modules that the control device depends on calling other function modules.
  • each functional module usually needs to output the status of the code execution by printing a log during the process of executing the specified function code, so as to facilitate subsequent When a function module fails, locate the fault.
  • all functional modules need to be jointly debugged. In this process, the number of print logs generated by each module is huge, and the test The workload of personnel fault location is relatively large.
  • testers can open the proxy module corresponding to the functional module, directly call the designated external interface function of the functional module through the proxy module, run the corresponding functional code, and generate a print log.
  • control device proposed in this application is more convenient for testers to conduct maintenance tests on each functional module individually in the later stage. .
  • Embodiments of the present application also provide a control device for implementing any of the above methods.
  • a control device including a unit (or means) for implementing any of the above methods is provided.
  • FIG 8 shows a schematic block diagram of a control device 800 provided by an embodiment of the present application.
  • the control device 800 includes:
  • the first obtaining unit 810 is used to obtain the function callback information of the functional module.
  • the function callback information includes the calling address of at least one external interface function of the functional module.
  • the test of the functional module relies on other functional modules to call at least one external interface function. At least one external interface function is used to test the functional module.
  • the second acquisition unit 820 is configured to receive a test command line, where the test command line includes function call address information, where the function call address information is used to indicate the call address of at least one external interface function of the test function module;
  • the function of the first acquisition unit 810 can be implemented by the agent module in the above embodiment, and the function of the second acquisition unit 820 can be implemented by the channel module in the above embodiment.
  • the testing unit 830 is configured to respond to the test command line by calling at least part of at least one external interface function to test the functional module.
  • test unit 830 is specifically configured to confirm that the proxy function is enabled.
  • the proxy function is enabled, at least one external interface function is called according to the test command line.
  • test unit 830 is specifically configured to match the calling address of the first external interface function included in the function calling address information with the calling address of the at least one external interface function. After the matching is successful, call the first external interface function. Test functional modules.
  • the test unit 830 is also specifically configured to determine the parameter. The value matches the value range information.
  • test unit 830 can be implemented by the agent module in the above embodiment.
  • the second obtaining unit 820 is also specifically configured to obtain the test command line sent by the external access device. It should be understood that the external access device can also directly send the test command line to the control device.
  • the sending unit 840 is used to send the test results of the functional module to the external access device.
  • the function of the sending unit 840 can be implemented by the channel module in the above embodiment.
  • the embodiment of the present application also provides an MCU, and further provides a vehicle-mounted unit MCU.
  • the MCU includes the control device 800 mentioned above.
  • a component may be, but is not limited to, a process, a processor, an object, an executable file, a thread of execution, a program and/or a computer running on a processor.
  • applications running on the computing device and the computing device may be components.
  • One or more components can reside in a process and/or thread of execution and a component can be localized on one computer and/or distributed between 2 or more computers. Additionally, these components can execute from various computer-readable media having various data structures stored thereon.
  • a component may, for example, be based on a signal having one or more data packets (eg, data from two components interacting with another component, a local system, a distributed system, and/or a network, such as the Internet, which interacts with other systems via signals) Communicate through local and/or remote processes.
  • data packets eg, data from two components interacting with another component, a local system, a distributed system, and/or a network, such as the Internet, which interacts with other systems via signals
  • the disclosed systems, devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or the part that contributes to the existing technology 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, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program code. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The present application relates to the technical field of test, and provides a test method and a control apparatus. The method may comprise: obtaining function callback information of a functional module, the function callback information comprising a calling address of at least one external interface function of the functional module, a test for the functional module depending on another functional module calling the at least one external interface function, and the at least one external interface function being used for testing the functional module; receiving a test command line, the test command line comprising function calling address information, and the function calling address information being used for indicating the calling address of the at least one external interface function for testing the functional module; and in response to the test command line, calling at least part of the at least one external interface function to test the functional module. The technical solution of the present can be applied to an intelligent vehicle or an electric vehicle, and is beneficial to improving the testability of the control apparatus applied to the intelligent vehicle or the electric vehicle.

Description

一种测试方法和控制装置A test method and control device 技术领域Technical field
本申请涉及测试技术领域,并且更具体地,涉及一种测试方法和控制装置。The present application relates to the field of testing technology, and more specifically, to a testing method and a control device.
背景技术Background technique
随着车辆的智能化程度越来越高,微控制单元(microcontroller unit,MCU)作为智能车载设备的常用芯片,由于MCU具有高功能安全属性,所以MCU需要支持在其上的源码二次开发能力。但是,MCU主要调试方式是通过调试器直接烧录源码,以打点、操作内存或者编写临时代码测试桩的方式,观察其外部输出如控制器局域网(controller area network,CAN)、日志、电压等变化,从而判断测试结果是否符合预期。As vehicles become more and more intelligent, microcontroller unit (MCU) is a commonly used chip for intelligent vehicle equipment. Since MCU has high functional safety attributes, MCU needs to support secondary development capabilities of source code on it. . However, the main debugging method of MCU is to directly burn the source code through the debugger, and observe changes in its external output such as controller area network (CAN), logs, voltage, etc. by running points, operating memory, or writing temporary code test stubs. , to determine whether the test results are in line with expectations.
当测试MCU功能模块时,通常需要其他功能模块调用该模块的外部接口函数,方可使该模块执行相应功能。在这种情况下,若其他功能模块未开发完成,则无法对本功能模块进行测试。此时就需要测试人员编写相应的临时代码,烧录到MCU中,以保证该模块的外部接口函数能够被调用。但是测试过程中如需要修改外部接口函数的入参,就需要修改临时代码,将临时代码重新烧录到MCU当中。另外,当其他功能模块开发完成后,测试人员只能对所有功能模块进行联调,难以针对控制装置中依赖于其他功能模块调用的功能模块进行端到端测试。而车载单元MCU通常是将多个相互关联的功能模块并行开发的,因此,在车载单元MCU测试的场景下,上述的问题将更为明显。When testing an MCU function module, other functional modules usually need to call the module's external interface function before the module can perform the corresponding function. In this case, if other functional modules have not been developed, this functional module cannot be tested. At this time, the tester needs to write the corresponding temporary code and burn it into the MCU to ensure that the external interface function of the module can be called. However, if you need to modify the input parameters of the external interface function during the test, you need to modify the temporary code and re-burn the temporary code into the MCU. In addition, after the development of other functional modules is completed, testers can only jointly debug all functional modules, making it difficult to conduct end-to-end testing of functional modules in the control device that rely on calls from other functional modules. The vehicle-mounted unit MCU is usually developed in parallel with multiple interrelated functional modules. Therefore, in the scenario of vehicle-mounted unit MCU testing, the above problems will be more obvious.
可见,车载单元MCU中功能模块的可测性差,灵活性差,已经成为智能驾驶技术发展中一个亟待解决的问题。It can be seen that the functional modules in the on-board unit MCU have poor measurability and poor flexibility, which has become an urgent problem to be solved in the development of intelligent driving technology.
发明内容Contents of the invention
本申请提供一种测试方法和控制装置,测试人员无需编写相应的测试桩,即可实现对功能模块外部接口函数的直接调用,解决功能模块外部接口函数由于缺失调用方,导致其无法完成功能测试的问题,进而解决了难以针对控制装置中依赖于其他功能模块调用的功能模块进行端到端测试的问题;同时,有助于提升控制装置的可测性。This application provides a testing method and control device. Testers can directly call the external interface function of the functional module without writing corresponding test stubs, and solve the problem that the external interface function of the functional module cannot complete the functional test due to the lack of a caller. This problem solves the problem of difficulty in conducting end-to-end testing of functional modules in the control device that rely on calls from other functional modules; at the same time, it helps improve the testability of the control device.
第一方面,提供了一种测试方法,该方法包括:获取功能模块的函数回调信息,该函数回调信息包括功能模块的至少一个外部接口函数的调用地址,该功能模块的测试依赖其他功能模块调用至少一个外部接口函数,其中,至少一个外部接口函数用于对该功能模块测试;获取测试命令行,该测试命令行包括函数调用地址信息,该函数调用地址信息用于指示测试上述功能模块的至少一个外部接口函数的调用地址;响应于上述测试命令行,调用至少一个外部接口函数中的至少部分对上述功能模块进行测试。In a first aspect, a testing method is provided. The method includes: obtaining function callback information of a functional module. The function callback information includes a calling address of at least one external interface function of the functional module. The testing of the functional module relies on calls from other functional modules. At least one external interface function, wherein at least one external interface function is used to test the functional module; obtain a test command line, the test command line includes function call address information, the function call address information is used to indicate at least testing of the above functional module The calling address of an external interface function; in response to the above test command line, call at least part of at least one external interface function to test the above functional module.
示例地,功能模块可以是集成在控制装置中的一种模块,该控制装置可以是MCU。For example, the functional module may be a module integrated in a control device, and the control device may be an MCU.
本申请实施例中的技术方案可以对交通工具中的MCU进行测试。在本申请中,交通工具可以包括一种或多种不同类型的在陆地(例如,公路,道路,铁路等),水面(例如: 水路,江河,海洋等)或者空间上操作或移动的运输工具或者可移动物体。例如,交通工具可以包括汽车,自行车,摩托车,火车,地铁,飞机,船,飞行器,机器人或其它类型的运输工具或可移动物体等。The technical solutions in the embodiments of this application can test MCUs in vehicles. In this application, transportation may include one or more different types of transportation vehicles that operate or move on land (e.g., highways, roads, railways, etc.), water (e.g., waterways, rivers, oceans, etc.) or in space Or movable objects. For example, vehicles may include cars, bicycles, motorcycles, trains, subways, airplanes, ships, aircraft, robots, or other types of transportation vehicles or movable objects.
示例地,上述函数回调信息,可以是在功能模块初始化的过程中主动下发的,也可以是在功能模块初始化之后通过请求操作使功能模块被动下发的。此外,上述函数回调信息还可以包括附加信息,例如,外部接口函数的入参的个数、入参的数据类型、入参的取值范围信息以及可缺省参数等信息,用于辅助功能模块的至少一个外部接口函数的调用。For example, the above function callback information may be actively issued during the initialization process of the function module, or may be passively issued by the function module through a request operation after the function module is initialized. In addition, the above function callback information can also include additional information, such as the number of input parameters of the external interface function, the data type of the input parameters, the value range information of the input parameters, and the default parameters, etc., for auxiliary function modules A call to at least one external interface function.
应理解,在测试功能模块的指定功能时,需要调用功能模块中指定的至少一个外部接口函数,方可使功能模块执行相应的功能。因此,响应于上述测试命令行,调用至少一个外部接口函数中的至少部分外部接口函数,即可实现对上述功能模块进行测试。It should be understood that when testing the specified function of the functional module, at least one external interface function specified in the functional module needs to be called in order for the functional module to perform the corresponding function. Therefore, in response to the above test command line, by calling at least part of the at least one external interface function, the above functional module can be tested.
示例地,上述测试命令行还包括指定外部接口函数的参数值,例如,该外部接口函数需要输入相应的参数,功能模块才能完成相应功能的执行。For example, the above test command line also includes parameter values that specify the external interface function. For example, the external interface function needs to input corresponding parameters so that the function module can complete the execution of the corresponding function.
基于上述技术方案,测试人员无需编写相应的测试桩,即可实现对功能模块外部接口函数的直接调用,解决功能模块外部接口函数由于缺失调用方,导致其无法完成功能测试的问题,进而解决了难以针对控制装置中依赖于其他功能模块调用的功能模块进行端到端测试的问题;同时,有助于提升控制装置的可测性。Based on the above technical solution, testers can directly call the external interface function of the functional module without writing corresponding test stubs, solving the problem that the external interface function of the functional module cannot complete the functional test due to the lack of a caller, thus solving the problem. It is difficult to conduct end-to-end testing of functional modules in the control device that rely on calls from other functional modules; at the same time, it helps to improve the testability of the control device.
结合第一方面,在第一方面的某些实现方式中,确认代理功能开启,其中,当代理功能开启时,根据测试命令行,调用至少一个外部接口函数。Combined with the first aspect, in some implementations of the first aspect, it is confirmed that the proxy function is enabled, wherein when the proxy function is enabled, at least one external interface function is called according to the test command line.
示例地,在控制装置中各个功能模块开发完成时,功能模块A指定功能的执行,依赖于功能模块B的调用功能模块A的外部接口函数,此时,需要对功能模块A的功能进行测试,当代理功能关闭时,则需要先使功能模块B执行相应的功能,以带动功能模块A执行相应的功能,方可完成对功能模块A的测试,该过程可以称为联调。当代理功能开启时,则无需启动功能模块B的相应功能,可以直接对功能模块A进行单独的端到端测试。For example, when the development of each functional module in the control device is completed, the execution of the specified function of functional module A depends on the external interface function of functional module B calling functional module A. At this time, the function of functional module A needs to be tested. When the agent function is turned off, function module B needs to be enabled to perform the corresponding function first to drive function module A to perform the corresponding function before the test of function module A can be completed. This process can be called joint debugging. When the proxy function is turned on, there is no need to start the corresponding function of function module B, and a separate end-to-end test can be directly performed on function module A.
基于上述技术方案,能够实现对功能模块联调和单独对某个功能模块端到端测试的切换,使测试控制装置的方法更为灵活。Based on the above technical solution, it is possible to switch between joint debugging of functional modules and end-to-end testing of a certain functional module individually, making the method of testing the control device more flexible.
结合第一方面,在第一方面的某些实现方式中,函数调用地址信息包括第一外部接口函数的调用地址;在第一外部接口函数的调用地址和至少一个外部接口函数的调用地址匹配成功后,调用至少一个外部接口函数中的至少部分对功能模块进行测试。In connection with the first aspect, in some implementations of the first aspect, the function calling address information includes the calling address of the first external interface function; the calling address of the first external interface function matches the calling address of at least one external interface function successfully. Finally, calling at least part of at least one external interface function to test the function module.
示例地,第一外部接口函数可以是测试上述功能模块所需要调用的一个或多个外部接口函数,即该第一外部接口函数可以是一个外部接口函数,也可以是一个外部接口函数集,其中包括多个外部接口函数。For example, the first external interface function may be one or more external interface functions that need to be called to test the above functional module, that is, the first external interface function may be an external interface function or a set of external interface functions, where Includes multiple external interface functions.
示例地,在匹配失败时,可以将该测试命令行丢弃,或者存储在指定位置,再定时清空。另外,在匹配失败时,还可以返回匹配失败信息,并将匹配失败信息发送至外部接入设备。For example, when the matching fails, the test command line can be discarded, or stored in a specified location, and then cleared periodically. In addition, when the matching fails, the matching failure information can also be returned and the matching failure information can be sent to the external access device.
示例地,上述外部接入设备可以是控制器局域网开放环境(controller area networkopen environment,CANoe)、系统级芯片(system on chip,SOC)等。For example, the above-mentioned external access device can be a controller area network open environment (controller area network open environment, CANoe), system on chip (system on chip, SOC), etc.
示例地,当测试命令行中包括参数值时,在第一外部接口函数的调用地址和至少一个外部接口函数的调用地址匹配成功后,还需要将参数值输入到该至少一个外部接口函数中。For example, when the test command line includes parameter values, after the calling address of the first external interface function successfully matches the calling address of at least one external interface function, the parameter value also needs to be input into the at least one external interface function.
基于上述技术方案,能够实现对功能模块单独的端到端测试,使功能相互依赖的功能 模块,在功能上相互独立;同时,有助于提升控制装置的可测性。Based on the above technical solution, it is possible to implement independent end-to-end testing of functional modules, making functional modules with interdependent functions functionally independent of each other; at the same time, it helps to improve the testability of the control device.
结合第一方面,在第一方面的某些实现方式中,函数调用地址信息包括功能模块的标识;根据该功能模块的标识,调用所述功能模块的至少一个外部接口函数对所述功能模块进行测试。In conjunction with the first aspect, in some implementations of the first aspect, the function call address information includes an identification of the functional module; according to the identification of the functional module, at least one external interface function of the functional module is called to perform the function on the functional module. test.
示例地,函数调用地址信息包括指定功能模块的标识时,在接收到该测试命令后,可以直接根据功能模块的标识,调用该功能模块的至少一个外部接口函数中的所有或部分外部接口函数。For example, when the function call address information includes the identifier of the specified functional module, after receiving the test command, all or part of the external interface functions in at least one external interface function of the functional module can be called directly according to the identifier of the functional module.
基于上述技术方案,对功能模块的至少一个外部接口函数的调用,不局限于根据函数调用地址信息包括的第一外部接口函数的调用地址进行调用,还可以通过功能模块的标识,对功能模块至少一个外部接口函数进行调用,从而提升了测试控制装置的灵活性;有助于提升控制装置的可测性。Based on the above technical solution, the call to at least one external interface function of the functional module is not limited to the call based on the calling address of the first external interface function included in the function calling address information. It can also call at least one external interface function of the functional module through the identification of the functional module. An external interface function is called, thereby improving the flexibility of testing the control device; helping to improve the testability of the control device.
结合第一方面,在第一方面的某些实现方式中,函数回调信息还包括第一外部接口函数入参的取值范围信息,且测试命令行包括第一外部接口函数的参数值,在调用至少一个外部接口函数中的至少部分对功能模块进行测试之前,还需要确定上述参数值与上述取值范围信息匹配。Combined with the first aspect, in some implementations of the first aspect, the function callback information also includes value range information of the input parameters of the first external interface function, and the test command line includes the parameter values of the first external interface function. When calling Before at least part of at least one external interface function tests the functional module, it is also necessary to determine that the above parameter value matches the above value range information.
示例地,取值范围信息可以是一种参数取值区间,在上述参数值处于该参数取值区间之内时,则表示上述参数值与上述取值范围信息匹配成功,可以对上述至少一个外部接口函数进行调用。在上述参数值处于该参数取值区间之外时,则表示在上述参数值与上述取值范围信息匹配失败,无法对上述至少一个外部接口函数进行调用。For example, the value range information may be a parameter value interval. When the above-mentioned parameter value is within the parameter value interval, it means that the above-mentioned parameter value and the above-mentioned value range information are successfully matched, and the above-mentioned at least one external Interface functions are called. When the above-mentioned parameter value is outside the parameter value range, it means that the above-mentioned parameter value fails to match the above-mentioned value range information, and the above-mentioned at least one external interface function cannot be called.
基于上述技术方案,可以提升调用功能模块的至少一个外部接口函数的准确性,减少因错误调用外部接口函数造成的功能模块测试异常的情况。Based on the above technical solution, the accuracy of calling at least one external interface function of the functional module can be improved, and functional module test abnormalities caused by incorrect calling of external interface functions can be reduced.
结合第一方面,在第一方面的某些实现方式中,获取外部接入设备发送的测试命令行。Combined with the first aspect, in some implementations of the first aspect, a test command line sent by the external access device is obtained.
示例地,上述测试命令行也可以是从控制装置内部获取的,例如,控制装置本地存储着测试代码,该代码中包括测试命令行,因此,也可以获取本地存储的测试命令行,使能够响应于该测试命令行,调用至少一个外部接口函数中的至少部分对功能模块进行测试。For example, the above test command line can also be obtained from inside the control device. For example, the control device locally stores the test code, and the code includes the test command line. Therefore, the locally stored test command line can also be obtained to enable the response. In the test command line, call at least part of at least one external interface function to test the function module.
基于上述技术方案,能够通过多种渠道获取到测试命令行,使测试控制装置的方法更为灵活。Based on the above technical solution, the test command line can be obtained through multiple channels, making the method of testing the control device more flexible.
结合第一方面,在第一方面的某些实现方式中,向外部接入设备发送对功能模块的测试结果。Combined with the first aspect, in some implementations of the first aspect, the test results of the functional modules are sent to the external access device.
示例地,上述功能模块外部接口函数的测试结果可以是一系列参数值,也可以是通过打印方式呈现的字符串,例如,目标外部接口函数名称,该函数输出的参数名称及其数值。For example, the test results of the external interface function of the above functional module can be a series of parameter values, or a string presented by printing, for example, the name of the target external interface function, the parameter name and its value output by the function.
第二方面,提供了一种控制装置,该控制装置包括:第一获取单元,用于获取功能模块的函数回调信息,该函数回调信息包括功能模块的至少一个外部接口函数的调用地址,该功能模块的测试依赖其他功能模块调用至少一个外部接口函数,其中,至少一个外部接口函数用于对该功能模块测试;第二获取单元,用于获取测试命令行,该测试命令行包括函数调用地址信息,该函数调用地址信息用于指示测试上述功能模块的至少一个外部接口函数的调用地址;测试单元,用于响应于上述测试命令行,调用至少一个外部接口函数中的至少部分对上述功能模块进行测试。In a second aspect, a control device is provided. The control device includes: a first acquisition unit for acquiring function callback information of a functional module. The function callback information includes the calling address of at least one external interface function of the functional module. The test of the module relies on other functional modules to call at least one external interface function, where at least one external interface function is used to test the functional module; the second acquisition unit is used to obtain a test command line, which includes function call address information , the function call address information is used to indicate the calling address of at least one external interface function for testing the above-mentioned functional module; the test unit is used to respond to the above-mentioned test command line, call at least part of the at least one external interface function to perform the above-mentioned functional module test.
示例地,功能模块可以是集成在控制装置中的一种模块,该控制装置可以是一种MCU。For example, the functional module may be a module integrated in a control device, and the control device may be an MCU.
示例地,上述函数回调信息还可以包括附加信息,例如,外部接口函数的入参的个数、入参的数据类型、入参的取值范围信息以及可缺省参数等信息,用于辅助功能模块的至少一个外部接口函数的调用。For example, the above function callback information may also include additional information, such as the number of input parameters of the external interface function, the data type of the input parameters, the value range information of the input parameters, and the default parameters, etc., for auxiliary functions. A call to at least one external interface function of the module.
应理解,在测试功能模块的指定功能时,需要调用功能模块中指定的至少一个外部接口函数,方可使功能模块执行相应的功能。因此,响应于上述测试命令行,调用至少一个外部接口函数中的至少部分外部接口函数,即可实现对上述功能模块进行测试。It should be understood that when testing the specified function of the functional module, at least one external interface function specified in the functional module needs to be called in order for the functional module to perform the corresponding function. Therefore, in response to the above test command line, by calling at least part of the at least one external interface function, the above functional module can be tested.
示例地,上述测试命令行还包括指定外部接口函数的参数值,例如,该外部接口函数需要输入相应的参数,功能模块才能完成相应功能的执行。For example, the above test command line also includes parameter values that specify the external interface function. For example, the external interface function needs to input corresponding parameters so that the function module can complete the execution of the corresponding function.
结合第二方面,在第二方面的某些实现方式中,上述测试单元还用于确认代理功能开启,其中,当代理功能开启时,根据测试命令行,调用至少一个外部接口函数。Combined with the second aspect, in some implementations of the second aspect, the above test unit is also used to confirm that the proxy function is enabled, wherein when the proxy function is enabled, at least one external interface function is called according to the test command line.
示例地,在控制装置中各个功能模块开发完成时,功能模块A指定功能的执行,依赖于功能模块B的调用功能模块A的外部接口函数,此时,需要对功能模块A的功能进行测试,当代理功能关闭时,则需要先使功能模块B执行相应的功能,以带动功能模块A执行相应的功能,方可完成对功能模块A的测试,该过程可以称为联调。当代理功能开启时,则无需启动功能模块B的相应功能,上述测试单元可以直接对功能模块A进行单独的端到端测试。For example, when the development of each functional module in the control device is completed, the execution of the specified function of functional module A depends on the external interface function of functional module B calling functional module A. At this time, the function of functional module A needs to be tested. When the agent function is turned off, function module B needs to be enabled to perform the corresponding function first to drive function module A to perform the corresponding function before the test of function module A can be completed. This process can be called joint debugging. When the proxy function is turned on, there is no need to start the corresponding function of functional module B. The above test unit can directly conduct a separate end-to-end test on functional module A.
结合第二方面,在第二方面的某些实现方式中,函数调用地址信息包括第一外部接口函数的调用地址;在第一外部接口函数的调用地址和至少一个外部接口函数的调用地址匹配成功后,上述测试单元具体用于调用第一外部接口函数对功能模块进行测试。Combined with the second aspect, in some implementations of the second aspect, the function calling address information includes the calling address of the first external interface function; the calling address of the first external interface function matches the calling address of at least one external interface function successfully. Finally, the above-mentioned test unit is specifically used to call the first external interface function to test the functional module.
示例地,第一外部接口函数可以是测试上述功能模块所需要调用的外部接口函数,该第一外部接口函数可以是一个外部接口函数,也可以是一个包括多个外部接口函数的函数集。For example, the first external interface function may be an external interface function that needs to be called to test the above functional module. The first external interface function may be an external interface function or a function set including multiple external interface functions.
示例地,在匹配失败时,测试单元可以将该测试命令行丢弃,或者存储在指定位置,再定时清空。另外,在匹配失败时,测试单元还可以返回匹配失败信息,并将匹配失败信息发送至外部接入设备。For example, when the match fails, the test unit can discard the test command line, or store it in a specified location, and then clear it regularly. In addition, when matching fails, the test unit can also return matching failure information and send the matching failure information to the external access device.
示例地,当测试命令行中包括参数值时,在第一外部接口函数的调用地址和至少一个外部接口函数的调用地址匹配成功后,上述测试单元还需要将参数值输入到该至少一个外部接口函数中。For example, when the test command line includes parameter values, after the calling address of the first external interface function and the calling address of at least one external interface function are successfully matched, the above-mentioned test unit also needs to input the parameter value to the at least one external interface. in function.
结合第二方面,在第二方面的某些实现方式中,函数调用地址信息包括功能模块的标识;上述测试单元具体用于根据该功能模块的标识,调用上述至少一个外部接口函数对功能模块进行测试。Combined with the second aspect, in some implementations of the second aspect, the function call address information includes the identification of the functional module; the above-mentioned test unit is specifically used to call the above-mentioned at least one external interface function to perform the function module according to the identification of the functional module. test.
示例地,函数调用地址信息包括指定功能模块的标识时,上述测试单元在获取到该测试命令后,可以直接根据功能模块标识,调用该功能模块的至少一个外部接口函数中的所有或部分外部接口函数。For example, when the function call address information includes the identifier of the specified functional module, after obtaining the test command, the above-mentioned test unit can directly call all or part of the external interfaces in at least one external interface function of the functional module based on the functional module identifier. function.
结合第二方面,在第二方面的某些实现方式中,函数回调信息还包括第一外部接口函数入参的取值范围信息,且测试命令行包括第一外部接口函数的参数值,上述测试单元具体用于,在调用至少一个外部接口函数中的至少部分对功能模块进行测试之前,确定上述参数值与上述取值范围信息匹配。Combined with the second aspect, in some implementations of the second aspect, the function callback information also includes value range information of the input parameters of the first external interface function, and the test command line includes the parameter values of the first external interface function. The above test The unit is specifically configured to determine that the parameter value matches the value range information before calling at least part of the at least one external interface function to test the functional module.
示例地,取值范围信息可以是一种参数取值区间,在上述参数值处于该参数取值区间 之内时,则表示上述参数值与上述取值范围信息匹配成功,上述测试单元可以对上述至少一个外部接口函数进行调用。在上述参数值处于该参数取值区间之外时,则表示在上述参数值与上述取值范围信息匹配失败,上述测试单元无法对上述至少一个外部接口函数进行调用。For example, the value range information may be a parameter value interval. When the above-mentioned parameter value is within the parameter value interval, it means that the above-mentioned parameter value and the above-mentioned value range information are successfully matched, and the above-mentioned test unit can perform the above-mentioned At least one external interface function is called. When the above-mentioned parameter value is outside the parameter value range, it means that the above-mentioned parameter value fails to match the above-mentioned value range information, and the above-mentioned test unit cannot call the above-mentioned at least one external interface function.
结合第二方面,在第二方面的某些实现方式中,上述第二获取单元具体用于获取外部接入设备发送的测试命令行。In conjunction with the second aspect, in some implementations of the second aspect, the above-mentioned second obtaining unit is specifically configured to obtain the test command line sent by the external access device.
示例地,上述测试命令行也可以由第二获取单元从控制装置直接内部获取,例如,控制装置本地存储着测试代码,该代码中包括测试命令行,因此,第二获取单元也可以获取本地存储的测试命令行,使上述测试单元能够响应于该测试命令行,调用至少一个外部接口函数中的至少部分对功能模块进行测试。For example, the above-mentioned test command line can also be directly obtained internally from the control device by the second acquisition unit. For example, the control device locally stores the test code, and the code includes the test command line. Therefore, the second acquisition unit can also obtain the locally stored test code. The test command line enables the above test unit to respond to the test command line and call at least part of at least one external interface function to test the functional module.
结合第二方面,在第二方面的某些实现方式中,上述控制装置还包括发送单元,用于向外部接入设备发送对功能模块的测试结果。With reference to the second aspect, in some implementations of the second aspect, the above-mentioned control device further includes a sending unit configured to send test results of the functional module to an external access device.
示例地,上述功能模块外部接口函数的测试结果可以是一系列参数值,也可以是通过打印方式呈现的字符串,例如,目标外部接口函数名称,该函数输出的参数名称及其数值。For example, the test results of the external interface function of the above functional module can be a series of parameter values, or a string presented by printing, for example, the name of the target external interface function, the parameter name and its value output by the function.
第三方面,提供了一种控制装置,包括存储器,用于存储计算机指令;还包括处理器,用于执行存储器中存储的计算机指令,以使得装置执行上述第一方面的方法设计中任意一种可能的实现方式中的方法。In a third aspect, a control device is provided, including a memory for storing computer instructions; and a processor for executing the computer instructions stored in the memory, so that the device executes any one of the method designs of the first aspect. Methods in possible implementations.
第四方面,提供了一种微控制单元,包括第二方面的控制装置。A fourth aspect provides a micro control unit, including the control device of the second aspect.
第五方面,提供了一种计算机存储介质,计算机存储介质中存储有计算机指令,该指令在计算机上执行时,使得计算机执行上述第一方面的方法设计中任意一种可能的实现方式中的方法。In a fifth aspect, a computer storage medium is provided. Computer instructions are stored in the computer storage medium. When the instructions are executed on a computer, they cause the computer to execute the method in any possible implementation of the method design of the first aspect. .
第六方面,提供了一种芯片,包括处理器,该处理器用于执行上述第一方面的方法设计中任意一种可能的实现方式中的方法。In a sixth aspect, a chip is provided, including a processor configured to execute the method in any possible implementation of the method design of the first aspect.
示例地,该芯片可以是基带芯片。By way of example, the chip may be a baseband chip.
第七方面,提供了一种计算机程序产品,该计算机程序代码或指令在计算机上执行时,使得计算机执行上述第一方面的方法设计中任意一种可能的实现方式中的方法。A seventh aspect provides a computer program product. When the computer program code or instructions are executed on a computer, the computer executes the method in any possible implementation of the method design of the first aspect.
附图说明Description of the drawings
图1是本申请实施例提供的一种现有MCU功能模块测试逻辑示意图。Figure 1 is a schematic diagram of an existing MCU function module testing logic provided by an embodiment of the present application.
图2是本申请实施例提供的一种控制装置架构示意图。Figure 2 is a schematic diagram of the architecture of a control device provided by an embodiment of the present application.
图3是本申请实施例提供的又一种控制装置架构示意图。FIG. 3 is a schematic diagram of another control device architecture provided by an embodiment of the present application.
图4是本申请实施例提供的又一种控制装置架构示意图。Figure 4 is a schematic diagram of another control device architecture provided by an embodiment of the present application.
图5是本申请实施例提供的一种测试方法的流程示意图。Figure 5 is a schematic flow chart of a testing method provided by an embodiment of the present application.
图6是本申请实施例提供的代理模块调用功能模块外部接口函数的流程示意图。Figure 6 is a schematic flowchart of the proxy module calling the external interface function of the function module provided by the embodiment of the present application.
图7是本申请实施例提供的代理模块后期维护的示意图。Figure 7 is a schematic diagram of the later maintenance of the agent module provided by the embodiment of the present application.
图8是本申请实施例提供的一种控制装置800的示意性框图。FIG. 8 is a schematic block diagram of a control device 800 provided by an embodiment of the present application.
具体实施方式Detailed ways
为便于理解本申请实施例,首先对本申请实施例涉及到的术语和概念进行解释。In order to facilitate understanding of the embodiments of the present application, the terms and concepts involved in the embodiments of the present application are first explained.
微控制单元,又称单片微型计算机或者单片机,是把中央处理器(central process unit,CPU)的频率与规格做适当缩减,并将内存、计数器、通用串行总线(universal serial bus,USB)、模数转换器、通用异步收发传输器、可编程逻辑控制器、直接存储器访问控制器等周边接口都整合在单一芯片上,形成芯片级的计算机,为不同的应用场合做不同组合控制。MCU的特点是:一般不支持运行多任务的复杂系统。在测试传统MCU多个相互关联的功能模块中某一个具体功能模块时,通常需要调用其他功能模块的外部接口函数,或者自身的外部接口函数被其他功能模块调用,方可实现该功能模块的功能测试。A microcontroller unit, also known as a single-chip microcomputer or single-chip microcomputer, appropriately reduces the frequency and specifications of the central processing unit (CPU), and combines memory, counters, and universal serial bus (USB) Peripheral interfaces such as analog-to-digital converters, universal asynchronous receivers and transmitters, programmable logic controllers, and direct memory access controllers are all integrated on a single chip to form a chip-level computer that can perform different combinations of controls for different applications. The characteristic of MCU is that it generally does not support complex systems running multiple tasks. When testing a specific functional module among the multiple interrelated functional modules of a traditional MCU, it is usually necessary to call the external interface functions of other functional modules, or its own external interface functions are called by other functional modules, in order to realize the function of the functional module. test.
二次开发,是指在现有的软件上进行定制修改,功能的扩展,实现开发者需要的功能,该过程通常都不会改变原有系统的内核。应理解,二次开发的执行者可以是一方,也可以是多方。以上述MCU的功能模块开发为例,对于包括基础功能的MCU可以提供给一方客户在其之上进行二次开发,扩展MCU功能,也可以提供给多方客户在其之上进行二次开发,扩展MCU功能,而且多方客户所进行二次开发的功能模块通常是相互关联的。由此可见,在这种情况下,出现上述MCU由于相互关联业务模块尚未开发完成而导致的本功能模块无法实现端到端测试的问题将尤为明显。Secondary development refers to customizing and modifying existing software, extending functions, and realizing the functions required by developers. This process usually does not change the core of the original system. It should be understood that the executor of secondary development can be one party or multiple parties. Taking the above-mentioned MCU functional module development as an example, an MCU including basic functions can be provided to one customer for secondary development and expansion of MCU functions, or it can be provided to multiple customers for secondary development and expansion on top of it. MCU functions, and the functional modules secondary developed by multiple customers are usually related to each other. It can be seen that in this case, the problem of the above-mentioned MCU being unable to implement end-to-end testing of this functional module due to the fact that the interrelated business modules have not yet been developed will be particularly obvious.
硬编码,是指将可变变量用一个固定值来代替的方法。在硬编码中,若要修改某个功能,就必需修改源代码,缺少灵活性。因此,使用硬编码编译后,如果后续需要更改已固定的变量值就非常困难。现有的测试MCU方法是测试人员根据测试文档的要求,通过硬编码的方式,编写测试代码并烧录到MCU中运行,使MCU功能模块在代码运行的时候接收测试代码中包括的测试命令,调用测试功能模块所需要调用的所有外部接口函数。由于测试命令需要采取硬编码的方式实现,测试命令中的外部接口函数入参均为固定值,如果需要更改上述外部接口函数入参,测试人员就需要重新编写测试代码,更改上述接口函数入参,再将修改后的测试代码烧录到MCU中进行二次测试。Hard coding refers to a method of replacing a variable variable with a fixed value. In hard coding, if you want to modify a certain function, you must modify the source code, which lacks flexibility. Therefore, after compiling with hard coding, it is very difficult to change the fixed variable value later. The existing method of testing MCU is that the tester writes the test code through hard coding according to the requirements of the test document and burns it into the MCU to run, so that the MCU function module receives the test command included in the test code when the code is running. Call all external interface functions that need to be called by the test function module. Since the test command needs to be implemented in a hard-coded manner, the input parameters of the external interface function in the test command are all fixed values. If the above-mentioned external interface function input parameters need to be changed, the tester needs to rewrite the test code and change the above-mentioned interface function input parameters. , and then burn the modified test code into the MCU for secondary testing.
桩函数,是指替代原函数功能的一种函数,使得在测试过程中能将被测功能模块与其依赖的功能模块隔离。例如,现有的测试MCU方法中,如果本功能模块已开发完成,但是在测试本功能模块的过程中,需要调用其他功能模块的外部接口函数,获取该外部接口函数的输出结果,而其他功能模块没有开发其外部接口函数,则测试人员可以编写测试桩,在测试桩中添加该外部接口函数的简单实现,本功能模块在执行功能的时候,调用测试桩中的外部接口函数即可获得相应的输出结果,以辅助本功能模块能够完成测试。A stub function refers to a function that replaces the function of the original function, so that the functional module under test can be isolated from the functional modules it depends on during the testing process. For example, in the existing MCU testing method, if this functional module has been developed, but in the process of testing this functional module, it is necessary to call the external interface function of other functional modules to obtain the output results of the external interface function, and other functions If the module has not developed its external interface function, the tester can write a test stub and add a simple implementation of the external interface function to the test stub. When this function module executes the function, the external interface function in the test stub is called to obtain the corresponding The output results are used to assist this functional module in completing the test.
为便于理解本申请实施例,首先结合图1详细说明现有技术测试MCU功能模块的方法。In order to facilitate understanding of the embodiments of the present application, the prior art method of testing MCU functional modules is first described in detail with reference to FIG. 1 .
图1是本申请实施例提供的一种现有MCU功能模块测试逻辑示意图。Figure 1 is a schematic diagram of an existing MCU function module testing logic provided by an embodiment of the present application.
功能模块A是基础功能模块,功能模块B是基于功能模块A的功能基础之上开发的高级功能,功能模块C是基于功能模块B的功能基础之上开发的高级功能。Function module A is a basic function module, function module B is an advanced function developed based on the functions of function module A, and function module C is an advanced function developed based on the functions of function module B.
一个实施例中,以测试功能模块B为例,由于功能模块B是在功能模块C的上一级功能模块,所以在功能模块B需要执行功能的时候,功能模块B的一个或多个外部接口函数需要被功能模块C调用,方可使功能模块B执行相应功能。由此可见,功能模块B相应功能的执行依赖于功能模块C调用功能模块B的指定的一个或多个外部接口函数。In one embodiment, taking the test function module B as an example, since the function module B is the upper-level functional module of the function module C, when the function module B needs to perform a function, one or more external interfaces of the function module B The function needs to be called by function module C before function module B can perform the corresponding function. It can be seen that the execution of the corresponding functions of function module B relies on function module C calling one or more designated external interface functions of function module B.
类似地,由于功能模块A是在功能模块B的上一级功能模块,所以功能模块A相应功能的执行依赖于功能模块B调用功能模块A的指定的一个或多个外部接口函数,使功 能模块A执行相应功能。Similarly, since functional module A is the upper-level functional module of functional module B, the execution of the corresponding functions of functional module A depends on functional module B calling one or more designated external interface functions of functional module A, so that the functional module A performs the corresponding function.
调用功能模块外部接口函数的前提条件可以是:已知该外部接口函数的调用地址以及相应的外部接口函数入参。The prerequisite for calling the external interface function of the function module may be: the calling address of the external interface function and the corresponding external interface function input parameters are known.
应理解,调用功能模块外部接口函数所要考虑的前提条件还可以包括确定如下信息:外部接口函数的入参个数,参数类型,参数值范围等。此外,还可以包括参数缺省等附加信息,本申请对此不作限定。It should be understood that the prerequisites to be considered when calling the external interface function of the function module may also include determining the following information: the number of input parameters of the external interface function, parameter type, parameter value range, etc. In addition, additional information such as parameter defaults may also be included, which is not limited in this application.
应理解,测试人员应当依照产品测试说明书中给出的针对功能模块相应功能对应外部接口函数调用方式,通过硬编码的方式编写测试代码,并将测试代码烧录到MCU中,在MCU运行过程中,调用指定功能模块的外部接口函数,使该功能模块能够执行相应功能,实现该功能模块的测试。It should be understood that the tester should write the test code through hard coding according to the external interface function calling method for the corresponding function of the function module given in the product test manual, and burn the test code into the MCU. During the operation of the MCU, , call the external interface function of the specified function module, so that the function module can perform the corresponding function and realize the test of the function module.
上述是现有的测试MCU业务功能的方法,由此可见,功能模块A、功能模块B和功能模块C之间是一种串行的功能实现,这也是MCU中常见的功能部署方式。The above is the existing method of testing MCU business functions. It can be seen that there is a serial function implementation between function module A, function module B and function module C. This is also a common function deployment method in MCU.
一个实施例中,对于上述现有的测试MCU业务功能的方法,如果测试人员需要测试功能模块B的相应功能,测试人员就必须从功能模块C入手,使功能模块C执行相应的功能,以驱动功能模块B相应功能的执行。而且只有在功能模块B执行功能的过程中,才会驱动功能模块A相应功能的执行。所以,在上述测试过程中,是无法针对MCU中依赖其它功能模块调用的功能模块单独进行端到端的测试。In one embodiment, for the above-mentioned existing method of testing MCU business functions, if the tester needs to test the corresponding function of function module B, the tester must start with function module C, so that function module C performs the corresponding function to drive Execution of the corresponding functions of function module B. And only in the process of function module B executing the function, the execution of the corresponding function of function module A will be driven. Therefore, during the above testing process, it is impossible to conduct end-to-end testing independently for functional modules in the MCU that rely on calls from other functional modules.
另外,开发人员对MCU进行功能开发通常采取的是并行开发方式,以上述实施例为例,功能模块A、功能模块B和功能模块C通常是交给不同的客户各自进行开发的,其开发进度通常无法统一。In addition, developers usually adopt a parallel development method for MCU function development. Taking the above embodiment as an example, function module A, function module B and function module C are usually handed over to different customers for development, and their development progress Usually cannot be unified.
应理解,由于MCU中功能上相互依赖的功能模块是串行实现的,以上述实施例为例,MCU只有在与功能模块A、功能模块B以及功能模块C全部开发完毕后,方可实现对功能模块A或功能模块B的测试,即现阶段对于上述场景,还无法对功能模块A或功能模块B进行单独的端到端测试。如需要测试功能模块A,则需要先执行功能模块B的相应功能,以调用功能模块A的外部接口函数,使功能模块A执行相应功能。进一步地,执行功能模块B的相应功能,还需要功能模块C调用功能模块B的外部接口函数,否则,还是无法实现对功能模块A的测试。It should be understood that since the functional modules in the MCU that are functionally dependent on each other are implemented in series, taking the above embodiment as an example, the MCU can only implement the functional module A, the functional module B, and the functional module C after they are all developed. Testing of Function Module A or Function Module B, that is, for the above scenario, at this stage, it is not possible to conduct independent end-to-end testing of Function Module A or Function Module B. If you need to test function module A, you need to first execute the corresponding function of function module B to call the external interface function of function module A so that function module A can perform the corresponding function. Furthermore, to execute the corresponding function of function module B, function module C also needs to call the external interface function of function module B. Otherwise, the test of function module A still cannot be implemented.
综上所述,现有的MCU存在可测性差,测试灵活性差,难以针对在MCU中依赖于其他功能模块调用的功能模块单独进行端到端测试,同时存在功能模块的外部接口缺失调用方导致相应功能难以测试问题。尤其在多客户对同一种MCU中相互关联的功能模块进行并行开发时,该问题会更为明显。To sum up, existing MCUs have poor testability and testing flexibility. It is difficult to conduct end-to-end testing of functional modules that rely on calls from other functional modules in the MCU. At the same time, there is a lack of callers in the external interfaces of functional modules. The corresponding function is difficult to test. This problem will be more obvious when multiple customers develop parallel functional modules of the same MCU.
鉴于此,本申请实施例提供了一种测试方法,通过代理模块调用功能模块的外部接口函数,使各个存在功能依赖关系的各个功能模块相互独立,解决功能模块外部接口函数由于缺失调用方无法执行相应功能,无法完成测试的问题,同时实现了对MCU中依赖于其他功能模块调用的功能模块单独进行端到端测试;同时有助于提升MCU可测性。In view of this, embodiments of the present application provide a testing method that calls the external interface function of the functional module through the proxy module, making each functional module with functional dependencies independent of each other, and solving the problem that the external interface function of the functional module cannot be executed due to the lack of the caller. The corresponding function solves the problem of being unable to complete the test. At the same time, it enables independent end-to-end testing of functional modules in the MCU that rely on calls from other functional modules; it also helps to improve the testability of the MCU.
另外,通过通道模块解析测试人员从外部接入设备输入的测试命令,将其解析成代理模块能够识别的测试命令行,并分发给上述代理模块,上述代理模块根据该测试命令行对功能模块进行测试。因此,测试人员可以通过编排测试命令的方式,反复更改MCU外部接口函数调用顺序、频率以及入参,进而实现MCU功能的路径覆盖测试,避免了测试人 员反复修改测试代码,并反复将测试代码烧录到MCU的过程。In addition, the channel module parses the test command input by the tester from the external access device, parses it into a test command line that can be recognized by the agent module, and distributes it to the above-mentioned agent module. The above-mentioned agent module performs functions on the functional module based on the test command line. test. Therefore, testers can repeatedly change the MCU external interface function calling sequence, frequency and input parameters by arranging test commands, thereby achieving path coverage testing of MCU functions, avoiding testers from repeatedly modifying the test code and repeatedly burning the test code. The process of recording to MCU.
图2示出了本申请实施例提供的一种控制装置架构示意图。该控制装置中包括功能模块、代理模块、通道模块和外部接入设备。Figure 2 shows a schematic diagram of the architecture of a control device provided by an embodiment of the present application. The control device includes function modules, agent modules, channel modules and external access equipment.
该控制装置架构中包括多个功能模块,同时每个功能模块都有一个代理模块与之对应。The control device architecture includes multiple functional modules, and each functional module has an agent module corresponding to it.
功能模块,用于实现控制装置的具体业务功能,将函数回调信息发送给代理模块,提供自身的外部接口函数用于测试。The function module is used to implement specific business functions of the control device, send function callback information to the agent module, and provide its own external interface functions for testing.
一个实施例中,上述函数回调信息包括外部接口函数的调用地址,还可以包括以下至少一项内容:外部接口函数的入参的个数、入参的数据类型以及入参的取值范围等附加信息,用于辅助完成外部接口函数的调用。In one embodiment, the above function callback information includes the calling address of the external interface function, and may also include at least one of the following: the number of input parameters of the external interface function, the data type of the input parameters, and the value range of the input parameters. Information, used to assist in calling external interface functions.
一个实施例中,功能模块可以是已经开发完成的功能模块,也可以是具体功能尚未开发完成的功能模块,即便其具体功能尚未开发完成,仍然能够向外提供自身的外部接口函数,测试人员根据调用该外部接口函数后数据流的传输状态也能够完成相应功能的初步测试。In one embodiment, the functional module may be a functional module that has been developed, or a functional module whose specific functions have not yet been developed. Even if its specific functions have not yet been developed, it can still provide its own external interface functions. The tester can The transmission status of the data stream after calling the external interface function can also complete the preliminary test of the corresponding function.
代理模块,用于获取功能模块的函数回调信息,并响应于测试命令行,调用至少一个外部接口函数中的至少部分外部接口函数,对功能模块进行测试。The proxy module is used to obtain the function callback information of the function module, and in response to the test command line, call at least some of the external interface functions of at least one external interface function to test the function module.
一个实施例中,测试命令行中包括函数调用地址信息,该函数调用信息可以包括第一外部接口函数的调用地址。应理解,第一外部接口函数可以是功能模块中需要被调用的一个或多个外部接口函数。代理模块可以根据该第一外部接口函数的调用地址,调用功能模块的一个或多个外部接口函数,以完成对功能模块的测试。应理解,在指定外部接口函数需要传入参数时,测试命令行中也需要包括相应的参数值,代理模块则需要将参数值输入到该外部接口函数中。In one embodiment, the test command line includes function calling address information, and the function calling information may include the calling address of the first external interface function. It should be understood that the first external interface function may be one or more external interface functions that need to be called in the functional module. The agent module can call one or more external interface functions of the functional module according to the calling address of the first external interface function to complete the test of the functional module. It should be understood that when specifying that an external interface function needs to pass in parameters, the test command line also needs to include the corresponding parameter values, and the proxy module needs to input the parameter values into the external interface function.
此外,代理模块还可以用于将来自所调用的外部接口函数对应功能模块输出的测试结果发送给通道模块,通过通道模块将测试结果发送给外部接入设备。应理解,代理模块也可以将上述测试结果直接发送至外部接入设备,视具体控制装置架构而定,例如,控制装置不设置通道模块,代理模块可以直接外部接入设备进行数据通信,本申请实施例对此不作限定。In addition, the agent module can also be used to send the test results output from the function module corresponding to the called external interface function to the channel module, and send the test results to the external access device through the channel module. It should be understood that the agent module can also directly send the above test results to the external access device, depending on the specific control device architecture. For example, if the control device does not have a channel module, the agent module can directly communicate with the external access device. This application The embodiment does not limit this.
一个实施例中,代理模块根据上述测试命令行可以只调用功能模块中的一个外部接口函数,也可以调用功能模块中的多个外部接口函数,即上述测试命令行可以用于调用一个外部接口函数,也可以用于调用多个外部接口函数,本申请对此不作限定。In one embodiment, the agent module can only call one external interface function in the functional module according to the above test command line, or it can call multiple external interface functions in the functional module. That is, the above test command line can be used to call one external interface function. , can also be used to call multiple external interface functions, which is not limited in this application.
通道模块,是一种与外部接入设备建立通信的模块,用于接收测试人员通过外部接入设备输入的测试命令,该测试命令中包括的外部接口函数和参数值可以基于测试人员的意愿更改,从而避免了反复烧录测试代码的过程。The channel module is a module that establishes communication with external access devices and is used to receive test commands input by testers through external access devices. The external interface functions and parameter values included in the test commands can be changed based on the tester's wishes. , thus avoiding the process of repeatedly burning test code.
此外,通道模块还可以用于将该测试命令解析成能够被代理模块识别的测试命令行,并将该测试命令行分发给各个代理模块。In addition, the channel module can also be used to parse the test command into a test command line that can be recognized by the agent module, and distribute the test command line to each agent module.
应理解,测试命令可以是以字符串的形式输入到通道模块的,但是其携带的数据,例如外部接口函数入参的参数值,实质上是有特定的数据类型的,例如,整型,浮点型,布尔型等。所以,通道模块可以将字符串形式的测试命令解析成一组包括外部接口函数地址以及特定数据类型参数的测试命令行,该测试命令行能够被代理模块识别,用于代理模块调用功能模块的外部接口函数。It should be understood that the test command can be input to the channel module in the form of a string, but the data it carries, such as the parameter value of the external interface function input parameter, actually has a specific data type, such as integer, floating Point type, Boolean type, etc. Therefore, the channel module can parse the test command in the form of a string into a set of test command lines including the external interface function address and specific data type parameters. This test command line can be recognized by the agent module and is used by the agent module to call the external interface of the function module. function.
应理解,通道模块的功能可以是如图2所示的单独设立的模块,专用于控制装置与外部接入设备进行实时通信,以及测试命令解析。也可以是集成于代理模块中的子模块,本申请对此不作限定。为了描述方便,本申请实施例均以代理模块与通道模块独立部署的形式进行说明。It should be understood that the function of the channel module can be a separately established module as shown in Figure 2, dedicated to real-time communication between the control device and external access equipment, and test command parsing. It may also be a sub-module integrated in the agent module, which is not limited in this application. For convenience of description, the embodiments of this application are described in the form of independent deployment of the agent module and the channel module.
外部接入设备,用于与控制装置建立联系,是测试人员向控制装置输入测试命令的设备,该外部接入设备可以是CANoe、SOC等。The external access device is used to establish contact with the control device and is a device for testers to input test commands to the control device. The external access device can be CANoe, SOC, etc.
一个实施例中,外部接入设备也可以直接向控制装置发送上述测试命令行,该场景下,无需上述通道模块对该测试命令行进行解析,该测试命令行可以直接发送给代理模块用于功能模块的外部接口函数的调用。In one embodiment, the external access device can also directly send the above-mentioned test command line to the control device. In this scenario, the above-mentioned channel module does not need to parse the test command line. The test command line can be directly sent to the agent module for function Calling of the external interface function of the module.
一个实施例中,与上述控制装置架构不同,一个代理模块还可以对应多个功能模块,例如,图3示出的本申请实施例提供的又一种控制装置架构示意图,或者,图4示出的本申请实施例提供的又一种控制装置架构示意图,再或者,在上述提到的控制装置架构中添加多个通道模块,本申请实施例对各个模块具体部署方式不作限定。为了方便描述,本申请实施例主要以图2的控制装置架构为准进行描述。In one embodiment, different from the above-mentioned control device architecture, one agent module can also correspond to multiple functional modules. For example, Figure 3 shows a schematic diagram of another control device architecture provided by an embodiment of the present application, or Figure 4 shows Another schematic diagram of the control device architecture provided by the embodiment of the present application, or multiple channel modules are added to the above-mentioned control device architecture. The embodiment of the present application does not limit the specific deployment method of each module. For convenience of description, the embodiment of the present application is mainly described based on the control device architecture in FIG. 2 .
一个实施例中,在车载单元控制装置测试场景中,用于车辆测试的台架通过上述外部接入设备可以向上述实施例中的控制装置输入测试命令。In one embodiment, in a vehicle-mounted unit control device testing scenario, a bench used for vehicle testing can input test commands to the control device in the above embodiment through the above-mentioned external access device.
应理解,上述控制装置可以是MCU,也可以是其他控制装置,本申请对此不作限定。It should be understood that the above control device may be an MCU or other control device, which is not limited in this application.
应理解,上述控制装置架构中,为了避免功能模块A、功能模块B以及功能模块C中任一个功能模块尚未开发完成而影响各个功能模块的测试,则需要为功能模块均添加了代理模块与之对应。当功能模块的指定外部接口模块需要被调用时,代理模块能够直接调用该外部接口函数,避免功能模块相应的外部接口函数得不到其他功能模块的调用,造成功能模块无法测试的问题,以及难以针对控制装置中依赖于其他功能模块调用的功能模块进行端到端测试的问题。It should be understood that in the above control device architecture, in order to avoid that any of the functional modules A, functional module B and functional module C has not yet been developed and affects the testing of each functional module, it is necessary to add an agent module to each functional module. correspond. When the specified external interface module of the functional module needs to be called, the proxy module can directly call the external interface function to prevent the corresponding external interface function of the functional module from being called by other functional modules, causing the problem that the functional module cannot be tested, and it is difficult to Aiming at the problem of end-to-end testing of function modules in control devices that rely on calls from other function modules.
应理解,上述难以针对控制装置中依赖于其他功能模块调用的功能模块进行端到端测试的问题包括但不限于以下两种测试场景:It should be understood that the above-mentioned problem of difficulty in conducting end-to-end testing of functional modules that rely on calls from other functional modules in the control device includes but is not limited to the following two test scenarios:
1、本功能模块已经开发完成,而本功能模块相应功能的执行,需要其他功能模块调用本功能模块的指定外部接口函数,方可完成功能测试。但是其他功能模块尚未开发完成,因此,本功能模块的指定外部接口函数缺失调用方,无法完成测试。1. This functional module has been developed, and the execution of the corresponding functions of this functional module requires other functional modules to call the designated external interface function of this functional module to complete the functional test. However, other functional modules have not yet been developed. Therefore, the designated external interface function of this functional module lacks a caller and the test cannot be completed.
2、本功能模块已经开发完成,而本功能模块相应功能的执行,需要其他功能模块调用本功能模块的指定外部接口函数,方可完成功能测试,其他功能模块已经开发完成,本功能模块的测试必须通过与其他功能模块进行联调方可完成测试,无法对本功能模块单独进行端到端的测试。2. This functional module has been developed, and the execution of the corresponding functions of this functional module requires other functional modules to call the designated external interface function of this functional module in order to complete the functional test. Other functional modules have been developed, and the test of this functional module Testing must be completed through joint debugging with other functional modules, and end-to-end testing cannot be performed on this functional module alone.
图5示出了本申请实施例提供的一种测试方法的流程示意图。Figure 5 shows a schematic flow chart of a testing method provided by an embodiment of the present application.
一个实施例中,该测试方法的执行主体是上述控制装置,具体功能可以由控制装置包括的代理模块以及通道模块来实现。In one embodiment, the execution subject of the test method is the above-mentioned control device, and specific functions can be implemented by the agent module and the channel module included in the control device.
S510,获取功能模块的函数回调信息,该函数回调信息包括该功能模块的至少一个外部接口函数的调用地址,该功能模块的测试依赖其他功能模块调用至少一个外部接口函数,该至少一个外部接口函数用于对该功能模块测试。S510. Obtain the function callback information of the functional module. The function callback information includes the calling address of at least one external interface function of the functional module. The test of the functional module relies on other functional modules to call at least one external interface function. The at least one external interface function Used to test this functional module.
应理解,该功能模块的测试,依赖其他功能模块调用该功能模块的至少一个外部接口 函数,方可使该功能模块执行相应的功能,以完成功能测试。It should be understood that the test of this functional module depends on other functional modules calling at least one external interface function of this functional module, so that the functional module can execute the corresponding function to complete the functional test.
一个实施例中,代理模块获取功能模块的函数回调信息的方式可以在系统初始化的时候,功能模块主动向代理模块发送函数回调信息,使代理模块获取到函数回调信息。或者,代理模块可以在系统运行过程中,主动请求获取功能模块的函数回调信息,本申请对此不作限定。In one embodiment, the proxy module obtains the function callback information of the functional module. During system initialization, the functional module actively sends the function callback information to the proxy module, so that the proxy module obtains the function callback information. Alternatively, the agent module can actively request to obtain the function callback information of the functional module during system operation, which is not limited in this application.
一个实施例中,代理模块可以与一个功能模块对应,也可以和多个功能模块对应,所以代理模块可以接收到来自一个或多个功能模块的多条函数回调信息。本申请实施例对此不作限定。In one embodiment, the proxy module can correspond to one functional module or multiple functional modules, so the proxy module can receive multiple pieces of function callback information from one or more functional modules. The embodiments of the present application do not limit this.
此外,函数回调信息还可以包括附加信息,例如,外部接口函数的入参的个数、入参的数据类型、入参的取值范围信息以及可缺省参数等信息,本申请对此不作限定。In addition, the function callback information may also include additional information, such as the number of input parameters of the external interface function, the data type of the input parameters, the value range information of the input parameters, and the default parameters, etc. This application does not limit this. .
S520,获取测试命令行,该测试命令行包括函数调用地址信息,其中,该函数调用地址信息用于指示测试功能模块的至少一个外部接口函数的调用地址。S520. Obtain a test command line. The test command line includes function calling address information, where the function calling address information is used to indicate the calling address of at least one external interface function of the test function module.
一个实施例中,获取到的测试命令行可以是通道模块解析来自外部接入设备发送的测试命令生成的,也可以是从外部接入设备直接获取的,还可以是从控制装置内部获取的。例如,通道模块先获取来自外部接入设备的测试命令,并将测试命令解析成一组包括外部接口函数地址以及特定数据类型参数的测试命令行,而该测试命令行能够被代理模块获取并且直接识别。再例如,控制装置本地存储着测试代码,该代码中包括测试命令行,因此,代理模块也可以获取到本地存储的测试命令行。再例如,外部接入设备直接发送测试命令行,使代理模块可以直接从外部接入设备获取测试命令行。In one embodiment, the obtained test command line may be generated by the channel module parsing the test command sent from the external access device, may be obtained directly from the external access device, or may be obtained from inside the control device. For example, the channel module first obtains the test command from the external access device, and parses the test command into a set of test command lines including the external interface function address and specific data type parameters, and the test command line can be obtained and directly recognized by the agent module . For another example, the control device stores test code locally, and the code includes a test command line. Therefore, the agent module can also obtain the locally stored test command line. For another example, the external access device directly sends the test command line, so that the agent module can directly obtain the test command line from the external access device.
一个实施例中,该测试命令行包括函数调用地址信息,或者,函数调用地址信息和参数值。进一步地,函数调用地址信息包括指定外部接口函数的调用地址,或者,指定功能模块的标识。In one embodiment, the test command line includes function call address information, or function call address information and parameter values. Further, the function calling address information includes the calling address of the designated external interface function, or the identification of the designated function module.
由于函数调用地址信息包括第一外部接口函数的调用地址,且该第一外部接口函数为测试功能模块时需要调用的一个或多个外部接口函数,因此根据该调用地址即可实现对功能模块中的外部接口函数的调用,当该外部接口函数需要输入参数时,测试命令行也要包括相应的参数值,代理模块需要将参数值输入到外部接口函数中,使外部接口函数对应的功能得以执行,进而完成对该功能模块进行测试。Since the function calling address information includes the calling address of the first external interface function, and the first external interface function is one or more external interface functions that need to be called when testing the functional module, the function module can be called based on the calling address. When the external interface function needs to input parameters, the test command line must also include the corresponding parameter values. The proxy module needs to input the parameter values into the external interface function so that the functions corresponding to the external interface function can be executed. , and then complete the test of the functional module.
当函数调用地址信息包括指定功能模块的标识时,代理模块在获取到该测试命令后,可以直接根据该功能模块标识,调用该功能模块的至少一个外部接口函数中的所有或部分外部接口函数,使外部接口函数对应的功能得以执行,进而完成对该功能模块进行测试。When the function call address information includes the identifier of the specified functional module, after obtaining the test command, the agent module can directly call all or part of the external interface functions of at least one external interface function of the functional module based on the functional module identifier, This enables the functions corresponding to the external interface functions to be executed, thereby completing the test of the functional module.
S530,响应于上述测试命令行,调用上述至少一个外部接口函数中的至少部分对功能模块进行测试。S530: In response to the above test command line, call at least part of the above at least one external interface function to test the function module.
一个实施例中,由于代理模块在技术实现上可以是一个代码模块,代理模块也可以是一个函数,也有一个唯一的调用地址,所以代理模块在接收测试命令行之前,需要将其调用地址下发到通道模块,当通道模块将外部输入的测试命令解析成代理模块能够识别的测试命令行后,根据该地址信息,即可将测试命令行发送给代理模块。In one embodiment, since the proxy module can be a code module in terms of technical implementation, the proxy module can also be a function, and also has a unique calling address, so the proxy module needs to issue its calling address before receiving the test command line. To the channel module, when the channel module parses the externally input test command into a test command line that can be recognized by the agent module, it can send the test command line to the agent module based on the address information.
一个实施例中,在上述S510之前,代理模块还需要确认代理功能是否开启,当代理功能开启时,代理模块能够接收来自通道模块的测试命令行,对功能模块指定外部接口函数进行调用,即实现对控制装置中每个功能模块都可以单独进行端到端测试。In one embodiment, before the above S510, the agent module also needs to confirm whether the agent function is turned on. When the agent function is turned on, the agent module can receive the test command line from the channel module and call the external interface function specified by the function module, that is, to achieve Each functional module in the control device can be tested individually end-to-end.
当代理功能关闭,代理模块不能接收来自通道模块的测试命令行,无法对功能模块指定外部接口函数进行调用,即此时对控制装置中的功能模块仅能够进行联调测试。When the agent function is turned off, the agent module cannot receive the test command line from the channel module and cannot call the external interface function specified by the function module. That is, at this time, only the joint debugging test of the function module in the control device can be performed.
一个实施例中,上述代理功能开启或关闭的信息也可以在代理模块接收测试命令行之前,和代理模块的调用地址一起下发到通道模块,当该信息表示为开启状态时,通道模块在分发测试命令行时,需要向该代理模块发送测试命令行;当该信息表示为关闭状态时,通道模块在分发测试命令行时,可以不向该代理模块发送测试命令行。In one embodiment, the information about turning on or off the agent function can also be sent to the channel module together with the calling address of the agent module before the agent module receives the test command line. When the information indicates that it is in the on state, the channel module distributes the information. When testing the command line, you need to send the test command line to the agent module; when the information is indicated as closed, the channel module does not need to send the test command line to the agent module when distributing the test command line.
应理解,测试人员可以根据测试需求,来控制指定代理模块的功能开启或关闭。It should be understood that testers can control the function of the designated agent module to be turned on or off according to test requirements.
一个实施例中,通道模块向代理模块发送测试命令行之前,通道模块接收外部接入设备发送的测试命令,并解析测试命令。应理解,解析测试命令的过程是将测试命令转化为代理模块能够识别的测试命令行的过程,例如,外部接入设备输入的测试命令是以字符串形式呈现的,而该字符串中携带的数据通常具有特殊的数据类型,例如整型、浮点型等,所以,在控制装置接收到测试命令后,需要对该测试命令进行解析,生成能够被代理模块识别的测试命令行,使代理模块可以通过测试命令行调用功能模块的指定外部接口函数。应理解,外部接入设备也可以直接向控制装置发送上述测试命令行,本申请实施例对此不作限定。In one embodiment, before the channel module sends the test command line to the agent module, the channel module receives the test command sent by the external access device and parses the test command. It should be understood that the process of parsing the test command is the process of converting the test command into a test command line that can be recognized by the agent module. For example, the test command input by the external access device is presented in the form of a string, and the string carried Data usually has special data types, such as integers, floating point, etc. Therefore, after the control device receives the test command, it needs to parse the test command and generate a test command line that can be recognized by the agent module, so that the agent module The specified external interface function of the function module can be called through the test command line. It should be understood that the external access device can also directly send the above test command line to the control device, which is not limited in the embodiments of the present application.
应理解,上述代理模块和通道模块可以集成在一个模块当中,也可以是两个相互独立的模块,本申请对此不作限定。It should be understood that the above-mentioned agent module and channel module can be integrated into one module, or they can be two independent modules, which is not limited in this application.
还应理解,通过上述的测试方法,测试人员无需编写相应的测试桩,即可实现对功能模块外部接口函数的直接调用,解决功能模块外部接口函数由于缺失调用方,导致其无法完成功能测试的问题,进而解决了难以针对控制装置中依赖于其他功能模块调用的功能模块进行单独的端到端测试的问题;同时,有助于提升控制装置的可测性。It should also be understood that through the above testing method, testers can directly call the external interface function of the functional module without writing corresponding test stubs, solving the problem that the external interface function of the functional module cannot complete the functional test due to the lack of a caller. This solves the problem of difficulty in conducting independent end-to-end testing of functional modules in the control device that rely on calls from other functional modules; at the same time, it helps to improve the testability of the control device.
应理解,通过通道模块能够使控制装置与外部接入设备之间进行数据通信,即测试命令可以直接通过外部接入设备发送至控制装置,不需要向控制装置烧录测试代码,使控制装置获得测试命令。It should be understood that the channel module enables data communication between the control device and the external access device, that is, the test command can be directly sent to the control device through the external access device, without burning the test code to the control device, so that the control device can obtain Test command.
一个实施例中,测试命令通常记载在测试说明书中,测试人员根据测试用例,通过外部接入设备向通道模块发送符合测试用例需求的测试命令。测试命令可以是如下形式:In one embodiment, the test commands are usually recorded in the test instructions, and the tester sends test commands that meet the requirements of the test case to the channel module through the external access device according to the test case. Test commands can be of the following form:
外部接口函数A调用地址=0x01;参数a=(int,50);External interface function A calling address = 0x01; parameter a = (int, 50);
外部接口函数B调用地址=0x11;参数a=(int,100);参数b=(boolean,false);External interface function B calling address = 0x11; parameter a = (int, 100); parameter b = (boolean, false);
外部接口函数C调用地址=0x21;External interface function C calling address = 0x21;
一个实施例中,包括功能模块指定外部接口函数的调用地址以及参数值。In one embodiment, the function module includes a function module that specifies the calling address and parameter value of the external interface function.
一个实施例中,经过通道模块解析生成的测试命令行包括第一外部接口函数的调用地址以及参数值。In one embodiment, the test command line generated after parsing by the channel module includes the calling address and parameter values of the first external interface function.
应理解,当外部接口函数不需要入参时,上述用于调用该外部接口函数的测试命令行中可以不包括参数值,或者参数值为空,例如,“null”或者不存在这项属性相应的数据。It should be understood that when an external interface function does not require input parameters, the above test command line for calling the external interface function may not include the parameter value, or the parameter value may be empty, for example, "null" or this attribute does not exist accordingly. The data.
还应理解,测试命令行中还可以包括其他的附加信息,例如,测试命令行中的第一外部接口函数的参数值是否与函数回调信息包括的第一外部接口函数入参的取值范围信息匹配,因此,附加信息也可以用于代理模块判断该测试命令行能否调用指定功能模块的外部接口函数,本申请对此不作限定。It should also be understood that the test command line may also include other additional information, for example, whether the parameter value of the first external interface function in the test command line is consistent with the value range information of the first external interface function input parameter included in the function callback information. Therefore, the additional information can also be used by the proxy module to determine whether the test command line can call the external interface function of the specified function module, which is not limited in this application.
一个实施例中,通道模块可以通过如下方式对从外部接入设备发来的测试命令进行解 析:In one embodiment, the channel module can parse the test command sent from the external access device in the following manner:
解析测试命令中关于外部接口函数的相关特征信息,例如,外部接口函数的调用地址、参数值以及附加信息,其中,附加信息包括上述外部接口函数的入参个数以及各个参数的数据类型等,当经过解析生成的这些信息后,将这些信息进行打包处理,即生成测试命令行。测试命令行可以是如下形式:Parse the relevant feature information about the external interface function in the test command, such as the calling address, parameter value and additional information of the external interface function. The additional information includes the number of input parameters of the above-mentioned external interface function and the data type of each parameter, etc. After parsing the generated information, the information is packaged to generate a test command line. The test command line can be of the following form:
外部接口函数A调用地址=0x01;附加信息:参数个数=2,参数类型=[int,boolean];External interface function A calling address = 0x01; additional information: number of parameters = 2, parameter type = [int, boolean];
参数值=[50,true];Parameter value = [50, true];
外部接口函数B调用地址=0x11;附加信息:参数个数=2,参数类型=[int,boolean];External interface function B calling address = 0x11; additional information: number of parameters = 2, parameter type = [int, boolean];
参数值=[100,false];Parameter value = [100, false];
外部接口函数C调用地址=0x21;附加信息:参数个数=0,参数类型=[null];External interface function C calling address = 0x21; additional information: number of parameters = 0, parameter type = [null];
参数值=[null];Parameter value = [null];
一个实施例中,当控制装置中存在多个代理模块时,即一个通道模块对应多个代理模块,通道模块需要将上述解析生成的测试命令行分发给与之对应的所有代理模块。In one embodiment, when there are multiple agent modules in the control device, that is, one channel module corresponds to multiple agent modules, the channel module needs to distribute the test command line generated by the above analysis to all corresponding agent modules.
一个实施例中,在控制装置中设有多个代理模块时,上述测试命令中还可以包括指定代理模块的地址信息,通道模块解析该测试命令后,能够确定接收经过解析生成的测试命令行的代理模块,从而避免了将解析后的测试命令行发送给所有代理模块,造成资源的浪费。In one embodiment, when there are multiple proxy modules in the control device, the above test command may also include the address information of the designated proxy module. After the channel module parses the test command, it can determine whether to receive the parsed and generated test command line. proxy module, thus avoiding the waste of resources caused by sending the parsed test command line to all proxy modules.
应理解,相比于现有的测试方法,测试人员可以通过编排测试命令的方式,实现编排功能模块外部接口函数调用顺序、频率以及入参,进而实现功能模块功能的路径覆盖测试,避免了测试人员反复修改测试代码,并反复将测试代码烧录到控制装置的过程。It should be understood that compared with existing testing methods, testers can arrange test commands to arrange the calling sequence, frequency and parameters of the external interface function of the function module, thereby achieving path coverage testing of the function module function and avoiding the need for testing. The personnel repeatedly modified the test code and repeatedly burned the test code into the control device.
当通道模块向代理模块发送测试命令行之后,代理模块需要根据该测试命令行包括的各项信息,判断是否需要调用功能模块的指定外部接口函数。After the channel module sends a test command line to the agent module, the agent module needs to determine whether it is necessary to call the specified external interface function of the function module based on various information included in the test command line.
图6示出了本申请实施例提供的代理模块调用功能模块外部接口函数的流程示意图。Figure 6 shows a schematic flowchart of the proxy module calling the external interface function of the functional module provided by the embodiment of the present application.
S610,代理模块将测试命令行和函数回调信息进行匹配,确定测试命令行是否能够用于调用指定外部接口函数。若匹配成功,转到S620,若匹配失败,转到S630。S610: The agent module matches the test command line and the function callback information to determine whether the test command line can be used to call the specified external interface function. If the matching is successful, go to S620; if the matching fails, go to S630.
一个实施例中,代理模块可以根据函数回调信息中包括的至少一个外部接口函数的调用地址等信息,生成外部接口函数库,库中存储着上述至少一个外部接口函数的调用条件,该调用条件至少要有外部接口函数的调用地址,此外,还可以有函数入参个数、参数数据类型、入参取值范围等附加信息,本申请实施例对附加信息所包括的内容不作限定。In one embodiment, the proxy module can generate an external interface function library based on the calling address of at least one external interface function included in the function callback information. The library stores the calling conditions of the at least one external interface function, and the calling conditions are at least It must have the calling address of the external interface function. In addition, there may also be additional information such as the number of function input parameters, parameter data types, input parameter value ranges, etc. The embodiments of this application do not limit the content of the additional information.
S620,代理模块调用指定外部接口函数,并将测试命令行包括的参数值输入到该外部接口函数中,完成该外部接口函数的调用。S620: The agent module calls the specified external interface function, and inputs the parameter values included in the test command line into the external interface function to complete the calling of the external interface function.
一个实施例中,在函数回调信息包括上述第一外部接口函数入参的取值范围信息,且测试命令行中包括参数值时,则代理模块需要确定参数值与取值范围信息是否匹配,匹配成功时,则将测试命令行中包括的各个参数值输入到该外部接口函数中,完成外部接口函数的调用,使功能模块执行相应的功能,并输出测试结果。In one embodiment, when the function callback information includes the value range information of the first external interface function input parameter, and the test command line includes the parameter value, the agent module needs to determine whether the parameter value matches the value range information. When successful, each parameter value included in the test command line is input into the external interface function, the call of the external interface function is completed, the function module executes the corresponding function, and the test result is output.
应理解,当外部接口函数不需要入参时,代理模块则也不需要向外部接口函数中输入参数值,在S610中匹配成功的测试命令行也可以不包括参数值。It should be understood that when the external interface function does not require input parameters, the proxy module does not need to input parameter values into the external interface function, and the successfully matched test command line in S610 may not include parameter values.
S630,代理模块终止本次对功能模块外部接口函数的调用。S630: The agent module terminates this call to the external interface function of the function module.
一个实施例中,在匹配失败时,代理模块可以将该测试命令行丢弃,或者存储在指定 位置,再定时清空,本申请实施例对此不作限定。另外,代理模块还可以返回匹配失败信息,并将匹配失败信息发送给通道模块,通过通道模块将其传输至外部接入设备,用于提示测试人员自查测试命令。In one embodiment, when the matching fails, the agent module can discard the test command line, or store it in a designated location, and then clear it regularly. This is not limited in the embodiments of this application. In addition, the agent module can also return matching failure information and send the matching failure information to the channel module, which transmits it to the external access device through the channel module to prompt the tester to self-check the test command.
S640,代理模块接收来自功能模块的测试结果,并将该测试结果转发给通道模块。S640: The agent module receives the test results from the function module and forwards the test results to the channel module.
一个实施例中,上述匹配失败信息或测试结果,都可以发送给通道模块,再由通道模块发送至外部接入设备,当代理模块也具有与外部接入设备进行通信的功能时,例如,将通道模块的功能集成在代理模块中,也可以通过代理模块直接发送至外部接入设备,本申请实施例对此不作限定,但最终都是要将上述匹配失败信息或测试结果发送至外部接入设备。In one embodiment, the above matching failure information or test results can be sent to the channel module, and then the channel module sends it to the external access device. When the proxy module also has the function of communicating with the external access device, for example, The function of the channel module is integrated in the proxy module, and can also be directly sent to the external access device through the proxy module. The embodiments of this application are not limited to this, but ultimately the above matching failure information or test results are sent to the external access device. equipment.
一个实施例中,上述测试结果还可以通过功能模块直接发送给通道模块,本申请对此不作限定。In one embodiment, the above test results can also be directly sent to the channel module through the functional module, which is not limited in this application.
一个实施例中,上述功能模块外部接口函数的测试结果可以是一系列参数值,也可以是通过打印方式呈现的字符串,例如,目标外部接口函数名称,该函数输出的参数及其数值,本申请对此不作限定。In one embodiment, the test results of the external interface function of the above functional module can be a series of parameter values, or a string presented by printing, for example, the name of the target external interface function, the parameters output by the function and their values. There are no restrictions on this application.
应理解,测试人员无需编写相应的测试桩,即可实现对功能模块外部接口函数的直接调用,解决功能模块外部接口函数由于缺失调用方,导致其无法完成功能模块测试的问题,进而解决了难以针对控制装置中依赖于其他功能模块调用的功能模块进行端到端测试的问题;同时,有助于提升控制装置的可测性。It should be understood that testers can directly call the external interface functions of the functional module without writing corresponding test stubs, solving the problem of the external interface function of the functional module being unable to complete the functional module test due to the lack of a caller, thereby solving the difficulty of testing the functional module. Aiming at the problem of end-to-end testing of functional modules in the control device that rely on calls from other functional modules; at the same time, it helps to improve the testability of the control device.
图7示出了本申请实施例提供的代理模块后期维护的示意图。Figure 7 shows a schematic diagram of the later maintenance of the agent module provided by the embodiment of the present application.
一个实施例中,现需要对图7中功能模块A的功能进行测试,该功能的执行需要功能模块B调用功能模块A的外部接口函数。和上述说明内容相同,由于功能模块B未完成开发,所以需要通过代理模块A,根据测试命令行调用功能模块A的指定外部接口函数,使功能模块A执行相应的功能。但是,当功能模块B开发完成后,由于功能模块B可以调用功能模块A的指定外部接口函数,而且该控制装置只有这两个功能模块,这两个功能模块现已完成开发,此时,可以将代理模块A的代理功能关闭,或者直接删除代理模块A。In one embodiment, the function of function module A in Figure 7 needs to be tested. The execution of this function requires function module B to call the external interface function of function module A. The same as the above description, since functional module B has not completed development, it is necessary to call the designated external interface function of functional module A according to the test command line through proxy module A, so that functional module A can perform the corresponding functions. However, when the development of functional module B is completed, since functional module B can call the designated external interface function of functional module A, and the control device only has these two functional modules, the development of these two functional modules has been completed. At this time, you can Turn off the proxy function of proxy module A, or delete proxy module A directly.
应理解,本申请实施例提出的控制装置架构更为灵活,根据控制装置中各个功能模块开发状况,可以独立添加、删除、开启或关闭指定的代理模块。It should be understood that the control device architecture proposed in the embodiment of the present application is more flexible. According to the development status of each functional module in the control device, designated agent modules can be independently added, deleted, turned on or off.
应理解,当控制装置的某个功能模块已经开发完成后,需要对该功能模块进行测试,但是该功能模块相应功能的执行,需要其他功能模块调用本功能模块的指定外部接口函数,方可完成功能测试,而其他功能模块尚未开发完成,通过现有的测试方法,无法实现对该功能模块的测试。但是,根据本申请实施例提供的测试方法可知,通过上述的代理模块即可实现对该功能模块的调用,无需等待其他功能模块开发完成后再进行该功能模块的测试。It should be understood that when a certain functional module of the control device has been developed, the functional module needs to be tested. However, the execution of the corresponding function of the functional module requires other functional modules to call the designated external interface function of this functional module before it can be completed. Functional testing, while other functional modules have not yet been developed, and it is impossible to test this functional module through existing testing methods. However, according to the testing method provided by the embodiment of the present application, it can be known that the function module can be called through the above-mentioned proxy module, and there is no need to wait for the development of other functional modules to be completed before testing the functional module.
应理解,当控制装置全部功能模块开发完成后,现有的测试方法是将各个相互依赖的功能模块进行联调,而无法单独针对某一个在控制装置功能部署中依赖其他功能模块调用的功能模块单独进行端到端的测试。It should be understood that after all functional modules of the control device are developed, the existing testing method is to jointly debug the interdependent functional modules, and cannot individually target a certain functional module that relies on other functional modules in the function deployment of the control device. Conduct end-to-end testing individually.
一个实施例中,功能模块A和功能模块B均已开发完成,其中,功能模块A的功能是获取雨量,功能模块B的功能是确定雨刷器摆动频率。此时需要对功能模块A的功能进行测试,现有的测试方法是运行功能模块B的确定雨刷器被动频率的功能,该过程中,功能模块B调用功能模块A的指定外部接口函数,使功能模块A开启获取雨量的功能, 然后方可返回雨量的数值。但是,根据本申请提供的测试方法可知,只需要开启功能模块A对应的代理模块的代理功能,代理模块即可直接调用功能模块A的指定外部接口函数,对功能模块A单独进行测试,而无需与功能模块B进行联调。简化了测试流程,实现单独针对控制装置依赖于其他功能模块调用的功能模块进行端到端的测试。In one embodiment, both functional module A and functional module B have been developed. The function of functional module A is to obtain rainfall, and the function of functional module B is to determine the wiper swing frequency. At this time, the function of function module A needs to be tested. The existing test method is to run the function of function module B to determine the wiper passive frequency. In this process, function module B calls the designated external interface function of function module A to make the function Module A turns on the function of obtaining rainfall, and then returns the rainfall value. However, according to the testing method provided in this application, it is only necessary to enable the proxy function of the proxy module corresponding to functional module A, and the proxy module can directly call the designated external interface function of functional module A to test functional module A separately without the need for Conduct joint debugging with function module B. The test process is simplified, and end-to-end testing can be carried out individually for the function modules that the control device depends on calling other function modules.
一个实施例中,对于多个相互依赖的功能模块进行联调的测试场景,每个功能模块在执行指定功能代码的过程中,通常需要将代码执行的状态通过打印日志的方式输出,以便于后续功能模块发生故障时,进行故障的定位。当多个相互依赖的功能模块中某一个模块出现故障,需要进行该功能模块具体故障定位时,就需要对所有的功能模块进行联调,而这个过程中各个模块生成的打印日志数量巨大,测试人员故障定位的工作量较大。但是,基于本申请提出的测试方法,测试人员可以打开该功能模块对应的代理模块,通过代理模块直接调用该功能模块的指定外部接口函数,运行相应的功能代码,生成打印日志。应理解,对单模块进行测试所生成的打印日志数量要远小于联调过程中生成的打印日志数量,因此,本申请提出的控制装置更方便于测试人员后期单独对每个功能模块进行维测。In one embodiment, for a test scenario where multiple interdependent functional modules are jointly debugged, each functional module usually needs to output the status of the code execution by printing a log during the process of executing the specified function code, so as to facilitate subsequent When a function module fails, locate the fault. When a module among multiple interdependent functional modules fails and the specific fault of the functional module needs to be located, all functional modules need to be jointly debugged. In this process, the number of print logs generated by each module is huge, and the test The workload of personnel fault location is relatively large. However, based on the testing method proposed in this application, testers can open the proxy module corresponding to the functional module, directly call the designated external interface function of the functional module through the proxy module, run the corresponding functional code, and generate a print log. It should be understood that the number of print logs generated by testing a single module is much smaller than the number of print logs generated during joint debugging. Therefore, the control device proposed in this application is more convenient for testers to conduct maintenance tests on each functional module individually in the later stage. .
本申请实施例还提供用于实现以上任一种方法的控制装置,例如,提供一种控制装置包括用以实现以上任一种方法的单元(或手段)。Embodiments of the present application also provide a control device for implementing any of the above methods. For example, a control device including a unit (or means) for implementing any of the above methods is provided.
图8示出了本申请实施例提供的一种控制装置800的示意性框图。如图8所示,该控制装置800包括:Figure 8 shows a schematic block diagram of a control device 800 provided by an embodiment of the present application. As shown in Figure 8, the control device 800 includes:
第一获取单元810,用于获取功能模块的函数回调信息,该函数回调信息包括功能模块的至少一个外部接口函数的调用地址,该功能模块的测试依赖其他功能模块调用至少一个外部接口函数,该至少一个外部接口函数用于对该功能模块测试。The first obtaining unit 810 is used to obtain the function callback information of the functional module. The function callback information includes the calling address of at least one external interface function of the functional module. The test of the functional module relies on other functional modules to call at least one external interface function. At least one external interface function is used to test the functional module.
第二获取单元820用于接收测试命令行,该测试命令行包括函数调用地址信息,其中,该函数调用地址信息用于指示测试功能模块的至少一个外部接口函数的调用地址;The second acquisition unit 820 is configured to receive a test command line, where the test command line includes function call address information, where the function call address information is used to indicate the call address of at least one external interface function of the test function module;
应理解,第一获取单元810的功能可以由上述实施例中的代理模块实现,第二获取单元820的功能可以由上述实施例中的通道模块实现。It should be understood that the function of the first acquisition unit 810 can be implemented by the agent module in the above embodiment, and the function of the second acquisition unit 820 can be implemented by the channel module in the above embodiment.
测试单元830,用于响应于测试命令行,调用至少一个外部接口函数中的至少部分对功能模块进行测试。The testing unit 830 is configured to respond to the test command line by calling at least part of at least one external interface function to test the functional module.
可选地,测试单元830具体用于确认代理功能开启,其中,当代理功能开启时,根据测试命令行,调用至少一个外部接口函数。Optionally, the test unit 830 is specifically configured to confirm that the proxy function is enabled. When the proxy function is enabled, at least one external interface function is called according to the test command line.
可选地,测试单元830具体还用于对函数调用地址信息包括的第一外部接口函数的调用地址和上述至少一个外部接口函数的调用地址进行匹配,匹配成功后,调用上述第一外部接口函数对功能模块进行测试。Optionally, the test unit 830 is specifically configured to match the calling address of the first external interface function included in the function calling address information with the calling address of the at least one external interface function. After the matching is successful, call the first external interface function. Test functional modules.
可选地,在函数回调信息还包括上述第一外部接口函数入参的取值范围信息,且测试命令行中包括第一外部接口函数的参数值时,测试单元830具体还用于确定该参数值与取值范围信息匹配。Optionally, when the function callback information also includes the value range information of the input parameter of the first external interface function, and the test command line includes the parameter value of the first external interface function, the test unit 830 is also specifically configured to determine the parameter. The value matches the value range information.
应理解,测试单元830的上述功能可以由上述实施例中的代理模块实现。It should be understood that the above functions of the test unit 830 can be implemented by the agent module in the above embodiment.
可选地,第二获取单元820具体还用于获取外部接入设备发送的测试命令行。应理解,外部接入设备也可以向控制装置直接发送测试命令行。Optionally, the second obtaining unit 820 is also specifically configured to obtain the test command line sent by the external access device. It should be understood that the external access device can also directly send the test command line to the control device.
发送单元840,用于向外部接入设备发送对功能模块的测试结果。The sending unit 840 is used to send the test results of the functional module to the external access device.
应理解,发送单元840的功能可以由上述实施例中的通道模块实现。It should be understood that the function of the sending unit 840 can be implemented by the channel module in the above embodiment.
本申请实施例还提供了一种MCU,进一步地,提供了一种车载单元MCU,该MCU包括前文所述的控制装置800。The embodiment of the present application also provides an MCU, and further provides a vehicle-mounted unit MCU. The MCU includes the control device 800 mentioned above.
在本说明书中使用的术语“部件”、“模块”、“系统”等用于表示计算机相关的实体、硬件、固件、硬件和软件的组合、软件、或执行中的软件。例如,部件可以是但不限于,在处理器上运行的进程、处理器、对象、可执行文件、执行线程、程序和/或计算机。通过图示,在计算设备上运行的应用和计算设备都可以是部件。一个或多个部件可驻留在进程和/或执行线程中,部件可位于一个计算机上和/或分布在2个或更多个计算机之间。此外,这些部件可从在上面存储有各种数据结构的各种计算机可读介质执行。部件可例如根据具有一个或多个数据分组(例如来自与本地系统、分布式系统和/或网络间的另一部件交互的二个部件的数据,例如通过信号与其它系统交互的互联网)的信号通过本地和/或远程进程来通信。The terms "component", "module", "system", etc. used in this specification are used to refer to computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a component may be, but is not limited to, a process, a processor, an object, an executable file, a thread of execution, a program and/or a computer running on a processor. Through the illustrations, both applications running on the computing device and the computing device may be components. One or more components can reside in a process and/or thread of execution and a component can be localized on one computer and/or distributed between 2 or more computers. Additionally, these components can execute from various computer-readable media having various data structures stored thereon. A component may, for example, be based on a signal having one or more data packets (eg, data from two components interacting with another component, a local system, a distributed system, and/or a network, such as the Internet, which interacts with other systems via signals) Communicate through local and/or remote processes.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each specific application, but such implementations should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be described again here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。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. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(eread-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。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 computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the existing technology 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, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program code. .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖 在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application. should be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (19)

  1. 一种测试方法,其特征在于,包括:A testing method, characterized by including:
    获取功能模块的函数回调信息,所述函数回调信息包括所述功能模块的至少一个外部接口函数的调用地址,所述功能模块的测试依赖其他功能模块调用所述至少一个外部接口函数,所述至少一个外部接口函数用于对所述功能模块测试;Obtain the function callback information of the functional module. The function callback information includes the calling address of at least one external interface function of the functional module. The test of the functional module relies on other functional modules to call the at least one external interface function. The at least one An external interface function is used to test the functional module;
    获取测试命令行,所述测试命令行包括函数调用地址信息,其中,所述函数调用地址信息用于指示测试所述功能模块的所述至少一个外部接口函数的调用地址;Obtain a test command line, where the test command line includes function call address information, where the function call address information is used to indicate the call address of the at least one external interface function for testing the functional module;
    响应于所述测试命令行,调用所述至少一个外部接口函数中的至少部分对所述功能模块进行测试。In response to the test command line, at least part of the at least one external interface function is called to test the functional module.
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1, further comprising:
    确认代理功能开启,其中,当所述代理功能开启时,根据所述测试命令行,调用所述至少一个外部接口函数。Confirm that the proxy function is enabled, wherein when the proxy function is enabled, the at least one external interface function is called according to the test command line.
  3. 根据权利要求1或2所述的方法,其特征在于,所述函数调用地址信息包括第一外部接口函数的调用地址,所述响应于所述测试命令行,调用所述至少一个外部接口函数中的至少部分对所述功能模块进行测试,包括:The method according to claim 1 or 2, characterized in that the function calling address information includes the calling address of the first external interface function, and the at least one external interface function is called in response to the test command line. Test at least part of the functional modules, including:
    在所述第一外部接口函数的调用地址和所述至少一个外部接口函数的调用地址匹配成功后,调用所述第一外部接口函数对所述功能模块进行测试。After the calling address of the first external interface function and the calling address of the at least one external interface function are successfully matched, the first external interface function is called to test the functional module.
  4. 根据权利要求1或2所述的方法,其特征在于,所述函数调用地址信息包括所述功能模块的标识,所述响应于所述测试命令行,调用所述至少一个外部接口函数中的至少部分对所述功能模块进行测试,还包括:The method according to claim 1 or 2, characterized in that the function call address information includes the identification of the functional module, and in response to the test command line, calling at least one of the at least one external interface function Part of the testing of the functional modules also includes:
    根据所述功能模块的标识,调用所述至少一个外部接口函数中的至少部分对所述功能模块进行测试。According to the identification of the functional module, at least part of the at least one external interface function is called to test the functional module.
  5. 根据权利要求1至4中任一项所述的方法,其特征在于,所述函数回调信息还包括第一外部接口函数入参的取值范围信息,所述测试命令行包括所述第一外部接口函数的参数值,在所述调用所述至少一个外部接口函数中的至少部分对所述功能模块进行测试之前,所述方法还包括:The method according to any one of claims 1 to 4, characterized in that the function callback information also includes value range information of the first external interface function input parameter, and the test command line includes the first external Parameter values of the interface function. Before calling at least part of the at least one external interface function to test the functional module, the method further includes:
    确定所述参数值与所述取值范围信息匹配。It is determined that the parameter value matches the value range information.
  6. 根据权利要求1至5中任一项所述的方法,其特征在于,所述获取测试命令行,包括:The method according to any one of claims 1 to 5, characterized in that said obtaining a test command line includes:
    获取外部接入设备发送的所述测试命令行。Obtain the test command line sent by the external access device.
  7. 根据权利要求6所述的方法,其特征在于,所述方法还包括:The method of claim 6, further comprising:
    向所述外部接入设备发送对所述功能模块的测试结果。Send the test results of the functional module to the external access device.
  8. 一种控制装置,其特征在于,包括:A control device, characterized by including:
    第一获取单元,用于获取功能模块的函数回调信息,所述函数回调信息包括所述功能模块的至少一个外部接口函数的调用地址,所述功能模块的测试依赖其他功能模块调用所述至少一个外部接口函数,所述至少一个外部接口函数用于对所述功能模块测试;The first acquisition unit is used to obtain the function callback information of the functional module. The function callback information includes the calling address of at least one external interface function of the functional module. The testing of the functional module relies on other functional modules to call the at least one External interface function, the at least one external interface function is used to test the functional module;
    第二获取单元,用于获取测试命令行,所述测试命令行包括函数调用地址信息,其中, 所述函数调用地址信息用于指示测试所述功能模块的所述至少一个外部接口函数中的至少部分的调用地址;The second acquisition unit is used to acquire a test command line, where the test command line includes function call address information, wherein the function call address information is used to indicate testing of at least one of the at least one external interface function of the functional module. Part of the calling address;
    测试单元,用于响应于所述测试命令行,调用所述至少一个外部接口函数对所述功能模块进行测试。A testing unit, configured to respond to the test command line and call the at least one external interface function to test the functional module.
  9. 根据权利要求8所述的控制装置,其特征在于,所述测试单元还用于:The control device according to claim 8, characterized in that the test unit is also used for:
    确认代理功能开启,其中,当所述代理功能开启时,根据所述测试命令行,调用所述至少一个外部接口函数。Confirm that the proxy function is enabled, wherein when the proxy function is enabled, the at least one external interface function is called according to the test command line.
  10. 根据权利要求8或9所述的控制装置,其特征在于,所述函数调用地址信息包括第一外部接口函数的调用地址,所述测试单元具体用于:The control device according to claim 8 or 9, characterized in that the function call address information includes the call address of the first external interface function, and the test unit is specifically used for:
    在所述第一外部接口函数的调用地址和所述至少一个外部接口函数的调用地址匹配成功后,调用所述第一外部接口函数对所述功能模块进行测试。After the calling address of the first external interface function and the calling address of the at least one external interface function are successfully matched, the first external interface function is called to test the functional module.
  11. 根据权利要求8或9所述的控制装置,其特征在于,所述函数调用地址信息包括所述功能模块的标识,所述测试单元具体用于:The control device according to claim 8 or 9, characterized in that the function call address information includes the identification of the functional module, and the test unit is specifically used for:
    根据所述功能模块的标识,调用所述至少一个外部接口函数中的至少部分对所述功能模块进行测试。According to the identification of the functional module, at least part of the at least one external interface function is called to test the functional module.
  12. 根据权利要求8至11中任一项所述的控制装置,其特征在于,所述函数回调信息还包括第一外部接口函数入参的取值范围信息,所述测试命令行包括所述第一外部接口函数的参数值,所述测试单元具体用于:The control device according to any one of claims 8 to 11, wherein the function callback information also includes value range information of the first external interface function input parameter, and the test command line includes the first Parameter values of external interface functions, the test unit is specifically used for:
    在调用所述至少一个外部接口函数中的至少部分对所述功能模块进行测试之前,确定所述参数值与所述取值范围信息匹配。Before calling at least part of the at least one external interface function to test the functional module, it is determined that the parameter value matches the value range information.
  13. 根据权利要求8至12中任一项所述的控制装置,其特征在于,所述第二获取单元具体用于:The control device according to any one of claims 8 to 12, characterized in that the second acquisition unit is specifically used for:
    获取外部接入设备发送的所述测试命令行。Obtain the test command line sent by the external access device.
  14. 根据权利要求13所述的控制装置,其特征在于,所述装置还包括:The control device according to claim 13, characterized in that the device further includes:
    发送单元,用于向所述外部接入设备发送对所述功能模块的测试结果。A sending unit, configured to send test results of the functional module to the external access device.
  15. 一种控制装置,其特征在于,包括:A control device, characterized by including:
    存储器,用于存储计算机指令;Memory, used to store computer instructions;
    处理器,用于执行所述存储器中存储的计算机指令,以使得所述装置执行如权利要求1至7中任一项所述的方法。A processor, configured to execute computer instructions stored in the memory, so that the device performs the method according to any one of claims 1 to 7.
  16. 一种微控制单元,其特征在于,包括如权利要求8至15中任一项所述的控制装置。A micro control unit, characterized by comprising the control device according to any one of claims 8 to 15.
  17. 一种计算机存储介质,其特征在于,所述计算机存储介质中存储有计算机指令,所述指令在计算机上执行时,使得所述计算机执行如权利要求1至7中任一项所述的方法。A computer storage medium, characterized in that computer instructions are stored in the computer storage medium, and when the instructions are executed on a computer, they cause the computer to perform the method according to any one of claims 1 to 7.
  18. 一种芯片,其特征在于,包括处理器,所述处理器用于执行如权利要求1至7中任一项所述的方法。A chip, characterized in that it includes a processor, the processor being used to execute the method according to any one of claims 1 to 7.
  19. 一种计算机程序产品,其特征在于,所述计算机程序代码或指令在计算机上执行时,使得所述计算机执行如权利要求1至7中任意一项所述的方法。A computer program product, characterized in that, when the computer program code or instructions are executed on a computer, the computer causes the computer to perform the method according to any one of claims 1 to 7.
PCT/CN2022/086219 2022-04-12 2022-04-12 Test method and control apparatus WO2023197128A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2022/086219 WO2023197128A1 (en) 2022-04-12 2022-04-12 Test method and control apparatus
CN202280004994.7A CN117222983A (en) 2022-04-12 2022-04-12 Test method and control device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/086219 WO2023197128A1 (en) 2022-04-12 2022-04-12 Test method and control apparatus

Publications (1)

Publication Number Publication Date
WO2023197128A1 true WO2023197128A1 (en) 2023-10-19

Family

ID=88328667

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/086219 WO2023197128A1 (en) 2022-04-12 2022-04-12 Test method and control apparatus

Country Status (2)

Country Link
CN (1) CN117222983A (en)
WO (1) WO2023197128A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101620536A (en) * 2009-08-17 2010-01-06 用友软件股份有限公司 Method and device for invoking performance function
CN101847100A (en) * 2010-06-08 2010-09-29 用友软件股份有限公司 Method for expanding software application and device
CN114116246A (en) * 2020-08-31 2022-03-01 华为技术有限公司 Function calling method and device
CN114237774A (en) * 2022-02-14 2022-03-25 北京安盟信息技术股份有限公司 Internal calling method for removing dependence of functional module

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101620536A (en) * 2009-08-17 2010-01-06 用友软件股份有限公司 Method and device for invoking performance function
CN101847100A (en) * 2010-06-08 2010-09-29 用友软件股份有限公司 Method for expanding software application and device
CN114116246A (en) * 2020-08-31 2022-03-01 华为技术有限公司 Function calling method and device
CN114237774A (en) * 2022-02-14 2022-03-25 北京安盟信息技术股份有限公司 Internal calling method for removing dependence of functional module

Also Published As

Publication number Publication date
CN117222983A (en) 2023-12-12

Similar Documents

Publication Publication Date Title
US7353498B2 (en) Multi-process debugger
US20070055911A1 (en) A Method and System for Automatically Generating a Test-Case
CN110688313B (en) Fault injection method for software testing under VxWorks operating system
CN117378179A (en) System and method for debugging, optimizing, profiling or recovering network devices in a real-time network
CN110704314B (en) Fault injection method for embedded software test
US20090204851A1 (en) Method and System for Software Testing
CN115328104A (en) Automatic testing device and method for train operation monitoring system
CN115546927A (en) UDS diagnosis automatic test system based on AUTOSAR standard
CN116681013A (en) Simulation verification method, platform, device, equipment and medium of network chip
CN110704315B (en) Fault injection device for embedded software test
US20130254750A1 (en) Method of debugging software and corresponding computer program product
CN113133041B (en) Method and device for testing vehicle-to-vehicle communication function in dynamic interval train control vehicle
WO2023197128A1 (en) Test method and control apparatus
CN112506775B (en) Multi-HIL platform testing method and system
CN116775498A (en) Software testing method and device, electronic equipment and storage medium
US20240176632A1 (en) Method for generating and verifying automotive embedded software based on autosar
CN106250123B (en) A kind of system test mode and operational mode compatibility method
US20020073253A1 (en) Test module
CN109144563A (en) Application component constructs packaging method, device and computer storage medium
CN108718253A (en) A kind of positioning problems method and device
CN114721286A (en) Distributed compiled parallel real-time simulation system and simulation method
US20030225566A1 (en) JTAG server
CN111611161A (en) Implementation method of lightweight debugging tool applied to avionic software
JP2003177937A (en) Apparatus and method for improvement of communication between emulator unit and host device
CN114978938B (en) Switch testing method, system and equipment

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 202280004994.7

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22936785

Country of ref document: EP

Kind code of ref document: A1