Middleware interface test method, device, equipment and medium
By using the CAN bus and the serial port rotation printing method of the first serial interface for interface testing after the middleware communication module is developed, the problem of time-consuming and labor-intensive middleware interface testing is solved, and low-cost and efficient interface testing is achieved.
Patent Information
- Application Number
- CN202410522671.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2025-10-31
AI Technical Summary
In existing technologies, middleware interface testing relies on calibration protocols, which is time-consuming, labor-intensive, and costly, affecting the overall development progress.
After the middleware communication module is developed, interface testing is performed using the CAN bus and the first serial interface. A serial port rotation printing method is used to send partial signals cycle by cycle for comparison, avoiding serial port bandwidth limitations, reducing costs and improving testing efficiency.
This enables timely interface testing after the middleware communication module is developed, reducing testing costs, improving testing efficiency, and solving the signal loss problem caused by serial port bandwidth limitations.
Smart Images

Figure CN120872801A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software testing, and in particular to a middleware interface testing method, apparatus, device, and medium. Background Technology
[0002] An embedded controller includes a low-level software module, a middleware communication module, and an upper-level application software module. Middleware is an independent system software service program that enables distributed application software to share resources across different technologies. The middleware resides above the client server's operating system and manages computing resources and network communication.
[0003] Middleware communication modules have sending and receiving interfaces, both of which need to be tested. Currently, middleware interface testing is typically performed using calibration software after the relevant calibration protocol has been developed and stabilized. This method involves numerous dependencies, is time-consuming, and costly. Furthermore, middleware interface development is usually completed early in the development process, the calibration protocol is often not yet mature, and calibration software is expensive. Therefore, the current approach to middleware interface testing is time-consuming, labor-intensive, and impacts the overall development schedule. Thus, providing a suitable middleware interface testing method has become an urgent technical problem to be solved. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a middleware interface testing method, apparatus, device, and medium, which enables timely interface testing after the middleware communication module development is completed, thereby improving interface testing efficiency and reducing testing costs. The specific solution is as follows:
[0005] On one hand, this application provides a middleware interface testing method applied to an embedded controller, the embedded controller including a low-level software module, a middleware communication module, an upper-level application software module, and a first serial interface, the method including:
[0006] In the i-th running cycle, the underlying software module receives M first signals from the CAN bus and sends M first signals to the M receiving interfaces of the middleware communication module, with each of the M first signals corresponding to one of the M receiving interfaces.
[0007] The middleware communication module sends M second signals to the upper-layer application software module based on M first signals, and the M second signals correspond one-to-one with the M receiving interfaces;
[0008] The upper-layer application software module selects N second signals from M second signals and sends N second signals to the first serial interface; where N is less than M.
[0009] The first serial interface sends N second signals to the target computer, and when i is less than a preset threshold, controls i to be incremented by one, repeating the step in the i-th running cycle where the underlying software module receives M first signals from the CAN bus until i reaches the preset threshold, so that when the target computer receives M second signals, it compares the M second signals with the M first signals to determine whether the receiving interface is normal; the preset threshold is the ratio of M to N, and the receiving interface corresponding to each of the M second signals is different.
[0010] In another aspect, embodiments of this application also provide a middleware interface testing method, applied to a target computer, the method comprising:
[0011] M first signals are sent to the underlying software module via the CAN bus;
[0012] Receive M second signals sent by the first serial interface; the M second signals are determined based on the M first signals;
[0013] The first signal and the second signal are compared. If they match, it is determined that the receiving interface of the middleware communication module is normal.
[0014] In another aspect, embodiments of this application also provide a middleware interface testing apparatus, including:
[0015] The first transmitting unit is configured to, in the i-th operating cycle, receive M first signals from the CAN bus and send M first signals to M receiving interfaces of the middleware communication module, wherein the M first signals and the M receiving interfaces correspond one-to-one.
[0016] The second sending unit is used for the middleware communication module to send M second signals to the upper-layer application software module according to M first signals, wherein the M second signals correspond one-to-one with the M receiving interfaces;
[0017] The selection unit is configured to allow the upper-layer application software module to select N second signals from M second signals and send the N second signals to the first serial interface; where N is less than M.
[0018] The third transmitting unit is used to send N second signals to the target computer through the first serial interface, and when i is less than a preset threshold, control i to be incremented by one, and repeatedly execute the step in the i-th running cycle where the underlying software module receives M first signals from the CAN bus until i reaches the preset threshold, so that when the target computer receives M second signals, it compares the M second signals with the M first signals to determine whether the receiving interface is normal; the preset threshold is the ratio of M to N, and the receiving interface corresponding to each of the M second signals is different.
[0019] In another aspect, embodiments of this application also provide a middleware interface testing apparatus, including:
[0020] The fourth transmitting unit is used to send M first signals to the underlying software module via the CAN bus;
[0021] The receiving unit is used to receive M second signals transmitted by the first serial interface; the M second signals are determined based on the M first signals.
[0022] The comparison unit is used to compare the first signal and the second signal. If they match, it is determined that the receiving interface of the middleware communication module is normal.
[0023] In another aspect, embodiments of this application provide a computer device, the computer device including a processor and a memory:
[0024] The memory is used to store program code and transmit the program code to the processor;
[0025] The processor is used to execute the methods described above according to the instructions in the program code.
[0026] In another aspect, embodiments of this application provide a computer-readable storage medium for storing a computer program for performing the methods described above.
[0027] This application provides a middleware interface testing method, apparatus, device, and medium. By sending a first signal to the receiving port of the middleware communication module and comparing the second signal sent by the middleware communication interface to the upper-layer application software module with the first signal, it can be determined whether the receiving interface has correctly received the first signal, thereby judging whether the receiving interface is abnormal. Moreover, since the first serial interface has an output bandwidth limitation, a portion of the second signal can be sent to the first serial interface in each running cycle, instead of sending all the second signals corresponding to the receiving interfaces to the first serial interface, which can avoid the loss of the second signals received by the first serial interface, resulting in test failure. It takes multiple running cycles to collect the second signals corresponding to each receiving interface, solving the problem of second signal loss caused by serial port bandwidth limitation. In addition, the first serial interface is inexpensive, which can reduce testing costs and greatly shorten testing time, improving testing efficiency. This testing method does not depend on the development and use of calibration protocols, and can perform interface testing in a timely manner after the middleware communication module is developed, improving interface testing efficiency. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 A flowchart illustrating a middleware interface testing method provided in an embodiment of this application is shown.
[0030] Figure 2 A test schematic diagram of a middleware interface provided in an embodiment of this application is shown;
[0031] Figure 3 This illustration shows a schematic diagram of a second signal received by a target computer in each operating cycle, according to an embodiment of this application.
[0032] Figure 4 A test schematic diagram of another middleware interface provided in an embodiment of this application is shown;
[0033] Figure 5 A schematic diagram of a test code provided in an embodiment of this application is shown;
[0034] Figure 6 This document illustrates a flowchart of a method for testing the sending interface of a middleware communication module, as provided in an embodiment of this application.
[0035] Figure 7A schematic diagram of a test code provided in an embodiment of this application is shown;
[0036] Figure 8 A schematic diagram of a test case script provided in an embodiment of this application is shown;
[0037] Figure 9 A test schematic diagram of a sending interface provided in an embodiment of this application is shown;
[0038] Figure 10 A structural block diagram of a middleware interface testing device provided in an embodiment of this application;
[0039] Figure 11 A structural block diagram of a middleware interface testing device provided in an embodiment of this application;
[0040] Figure 12 This is a structural diagram of a computer device provided in an embodiment of this application. Detailed Implementation
[0041] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the specific embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0042] Many specific details are set forth in the following description in order to provide a full understanding of this application. However, this application may also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the spirit of this application. Therefore, this application is not limited to the specific embodiments disclosed below.
[0043] For ease of understanding, the following detailed description, in conjunction with the accompanying drawings, provides a middleware interface testing method, apparatus, device, and medium according to embodiments of this application.
[0044] refer to Figure 1 The diagram shown is a flowchart of a middleware interface testing method provided in an embodiment of this application. The method may include the following steps.
[0045] S101, in the i-th running cycle, the underlying software module receives M first signals from the CAN bus and sends M first signals to the M receiving interfaces of the middleware communication module.
[0046] In this embodiment, the method can be applied to an embedded controller. The embedded controller includes a low-level software module, a middleware communication module, an upper-level application software module, and a first serial interface. The middleware communication module has a sending interface and a receiving interface, which can perform interface testing on the sending and receiving interfaces in the embedded controller. (Reference) Figure 2 The diagram shown is a test schematic of a middleware interface provided in an embodiment of this application.
[0047] Specifically, in each operating cycle, the CAN bus can send M first signals to the underlying software module of the embedded controller. The underlying control module then forwards the M first signals to the M receiving interfaces of the middleware communication module. The M first signals correspond one-to-one with the M receiving interfaces, and M is greater than or equal to 1. That is to say, for each receiving interface, the CAN bus will send a first signal to it. In addition, the initial value of i can be 1.
[0048] S102, the middleware communication module sends M second signals to the upper-layer application software module based on M first signals.
[0049] Specifically, when the middleware communication module's receiving interface is working normally, the receiving interface can correctly receive the first signal and forward it to the upper-layer application software module. However, when the receiving interface malfunctions, it cannot correctly identify the first signal and may forward an incorrect signal to the upper-layer application software module.
[0050] Since it is impossible to confirm whether the receiving interface of the intermediate communication module has failed, the signal it sends to the upper-layer application software module can be recorded as the second signal. Each receiving interface will send a signal to the upper-layer application software module, that is, the number of second signals is also M, and the M second signals correspond one-to-one with the M receiving interfaces.
[0051] S103, the upper-layer application software module selects N second signals from M second signals and sends the N second signals to the first serial interface.
[0052] Specifically, the upper-layer application software module can forward the second signal to the first serial interface in the embedded controller. However, since there are many receiving interfaces, even up to thousands, the first serial interface has bandwidth limitations. This means that if all the second signals of the receiving interfaces are printed out in the current running cycle, a large number of second signals will be lost, resulting in test failure.
[0053] Therefore, the upper-layer application software module can select N second signals from M second signals, where N is less than M, that is, select a portion of the second signals and send N second signals to the first serial interface, thereby avoiding the loss of second signals due to bandwidth limitations and ensuring the smooth progress of the test.
[0054] S104, the first serial interface sends N second signals to the target computer, and when i is less than a preset threshold, controls i to be incremented by one, repeating the step of the underlying software module receiving M first signals from the CAN bus in the i-th running cycle until i reaches the preset threshold, so that when the target computer receives M second signals, it can compare the M second signals with the M first signals to determine whether the receiving interface is normal.
[0055] In this embodiment of the application, the target computer can determine whether the receiving interface and sending interface of the middleware communication module are normal. The first serial interface can send N second signals to the target computer for storage and compare the number of rounds i of the running cycle with the size of a preset threshold. The preset threshold is the ratio of M to N. That is, when the running cycle reaches the preset threshold, the target computer can receive all M second signals, and the receiving interface corresponding to each of the M second signals is different.
[0056] For example, when i is 1, the N second signals can be the five second signals corresponding to the first to fifth receiving interfaces; when i is 2, the N second signals can be the five second signals corresponding to the sixth to tenth receiving interfaces. (See reference...) Figure 3 The diagram shown is a schematic of a second signal received by a target computer in each operating cycle according to an embodiment of this application, where each sector represents an operating cycle.
[0057] Specifically, when i is less than a preset threshold, i can be incremented by one to enter the next operating cycle. This means the underlying software module receives M first signals from the CAN bus again and sends N second signals to the upper-layer application software, storing these N second signals in the target computer. This process continues until i reaches the preset threshold, at which point the target computer has received all the second signals sent by the receiving interface.
[0058] The target computer can compare M second signals with M first signals. For each receiving interface, if the first and second signals match, it indicates that the receiving interface is normal and can correctly forward the received first signals. If the first and second signals do not match, it indicates that the receiving interface is faulty.
[0059] In this way, by using serial port rotation printing, only N second signals can be output in the serial port printing window in each running cycle. The next N second signals are then output in the next running cycle, until all signals are printed. This solves the problem of signal loss in the middleware interface due to serial port bandwidth limitations. In other words, it takes multiple running cycles to collect the second signal corresponding to each receiving interface, thus resolving the issue of second signal loss caused by serial port bandwidth limitations. Furthermore, the first serial interface is inexpensive, reducing testing costs and significantly shortening testing time, thus improving testing efficiency. This testing method does not rely on the development and use of calibration protocols and can perform interface testing promptly after the middleware communication module is developed, improving interface testing efficiency.
[0060] The first signal can be sent by CAN bus emulation software in the target computer. The CAN bus emulation software sends the first signal to the CAN bus, which is then transmitted to the embedded controller. (Refer to...) Figure 2 As shown.
[0061] In one possible implementation, if the first serial interface and the target computer's interface are inconsistent, and the first serial interface cannot directly transmit the second signal to the target computer, then N second signals can be sent to the target computer through the second serial interface and serial port conversion module in the debugging board. This ensures that the target computer can receive the second signals and guarantees the smooth progress of the test. (See reference...) Figure 4 The diagram shown is a test schematic of another middleware interface provided in an embodiment of this application.
[0062] Specifically, the upper-layer application software module can contain test code. Corresponding test code is written in the application layer software module and integrated and burned into the embedded controller. Executing the test code controls the middleware communication module to send M first signals to the upper-layer application software module based on M first signals sent by the lower-layer software module. In other words, this test code can be used for signal printing output. (Reference) Figure 5 The diagram shown is a schematic of a test code provided in an embodiment of this application, wherein the global variable A is equivalent to the running cycle i in this application.
[0063] refer to Figure 4 As shown, the target computer can have a serial port debugging assistant and a signal value comparison program. The second signal can be sent to the serial port debugging assistant, which can forward M second signals to the signal value comparison program. The signal value comparison program can also obtain M first signals from the CAN bus simulation software to perform signal comparison.
[0064] For the target computer, it can send M first signals to the underlying software module via the CAN bus and receive M second signals sent by the first serial interface. The M second signals are determined based on the M first signals, and the first and second signals are compared. If they match, it is determined that the receiving interface of the middleware communication module is normal.
[0065] In practical applications, corresponding test code can be written in the application layer software module and integrated into the embedded controller. The computer, power supply, embedded controller and debugging board, USB to serial port module and other hardware and wiring harnesses are properly connected and the communication link is debugged to be smooth. All signals that the embedded controller may receive are sent out simultaneously and periodically according to the frequency set by the CAN bus simulation software. Finally, the received data log is read from the serial port debugging assistant and compared with all signal values sent by the CAN bus simulation software through the signal value comparison program. Finally, a middleware receiving signal interface test report is generated.
[0066] In this embodiment of the application, the sending interface of the middleware communication module can also be tested. The testing of the sending interface can be performed after the testing of the receiving interface. This allows the normal receiving interface that has passed the test to participate in the testing process of the sending interface, thereby improving the accuracy of the testing of the sending interface and avoiding the impact of abnormal receiving interfaces on the test results of the sending interface.
[0067] Alternatively, the sending interface of the middleware communication module can be tested first, followed by the receiving interface. The normal receiving interface can be selected based on experience. This way, the testing order of the sending and receiving interfaces is more flexible, improving the testing flexibility.
[0068] refer to Figure 6 The diagram shows a flowchart of a test for the sending interface of a middleware communication module provided in an embodiment of this application. The test process includes the following steps.
[0069] S201, the underlying software module receives control signals from the CAN bus and sends the control signals to the target receiving interface of the middleware communication module.
[0070] Specifically, the CAN bus simulation software in the target computer can send control signals to the CAN bus. The control signals are used to control the signals output by the middleware communication module. The CAN bus can forward the control signals to the underlying software module. The underlying software module can send the control signals to the target receiving interface of the middleware communication module. The target receiving interface can be a known normal receiving interface, that is, one of M receiving interfaces.
[0071] S202, the upper-layer application software module sends multiple third signals to the middleware communication module based on the control signals sent by the middleware communication module.
[0072] Specifically, the middleware communication module can forward the control signal to the upper-layer application software module. The upper-layer application software module can set test code, and executing the test code enables it to determine a suitable third signal based on the control signal and send the third signal to the middleware communication module. Since the middleware communication module has multiple sending interfaces, there are also multiple third signals, with each third signal corresponding one-to-one with a different sending interface of the middleware communication module.
[0073] In one possible implementation, when the third signal is less than or equal to the signal threshold, the fourth signal is the minimum value of the multiple signals corresponding to the transmitting interface; when the third signal is greater than the signal threshold, the fourth signal is the maximum value of the multiple signals corresponding to the transmitting interface.
[0074] In other words, when the third signal is relatively small, the upper-layer application software module notifies the middleware communication module's sending interface to select the smallest signal as the fourth signal for transmission. If the third signal is relatively large, the middleware communication module's sending interface needs to select the largest signal as the fourth signal for transmission.
[0075] refer to Figure 7 The diagram shown illustrates a test code provided in an embodiment of this application. The constant C represents the signal threshold. This test code uses the received bus signal A as a control signal and employs an if-else selection structure to selectively send the maximum or minimum values of all signals to the bus. (Reference) Figure 8 The diagram shown is a schematic of a test case script provided in an embodiment of this application.
[0076] S203, the middleware communication module sends multiple fourth signals to the underlying software module through multiple sending interfaces based on multiple third signals.
[0077] When the middleware communication module receives multiple third signals, if its sending interface is functioning correctly, it will send the third signals under the control of the control signals. If the sending interface malfunctions, the signal sent to the underlying software module may not be a third signal; instead, the signal sent by the middleware communication module to the underlying software module through the sending interface can be denoted as a fourth signal. Each of these fourth signals corresponds one-to-one with a sending interface; that is, each sending interface will send one fourth signal to the underlying software module.
[0078] S204, the underlying software module sends a fourth signal to the CAN bus so that the CAN bus can forward it to the target computer, and the target computer compares the third signal and the fourth signal.
[0079] The underlying software module can forward multiple fourth signals to the CAN bus, which then forwards them to the target computer. The target computer can compare the third and fourth signals. If the third and fourth signals match, it means that the middleware communication module's sending interface has sent the third signal as determined by the test code. In this case, the fourth signal is the same as the third signal, and the middleware communication module's sending interface is functioning correctly. If they do not match, it means that the sending interface did not send the third signal to the underlying software module, but instead sent an incorrect signal, causing the signal comparison to fail. This indicates that the sending interface is malfunctioning.
[0080] In this embodiment, the target computer can send control signals to the underlying software module via the CAN bus; receive a fourth signal sent by the underlying software module; determine the fourth signal based on the control signal; determine a third signal based on the control signal, and compare the third signal and the fourth signal. If the comparison is consistent, it is determined that the sending interface of the middleware communication module is normal.
[0081] refer to Figure 9 The diagram shown is a test schematic of a transmitting interface provided in an embodiment of this application. The CAN bus simulation software in the target computer can send control signals to the CAN bus and receive a fourth signal from the CAN bus. The fourth signal is compared with the third signal to generate an interface test report.
[0082] This application provides a middleware interface testing method. By sending a first signal to the receiving port of the middleware communication module and comparing the second signal sent by the middleware communication interface to the upper-layer application software module with the first signal, it can be determined whether the receiving interface has correctly received the first signal, thereby judging whether the receiving interface is abnormal. Moreover, since the first serial interface has an output bandwidth limitation, a portion of the second signal can be sent to the first serial interface in each running cycle, instead of sending all the second signals corresponding to the receiving interfaces to the first serial interface. This avoids the loss of the second signals received by the first serial interface, which would lead to test failure. It takes multiple running cycles to collect the second signals corresponding to each receiving interface, solving the problem of second signal loss caused by serial port bandwidth limitation. In addition, the first serial interface is inexpensive, which can reduce testing costs and greatly shorten testing time, thus improving testing efficiency. This testing method does not depend on the development and use of calibration protocols and can perform interface testing in a timely manner after the middleware communication module is developed, improving interface testing efficiency.
[0083] Based on the above middleware interface testing methods, this application also provides a middleware interface testing apparatus, see reference. Figure 10 The diagram shown is a structural block diagram of a middleware interface testing device provided in an embodiment of this application. The device may include:
[0084] The first transmitting unit 201 is used to, in the i-th operating cycle, the underlying software module receives M first signals from the CAN bus and sends M first signals to M receiving interfaces of the middleware communication module, wherein the M first signals and the M receiving interfaces correspond one-to-one.
[0085] The second sending unit 202 is used for the middleware communication module to send M second signals to the upper-layer application software module according to M first signals, wherein the M second signals correspond one-to-one with the M receiving interfaces;
[0086] Selection unit 203 is used by the upper-layer application software module to select N second signals from M second signals and send N second signals to the first serial interface; where N is less than M;
[0087] The third transmitting unit 204 is used to send N second signals to the target computer through the first serial interface, and when i is less than a preset threshold, control i to be incremented by one, and repeatedly execute the step in the i-th running cycle in which the underlying software module receives M first signals from the CAN bus until i reaches the preset threshold, so that when the target computer receives M second signals, it compares the M second signals with the M first signals to determine whether the receiving interface is normal; the preset threshold is the ratio of M to N, and the receiving interface corresponding to each of the M second signals is different.
[0088] This application also provides a middleware interface testing device, see reference. Figure 11 The diagram shown is a structural block diagram of a middleware interface testing device provided in an embodiment of this application. The device may include:
[0089] The fourth transmitting unit 301 is used to send M first signals to the underlying software module via the CAN bus;
[0090] The receiving unit 302 is used to receive M second signals sent by the first serial interface; the M second signals are determined based on the M first signals.
[0091] The comparison unit 303 is used to compare the first signal and the second signal. If they match, it is determined that the receiving interface of the middleware communication module is normal.
[0092] This application provides a middleware interface testing device. In each running cycle, it sends a portion of the second signal to the first serial interface, instead of sending all the second signals corresponding to the receiving interfaces to the first serial interface. This avoids test failure due to the loss of second signals received by the first serial interface. Multiple running cycles are required to collect the second signal corresponding to each receiving interface, solving the problem of second signal loss caused by serial port bandwidth limitations. Furthermore, the first serial interface is inexpensive, reducing testing costs and significantly shortening testing time, thus improving testing efficiency. This testing method does not rely on the development and use of calibration protocols and can perform interface testing promptly after the middleware communication module is developed, improving interface testing efficiency.
[0093] In another aspect, embodiments of this application provide a computer device, with reference to Figure 12 The diagram shown is a structural diagram of a computer device provided in an embodiment of this application. The computer device includes a processor 310 and a memory 320.
[0094] The memory 320 is used to store program code and transmit the program code to the processor 310;
[0095] The processor 310 is used to execute the method provided in the above embodiments according to the instructions in the program code.
[0096] The computer device may include a terminal device or a server, and the aforementioned apparatus may be configured in the computer device.
[0097] In another aspect, embodiments of this application also provide a storage medium for storing a computer program for executing the methods provided in the above embodiments.
[0098] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by program instructions in hardware. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium can be at least one of the following media: read-only memory (ROM), RAM, magnetic disk, or optical disk, etc., and other media capable of storing program code.
[0099] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on its differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0100] The above description is merely a preferred embodiment of this application. Although this application has disclosed preferred embodiments above, it is not intended to limit this application. Any person skilled in the art can make many possible variations and modifications to the technical solutions of this application using the methods and techniques disclosed above, or modify them into equivalent embodiments with equivalent changes, without departing from the scope of the technical solutions of this application. Therefore, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of this application without departing from the content of the technical solutions of this application shall still fall within the protection scope of the technical solutions of this application.
Claims
1. A middleware interface testing method, characterized in that, Applied to an embedded controller, the embedded controller including a low-level software module, a middleware communication module, an upper-level application software module, and a first serial interface, the method includes: In the i-th running cycle, the underlying software module receives M first signals from the CAN bus and sends M first signals to the M receiving interfaces of the middleware communication module, with each of the M first signals corresponding to one of the M receiving interfaces. The middleware communication module sends M second signals to the upper-layer application software module based on M first signals, and the M second signals correspond one-to-one with the M receiving interfaces; The upper-layer application software module selects N second signals from M second signals and sends N second signals to the first serial interface; where N is less than M. The first serial interface sends N second signals to the target computer, and when i is less than a preset threshold, controls i to be incremented by one, repeating the step in the i-th running cycle where the underlying software module receives M first signals from the CAN bus until i reaches the preset threshold, so that when the target computer receives M second signals, it compares the M second signals with the M first signals to determine whether the receiving interface is normal; the preset threshold is the ratio of M to N, and the receiving interface corresponding to each of the M second signals is different.
2. The method according to claim 1, characterized in that, The first serial interface sends N of the second signals to the target computer, including: The first serial interface sends N of the second signals to the target computer through the second serial interface and the serial port conversion module.
3. The method according to claim 1, characterized in that, The method further includes: The underlying software module receives control signals from the CAN bus and sends the control signals to the target receiving interface of the middleware communication module; The upper-layer application software module sends multiple third signals to the middleware communication module according to the control signals sent by the middleware communication module; each of the multiple third signals corresponds one-to-one with a multiple sending interface of the middleware communication module. The middleware communication module sends multiple fourth signals to the underlying software module through multiple sending interfaces based on multiple third signals; each of the multiple fourth signals corresponds one-to-one with the multiple sending interfaces. The underlying software module sends the fourth signal to the CAN bus so that the CAN bus forwards it to the target computer, and the target computer compares the third signal and the fourth signal.
4. The method according to claim 3, characterized in that, When the third signal is less than or equal to the signal threshold, the fourth signal is the minimum value of the multiple signals corresponding to the transmitting interface; When the third signal is greater than the signal threshold, the fourth signal is the maximum value of the multiple signals corresponding to the transmitting interface.
5. A middleware interface testing method, characterized in that, Applied to a target computer, the method includes: M first signals are sent to the underlying software module via the CAN bus; Receive M second signals sent by the first serial interface; the M second signals are determined based on the M first signals; The first signal and the second signal are compared. If they match, it is determined that the receiving interface of the middleware communication module is normal.
6. The method according to claim 5, characterized in that, The method further includes: Control signals are sent to the underlying software module via the CAN bus; Receive a fourth signal sent by the underlying software module; the fourth signal is determined according to the control signal; The third signal is determined based on the control signal, and the third signal is compared with the fourth signal. If the comparison is consistent, it is determined that the sending interface of the middleware communication module is normal.
7. A middleware interface testing device, characterized in that, include: The first transmitting unit is configured to, in the i-th operating cycle, receive M first signals from the CAN bus and send M first signals to M receiving interfaces of the middleware communication module, wherein the M first signals and the M receiving interfaces correspond one-to-one. The second sending unit is used for the middleware communication module to send M second signals to the upper-layer application software module according to M first signals, wherein the M second signals correspond one-to-one with the M receiving interfaces; The selection unit is configured to allow the upper-layer application software module to select N second signals from M second signals and send the N second signals to the first serial interface; where N is less than M. The third transmitting unit is used to send N second signals to the target computer through the first serial interface, and when i is less than a preset threshold, control i to be incremented by one, and repeat the step of the underlying software module receiving M first signals from the CAN bus in the i-th running cycle until i reaches the preset threshold, so that when the target computer receives M second signals, it compares the M second signals with the M first signals to determine whether the receiving interface is normal. The preset threshold is the ratio of M to N, and the receiving interface corresponding to each of the M second signals is different.
8. A middleware interface testing device, characterized in that, include: The fourth transmitting unit is used to send M first signals to the underlying software module via the CAN bus; The receiving unit is used to receive M second signals transmitted by the first serial interface; the M second signals are determined based on the M first signals. The comparison unit is used to compare the first signal and the second signal. If they match, it is determined that the receiving interface of the middleware communication module is normal.
9. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the method according to any one of claims 1-4 or 5-6 according to the instructions in the program code.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program for performing the method according to any one of claims 1-4 or 5-6.