A testing method and system for updating test information in real time

By adopting a hierarchical architecture and blocking message mechanism in the test system, the problem of mutually exclusive access to critical area resources under multi-threaded operations is solved, the system stability and fault location efficiency are improved, and the safe display of real-time update of test information is realized.

CN112765037BActive Publication Date: 2024-12-31HUBEI SANJIANG AEROSPACE HONGFENG CONTROL
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110121454.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-28
Publication Date
2024-12-31
Estimated Expiration
2041-01-28

AI Technical Summary

Technical Problem

Existing test systems have critical area resource mutually exclusive access problems during multi-threading operations, resulting in illegal memory access and system crash.

Method used

It adopts a hierarchical architecture design, including data access layer, business logic layer and presentation layer, and passes information between the main thread and the test thread through a blocking message mechanism to ensure the security and stability of information transmission.

Benefits of technology

It effectively prevents the problem of illegal access to message memory by multiple threads simultaneously, improves the stability of the system and fault location efficiency, and improves the maintainability and portability of the software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112765037B_ABST
    Figure CN112765037B_ABST
Patent Text Reader

Abstract

The present invention discloses a test system and method for updating test information in real time. The system is designed with a layered architecture, which includes, from bottom to top, a data access layer, a business logic layer, and a presentation layer. The data access layer is used to initialize a data interface board and provide a data input and output interface for the data interface board; the business logic layer is used to encapsulate business logic according to the technical requirements of a single machine, and to perform data interaction with a single machine under test through the data access layer to implement testing of the single machine under test; the presentation layer belongs to the main thread, and is used to create a test tree and a test thread according to the user's test configuration input; the business logic layer belongs to the test thread, and is used to traverse and execute test items through a test class, and to send the test process information and the test result information to the main thread through a blocking message mechanism for storage and display. The present invention can solve the problem in the prior art that multiple threads simultaneously operate test information, causing illegal memory access, thereby causing system crashes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of measurement and control technology, and more specifically, relates to a test method and system for updating test information in real time. Background Art

[0002] With the continuous development of control systems, the degree of product universalization, serialization and integration is getting higher and higher, and the model weapon system has put forward higher requirements on the stability and robustness of the test system. With the increasing complexity of the test system test business process, especially in the communication interface test, the requirements for test information update and system stability are getting higher and higher.

[0003] At present, most of the test systems of domestic weapon models adopt the "multi-threading + non-blocking message mapping" technology. Multi-threading generally includes at least user interface thread and working thread. The user interface thread processes user input and corresponding user-generated events and messages through message queues and message loops; the working thread is responsible for performing background calculations and work tasks; the "non-blocking" message mapping mechanism can efficiently realize the message transmission from the working thread to the user interface, but this solution has the problem of mutually exclusive access to critical area resources, that is, if multiple threads operate test information at the same time, it will cause illegal memory access, thus causing the system to crash. Summary of the invention

[0004] In view of at least one defect or improvement need in the prior art, the present invention provides a test method and system for updating test information in real time, which can solve the problem of system crash caused by illegal memory access when updating test information.

[0005] To achieve the above object, according to a first aspect of the present invention, a test system for updating test information in real time is provided, comprising:

[0006] The data access layer is used to initialize the data interface board and provide the data input and output interface of the data interface board;

[0007] The business logic layer is used to encapsulate the test class according to the test requirements of the product to be tested, and the test class is used to perform data interaction with the product to be tested through the data input and output interface;

[0008] The presentation layer is used to encapsulate the human-machine operation interface and the test function management interface;

[0009] The presentation layer belongs to the main thread, and the presentation layer is also used to create a test tree and a test thread according to the test configuration input by the user;

[0010] The business logic layer belongs to the test thread. The business logic layer is also used to traverse and execute test items through the test class to implement testing of the product to be tested, and send the test process information and test result information to the main thread through a blocking message mechanism for storage and display.

[0011] Preferably, the blocking message mechanism means that after sending the specified test process information or test result information to the main thread, the test items after the current test item will continue to be executed until the main thread has processed the specified test process information or test result information and displayed the message on the interface.

[0012] Preferably, the test result information includes test item conclusions and information of concern to the user; the test process information includes operation information performed during the test process and information received by the business logic layer.

[0013] Preferably, the encapsulation of the human-machine operation interface and the test function management interface includes: creating an operation interface class, a test tree class, a real-time information class, a test record class and a test information class; the operation interface class is responsible for managing the test configuration interface and receiving the user's test configuration input; the test tree class is used to display the status of each test item in the test tree on the interface according to the received test process information or test result information; the real-time information class is used to display the received test process information in the real-time information box; the test record class is used to display the received test result information in the test record box; the test information class is used to save test related information.

[0014] Preferably, encapsulating the test class according to the test requirements of the product to be tested includes: creating a test common class, a self-test class and one or more product test classes; the test common class is the parent class of the self-test class and the product test class, and is used to manage common properties and methods; the self-test class and the product test class inherit the self-test common class, have the common properties and methods of the parent class, and also define test item initialization, test tree construction and test function methods according to the test requirements.

[0015] Preferably, the common properties and methods include: parent class and child class object conversion, calling and executing tree structure test items, outputting switch quantities, inputting switch quantities, outputting DA signals, reading AD signals, sending CAN messages and reading CAN messages.

[0016] Preferably, the data input and output interface for providing the data interface board includes: creating a driver management class and a test exception class; the driver management class is used to realize the opening and closing of the data interface board and provide the data interface board access interface function; the test exception class is used to send the exceptions encountered during the access process of the data interface board to the main thread through the business logic layer to display on the interface.

[0017] According to a second aspect of the present invention, there is provided a test method for updating test information in real time, comprising the steps of:

[0018] Initialize the data interface board and provide the data input and output interface and abnormal feedback interface of the data interface board;

[0019] Encapsulate a test class according to the test requirements of the product to be tested, wherein the test class is used to perform data interaction with the product to be tested through the data input and output interface;

[0020] Encapsulate the human-machine operation interface and test function management interface;

[0021] Start the main thread and create a test tree and test thread according to the user's test configuration input;

[0022] The test thread traverses and executes the test items through the test class to implement the test of the product to be tested, and sends the test process information and the test result information to the main thread through the blocking message mechanism for display.

[0023] In general, compared with the prior art, the present invention has beneficial effects: the "layered" concept is adopted for software architecture design, which ensures high cohesion and low coupling of the software framework, and improves the maintainability and portability of the software; multi-threading technology is adopted to achieve real-time display of test information and improve the efficiency of fault location; "blocking" message mapping technology is adopted to solve the problem that multiple threads operating message memory at the same time may cause illegal memory access, thereby causing system crashes. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 is a block diagram of a test system for updating test information in real time according to an embodiment of the present invention;

[0025] Figure 2 It is a flow chart of a test method for updating test information in real time according to an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0027] A test system for updating test information in real time according to an embodiment of the present invention is designed with a layered architecture, including a data access layer, a business logic layer and a presentation layer.

[0028] The data access layer is used to initialize the data interface board and provide the data input and output interface of the data interface board. For example, during the test process, the DIO interface, AD / DA interface and CAN interface are accessed to realize data input (DI, AD, receiving CAN messages) and data output (DO, DA, sending CAN messages).

[0029] The business logic layer is used to encapsulate the test class according to the test requirements of the product to be tested. The test class is used to interact with the product to be tested through the data input and output interface. That is, the business logic is encapsulated according to the single machine technical requirements, and data is interacted with the single machine under test through the data access layer.

[0030] The presentation layer is used to encapsulate the human-machine operation interface and the test function management interface.

[0031] When executing the test, the presentation layer in the main thread creates the test tree and test thread according to the user's test configuration input. The main thread completes system initialization, test thread creation, and display and saves test information; the test thread mainly performs tests according to the encapsulated business logic process.

[0032] The business logic layer traverses and executes the test threads, implements the test of the product to be tested through the test class, and sends the test process information and test result information to the presentation layer through a blocking message mechanism for storage and display.

[0033] Preferably, the blocking message mechanism means that after sending the specified test process information or test result information to the main thread, the test items after the current test item are continued to be executed until the message that the main thread has processed the specified test process information or test result information and displayed it on the interface is received. Specifically, the specified message is sent to the specified window through the SendMessage function of MFC until the receiving window program processes the message and returns to execute the subsequent program.

[0034] Preferably, the test result information includes the conclusions of the test items and information of concern to the user; the test process information includes the operation information performed during the test process and the information received by the business logic layer.

[0035] The working principle of the test system is as follows: the presentation layer provides an interface for users to configure test information. After the user clicks "Start Test", a test tree is generated. During the test, the test item status (green for normal, red for abnormal), test process information and test result information in the test tree are updated in real time. After the test, the user is prompted to enter the test information and save the test data. The business logic layer encapsulates the business logic according to the technical requirements of the single machine, that is, according to the required process, the board operation interface provided by the data access layer is used to input the switch quantity / voltage / control instructions, etc. to the single machine under test. The state information (switch quantity / voltage / status message, etc.) fed back by the single machine under test is collected through the data access layer, and the information is interpreted as required, so as to realize the function, performance and interface verification of the single machine under test. During the test, the test process information (action instructions and status information) and result information (test items and test conclusions) are sent to the presentation layer in real time for display and output. The data access layer provides the initialization function of the DIO board, AD / DA board and CAN board, and provides the input and output interfaces of the above boards to realize the interaction with the single machine during the test.

[0036] like Figure 1 As shown, the presentation layer includes the following classes: operation interface class, test tree class, real-time information class, test record class, and test information class.

[0037] The operation interface class is responsible for managing the test configuration interface and receiving the user's test configuration input, such as selecting the product to be tested, clicking to start the test, etc.

[0038] The test tree class is used to display the status of each test item in the test tree on the interface according to the received test process information or test result information. For example, all test items of the tested product selected by the operator are displayed in the form of a tree in the interface, and after the test starts, the test items are marked with different colors (yellow - executing, red - test abnormality, green - test normal), so that the tester can view the test information intuitively.

[0039] The real-time information class is used to display the received test process information in the real-time information box.

[0040] The test record class is used to display the received test result information in the test record box.

[0041] The test information class is used to save test-related information and can be called after the test is completed, such as the product code, number, test time, test location, tester, etc.

[0042] The business logic layer includes the following classes: a common test class, a self-test class, and one or more product test classes (eg, a product A test class and a product B test class).

[0043] The test common class is the parent class of the self-test class and the product test class, and is used to manage common properties and methods, such as parent class and child class object conversion, calling and executing tree structure test items, output switch quantity, input switch quantity, output DA, read AD, send CAN message, read CAN message, etc.

[0044] The self-test class and product test class inherit from the test common class and have the common properties and methods of the parent class. In addition, methods such as test item initialization, test tree construction, and test functions are defined according to the test requirements.

[0045] The data access layer includes the following classes: driver management class and test exception class. The driver management class is responsible for opening and closing all boards and providing board access interface functions, such as DO output, DI input, DA output, AD input, and sending and receiving CAN messages; the test exception class sends the exceptions encountered during board access to the business logic layer and displays them on the interface through a pop-up box to prompt the operator, such as: board opening failure, DO output exception, CAN sending exception, etc.

[0046] A test system for real-time updating of test information provided by an embodiment of the present invention adopts a "layered" concept for architectural design, thereby improving the maintainability and portability of the system; adopts multi-threading technology to realize real-time display of test information and improve the efficiency of fault location; and adopts "blocking" message mapping instead of "non-blocking" message mapping, thereby effectively preventing the problem of illegal memory access that may be caused by multiple threads operating the message memory at the same time.

[0047] like Figure 2 As shown, a test method for updating test information in real time according to an embodiment of the present invention comprises the following steps:

[0048] S1, initialize the data interface board and provide the data input and output interface and abnormal feedback interface of the data interface board;

[0049] S2, encapsulate the test class according to the test requirements of the product to be tested, and the test class is used to interact with the product to be tested through the data input and output interface;

[0050] S3, encapsulation of human-machine operation interface and test function management interface;

[0051] S4, start the main thread. After the user clicks to start the test, create a test tree and test thread in the main thread according to the user's test configuration input;

[0052] S5, preferably starting from the root node according to the defined tree structure, traversing and executing the test threads, implementing the test of the product to be tested through the test class, and sending the test process information and the test result information to the main thread through the blocking message mechanism for display.

[0053] Preferably, step S5 includes sub-steps:

[0054] (1) The process information to be displayed is passed to the main thread through a blocking message mapping mechanism so as to be displayed on the process information interface.

[0055] The following is an example of some process information in the embodiment:

[0056] Cable detection

[0057] Read cable detection 3 signal, value 1

[0058] Read cable detection 2 signal, value 0

[0059] Read cable detection 1 signal, value 0

[0060] Cable detection is normal

[0061] Tester power distribution output test

[0062] Write XX power supply + BB signal, value 1

[0063] Write XX power supply + BF signal, value 1

[0064] Read + BBO power supply recovery, value: 6.080322 6.076050 6.082153 6.088867 6.090088 6.079407 6.096191 6.091614

[0067] Read +BF power supply recovery, value: 5.842590 5.842896 5.845337 5.839844 5.841370 5.845032 5.846252 5.843506

[0070] +BBO power supply recovery qualified range: 30V±3V Measured value: 29.255V

[0071] +BF power supply recovery qualified range: 28V±3V Measured value: 28.090V

[0072] The tester power distribution output test is normal

[0073] CAN bus test

[0074] Send CAN1 data ID = 0x1234567

[0075] Value 00H 01H 02H 03H 04H 05H 06H 07H

[0076] Receive CAN1 data ID = 0x7654321

[0077] Value 03H 01H 01H 07H 00H 00H 00H 00H

[0078] Send CAN2 data ID = 0x1234567

[0079] Value 00H 01H 02H 03H 04H 05H 06H 07H

[0080] Receive CAN2 data ID = 0x7654321

[0081] Value 03H 01H 01H 07H 00H 00H 00H 00H

[0082] CAN bus test is normal

[0083] (2) Receive the user's judgment input on whether the test process information is normal; if the judgment input indicates that the test process information is normal, directly go to step S54; if the judgment input indicates that the test process information is normal or not, go to step (3).

[0084] (3) Receive input from the user indicating whether to terminate the test; if the user indicates to terminate the test, set the test item identifier corresponding to the current test process information to error and enter step (4); if the user indicates not to terminate the test, directly enter step (4).

[0085] (4) The result data to be displayed is passed to the main thread through a blocking message mapping mechanism and displayed on the result information interface.

[0086] The following are some examples of result information in the examples:

[0087] Cable detection

[0088] Cable detection is normal

[0089] Tester power distribution output test

[0090] +BBO power supply recovery qualified range: 30V±5V Measured value: 29.255V

[0091] +BF power supply recovery qualified range: 28V±5V Measured value: 28.090V

[0092] The tester power distribution output test is normal

[0093] CAN bus test

[0094] CAN bus test is normal

[0095] (5) Determine whether there are any test items to be executed; if so, continue to execute the test items after the current test item; if not, go to step (6).

[0096] (6) After the test is completed, save the test information and end the test.

[0097] The implementation principle and technical principle of the method are the same as the above method and will not be repeated here.

[0098] It must be noted that in any of the above embodiments, the method is not necessarily executed in sequence according to the sequence number. As long as it cannot be inferred from the execution logic that it must be executed in a certain order, it means that it can be executed in any other possible order.

[0099] It will be easily understood by those skilled in the art that the above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A test system for updating test information in real time, characterized in that: include: The data access layer is used to initialize the data interface board and provide the data input and output interface of the data interface board; The business logic layer is used to encapsulate the test class according to the test requirements of the product to be tested, and the test class is used to perform data interaction with the product to be tested through the data input and output interface; The presentation layer is used to encapsulate the human-machine operation interface and the test function management interface; The presentation layer belongs to the main thread, and the presentation layer is also used to create a test tree and a test thread according to the test configuration input by the user; The business logic layer belongs to the test thread. The business logic layer is also used to traverse and execute test items through the test class to implement the test of the product to be tested, and send the test process information and test result information to the main thread through a blocking message mechanism for storage and display.

2. A test system for updating test information in real time as claimed in claim 1, characterized in that: The blocking message mechanism means that after sending the specified test process information or test result information to the main thread, the test items after the current test item will continue to be executed until the main thread has processed the specified test process information or test result information and displayed the message on the interface.

3. A test system for updating test information in real time as claimed in claim 1, characterized in that: The test result information includes the conclusions of the test items and information of concern to the user; the test process information includes the operation information performed during the test process and the information received by the business logic layer.

4. A test system for updating test information in real time as claimed in claim 1, characterized in that: The encapsulation of the human-machine operation interface and the test function management interface includes: creating an operation interface class, a test tree class, a real-time information class, a test record class and a test information class; the operation interface class is responsible for managing the test configuration interface and receiving the user's test configuration input; the test tree class is used to display the status of each test item in the test tree on the interface according to the received test process information or test result information; the real-time information class is used to display the received test process information in the real-time information box; the test record class is used to display the received test result information in the test record box; the test information class is used to save test related information.

5. A test system for updating test information in real time as claimed in claim 1, characterized in that: The packaging of the test class according to the test requirements of the product to be tested includes: creating a test common class, a self-test class and one or more product test classes; the test common class is the parent class of the self-test class and the product test class, and is used to manage common properties and methods; the self-test class and the product test class inherit from the test common class, have the common properties and methods of the parent class, and in addition, define test item initialization, test tree construction and test function methods according to the test requirements.

6. A test system for updating test information in real time as claimed in claim 5, characterized in that: The common properties and methods include: parent class and child class object conversion, calling and executing tree structure test items, outputting switch quantity, inputting switch quantity, outputting DA signal, reading AD signal, sending CAN message and reading CAN message.

7. A test system for updating test information in real time as claimed in claim 1, characterized in that: The data input and output interface for providing the data interface board includes: creating a driver management class and a test exception class; the driver management class is used to realize the opening and closing of the data interface board and provide the data interface board access interface function; the test exception class is used to send the exceptions encountered during the access process of the data interface board to the main thread through the business logic layer to display on the interface.

8. A test method for updating test information in real time, characterized in that: Includes steps: Initialize the data interface board and provide the data input and output interface and abnormal feedback interface of the data interface board; Encapsulate a test class according to the test requirements of the product to be tested, wherein the test class is used to perform data interaction with the product to be tested through the data input and output interface; Encapsulate the human-machine operation interface and test function management interface; Start the main thread and create a test tree and test thread according to the user's test configuration input; The test thread traverses and executes the test items through the test class to implement the test of the product to be tested, and sends the test process information and the test result information to the main thread through a blocking message mechanism for display.

9. A test method for updating test information in real time as claimed in claim 8, characterized in that: The blocking message mechanism means that after sending the specified test process information or test result information to the main thread, the test items after the current test item will continue to be executed until the message is received that the main thread has processed the specified test process information or test result information and displayed it on the interface.

10. A test method for updating test information in real time as claimed in claim 8, characterized in that: The sending of the test process information and the test result information to the main thread for display via a blocking message mechanism comprises the following steps: (1) passing the process information to be displayed to the main thread through a blocking message mapping mechanism to display it on the process information interface; (2) receiving a judgment input from a user to determine whether the test process information is normal; if the judgment input indicates that the test process information is normal, directly proceed to step (4); if the judgment input indicates that the test process information is normal or not, proceed to step (3); (3) receiving the user's input indicating whether to terminate the test; if the user indicates to terminate the test, the test item flag corresponding to the current test process information is set to error, and the process proceeds to step (4); if the user indicates not to terminate the test, the process proceeds directly to step (4); (4) The result data to be displayed is passed to the main thread through the blocking message mapping mechanism and displayed on the result information interface; (5) Determine whether there are any test items to be executed; if so, continue to execute the test items after the current test item; if not, go to step (6); (6) After the test is completed, save the test information and end the test.