Integration test method and system of embedded system
By establishing a communication connection between the test system of the embedded system and the system under test, automatic test case execution is achieved, and the problem of inability to cover OS system calls and test efficiency in the prior art is solved, and testing efficiency and code maintenance are improved. sex.
Patent Information
- Application Number
- CN202411070635.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-12-13
AI Technical Summary
Integration testing of existing embedded systems cannot overwrite OS system calls, test efficiency is inefficient, and it cannot implement effective testing of automation and multiple interactive functions.
By establishing a communication connection between the test system and the system under test, using the communication interface module and the use case management module for message encoding and decoding, simulating the external interface of the system under test, automating the test case execution, and generating test reports until all use cases pass .
It realizes the complete separation of test code and engineering code, reduces the complexity of code maintenance, improves testing efficiency, supports automated testing, and allows test case development and function development to be carried out simultaneously. The test code only needs to care about the external interface of the system rather than the internal one. detail.
Smart Images

Figure CN119127667A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of embedded systems, and in particular to an integrated testing method and system for embedded systems. Background Art
[0002] In the prior art, the following methods are often used for integration testing of embedded systems:
[0003] 1. After testing on the PC, deploy the software to the device through stubbing. This method mixes the test code and stubbing code together, resulting in a large amount of engineering code. In addition, because the OS system calls on the PC and the OS system calls on the device are often inconsistent, the OS system call tests cannot be covered;
[0004] 2. Send instructions to the device, and then use the log on the device to determine whether the running results meet expectations. This method is inefficient, cannot be automated, and cannot be implemented for functions involving multiple interactions. Summary of the invention
[0005] In view of this, the first aspect of the present invention provides an integrated testing method for an embedded system to solve the technical problems in the prior art that the system test cannot cover OS system calls and the testing efficiency is low. The embedded system in the method includes a testing system and a system under test, specifically including:
[0006] The test system establishes a communication connection with the system under test, wherein the test system includes a communication interface module and a use case management module, the system under test includes a communication adapter module and a service management module, and the communication connection between the test system and the system under test is realized based on the connection between the communication adapter module and the communication interface module;
[0007] Perform the following test steps for each use case:
[0008] Step S1, the use case management module encodes a simulation message according to the interface requirements of the communication adapter module, and sends the simulation information to the communication adapter module;
[0009] Step S2, after receiving the simulation message, the communication adapter module forwards the simulation message to the service management module for processing, and the service management module sends the processing result to the test system after processing;
[0010] Step S3, the use case management module decodes the message according to the interface definition of the communication adapter module, presets the test result, compares the preset test result with the test result in the processing result to see if they are consistent, if they are consistent, the use case is determined to have passed; otherwise, the use case is determined to have failed.
[0011] Furthermore, the communication interface module is used to simulate multiple external interfaces of the system under test, and the communication adaptation module performs interface adaptation based on different external interfaces.
[0012] Furthermore, after the test steps are executed for all the use cases respectively, the execution results of each use case are counted and a test report is generated.
[0013] Furthermore, the user modifies the test system and the system under test according to the test report, and then re-executes the test steps of each of the use cases until all of the use cases are determined to have passed.
[0014] A second aspect of the present invention provides an integrated testing system for an embedded system, the system being used to execute the integrated testing method for an embedded system according to the first aspect of the present invention, the system comprising:
[0015] A test initiation module, used for establishing a communication connection between the test system and the system under test, wherein the test system includes a communication interface module and a use case management module, the system under test includes a communication adapter module and a service management module, and the communication connection between the test system and the system under test is realized based on the connection between the communication adapter module and the communication interface module;
[0016] The test case module is used to perform the following test steps for each test case:
[0017] Step S1, the use case management module encodes a simulation message according to the interface requirements of the communication adapter module, and sends the simulation information to the communication adapter module;
[0018] Step S2, after receiving the simulation message, the communication adapter module forwards the simulation message to the service management module for processing, and the service management module sends the processing result to the test system after processing;
[0019] Step S3, the use case management module decodes the message according to the interface definition of the communication adapter module, presets the test result, compares the preset test result with the test result in the processing result to see if they are consistent, if they are consistent, the use case is determined to have passed; otherwise, the use case is determined to have failed.
[0020] The third aspect of the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any one of the above-mentioned integrated testing methods for embedded systems is implemented.
[0021] A fourth aspect of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for executing any of the above-mentioned integrated testing methods for embedded systems.
[0022] Compared with the prior art, the beneficial effects that can be achieved by at least one of the above-mentioned technical solutions adopted in this specification include at least: providing an integrated testing method for an embedded system, in which the test code and the engineering code are completely separated, and there is no need to write a series of complicated stub functions during testing, so that code maintenance is convenient; at the same time, it is convenient for division of labor, test case development and function development can be carried out at the same time, and the test code writer only needs to care about the external interface of the system and does not need to care about the internal details of the system at all, and the entire testing process can be automated, thereby improving testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0024] Figure 1 A schematic diagram of the structure of a test system provided by an embodiment of the present invention;
[0025] Figure 2 A schematic diagram of the structure of a system under test provided by an embodiment of the present invention;
[0026] Figure 3 An architecture diagram of an integrated testing method for an embedded system provided by an embodiment of the present invention;
[0027] Figure 4 It is a schematic diagram of the structure of an integrated test system for an embedded system provided by an embodiment of the present invention;
[0028] Figure 5 It is a schematic diagram of a computer device provided by an embodiment of the present invention.
[0029] Reference numerals in the figure: 400, integrated test system for embedded system; 401, test start module; 402, use case test module; 501, memory; 502, processor. DETAILED DESCRIPTION
[0030] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0031] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that, in the absence of conflict, the following embodiments and the features in the embodiments can be combined with each other. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present application.
[0032] In an embodiment of the present invention, an integrated testing method for an embedded system is provided, in which the test code and the engineering code are completely separated, and the code maintenance is convenient; at the same time, it is convenient for division of labor, and test case development and function development can be carried out simultaneously. The test code writer only needs to care about the external interface of the system and does not need to care about the internal details of the system at all; the entire testing process can be automated, thereby improving the testing efficiency.
[0033] like Figure 3 As shown, the present invention provides an integrated testing method for an embedded system, wherein the embedded system includes a testing system and a system under test, and the method specifically includes:
[0034] The test system establishes a communication connection with the system under test, wherein the test system includes a communication interface module and a use case management module, the system under test includes a communication adapter module and a service management module, and the communication connection between the test system and the system under test is realized based on the connection between the communication adapter module and the communication interface module;
[0035] Furthermore, the communication interface module is used to simulate multiple external interfaces of the system under test, and the communication adaptation module performs interface adaptation based on different external interfaces.
[0036] Specifically, the test system provided in this embodiment communicates with the system under test in a manner supported by both parties. The communication interface module of the test system is used to simulate multiple external interfaces of the system under test. The system under test adapts to the communication interface of the test system through the communication adapter module, thereby establishing a connection with the test system. Figure 1As shown in the figure, the communication interface module of the test system simulates the external interface of the system under test, and sends messages to the system under test through the use case management module to trigger related services; after the system under test processes the services, it sends the results that need to be output externally to the test system. For each external interface, the system under test has a corresponding communication adapter module to send and receive data; at the same time, the business management module completes data decoding and corresponding functions. The system structure diagram of the system under test is shown in the figure. Figure 2 As shown, the communication interface module of the test system is used to realize the underlying communication with the system under test; the test case management module is used to realize the specific test case functions.
[0037] according to Figure 3 As shown, perform the following test steps for each use case:
[0038] Step S1, the use case management module encodes a simulation message according to the interface requirements of the communication adapter module, and sends the simulation information to the communication adapter module;
[0039] Step S2, after receiving the simulation message, the communication adapter module forwards the simulation message to the service management module for processing, and the service management module sends the processing result to the test system after processing;
[0040] Step S3, the use case management module decodes the message according to the interface definition of the communication adapter module, presets the test result, compares the preset test result with the test result in the processing result to see if they are consistent, if they are consistent, the use case is determined to have passed; otherwise, the use case is determined to have failed.
[0041] Furthermore, after executing the above S1, S2, and S3 test steps for all use cases respectively, the execution results of each use case are counted and a test report is generated.
[0042] Furthermore, the user modifies the test system and the system under test according to the test report, and then re-executes the test steps of each of the use cases until all of the use cases are determined to have passed.
[0043] Specifically, if Figure 3 As shown, for a single test case, the test system first generates a simulation message according to the external interface protocol of the system under test and sends it to the system under test; secondly, after receiving the message, the communication adapter module of the system under test forwards it to the business management module for processing, and the business management module sends the processing result to the test system after processing; the test system decodes the message according to the external interface protocol of the system under test, extracts the execution result returned by the test system from the decoded message, and compares the expected result with the result actually returned by the test system. If they are consistent, the case is judged to have passed; if they are inconsistent, the case fails.
[0044] For the integration test of multiple use cases, after the system under test and the test system are started, the test steps S1, S2, and S3 of each use case are executed cyclically; after all use cases are executed, the use case execution results are counted and a test report is generated. Users can determine whether the problem is with the system under test or the test system based on the test report. After correcting the problem, re-test the use case until all use cases are judged to have passed. After starting the system under test and the test system, the entire integration test process can be completed automatically.
[0045] Based on the same inventive concept, an integrated test system for an embedded system is also provided in the embodiments of the present invention, as described in the following embodiments. Since the principle of solving the problem by an integrated test system for an embedded system is similar to that of an integrated test method for an embedded system, the implementation of an integrated test system for an embedded system can refer to the implementation of an integrated test method for an embedded system, and the repetitions are not repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.
[0046] according to Figure 4 As shown, in this embodiment, an integrated testing system 400 for an embedded system is also provided, and the system 400 is used to execute the integrated testing method for the embedded system described above, and the system includes:
[0047] A test initiation module 401 is used for establishing a communication connection between the test system and the system under test, wherein the test system includes a communication interface module and a use case management module, the system under test includes a communication adapter module and a service management module, and the communication connection between the test system and the system under test is realized based on the connection between the communication adapter module and the communication interface module;
[0048] The use case testing module 402 is used to perform the following test steps for each use case:
[0049] Step S1, the use case management module encodes a simulation message according to the interface requirements of the communication adapter module, and sends the simulation information to the communication adapter module;
[0050] Step S2, after receiving the simulation message, the communication adapter module forwards the simulation message to the service management module for processing, and the service management module sends the processing result to the test system after processing;
[0051] Step S3, the use case management module decodes the message according to the interface definition of the communication adapter module, presets the test result, compares the preset test result with the test result in the processing result to see if they are consistent, if they are consistent, the use case is determined to have passed; otherwise, the use case is determined to have failed.
[0052] In this embodiment, a computer device is provided, such as Figure 5 As shown, it includes a memory 501, a processor 502, and a computer program stored in the memory 501 and executable on the processor 502. When the processor 502 executes the computer program, any one of the above-mentioned integrated testing methods for embedded systems is implemented.
[0053] Specifically, the computer device may be a computer terminal, a server or a similar computing device.
[0054] In this embodiment, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program for executing any one of the above-mentioned integrated testing methods for embedded systems.
[0055] Specifically, computer-readable storage media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer-readable storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable storage media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0056] The present invention achieves the following technical effects through the above embodiments:
[0057] Separate the test system from the system under test. One test system simulates multiple external interfaces of the system under test. The system under test only needs to be simply adapted in the communication interface part. This solution can reduce the complexity of the system under test code, realize the separation of test case code and function code, and realize automated testing. The test system program is implemented on a PC, which has rich development resources and can expand the presentation of test reports as needed.
[0058] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.
[0059] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An integrated testing method for embedded systems, It is characterized in that The embedded system includes a test system and a system under test, and the method includes: The test system establishes a communication connection with the system under test, wherein the test system includes a communication interface module and a use case management module, the system under test includes a communication adapter module and a service management module, and the communication connection between the test system and the system under test is realized based on the connection between the communication adapter module and the communication interface module; Perform the following test steps for each use case: Step S1, the use case management module encodes a simulation message according to the interface requirements of the communication adapter module, and sends the simulation information to the communication adapter module; Step S2, after receiving the simulation message, the communication adapter module forwards the simulation message to the service management module for processing, and the service management module sends the processing result to the test system after processing; Step S3, the use case management module decodes the message according to the interface definition of the communication adapter module, presets the test result, compares the preset test result with the test result in the processing result to see if they are consistent, if they are consistent, the use case is determined to have passed; otherwise, the use case is determined to have failed.
2. The integrated testing method of an embedded system according to claim 1, It is characterized in that The communication interface module is used to simulate multiple external interfaces of the system under test, and the communication adaptation module performs interface adaptation based on different external interfaces.
3. The integrated testing method of an embedded system according to claim 1, It is characterized in that After the test steps in claim 1 are executed for all use cases respectively, the execution results of each use case are counted and a test report is generated.
4. The integrated testing method of an embedded system according to claim 1, It is characterized in that The user modifies the test system and the system under test according to the test report, and then re-executes the test steps of each use case until all the use cases are determined to have passed.
5. An integrated test system for embedded systems, It is characterized in that The system is used to perform the integrated testing method of the embedded system according to any one of claims 1 to 4, and the system comprises: A test initiation module, used for establishing a communication connection between the test system and the system under test, wherein the test system includes a communication interface module and a use case management module, the system under test includes a communication adapter module and a service management module, and the communication connection between the test system and the system under test is realized based on the connection between the communication adapter module and the communication interface module; The test case module is used to perform the following test steps for each test case: Step S1, the use case management module encodes a simulation message according to the interface requirements of the communication adapter module, and sends the simulation information to the communication adapter module; Step S2, after receiving the simulation message, the communication adapter module forwards the simulation message to the service management module for processing, and the service management module sends the processing result to the test system after processing; Step S3, the use case management module decodes the message according to the interface definition of the communication adapter module, presets the test result, compares the preset test result with the test result in the processing result to see if they are consistent, if they are consistent, the use case is determined to have passed; otherwise, the use case is determined to have failed.
6. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the integrated testing method for the embedded system according to any one of claims 1 to 4 is implemented.
7. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program for executing the integrated testing method for an embedded system according to any one of claims 1 to 4.
