Event-driven direct ui automatic testing method and framework

By injecting and parsing the window message flow of DirectUI applications through Hook, extracting basic control properties, and abstracting operations and event listeners into standardized interfaces, the problem of traditional methods being unable to recognize DirectUI controls is solved, enabling efficient event-driven testing and reducing script maintenance costs and testing time.

CN121070805BActive Publication Date: 2026-02-06CHENGDU JUNYUN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511613109.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-06
Publication Date
2026-02-06
Estimated Expiration
2045-11-06

AI Technical Summary

Technical Problem

Traditional automated testing methods based on native Windows controls cannot effectively identify and manipulate DirectUI controls, resulting in high script maintenance costs, difficulty in capturing real-time changes in the internal state of controls, and inability to efficiently implement event-driven testing.

Method used

By injecting the window message flow of the target DirectUI application through Hook, parsing the control tree structure, extracting basic attributes, and abstracting native operations and event listening into standardized interfaces, this provides an event-driven DirectUI automated testing method and framework, including an event-driven Hook module, a dynamic reflection and control information extraction layer, a standardized interface abstraction layer, and an automation engine integration point.

Benefits of technology

It achieves accurate identification and operation of DirectUI controls, reduces dependence on volatile internal object identifiers, improves the readability, portability and cross-project reusability of automation scripts, increases the coverage and accuracy of test scenarios, and reduces script maintenance costs and testing time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121070805B_ABST
    Figure CN121070805B_ABST
Patent Text Reader

Abstract

The application relates to the field of application automation testing, and particularly discloses a DirectUI automation testing method and framework based on event driving, which comprises the following steps: S1: performing Hook point injection on a target DirectUI application, capturing a window message stream and converting the window message stream into events recognizable by a testing framework; S2: analyzing a control tree structure of the target DirectUI application and extracting basic attributes of the control; S3: abstracting native operations and event listening of the DirectUI control into standardized interfaces irrelevant to specific control implementation; S4: outputting the standardized interfaces obtained in step S3 for integration of an automation engine, and based on the control tree structure and the basic attributes of the target DirectUI application, enabling the automation engine to complete event-based DirectUI automation testing logic arrangement and execution. A corresponding implementation framework is provided. The application does not depend on any predefined identification, realizes accurate identification of the DirectUI control, and eliminates strong dependence on variable internal object identification.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of application automation testing, in particular to a DirectUI automation testing method and framework based on event driving. BACKGROUND

[0002] The traditional automation testing method usually adopted by the test framework based on Windows native controls mainly relies on the standard properties and identification methods of UI elements. The core implementation is to locate and operate the controls through the standard properties of the controls (such as control ID, class name, text content, etc.), and send standard Windows messages to trigger the control behavior. Or in some complex scenarios, the controls are located through image matching.

[0003] The UI of the current desktop application gradually jumps out of the framework of Windows native controls. Among them, DirectUI has become the mainstream implementation method of high-interactive software such as instant messaging, financial transactions and design tools, with a handle-free, self-drawing and pixel-level layout interface architecture.

[0004] However, the DirectUI control is self-drawn and cannot be identified by the standard Windows control property, so the traditional method cannot directly obtain its internal properties and states. Moreover, the internal message processing mechanism of the DirectUI control is different from that of the standard Windows control, and the traditional message simulation method often cannot trigger its behavior. Some traditional methods obtain control information through memory reading or private API, and these internal identifiers are easily invalidated with the change of application version, resulting in high script maintenance cost. The traditional automation testing method is difficult to capture the internal state changes of the DirectUI control (such as dynamic loading and data refreshing) in real time, and cannot efficiently realize event-driven testing. SUMMARY

[0005] Therefore, the present application provides a DirectUI automation testing method based on event driving, which aims to solve the problems of the traditional test method based on Windows native controls in testing DirectUI controls.

[0006] Specifically, the method comprises the following steps:

[0007] S1: performing Hook point injection on a target DirectUI application, capturing the window message stream of the target DirectUI application, and converting the window message stream into events recognizable by the test framework;

[0008] S2: based on the window information stream captured in step S1, analyzing the control tree structure of the target DirectUI application, and extracting the basic properties of the control;

[0009] S3: abstract the native operation and event listening of the DirectUI control into a standardized interface irrelevant to the specific control implementation;

[0010] S4: output the standardized interface obtained in step S3 for integration by an automation engine, and based on the control tree structure and basic attributes of the target DirectUI application, enable the automation engine to complete event-based DirectUI automation test logic arrangement and execution.

[0011] Further, in step S1,

[0012] The Hook point injection is implemented through process injection technology, and the injection target is the DirectUI library window process of the target DirectUI application.

[0013] The window message stream specifically includes user input messages, timer messages, and control internal notification messages.

[0014] The window message stream is converted into events recognizable by the test framework, specifically including: establishing a mapping relationship between window message types and framework event types, and one-to-one mapping of different types of window messages into corresponding framework events; extracting window handle associated information from the parameters of the window message, binding the converted framework event with the corresponding target DirectUI control; and using an asynchronous capture mechanism, the window message and the message processing of the target DirectUI application are executed in parallel.

[0015] Further, in step S2,

[0016] The control tree structure of the target DirectUI application is parsed through a recursive traversal method, and the triggering condition of the traversal operation is the window handle captured in step S1.

[0017] After extracting the basic attributes of the control, the basic attributes are further serialized.

[0018] Further, in step S3,

[0019] The native operation of the DirectUI control includes click operation, input operation, and state acquisition operation.

[0020] The event listening specifically includes attribute change listening and focus switching listening; the standardized interface supports direct calling by a JavaScript engine or an automation engine compatible with JavaScript.

[0021] Further, the event-driven DirectUI automation test method further includes step S5: performance optimization processing,

[0022] comprise, S51: in the process of capturing the window message stream in step S1, filtering the window message stream according to the requirement of the current automation test case, and only retaining target messages related to the test case;

[0023] S52: after extracting the control basic attribute in step S2, identifying and marking the control basic attribute frequently accessed by the test script, and storing the control basic attribute in cache; when the subsequent test script needs to access the control basic attribute, data is directly read from the cache.

[0024] Correspondingly, the application provides an event-driven DirectUI automation testing framework for realizing the event-driven DirectUI automation testing method, comprising:

[0025] An event-driven Hook module is configured to capture a window message stream of a target DirectUI application, and convert the window message stream into identifiable events.

[0026] A dynamic reflection and control information extraction layer is in communication connection with the event-driven Hook module, configured to parse a control tree structure of the target DirectUI application based on the window message stream captured by the event-driven Hook module, and extract basic attributes of the control.

[0027] A standardized interface abstraction layer is in communication connection with the dynamic reflection and control information extraction layer, configured to encapsulate native operations and event listening of the DirectUI control into a standardized application program interface irrelevant to specific control implementation.

[0028] An automation engine integration point is in communication connection with the standardized interface abstraction layer, configured to output the standardized application program interface for integration of an automation engine, and realize event-based DirectUI automation testing logic arrangement and execution based on the control tree structure and the basic attributes of the target DirectUI application.

[0029] Further, the event-driven Hook module is configured to Hook a DirectUI library window process of the target DirectUI application to capture the window message stream; the window message stream at least comprises one of a user input message, a timer message and a control internal notification message; and the event-driven Hook module adopts an asynchronous capture mechanism.

[0030] Further, the dynamic reflection and control information extraction layer parses the control tree structure of the target DirectUI application through a recursive traversal manner.

[0031] The basic attributes of the control comprise accurate coordinates, size, display text, background image resource identifier, control type and state identifier of the control.

[0032] Further, the native operation of the DirectUI control includes a click operation, an input operation and a state acquisition operation of the control; the event listening includes attribute change listening and focus switching listening of the control; the standardized application program interface adapts operation requirements and event response scenarios of multiple types of DirectUI controls.

[0033] Further, the event-driven DirectUI automation testing framework further includes a performance optimization module, which is configured to filter the window message stream captured by the event-driven Hook module, retain only target messages related to the current automation testing logic, and eliminate redundant messages to reduce processing overhead; and cache store high-frequency access control attributes extracted by the dynamic reflection and control information extraction layer, and directly call the cached data during subsequent access to reduce time consumption of repeated reflection and analysis of the control tree.

[0034] The application realizes accurate identification of DirectUI controls by Hook injection and capture of window information flow, without source code invasion or modification of the target application, analysis of the control tree and extraction of attributes, and without dependence on any predefined identifier, eliminates strong dependence on variable internal object identifiers, abstracts native operations and event listening into standardized interfaces irrelevant to specific control implementation, and facilitates direct integration and calling of various engines, improves readability, portability and cross-project reusability of the automation script, and improves coverage and accuracy of the testing scenario. BRIEF DESCRIPTION OF DRAWINGS

[0035] Figure 1 is a DirectUI automation testing method step diagram based on event driving of the application;

[0036] Figure 2 is a DirectUI automation testing framework schematic diagram based on event driving of the application. DETAILED DESCRIPTION

[0037] The conventional automation testing method usually adopted by the testing framework based on Windows native controls mainly depends on standard attributes and identification methods of UI elements. The core implementation method is to locate and operate the control through the standard attributes (such as control ID, class name, text content, etc.) of the control, and send a standard Windows message to trigger the control behavior. Or in some complex scenarios, the control is located through image matching.

[0038] The UI of the current desktop application gradually jumps out of the framework of Windows native controls. Among them, DirectUI has become the mainstream implementation method of high-interaction software such as instant messaging, financial transactions and design tools, with a handle-free, self-drawing and pixel-level layout interface architecture.

[0039] However, the DirectUI control is custom-drawn and cannot be identified by standard Windows control properties, so traditional methods cannot directly obtain its internal properties and states. In addition, the internal message processing mechanism of the DirectUI control is different from that of the standard Windows control, and the traditional message simulation method often cannot trigger its behavior. Some traditional methods obtain control information through memory reading or private API, and these internal identifiers are easily invalidated with application version changes, resulting in high script maintenance costs. Traditional automation testing methods cannot capture the internal state changes of the DirectUI control (such as dynamic loading and data refreshing) in real time, and cannot efficiently implement event-driven testing.

[0040] Therefore, the present application provides an event-driven DirectUI automation testing method, which aims to solve the problems of traditional testing methods based on Windows native controls in testing DirectUI controls.

[0041] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the various embodiments of the present application will be described in detail below with reference to the drawings. However, those skilled in the art can understand that in the various embodiments of the present application, many technical details are proposed in order to make the reader better understand the present application. However, the technical scheme claimed by the present application can be implemented even without these technical details and various changes and modifications based on the following embodiments.

[0042] In the following description, certain specific details are set forth in order to provide a thorough understanding of various disclosed embodiments. However, persons of ordinary skill in the relevant arts will recognize that embodiments can be practiced without one or more of these specific details. In other instances, well-known apparatuses, structures, and techniques associated with the present application have not been shown or described in order to avoid unnecessarily obscuring the description of the embodiments.

[0043] Unless the context clearly requires otherwise, throughout the description and the claims, the words "comprise", "comprising", and the like are to be construed in an open, non- limiting sense, as meaning "comprising, but not limited to".

[0044] The various embodiments of the present application will be described in detail below with reference to the drawings, so that the purpose, characteristics and advantages of the present application can be more clearly understood. It should be understood that the embodiments shown in the drawings are not a limitation on the scope of the present application, but are only intended to illustrate the essential spirit of the technical scheme of the present application.

[0045] Reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Thus, the appearances of the phrase "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.

[0046] Specifically, as shown in the figure, the event-driven DirectUI automation testing method proposed by the application includes the following steps: Figure 1

[0047] S1: Perform Hook point injection on the target DirectUI application, capture the window message stream of the target DirectUI application, and convert the window message stream into events recognizable by the test framework;

[0048] S2: Based on the window information stream captured in step S1, parse the control tree structure of the target DirectUI application, and extract the basic attributes of the controls;

[0049] S3: Abstract the native operation and event listening of the DirectUI control into a standardized interface independent of the specific control implementation;

[0050] S4: Output the standardized interface obtained in step S3 for integration by the automation engine, and based on the control tree structure and basic attributes of the target DirectUI application, make the automation engine complete the event-based DirectUI automation testing logic arrangement and execution.

[0051] In step S1, based on the process injection capability of the Frida ecosystem, Hook logic can be injected into the process space of the target DirectUI application, and the window process of the DirectUI library can be accurately located as a Hook point;

[0052] In step S2, without relying on pre-defined object IDs, custom control identifiers, and other volatile identifiers, the extracted basic attributes cover the core information required for testing;

[0053] In step S3, the interface design includes operation interfaces and listening interfaces, which are independent of the control implementation, i.e., the same interface can be adapted to all types of DirectUI controls;

[0054] In step S4, first, the target control is found from the control tree through structure attribute matching; then the operation interface is called to perform interactive operations; finally, the control state changes are captured through the listening interface to realize automation testing logic arrangement and execution.

[0055] ​The application does not need to intrude or modify the source code of the target application, and only needs to inject and capture the window information flow through Hook, analyze the control tree and extract the attributes, does not depend on any predefined identifier, realizes accurate identification of the DirectUI control, and eliminates the strong dependence on the variable internal object identifier. The native operation and event listening are abstracted into a standardized interface independent of the specific control implementation, the interface is convenient for direct integration and calling of various engines, improves the readability, portability and cross-project reusability of the automation script, and improves the coverage and accuracy of the test scene.

[0056] Further, in step S1,

[0057] The Hook point injection is realized by process injection technology, and the injection target is the DirectUI library window process of the target DirectUI application;

[0058] The window message flow specifically includes user input messages, timer messages and control internal notification messages;

[0059] The window message flow is converted into events recognizable by the test framework, specifically including: establishing a mapping relationship between the window message type and the framework event type, and one-to-one mapping of different types of window messages into corresponding framework events; extracting window handle associated information from the parameters of the window message, binding the converted framework event and the corresponding target DirectUI control; and using an asynchronous capture mechanism, the window message and the message processing of the target DirectUI application are executed in parallel.

[0060] Among them, the SetWindowsHookEx function is used to set a global hook, and the custom hook callback function is mounted to the message processing link of the DirectUI library window process, when the target application receives or sends a message, the hook callback function will be triggered first, thereby realizing the interception and capture of the target message flow.

[0061] The user input message includes, for example, WM_MOUSEMOVE (mouse movement), WM_LBUTTONDOWN (left button click), WM_KEYDOWN (key press), etc. Timer message: such as WM_TIMER. Control internal notification: such as WM_NOTIFY.

[0062] Among them, the asynchronous capture mechanism realizes the message queue and asynchronous callback, which ensures that the message capture does not affect the performance and behavior of the target application.

[0063] The captured Windows message needs to be converted into an event recognizable by the framework, and the conversion rule includes, for example:

[0064] Event type mapping:

[0065] WM_LBUTTONDOWN mapping: EVENT_CLICK;

[0066] WM_KEYDOWN mapping: EVENT_KEYPRESS;

[0067] WM_TIMER mapping: EVENT_TIMER.

[0068] Event parameter extraction:

[0069] Extracting coordinates, key values, control handles, etc. from message parameters.

[0070] Associated with specific DirectUI control instances through control handles.

[0071] Further, in step S2,

[0072] The control tree structure of the target DirectUI application is parsed through recursive traversal, and the triggering condition of the traversal operation is the window handle captured in step S1;

[0073] After extracting the basic attributes of the control, the basic attributes are further serialized.

[0074] Since the original extraction results of the basic attributes of the DirectUI control such as coordinates, text, and resource ID are mostly discrete raw data, it is difficult to be directly read, stored or transmitted by the automation engine. Serialization processing converts discrete attributes into standardized and structured data formats, realizing the storage, parsing and reuse of attribute data. Among them, JSON format is preferred as the serialization standard.

[0075] Further, in step S3,

[0076] The native operation of the DirectUI control includes click operation, input operation and state acquisition operation;

[0077] The event listening is specifically attribute change listening and focus switching listening; the standardized interface supports direct calling of JavaScript engine or automation engine compatible with JavaScript.

[0078] Further, the event-driven DirectUI automation testing method further comprises step S5: performance optimization processing,

[0079] Including S51: during the process of capturing the window message stream in step S1, filtering the window message stream according to the requirements of the current automation test case, and only retaining the target messages related to the test case;

[0080] S52: After extracting the control base properties in step S2, the control base properties frequently accessed by the test script are identified and marked, and cached storage is performed; when the control base properties need to be accessed by the subsequent test script, the data is directly read from the cache.

[0081] The traditional automation test method has no filtering mechanism for the captured window message stream, and will include redundant messages (such as the timing refresh messages of other function modules and the system-level window movement messages) irrelevant to the test into the processing flow, occupying a large amount of CPU resources and processing time; the present scheme retains only the target messages required by the test case through the directional message filtering of S51, can reduce the redundant message processing amount, significantly reduces the subsequent data processing time after message capture, and avoids the target DirectUI application and the test framework from appearing stuck due to message processing overload.

[0082] In the traditional method, the control tree needs to be extracted and parsed again through dynamic reflection every time the test script accesses the control properties, and especially for large-scale DirectUI applications with a large number of controls and deep levels, repeated parsing will generate huge performance overhead; the present scheme stores the frequently accessed properties into the memory cache pool through the frequent property caching mechanism of S52, and subsequent access does not need to parse the control tree repeatedly, which can reduce the reflection operation time and greatly improve the property access efficiency of the test script and the overall test execution speed.

[0083] Further, in order to realize the above method, the present application correspondingly proposes an event-driven DirectUI automation test framework, as shown in Figure 2 , comprising:

[0084] An event-driven Hook module is used to capture the window message stream of the target DirectUI application, and convert the window message stream into identifiable events;

[0085] A dynamic reflection and control information extraction layer is in communication connection with the event-driven Hook module, and is used to parse the control tree structure of the target DirectUI application based on the window information stream captured by the event-driven Hook module, and extract the base properties of the control;

[0086] A standardized interface abstraction layer is in communication connection with the dynamic reflection and control information extraction layer, and is used to encapsulate the native operation and event listening of the DirectUI control into a standardized application program interface irrelevant to the specific control implementation;

[0087] An automation engine integration point is in communication connection with the standardized interface abstraction layer, and is used to output the standardized application program interface for the integration of the automation engine, and based on the control tree structure and the base properties of the target DirectUI application, realize the event-based DirectUI automation test logic arrangement and execution.

[0088] Further, the event-driven Hook module is used to Hook the DirectUI library window process of the target DirectUI application to capture the window message stream; the window message stream at least contains one of user input messages, timer messages and control internal notification messages; and the event-driven Hook module adopts an asynchronous capture mechanism.

[0089] Further, the dynamic reflection and control information extraction layer analyzes the control tree structure of the target DirectUI application through a recursive traversal manner.

[0090] The basic attributes of the control include the precise coordinates, size, display text, background image resource identifier, control type and state identifier of the control.

[0091] Further, the native operation of the DirectUI control includes the click operation, input operation and state acquisition operation of the control; the event listening includes the attribute change listening and focus switching listening of the control; and the standardized application program interface adapts the operation requirements and event response scenarios of multiple types of DirectUI controls.

[0092] Further, the performance optimization module is used to filter the window message stream captured by the event-driven Hook module, only retains the target message related to the current automation test logic, and eliminates redundant messages to reduce processing overhead; and the high-frequency access control attribute extracted by the dynamic reflection and control information extraction layer is stored in cache, and the cached data is directly called in subsequent access to reduce the time consumption of repeated reflection and analysis of the control tree.

[0093] The following takes an automated test of a DirectUI login interface as an example to illustrate the implementation process of the above method and framework:

[0094] The DirectUI login interface to be tested has no Windows standard control attribute, and the control message processing depends on the DirectUI library private logic, contains three core controls of account input box, password input box and login button, the test target is to realize the precise positioning and operation of the control without modifying the source code or depending on the internal private identifier, to capture the login state change in real time to support the asynchronous test logic, and to reduce the script maintenance cost.

[0095] In a specific implementation, first, the Hook script is dynamically injected into the login interface process through the Frida tool, the window process of the DirectUI library is accurately hooked to capture key messages such as the WM_LBUTTONDOWN message of the user clicking the login button and the internal notification message UM_INTERNAL_EVENT after login, and then these messages are converted into events such as EVENT_CLICK that can be recognized by the framework according to the mapping rules in the file, and the coordinates, window handle and other information are extracted from the message parameters and bound to the login button control. Then, taking the captured window handle as the entrance, the control tree is parsed by recursive traversal, three core controls are located, and the spatial properties, display properties and type properties are extracted, and then these properties are serialized in JSON format, for example, the serialized data of the login button includes "type", "text", "rect", "resId" and other fields, to ensure that the properties can be parsed across engines.

[0096] After that, the standardized operation interface independent of the control implementation is abstractly defined, such as the click (invoke internal logic to click based on control coordinates), input_text (write input box text buffer and trigger text change callback), and get_text (read control text) methods included in the DirectUIInterface class. During testing, these interfaces are used to complete the operations of account input, password input, and click login. At the same time, the standardized interface is output to the JavaScript automation engine, and a lazy loading mechanism is used to traverse the corresponding subtree only when the control is operated. The event subscription-publishing mode is also used to listen to the attribute change event after login, such as the display of the "logging in" prompt text, the framework captures the message and triggers the assertion logic to realize asynchronous scene testing. In addition, to improve cross-version compatibility, the control type, display text, and approximate coordinate range are used for fuzzy matching to locate the control, avoiding script failure due to version iteration. In terms of performance optimization, redundant messages unrelated to login testing are filtered, and frequently accessed control properties are cached in memory to reduce message processing volume and repeated control tree parsing time.

[0097] The embodiment fully verifies the feasibility and superiority of the application, overcomes the pain points of traditional methods that cannot identify DirectUI controls, invalid operations, and insufficient asynchronous scene coverage, the standardized interface and the JavaScript engine integration reduce the test threshold, the cross-version compatibility strategy reduces the script maintenance cost, the performance optimization measures greatly shorten the test time, and the entire technical process can be reused to other DirectUI interface tests, only the control identifier and operation logic need to be adjusted, which provides a replicable practice template for the automation test of DirectUI applications. The embodiments of the application are described in detail above. The embodiments in the specification are described in a progressive manner, and each embodiment mainly describes the differences from other embodiments. The same or similar parts of each embodiment can be referred to. For the device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the related parts are described in the method part. It should be noted that, for those skilled in the art, without departing from the principles of the application, some improvements and modifications can be made to the application, and these improvements and modifications also fall within the protection scope of the claims of the application.

[0098] Those skilled in the art will further appreciate that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been described in general terms above as being performed in a particular manner. Whether such functionality is implemented in hardware or software depends on the particular application and design constraints imposed on the overall architecture. Those skilled in the art can implement the described functionality in varying ways for each particular application, but such implementation should not be interpreted to depart from the scope of the application.

[0099] The steps of the method or algorithm described in connection with the embodiments disclosed herein can be directly implemented in hardware, software executed by a processor, or a combination of both. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

Claims

1. An event-driven based DirectUI automated testing method, characterized in that, The method comprises the following steps: S1: performing hook point injection on a target DirectUI application, capturing a window message stream of the target DirectUI application, and converting the window message stream into events recognizable by a test framework; The hook point injection is implemented by a process injection technique, and the injection target is a DirectUI library window process of the target DirectUI application; The window message stream specifically comprises user input messages, timer messages, and control internal notification messages; The conversion of the window message stream into events recognizable by the test framework specifically comprises: establishing a mapping relationship between window message types and framework event types, mapping different types of window messages one by one into corresponding framework events; extracting window handle associated information from parameters of the window messages, binding the converted framework events to corresponding target DirectUI controls; and using an asynchronous capture mechanism, the window messages are executed in parallel with message processing of the target DirectUI application; S2: based on the window information stream captured in step S1, analyzing a control tree structure of the target DirectUI application, and extracting basic attributes of the controls; S3: abstracting native operations and event listening of DirectUI controls into standardized interfaces irrelevant to specific control implementations; S4: outputting the standardized interfaces obtained in step S3 for integration by an automation engine, and based on the control tree structure and the basic attributes of the target DirectUI application, enabling the automation engine to complete event-based DirectUI automation test logic arrangement and execution.

2. The event-driven based DirectUI automation testing method of claim 1, wherein, In step S2, The analysis of the control tree structure of the target DirectUI application is implemented by a recursive traversal method, and the triggering condition of the traversal operation is the window handle captured in step S1; After the extraction of the basic attributes of the controls, the basic attributes are further subjected to serialization processing.

3. The event-driven based DirectUI automation testing method of claim 2, wherein, In step S3, The native operations of the DirectUI controls include click operations, input operations, and state acquisition operations; The event listening specifically comprises attribute change listening and focus switching listening; and the standardized interfaces support direct calling by a JavaScript engine or an automation engine compatible with JavaScript.

4. The event-driven DirectUI automation test method according to any one of claims 1-3, further comprising step S5: performance optimization processing, S51: during the capturing of the window message stream in step S1, filtering the window message stream according to requirements of a current automation test case, and retaining only target messages related to the test case; S52: after the extraction of the basic attributes of the controls in step S2, identifying and marking basic attributes of controls frequently accessed by test scripts, and storing the basic attributes in cache; when a subsequent test script needs to access the basic attributes of the controls, data is directly read from the cache. The method comprises:

5. An event-driven based DirectUI automation testing framework, characterized in that, an event-driven hook module configured to capture a window message stream of a target DirectUI application, and convert the window message stream into recognizable events; and an event-driven hook module configured to capture a window message stream of a target DirectUI application, and convert the window message stream into recognizable events; and The event-driven Hook module is configured to Hook a DirectUI library window process of a target DirectUI application to capture a window message stream; The window message stream comprises at least one of a user input message, a timer message and a control internal notification message, and the event-driven Hook module adopts an asynchronous capture mechanism; A dynamic reflection and control information extraction layer is in communication connection with the event-driven Hook module, configured to parse a control tree structure of the target DirectUI application and extract basic attributes of a control based on the window information stream captured by the event-driven Hook module; A standardized interface abstraction layer is in communication connection with the dynamic reflection and control information extraction layer, configured to encapsulate native operations and event listening of the DirectUI control into a standardized application program interface irrelevant to a specific control implementation; An automation engine integration point is in communication connection with the standardized interface abstraction layer, configured to output the standardized application program interface for integration of an automation engine, and implement event-based DirectUI automation test logic arrangement and execution based on the control tree structure and the basic attributes of the target DirectUI application.

6. The event-driven DirectUI automation test framework according to claim 5, wherein The dynamic reflection and control information extraction layer parses the control tree structure of the target DirectUI application through a recursive traversal manner; The basic attributes of the control comprise accurate coordinates, size, display text, background image resource identifier, control type and state identifier of the control.

7. The event-driven based DirectUI automation testing framework according to claim 6, wherein, The native operations of the DirectUI control comprise click operation, input operation and state acquisition operation of the control, and the event listening comprises attribute change listening and focus switching listening of the control; and the standardized application program interface is adapted to operation requirements and event response scenarios of multiple types of DirectUI controls.

8. The event-driven DirectUI automation test framework according to any one of claims 5-7, wherein Further comprising a performance optimization module configured to filter the window message stream captured by the event-driven Hook module, retain only target messages related to current automation test logic and eliminate redundant messages to reduce processing overhead; and cache high-frequency access control attributes extracted by the dynamic reflection and control information extraction layer, so that cached data is directly called in subsequent access to reduce time consumption of repeated reflection and parsing of the control tree.

Citation Information

Patent Citations

  • Atom manipulation encapsulation apparatus and method

    CN101216766A

  • Test management method and device based on cloud real machine platform

    CN116414685A