Cross-platform lightweight embedded software automatic test architecture and application method

By adopting a cross-platform lightweight embedded software automated testing architecture, the problem of insufficient cross-platform capability of embedded software testing tools is solved, and the rapid porting and integration of test case sets is realized, thereby improving testing efficiency and software quality.

CN118964190APending Publication Date: 2024-11-15SOUTHWEST CHINA RES INST OF ELECTRONICS EQUIP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411019319.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

Existing embedded software testing tools lack cross-platform automated testing capabilities, making it difficult to achieve dynamic testing across all stages. They also suffer from inconsistent testing standards, low testing efficiency, and difficulty in covering real-world application scenarios, leading to problems being missed until the system integration and testing phase, which affects product quality and schedule.

Method used

A cross-platform, lightweight, automated testing architecture for embedded software is designed, comprising an application layer, a framework layer, a hardware layer, and a device layer. It provides a unified interface and operating system adaptation, supports cross-platform portability and integration of test case sets, and realizes test case registration, execution, management, error judgment, and result statistics through the automated testing framework, while shielding hardware resource and operating system differences.

Benefits of technology

It enables rapid portability and integration of test case sets, improves testing efficiency, ensures software quality, supports multiple hardware platforms and operating systems, reduces testing costs, and realizes dynamic software testing at all stages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964190A_ABST
    Figure CN118964190A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-platform lightweight embedded software automatic test architecture and an application method, and the embedded software automatic test architecture comprises an application layer which is configured to provide a test case set, display a test result, and execute test case writing and man-machine interaction; the framework layer is configured to provide an automatic embedded software testing framework, the automatic embedded software testing framework can provide a uniform interface for a user, an operating system is adapted to the user, and related tasks are executed, and the related tasks comprise use case registration, use case execution, use case management, error judgment, exception prompt and result statistics; the hardware layer is configured to provide a hardware platform for running embedded software; and the device layer is configured to provide various systems or devices having interactive relationships with the embedded software. The method can be used for quickly executing the test case set in the full stages of embedded software development, debugging, testing, maintenance and the like, and verifying the function, performance and boundary of the software.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer software application, and in particular to a cross-platform lightweight embedded software automatic testing architecture and an application method. Background Art

[0002] Embedded software has the characteristics of high coupling between software and hardware, multiple types of operating hardware platforms, strong real-time performance, and high requirements for indicators such as the number of memory and I / O channels. Therefore, the testing and verification of embedded software is relatively difficult. At present, with the continuous increase in the number of chips and operating systems and the continuous improvement of product complexity, the number and complexity of embedded software are increasing, and its scale and operating platform capabilities have shown a step-change. In order to better ensure the reliability, stability and security of embedded software, higher requirements are put forward for the testing of embedded software.

[0003] At present, most of the automated testing tools for embedded software are unit testing tools, which mainly complete unit testing and static testing, and lack phased functional and scenario testing. Current unit testing tools, such as GTest, TestBed, and C++Test, generally run on the Windows platform. Many scenarios and interface tests require stubs, and there are few automated testing practices and cases. At the same time, these tools basically test software products at specific stages of software development and debugging, and cannot perform full-stage dynamic testing on embedded software products.

[0004] In addition, the test procedures for hardware computing platforms are generally developed by manufacturers based on specific software and hardware products. The development of test cases is difficult, inefficient, and has poor portability. There is little involvement in software function and performance testing. There are problems such as insufficient function and performance testing, inconsistent testing standards, and lack of software boundary testing. In addition, the test scenarios based on actual applications are not covered enough, resulting in many problems being missed in the system integration and joint testing phase, which seriously affects the software integration progress and product quality. At the same time, when software products involve the addition and modification of functions, it is difficult to achieve use case regression and coverage of normal and abnormal scenarios due to the inability to improve efficiency through automated testing, and it is difficult to evaluate the impact of modifications in an objective and effective manner. It is difficult to discover potential risks in a timely manner, resulting in many problems being exposed only in the later stages, which greatly affects the product / equipment quality and the development, joint testing, and delivery progress. Summary of the invention

[0005] In order to solve the above problems, the present invention proposes a cross-platform lightweight embedded software automatic testing architecture and application method, which is used to quickly execute test case sets in all stages of embedded software development, debugging, testing, maintenance, etc. to verify the functions, performance and boundaries of the software. The main purposes of the present invention are as follows:

[0006] 1. Support multiple hardware platforms and operating systems, shield the impact of differences in software and hardware resources on the development, migration and execution of test cases, realize the migration, reuse and integration of test case sets across hardware platforms, and improve the portability of test software;

[0007] 2. Use lightweight solutions to implement use case registration, use case execution, use case management, error judgment, exception prompts, and present test case execution results to users, thereby achieving efficient integration and rapid testing and improving testing efficiency;

[0008] 3. Design a test case development template based on the automatic testing framework to facilitate use case developers to develop efficiently and realize the reuse of test cases across systems / devices, thereby reducing test verification costs and ensuring software quality.

[0009] The technical solution adopted by the present invention is as follows:

[0010] A cross-platform, lightweight embedded software automatic testing architecture, including:

[0011] The application layer is configured to provide test case sets and display test results, and perform test case writing and human-computer interaction;

[0012] The framework layer is configured to provide an embedded software automatic testing framework, which can provide a unified interface, operating system adaptation and execution of related tasks to users, including use case registration, use case execution, use case management, error judgment, abnormal prompts and result statistics;

[0013] The hardware layer is configured to provide a hardware platform for embedded software to run;

[0014] The device layer is configured to provide various systems or devices that interact with the embedded software.

[0015] Furthermore, by calling the setting interface, the test case is automatically registered into the embedded software automatic testing framework when the automatic testing program is executed, and the embedded software automatic testing framework can uniformly manage the test case set.

[0016] Furthermore, when the test start command is input, the embedded software automatic testing framework automatically traverses and executes the test cases that have been registered and managed, determines whether the test case execution is abnormal according to the target intention, and outputs the test progress, test exception information and test results, and records the test results to the local file system.

[0017] Furthermore, by abstracting the commonly used interfaces of the operating system and shielding the differences in hardware resources and operating systems, the embedded software automatic testing framework provides a unified standard interface for test cases.

[0018] Furthermore, the embedded software automatic testing framework uses different macros to use public interfaces to call interface functions of different operating systems, thereby achieving cross-platform porting of test case sets.

[0019] Furthermore, the types of operating systems and public interface abstract functions supported by the embedded software automatic testing framework can be continuously increased according to the software operating environment, and only the public interface and operating system macro definitions of the corresponding operating system need to be increased.

[0020] Furthermore, the embedded software automatic testing framework provides test case registration and multiple test result expectation interfaces. Test case developers can call the interfaces at will for the embedded software automatic testing framework to check and judge the test case execution results. When the judgment criterion is true, the test case execution is successful; when the judgment criterion is false, the test case execution fails. The embedded software automatic testing framework uniformly manages the test case execution results.

[0021] Furthermore, the embedded software automatic testing framework provides a test start interface for testers to start the test and realize automatic execution of test cases.

[0022] A cross-platform lightweight embedded software automatic testing architecture application method, comprising:

[0023] Use the test interface provided by the embedded software automatic testing framework to write the use case function name, and the test interface written use case function name passed in by the test case is globally unique;

[0024] Determine the operating system layer or application layer interface type, call times and call duration information that need to be called based on the test content;

[0025] The corresponding test result expectation interface is selected according to the interface return value, the number of successful calls, and the function execution timeout information to determine the test result; the embedded software automatic testing framework traverses the test case set and finally presents the test case execution result to the tester.

[0026] Furthermore, the embedded software automatic testing framework makes a judgment based on the expected interface type and input parameters of the called test result to determine whether the current test case is executed successfully or failed.

[0027] The beneficial effects of the present invention are:

[0028] 1) The present invention supports multiple hardware platforms and operating systems, and provides a unified interface for test case developers. Test cases and automatic test frameworks can be quickly transplanted and integrated across platforms and devices, so that testers and software developers can find software defects more quickly and accurately, avoid software problems in a timely manner, and improve the quality and efficiency of software delivery;

[0029] 2) The present invention designs a standard test case development template suitable for an embedded software automatic test framework, which can improve the development efficiency and reuse rate of test cases;

[0030] 3) The code size of the present invention is small, and it can be quickly integrated into embedded software without any sense, so as to realize full-function software dynamic testing in all stages of software development, debugging, testing and maintenance, thereby improving the embedded software testing efficiency and ensuring the software quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is a schematic diagram of an embedded software automatic testing architecture of the present invention.

[0032] Figure 2 It is a flowchart of an automatic testing framework of the present invention.

[0033] Figure 3 It is a test case writing framework diagram of the present invention.

[0034] Figure 4 It is a file reading speed test result diagram of the present invention. DETAILED DESCRIPTION

[0035] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, the specific implementation methods of the present invention are now described. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention, that is, the embodiments described are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0036] Example 1

[0037] like Figure 1 As shown, this embodiment provides a cross-platform lightweight embedded software automatic testing architecture, including an application layer, a framework layer, a hardware layer and a device layer. Among them, the application layer includes a test case set and a test result display, which mainly realizes test case writing and human-computer interaction; the framework layer is an embedded software automatic testing framework, which provides users with a unified interface and operating system abstraction, and realizes functions such as case registration, case execution, case management, error judgment, abnormal prompts and result statistics; the hardware layer is the hardware platform for the test application to run; the device layer is various systems or devices that have an interactive relationship with the test software. The main content of the present invention includes the design of a cross-platform lightweight embedded software automatic testing framework (framework layer) and a test case (application layer) development method based on the framework.

[0038] The cross-platform lightweight embedded software automatic testing framework mainly implements the functions of case registration, case execution, case management, error judgment, exception prompts, result statistics and recording. The test case developer calls a specific interface to realize the automatic registration of the test case into the automatic testing framework when the automatic test program is executed. The automatic testing framework can manage the test case set in a unified manner; when the tester enters the test start command, the automatic testing framework automatically traverses and executes the registered and managed test cases, determines whether the case execution is abnormal according to the intention of the test case developer, and outputs the test progress, test exception information and test results, and records the test results to the local file system. The tester can clearly understand the execution process and results of the test case. The automatic testing process of the automatic testing framework is shown in Figure 2 .

[0039] By abstracting the common interfaces of the operating system and shielding the differences in hardware resources and operating systems, the automatic testing framework provides a unified standard interface for test cases. By defining different macros to use the public interface to call the interface functions of different operating systems, the zero / low-cost porting of the test case set across platforms can be achieved. The abstract common operating system interface functions are shown in Table 1, and the common operating system macro definitions are shown in Table 2. The types of operating systems and public interface abstract functions supported by the automatic testing framework can be continuously increased according to the software's operating environment. It only needs to increase the public interface implementation and operating system macro definition of the corresponding operating system.

[0040] Table 1 - Operating system interface file function identifier

[0041] CSU Name CSU Logo CSU Name CSU Logo Constructor VOS Get time count TickGet Destructor ~VOS Make space in memory Malloc Initialize tick InitStart Free up space Free File system initialization InitEnd Print Printf Creating a message queue MsgQCreate Print Sprintf Get the number of messages in the message queue MsgQNum Close File Close Receive a message from the message queue MsgRecv Reading a file Read Send a message to a message queue MsgSend Writing files Write Creating a Semaphore SemCreate Operation parameter settings Ioctl Get semaphore SemTake Move the file pointer Lseek Release semaphore SemGive Opening a file Open Refresh semaphore SemFlush Deleting files Ulink Deleting a semaphore SemDelete …… ……

[0042] Table 2 - Operating system macro definitions

[0043] Operating system name Macro Definition VXWORKS 5.5 System #define_OS_VXWORKS_ Ruihua Operating System #define _OS_ACORE_ Tianmai Operating System #define_OS_REDE_ Kylin operating system #define_OS_KYLIN_ FreeRTOS operating system #define _OS_FREE_ … …

[0044] In order to facilitate test case developers to develop and transplant use cases, and to facilitate testers to conduct automated testing of embedded software, the automatic testing framework provides multiple public interfaces to the outside world. Specifically, the automatic testing framework provides test case registration and multiple test result expectation interfaces. Use case developers can call the interfaces at will for the automatic testing framework to check and judge the use case execution results. When the judgment criterion is true, the use case execution is successful. When the judgment criterion is false, the use case execution fails, thereby achieving the tester's intention. The automatic testing framework manages the test case execution results in a unified manner. At the same time, the automatic testing framework provides a test startup interface to facilitate testers to start tests, realize automated use case execution, and improve the efficiency of embedded software testing and verification. The specific interfaces provided by the automatic testing framework to use case developers are as follows:

[0045] 1. Use case registration: #define TEST(testcase_name);

[0046] 2. Automatic test start: #define RUN_ALL_TESTS();

[0047] 3. Test result expectation m! = n: #define EXPECT_EQ(m,n);

[0048] 4. Test result expectation m == n: #define EXPECT_NE(m,n);

[0049] 5. Test result expectation m>=n: #define EXPECT_LT(m,n);

[0050] 6. Test result expectation m>n: #define EXPECT_LE(m,n);

[0051] 7. Test result expectation m<=n: #define EXPECT_GT(m,n);

[0052] 8. Test result expectation m <n:#define EXPECT_GE(m,n)。

[0053] In order to facilitate the rapid development of test cases, automatic registration and automatic execution of test cases, and realize the low / zero cost migration and integration of test cases across systems, it is necessary to write a test case development template based on the automatic testing framework. The use case development block diagram designed by the present invention is shown in Figure 3 . First, the TEST (testcase_name) interface provided by the automatic testing framework must be used to write the test case function name. The "testcase_name" passed in by the test case is globally unique; secondly, determine the type of operating system layer or application layer interface that needs to be called, the number of calls, and the call duration information based on the test content; finally, select the appropriate test result expectation interface to determine the test result based on the interface return value, the number of successful calls, and the function execution timeout information. The automatic testing framework makes an error judgment based on the type of test result expectation interface called and the input parameters to determine whether the current test case is executed successfully or failed; the automatic testing framework traverses the test case set and finally presents the test case execution results to the tester.

[0054] Example 2

[0055] This embodiment is based on embodiment 1:

[0056] This embodiment mainly tests whether the reading speed of the computer module file system meets the design requirements. The test case writing and automatic test framework application process are as follows:

[0057] The first step is to sort out the test case implementation method.

[0058] For the file system read speed test, the correctness of reading the file is considered first, and then the speed of reading the file. Therefore, when designing test cases, specific-length known data is first written into the file system, and then the data written into the file system is read multiple times. The time taken for file reading is recorded, and at the same time, it is judged whether the file read each time is correct. Finally, the interface provided by the automated test framework is called for error judgment.

[0059] The second step is to write the test case code.

[0060] The pseudo-code for writing the file system read speed test case is as follows:

[0061] TEST(FileSystemReadSpeedTest) / / File system read speed test case

[0062] {

[0063] unsigned int uiTestNum = 1000; / / Number of file reads

[0064] unsigned int uiTestSuc = 0; / / Number of times the file read speed meets the design requirements

[0065] / / to do Generate specific-length known data

[0066] VOS::Write(fd, buf, len); / / Write the known data into the file system

[0067] for (unsigned int i = 0; i < uiTestNum; i++) / / Perform the read speed test on the file uiTestNum times

[0068] {

[0069] unsigned int uiReadStartTime = VOS::TickGet(); / / Record the start time of file reading

[0070] VOS::Read(fd, buf, len); / / Read the file written into the file system before

[0071] unsigned int uiReadEndTime = VOS::TickGet(); / / Record the end time of file reading

[0072] / / to do determine whether the file is read successfully, whether the read file content is correct, and whether the file reading speed meets the technical indicator requirements

[0073] if(...) / / If the above judgment results are all yes, the number of successes will increase by 1

[0074] {

[0075] iTestSuc++;

[0076] }

[0077] }

[0078] EXPECT_NE(iTestNum,iTestSuc); / / Call the automatic test framework interface to make an error judgment

[0079] }

[0080] The third step is to automatically adapt and compile the test framework and test cases.

[0081] Modify the automatic test framework operating system configuration declaration, select the type of operating system running on the computer module, in this case, select Tianmai operating system interface abstraction, enable the #define_OS_ACORE_ macro definition, and then compile the code.

[0082] The fourth step is to load and start the test program.

[0083] Load the test case program compiled in the third step into the computer module memory, and enter the "RUN_ALL_TESTS" function in the desktop system serial port interface to start the embedded software automatic testing framework. After the framework is started, it will execute the automatic registration of use cases, use case management, use case execution, error judgment, exception prompts and result output functions.

[0084] Step 5: Output the test results.

[0085] The automatic testing framework outputs the execution process and test results of the test cases, such as Figure 4 As shown, the reading speed test of the computer module file system meets the technical indicator requirements.

[0086] The above cross-platform lightweight embedded software automatic testing framework and its application method have small code volume and support multiple software and hardware platforms. By using the use case development module, the test case set and the embedded software automatic testing framework can be quickly integrated, transplanted and reused across platforms and devices without changing the test case code, thereby realizing full-function software function dynamic testing in all stages of software development, thereby improving test efficiency, reducing test costs and ensuring software quality.

[0087] The above is only a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the concept described herein through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art shall not deviate from the spirit and scope of the present invention, and shall be within the scope of protection of the claims attached to the present invention.

Claims

1. A cross-platform lightweight embedded software automatic testing architecture, characterized in that: include: The application layer is configured to provide test case sets and display test results, and perform test case writing and human-computer interaction; The framework layer is configured to provide an embedded software automatic testing framework, which can provide a unified interface, operating system adaptation and execution of related tasks to users, including use case registration, use case execution, use case management, error judgment, abnormal prompts and result statistics; The hardware layer is configured to provide a hardware platform for embedded software to run; The device layer is configured to provide various systems or devices that interact with the embedded software.

2. A cross-platform lightweight embedded software automatic testing architecture according to claim 1, characterized in that: By calling the setting interface, the test case is automatically registered into the embedded software automatic test framework when the automatic test program is executed, and the embedded software automatic test framework can uniformly manage the test case set.

3. A cross-platform lightweight embedded software automatic testing architecture according to claim 1, characterized in that: When the test start command is input, the embedded software automatic testing framework automatically traverses and executes the test cases that have been registered and managed, determines whether the test case execution is abnormal according to the target intention, and outputs the test progress, test exception information and test results, and records the test results to the local file system.

4. A cross-platform lightweight embedded software automatic testing architecture according to claim 1, characterized in that: By abstracting the common interfaces of the operating system and shielding the differences in hardware resources and operating systems, the embedded software automatic testing framework provides a unified standard interface for test cases.

5. The cross-platform lightweight embedded software automatic testing architecture according to claim 1, characterized in that: The embedded software automatic testing framework uses different macros to use a public interface to call interface functions of different operating systems, thereby achieving cross-platform transplantation of test case sets.

6. A cross-platform lightweight embedded software automatic testing architecture according to claim 5, characterized in that: The types of operating systems and public interface abstract functions supported by the embedded software automatic testing framework can be continuously increased according to the software operating environment, and only the public interface and operating system macro definitions of the corresponding operating system need to be increased.

7. The cross-platform lightweight embedded software automatic testing architecture according to claim 1, characterized in that: The embedded software automatic testing framework provides test case registration and multiple test result expectation interfaces. Test case developers can call the interfaces at will for the embedded software automatic testing framework to check and judge the test case execution results. When the judgment criterion is true, the test case execution is successful; when the judgment criterion is false, the test case execution fails. The embedded software automatic testing framework uniformly manages the test case execution results.

8. A cross-platform lightweight embedded software automatic testing architecture according to claim 7, characterized in that: The embedded software automatic testing framework provides a test start interface for testers to start the test and realize the automatic execution of test cases.

9. A cross-platform lightweight embedded software automatic test architecture application method, applied to the embedded software automatic test architecture of claim 1, characterized in that: The application method comprises: Use the test interface provided by the embedded software automatic testing framework to write the use case function name, and the test interface written use case function name passed in by the test case is globally unique; Determine the operating system layer or application layer interface type, call times and call duration information that need to be called based on the test content; The corresponding test result expectation interface is selected according to the interface return value, the number of successful calls, and the function execution timeout information to determine the test result; the embedded software automatic testing framework traverses the test case set and finally presents the test case execution result to the tester.

10. The cross-platform lightweight embedded software automatic testing architecture application method according to claim 9, characterized in that: The embedded software automatic testing framework makes a judgment based on the expected interface type and input parameters of the called test result to determine whether the current test case is executed successfully or failed.