Universal test software system based on QT
Through modular design and the application of QT signal and slot mechanism, a universal test software system based on QT is realized, which solves the universality, scalability and cross-platform compatibility problems of existing test software systems and improves test efficiency and user experience.
Patent Information
- Application Number
- CN202510700559.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-09-19
Smart Images

Figure CN120670328A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software testing, and in particular relates to a universal testing software system based on QT. Background Art
[0002] In the field of software testing, as the scale and complexity of software systems continue to increase, the requirements for test software are also becoming increasingly demanding. Existing test software architectures often suffer from poor versatility and insufficient scalability. Different test projects require redevelopment of test software based on specific requirements, resulting in high development costs and low efficiency.
[0003] Furthermore, traditional testing software also suffers from cross-platform compatibility deficiencies, making it difficult to run stably on different operating systems. For example, some testing software developed based on specific frameworks only works on Windows systems and cannot meet the testing requirements of Linux systems. Furthermore, existing testing software lacks flexibility in interface interaction design, making it difficult to quickly adapt to the diverse user requirements for test interface layout and operation methods, impacting the tester's work experience and testing efficiency.
[0004] For example, patent document CN109359038B discloses a method for implementing a configuration test system based on a combination of Qt and Lua. The human-computer interaction module includes an executable file generated by cross-platform Qt compilation and linking, and several C-class Lua script files. The function execution module compiles Lua source code using an embedded system, linking it to generate an executable file in the form of a library. The implementation includes executable files and Lua script files in an embedded environment. The present invention utilizes Qt, a cross-platform technology, and various Qt controls to address the display-friendly nature of the test interface. The same software can be applied to Windows, Linux, and other environments. Although this method achieves cross-platform operation, it still cannot meet different test requirements, and its versatility and scalability are low. Different test projects require the redevelopment of test software tailored to specific needs, resulting in high development costs and low efficiency.
[0005] Therefore, it is urgent to develop a testing software with strong versatility, excellent scalability, high compatibility and the ability to meet the needs of different testing projects. Summary of the Invention
[0006] To solve the above technical problems, this application provides a general testing software system based on QT, which is implemented in the QT development environment and includes the following contents:
[0007] The interactive implementation subsystem is used to instantiate the UI module and the control module and start the entire test software system. The UI module is built based on the QT graphical user interface framework, uses the QT signal and slot mechanism to implement the interaction between interface elements and business logic, and supports custom interface layout. The control module creates multiple classes corresponding to different test function modules in the project, defines test logic functions and interface functions in the classes, and uses QT's QThread class to create test threads to execute test tasks.
[0008] The communication module realizes the communication between the test software and the tested object and external devices by creating a communication class, which has data sending, receiving, parsing and encapsulation functions;
[0009] The tool module is used to carry the tool sub-modules, including the configuration file module, the control style module, the file operation module, the timer module, the test report module, and the tool function module; wherein the control style module is used to set the control style, and the tool function module stores commonly used tool functions for other modules to call;
[0010] Public modules are used to define global variables and structures and implement variable interactions between modules;
[0011] When performing general testing, the UI module issues test instructions in response to user needs. After receiving the test instructions, the control module creates a test thread in the corresponding test function module to execute the test task; after receiving the test instructions, the common module defines global variables and structures, and feeds back to the UI module and the control module to realize variable interaction between modules; at the same time, the communication module creates a communication class between the test software, the object under test and the external device that meets the test task; the tool module receives the call instruction of the tool sub-module and executes the corresponding tool sub-module. After the test task is completed, the UI module obtains and outputs the test results.
[0012] Furthermore, the UI module includes a main interface, an automatic test interface, a manual test interface, a hardware calibration interface, a help interface, a user login interface, a report generation interface and a user switching interface, which are used to realize the interactive functions of user login, automatic test, manual test, calibration mode, KIO test, AD / DA test, CAN communication test, serial port communication test, Ethernet communication test and report generation.
[0013] Furthermore, the hardware calibration interface submodule includes communication calibration, KI calibration, KO calibration, AD calibration, and DA calibration.
[0014] Furthermore, the automatic test interface includes a device name input box, a device number input box, a test start time display box, a test end time display box, a start test button, and a test result display box.
[0015] Furthermore, the report generation interface is used to generate a test report, including a print preview function to realize a preview effect display of the test report printing.
[0016] Furthermore, the control module includes a main control module, a data processing module and other control function modules. The main control submodule is used to initialize the communication, timer, clock and other functions; the data processing submodule is used to analyze and process the communication received data and display the sending interface, as well as calculate and assign values to the communication sent data; the other control submodules are modules reserved for developers to design according to the project software requirements.
[0017] Furthermore, the communication module includes a CAN communication module, a serial communication module, and an Ethernet communication module, which are used to support multiple communication protocols. The communication protocol and method can be selected for data transmission according to communication requirements.
[0018] Furthermore, the tool functions in the tool function module include a warning prompt box function, a data format conversion function, and a log recording function.
[0019] Furthermore, the common module includes a global structure and union declaration submodule, a global variable and constant declaration submodule, and a control module and UI module connection submodule.
[0020] Furthermore, the control module and UI module connection submodule uses QT's signal and slot mechanism to associate the control module with the UI module, so that the variables of the control module and the variables in the UI module can be used interactively.
[0021] The beneficial effects of the present invention are:
[0022] (1) Versatility and strong scalability: Through modular design, the test software system can be applied to a variety of different types of test projects. Whether it is a simple functional test or a complex manual test or automatic test, it can be quickly built and configured based on the framework, which greatly improves the versatility of the test software. It is no longer necessary to redevelop the test software according to specific needs for different test projects, thereby reducing development costs, improving test efficiency and system utilization.
[0023] (2) Improve the cross-platform compatibility of test software: Since QT itself has good cross-platform compatibility, the test software architecture developed based on QT can run stably on multiple operating systems such as Windows and Linux without a large amount of code modification, reducing the cost and difficulty of cross-platform development.
[0024] (3) Flexible interface interaction: The interface display module provides rich interface customization functions. Developers can freely adjust the interface layout and appearance style according to their own needs, thereby improving the tester's work experience and testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 This is an architecture diagram of the QT-based universal test software system provided by the present invention;
[0026] Figure 2 This is a schematic diagram of the main interface of the QT-based universal test software system provided by the present invention;
[0027] Figure 3 This is a schematic diagram of the automatic test interface of the QT-based universal test software system provided by the present invention;
[0028] Figure 4 This is a schematic diagram of the hardware calibration interface of the QT-based universal test software system provided by the present invention;
[0029] Figure 5 This is a schematic diagram of the help interface of the QT-based universal testing software system provided by the present invention. DETAILED DESCRIPTION
[0030] The technical solution of the present invention is further described below, but the scope of protection claimed is not limited to the description.
[0031] The embodiment of the present invention provides a universal test software system based on QT, which solves the problems of poor versatility, insufficient scalability, poor cross-platform compatibility and inflexible interface interaction of existing test software, and realizes that a set of test software system can be applied to multiple test scenarios, reduces development costs and improves test efficiency.
[0032] The general test software system based on QT, such as Figure 1 As shown, it is implemented in the QT development environment and includes the following:
[0033] The interactive implementation subsystem is used to instantiate the UI module and control module and start the entire test software system; wherein, the UI module is built based on the QT graphical user interface framework, uses the QT signal and slot mechanism to realize the interaction between interface elements and business logic, and supports customized interface layout; the control module creates multiple classes in the project corresponding to different test function modules, defines test logic functions and interface functions in the class, and uses QT's QThread class to create test threads to execute test tasks.
[0034] The UI module includes a main interface, an automatic test interface, a manual test interface, a hardware calibration interface, a help interface, a user login interface, a report generation interface, and a user switching interface, and is used to realize the interactive functions of user login, automatic test, manual test, calibration mode, KIO test, AD / DA test, CAN communication test, serial port communication test, Ethernet communication test, and report generation.
[0035] The interface design of the main interface is as follows Figure 2 As shown, the top is the menu bar QMenuBar, the middle is the stack window QStackedWidget, and the bottom displays the software name, version number and company logo.
[0036] The hardware calibration interface submodule includes communication calibration, KI calibration, KO calibration, AD calibration, and DA calibration. Figure 4 As shown, it includes the last calibration time display box, the last calibration result display light, the start calibration button, the return button, the pause button, the end calibration button, the restart button, the calibration details display box, and the calibration process display.
[0037] The help interface is as follows Figure 5 As shown, it includes the usage instructions of each function and user precautions, which can be adaptively changed according to the specific content of the software.
[0038] The automatic test interface is as follows Figure 3 As shown, it includes a device name input box, a device number input box, a test start time display box, a test end time display box, a start test button, and a test result display box.
[0039] The report generation interface is used to generate a test report, including a print preview function to realize a preview display of the test report printing.
[0040] The implementation of the UI module is to create a new QTWidgets application project in the QT development environment. Use the QTDesigner tool to design the basic layout of the interface, drag and drop various interface elements onto the interface, such as QPushButton, QLineEdit, QListWidget, and arrange them reasonably through the layout manager. Associate corresponding signals and slot functions with each interface element to realize the interaction between user operations and the control module, such as button clicks and text input. For example, when the user clicks the "Start Test" button, the corresponding slot function is triggered, and the UI module sends an instruction to start the test to the control module. The main style setting is realized by modifying QT's style sheet QSS. Different QSS files are selected in the software setting interface and applied to the interface to change the appearance of the interface.
[0041] The control module creates multiple classes in the project, corresponding to different test function modules (such as communication test module class, timer test module class, clock test module class). Each class defines the corresponding test logic function and interface function, uses QT's QThread class to create test threads, and assigns specific test tasks to different threads for execution.
[0042] The control module includes a main control module, a data processing module and other control function modules. The main control submodule is used to initialize functions such as communication, timer, and clock; the data processing submodule is used to parse and process communication received data and display the sending interface, as well as calculate and assign values to communication sent data; the other control submodules are modules reserved for developers to design according to project software requirements.
[0043] To implement the control module, multiple classes are created in the project, corresponding to different test function modules, such as the communication test module class, the timer test module class, and the clock test module class. Each class defines the corresponding test logic functions and interface functions, uses QT's QThread class to create test threads, and assigns specific test tasks to different threads for execution.
[0044] The communication module creates a communication class to realize the communication between the test software and the object under test and external devices according to the communication requirements. The communication class has data sending, receiving, parsing and encapsulation functions.
[0045] The communication modules include a CAN communication module, a serial communication module, and an Ethernet communication module, which are used to support multiple communication protocols. The communication protocol and method can be selected for data transmission according to communication requirements.
[0046] The communication module is implemented by creating a corresponding network communication class based on communication requirements. Data sending and receiving functions are implemented in the communication class. For example, when sending data, test data is encapsulated according to a specific protocol format and then sent through a network socket. When receiving data, the received data is parsed, useful information is extracted, and passed to the corresponding module for processing.
[0047] The tool module is used to carry the tool sub-module, including the configuration file module, the control style module, the file operation module, the timer module, the test report module, and the tool function module; wherein, the control style module is used to set the control style, including: setting the control style of buttons and indicator lights; the tool function module stores commonly used tool functions for other modules to call, such as warning prompt boxes, to facilitate direct calling by other modules.
[0048] The tool functions in the tool function module include a warning prompt box function, a data format conversion function, and a log recording function.
[0049] The tool module implementation, including the file operation submodule, implements file creation, opening and closing, reading and writing, and other functions. Other classes use it by calling functions and passing parameters. The control style submodule in the tool module assigns designed control styles to string constants, such as the styles of buttons and indicator lights. Other classes can use it after applying the header file.
[0050] Public modules are used to define global variables and structures and implement variable interactions between modules;
[0051] The common module includes a global structure and union declaration submodule, a global variable and constant declaration submodule, and a control module and UI module connection submodule.
[0052] The control module and UI module connection submodule uses QT's signal and slot mechanism to associate the control module with the UI module, so that the variables of the control module and the variables in the UI module can be used interactively. Because the control module and the UI module are isolated from each other, some variables declared in the control module cannot be used in the IU module. Therefore, a control module and UI module connection submodule is established to connect the two modules so that the variables of the two modules can be used mutually.
[0053] The common module defines global variables, structure arrays, and variables required for the entire project. Furthermore, the common module connects the control module and the UI module in a submodule that connects the control module and the UI module. These modules are linked via signals and slots, allowing data obtained in the control module to be used in the UI module.
[0054] When performing general testing, the UI module issues test instructions in response to user needs. After receiving the test instructions, the control module creates a test thread in the corresponding test function module to execute the test task; after receiving the test instructions, the common module defines global variables and structures, and feeds back to the UI module and the control module to realize variable interaction between modules; at the same time, the communication module creates a communication class between the test software, the object under test and the external device that meets the test task; the tool module receives the call instruction of the tool sub-module and executes the corresponding tool sub-module. After the test task is completed, the UI module obtains and outputs the test results.
[0055] The above disclosure is only a specific embodiment of the present invention, but the present invention is not limited thereto. Any changes that can be conceived by those skilled in the art should fall within the scope of protection of the present invention.
Claims
1. A general test software system based on QT, characterized in that: Implemented in the QT development environment, including the following: The interactive implementation subsystem is used to instantiate the UI module and the control module and start the entire test software system. The UI module is built based on the QT graphical user interface framework, uses the QT signal and slot mechanism to implement the interaction between interface elements and business logic, and supports custom interface layout. The control module creates multiple classes corresponding to different test function modules in the project, defines test logic functions and interface functions in the classes, and uses QT's QThread class to create test threads to execute test tasks. The communication module realizes the communication between the test software and the tested object and external devices by creating a communication class, which has data sending, receiving, parsing and encapsulation functions; The tool module is used to carry the tool sub-modules, including the configuration file module, the control style module, the file operation module, the timer module, the test report module, and the tool function module; wherein the control style module is used to set the control style, and the tool function module stores commonly used tool functions for other modules to call; Public modules are used to define global variables and structures and implement variable interactions between modules; When performing general testing, the UI module issues test instructions in response to user needs. After receiving the test instructions, the control module creates a test thread in the corresponding test function module to execute the test task; after receiving the test instructions, the common module defines global variables and structures, and feeds back to the UI module and the control module to realize variable interaction between modules; at the same time, the communication module creates a communication class between the test software, the object under test and the external device that meets the test task; the tool module receives the call instruction of the tool sub-module and executes the corresponding tool sub-module. After the test task is completed, the UI module obtains and outputs the test results.
2. The QT-based universal test software system according to claim 1, wherein: The UI module includes a main interface, an automatic test interface, a manual test interface, a hardware calibration interface, a help interface, a user login interface, a report generation interface, and a user switching interface, and is used to realize the interactive functions of user login, automatic test, manual test, calibration mode, KIO test, AD / DA test, CAN communication test, serial port communication test, Ethernet communication test, and report generation.
3. The QT-based universal test software system according to claim 2, wherein: The hardware calibration interface submodule includes communication calibration, KI calibration, KO calibration, AD calibration, and DA calibration.
4. The QT-based universal test software system according to claim 2, wherein: The automatic test interface includes a device name input box, a device number input box, a test start time display box, a test end time display box, a start test button, and a test result display box.
5. The QT-based universal test software system according to claim 2, wherein: The report generation interface is used to generate a test report, including a print preview function to realize a preview display of the test report printing.
6. The QT-based universal test software system according to claim 1, wherein: The control module includes a main control module, a data processing module and other control function modules. The main control submodule is used to initialize functions such as communication, timer, and clock; the data processing submodule is used to parse and process communication received data and display the sending interface, as well as calculate and assign values to communication sent data; the other control submodules are modules reserved for developers to design according to project software requirements.
7. The QT-based universal test software system according to claim 1, wherein: The communication modules include a CAN communication module, a serial communication module, and an Ethernet communication module, which are used to support multiple communication protocols. The communication protocol and method can be selected for data transmission according to communication requirements.
8. The QT-based universal test software system according to claim 1, wherein: The tool functions in the tool function module include a warning prompt box function, a data format conversion function, and a log recording function.
9. The QT-based universal test software system according to claim 1, wherein: The common module includes a global structure and union declaration submodule, a global variable and constant declaration submodule, and a control module and UI module connection submodule.
10. The QT-based universal testing software system according to claim 9, characterized in that: The control module and UI module connection submodule uses QT's signal and slot mechanism to associate the control module with the UI module, so that the variables of the control module and the variables in the UI module can be used interactively.
Citation Information
Patent Citations
A configuration testing system, implementation method, and equipment based on a combination of Qt and Lua.
CN109359038B
