Adaptive program testing method and device for application program

By automatically identifying and clicking button controls in the target application running environment and obtaining test results, the problem of low efficiency of adapter testing in the existing technology is solved, efficient and automated adapter testing is achieved, and labor costs and artificial mistake.

CN119271531APending Publication Date: 2025-01-07ZHONGKE FANGDE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411761491.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-10
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

In the prior art, when the application is adapted between different operating systems, the test efficiency is low and it relies on manual operations, which has problems such as high labor costs, low efficiency, error-prone and difficult to batch operation.

Method used

By automatically identifying and clicking button controls in the target application running environment, obtaining test results, and characterizing whether the adapter enables the application to provide services in the target operation environment, realizing automated testing and reducing manual intervention.

Benefits of technology

It improves the efficiency of adapter program testing, reduces labor costs, reduces human errors, realizes rapid and comprehensive testing of adapter programs, and supports batch operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271531A_ABST
    Figure CN119271531A_ABST
Patent Text Reader

Abstract

The invention is suitable for the field of software development, and discloses an adaptive program testing method and device for an application program, and the method comprises the steps: obtaining at least one application process, running in a target running environment, of a target application after the target application is started; the target operating environment is an operating environment constructed by an adaptive program in a first operating system; the target application is an application program developed based on a second operating system; obtaining a target window belonging to the application process in the target operation environment; button controls in the target window are identified to obtain a button list, and the button list comprises at least one button control; and executing a mouse click operation on a button control in the button list to obtain a test result corresponding to the button control, the test result representing whether the adaptive program enables the target application to provide services in the target running environment.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention with a filing date of October 10, 2024, an invention name of “A method and device for testing adapters for an application” and an application number of 2024114074095. Technical Field

[0002] The present application relates to the field of computer technology, and in particular to a method and device for testing an adapter of an application program. Background Art

[0003] In order to adapt an application built on a certain operating system to different operating systems, an adapter program needs to be deployed in the operating system, and the application program can run on different operating systems based on the adapter program.

[0004] Currently, developers usually manually click on the button controls in the application running in the operating system to observe whether there are any abnormalities, so as to test whether the adapter can make the application run normally in the operating system. If there are abnormalities, the developer will optimize the adapter deployed in the operating system based on the observed abnormalities to make the application run normally in the operating system.

[0005] However, this method of testing the adapter program relies on developers and has low testing efficiency. Summary of the invention

[0006] In view of the above problems, the present application provides a method and device for testing an adapter of an application program to improve the testing efficiency of the adapter used by the application program in the operating system. The specific scheme is as follows:

[0007] The first aspect of the present application provides a method for testing an adapter of an application program, the method comprising:

[0008] After the target application is started, obtaining at least one application process of the target application running in a target operating environment; the target operating environment is an operating environment constructed by the adapter program in the first operating system; the target application is an application developed based on the second operating system;

[0009] Obtaining an initial window in the target operating environment; the initial window is all top-level windows in the target operating environment;

[0010] Filtering out a target window belonging to the application process from the initial window;

[0011] Identifying a button control in the target window to obtain a button list, wherein the button list includes at least one button control;

[0012] A mouse click operation is performed on a button control in the button list to obtain a test result corresponding to the button control, wherein the test result indicates whether the adapter enables the target application to provide services in the target operating environment.

[0013] In a possible implementation, obtaining at least one application process of the target application running in the target running environment includes:

[0014] Generate a process snapshot in the target operating environment;

[0015] Processing the process snapshot to obtain a first process list in the target operating environment, wherein the first process list includes at least one process;

[0016] Filtering newly added processes in the first process list relative to processes in the second process list to obtain at least one application process of the target application in the target running environment;

[0017] The second process list includes at least one process, and the processes in the second process list are processes in the target operating environment before the target application is started.

[0018] In a possible implementation, filtering out a target window belonging to the application process from the initial window includes:

[0019] Obtaining process information of the process to which the initial form belongs;

[0020] According to the process information, a target window belonging to the application process in the initial window is filtered out.

[0021] In a possible implementation, obtaining a button control in the target window includes:

[0022] Using a target mode, obtaining a button control whose control type is a button type in the target window; the target mode includes at least one of a first mode and a second mode;

[0023] The first method and the second method use different interface types.

[0024] In a possible implementation, the first method includes:

[0025] Using the first type of interface, enumerate the sub-windows contained in the target window to obtain the primary selected sub-windows; obtain the class name information corresponding to each of the primary selected sub-windows; filter the primary selected sub-windows whose class name information is characterized as a button type to obtain a button control;

[0026] The second method includes:

[0027] Using the second type of interface, enumerate the sub-controls included in the target form to obtain the primary sub-controls; obtain the role information and state information corresponding to each of the primary sub-controls; filter the primary sub-controls whose role information is characterized as a button type and whose state information is characterized as a visible state to obtain a button control;

[0028] The first type of interface is different from the second type of interface.

[0029] In a possible implementation, the method further includes:

[0030] Obtain title information and coordinate information of the button control;

[0031] Add the title information and coordinate information of the button control to the button list;

[0032] The test result corresponding to the button control at least includes: title information and coordinate information of the button control and process information of the process to which the button control belongs.

[0033] In a possible implementation, after identifying the button control in the target window and before performing a mouse click operation on the button control in the button list, the method further includes:

[0034] Compare the current number of button controls identified this time with the value in the target variable; the target variable records the historical number of button controls identified last time;

[0035] If the current number of button controls identified this time is inconsistent with the value in the target variable, the current number is recorded in the target variable; the button controls newly added to the button list in the button controls identified this time are added to the button list; after waiting for a first period of time, the step of obtaining at least one application process of the target application running in the target running environment is executed;

[0036] If the current number of button controls identified this time is consistent with the value in the target variable, add 1 to the value of the polling variable; determine whether the value in the polling variable reaches the target threshold; if the value in the polling variable does not reach the target threshold, wait for a second period of time, and then return to execute the step of obtaining at least one application process of the target application running in the target operating environment; if the value in the polling variable reaches the target threshold, execute the step of performing a mouse click operation on the button controls in the button list.

[0037] In a possible implementation, performing a mouse click operation on a button control in the button list to obtain a test result includes:

[0038] Select a button control that has not been subjected to a mouse click operation from the button list to perform the mouse click operation to obtain a test result;

[0039] After obtaining the test result, the method further includes:

[0040] In the case where the test result indicates that the adapter enables the target application to provide services in the target running environment, returning to the step of selecting a button control from the button list that has not been subjected to the mouse click operation to perform the mouse click operation, until all the button controls in the button list are subjected to the mouse click operation;

[0041] In the case where the test result indicates that the adapter program makes the target application unable to provide services in the target operating environment, a test report is generated according to the test result, and the test report is used to adjust the adapter program.

[0042] In a possible implementation, the test result indicates that the adapter makes the target application unable to provide services in the target operating environment, including:

[0043] The test result indicates that an event that a process crash occurs in the application process to which the button control belongs;

[0044] Wherein, the method further comprises:

[0045] The system registry of the first operating system is adjusted so that the event of the process crash can be identified.

[0046] A second aspect of the present application provides an adapter testing device for an application program, the device comprising:

[0047] a process obtaining unit, configured to obtain, after the target application is started, at least one application process of the target application running in a target operating environment; the target operating environment is an operating environment constructed by the adapter program in the first operating system; the target application is an application developed based on the second operating system;

[0048] A window acquisition unit, used to acquire an initial window in the target operating environment; the initial window is all top-level windows in the target operating environment; and from the initial window, a target window belonging to the application process is screened out;

[0049] A button identification unit, used for identifying the button controls in the target window to obtain a button list, wherein the button list includes at least one button control;

[0050] A click execution unit is used to execute a mouse click operation on a button control in the button list to obtain a test result corresponding to the button control, wherein the test result indicates whether the adapter enables the target application to provide services in the target operating environment.

[0051] A third aspect of the present application provides a computer program product, comprising computer-readable instructions, which, when executed on an electronic device, enables the electronic device to implement the adapter testing method for an application program according to the first aspect or any implementation of the first aspect.

[0052] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0053] The memory is used to store computer programs;

[0054] The processor is used to execute the computer program so that the electronic device can implement the adapter program testing method of the application program according to the first aspect or any implementation manner of the first aspect.

[0055] A fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement an adapter program testing method for an application program in the above-mentioned first aspect or any implementation method of the first aspect.

[0056] With the help of the above-mentioned technical scheme, in a method and device for testing an adapter of an application provided by the present application, when a target application developed based on a second operating system runs in a target operating environment constructed based on an adapter in a first operating system, an application process of the target application in the target operating environment is obtained. After obtaining the button controls in the window corresponding to each application process, a mouse click operation is performed on these button controls, so that the test results of the button controls can be obtained. The test results of these button controls can characterize whether the adapter enables the target application to provide services in the target operating environment. This testing process does not need to rely on developers, and the adapter can be tested by testing the button controls of the target application, thereby improving the testing efficiency of the adapter. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0058] Figure 1 A flowchart of an implementation method of an adapter testing method for an application provided in an embodiment of the present application;

[0059] Figure 2 This is a schematic diagram of the window of the home page of the target application;

[0060] Figure 3 A partial flow chart of a method for testing an adapter of an application provided in an embodiment of the present application;

[0061] Figure 4 Another partial flow chart of a method for testing an adapter of an application provided in an embodiment of the present application;

[0062] Figure 5 A flowchart of another part of a method for testing an adapter of an application provided in an embodiment of the present application;

[0063] Figure 6 Another partial flow chart of a method for testing an adapter of an application provided in an embodiment of the present application;

[0064] Figure 7 Another flow chart of a method for testing an adapter of an application provided in an embodiment of the present application;

[0065] Figure 8 Another flow chart of a method for testing an adapter of an application provided in an embodiment of the present application;

[0066] Fig. 9 A schematic diagram of the structure of an adapter testing device for an application provided in an embodiment of the present application;

[0067] Fig.10 Another structural schematic diagram of an adapter testing device for an application provided in an embodiment of the present application;

[0068] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0069] Fig.12 This is an example diagram of the application being applicable to testing the target test software in Wine in Linux. DETAILED DESCRIPTION

[0070] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0071] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0072] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0073] This application can be applied in the field of software development. Taking the example of an application developed based on the Windows operating system running in the Linux operating system, multiple application scenarios implemented in products will be introduced below.

[0074] When migrating and running Windows applications on other operating systems such as Linux, they mainly rely on adapters such as Wine. Wine is an open source compatibility layer that can simulate the Windows application programming interface API (Application Programming Interface), allowing many applications developed based on Windows to run on non-Windows operating systems such as Linux. However, since Wine is not a complete Windows operating system, its support for applications developed based on Windows is not always perfect. In order to improve compatibility, it is usually necessary to optimize Wine, that is, to analyze and adjust the operation of specific Windows applications in the operating environment built by Wine on Linux and optimize the program code of Wine accordingly.

[0075] The current optimization method mainly relies on manual operation, that is, the technician (developer) runs the target application in the Wine environment, tests each function of the target application one by one, and records any compatibility issues that occur, and then modifies and optimizes the Wine code to address these issues. Specifically: the technician runs the Windows target application in the Wine environment; manually clicks on each function button of the target application to observe whether there are any abnormalities; if a problem is found, the technician will record the specific situation (such as crash, functional abnormality, etc.); based on the recorded abnormal situation, the technician manually modifies the Wine code to solve the problem, and repeatedly tests until the problem is solved.

[0076] However, the current optimization method has the following defects:

[0077] High labor costs: Existing optimization work mainly relies on manual operation and observation, which requires technicians to invest a lot of time and energy, especially when dealing with complex or large applications, the workload is huge.

[0078] Inefficiency: Manual operations are inevitably affected by personal factors, such as fatigue and lack of concentration, which makes the adaptation process inefficient and time-consuming.

[0079] Error-prone: Manual operation is subjective and prone to errors or omissions, especially when dealing with a large number of functional tests.

[0080] Difficult to operate in batches: Since the adaptation work relies on manual work, it is difficult to complete the adaptation tasks of multiple software in a short period of time, and it cannot meet the needs of large-scale application migration.

[0081] In order to solve the above problems, an embodiment of the present application provides an adapter testing method for an application program. The following is a detailed introduction to an adapter testing method for an application program in an embodiment of the present application in conjunction with the accompanying drawings.

[0082] Reference Figure 1 , is a flow chart of a method for testing an adapter of an application provided in an embodiment of the present application. The method can be applied to electronic devices capable of data processing, such as computers or servers. The technical solution in this embodiment is mainly used to improve the testing efficiency of the adapter.

[0083] Specifically, the method in this embodiment may include the following steps:

[0084] Step 101: After the target application is started, at least one application process of the target application running in the target running environment is obtained.

[0085] The target operating environment may be an operating environment constructed by the adapter in the first operating system. The target application is an application developed based on the second operating system. For example, the target application may be any type of application such as a social application, a shopping application, a search application, etc. developed based on Windows. Accordingly, the adapter may be a Wine program, which constructs a target operating environment in Linux so that the target application can run in Linux.

[0086] It should be noted that in the first operating system, the adapter program is pre-installed and started, and the target application is installed in the first operating system. The scheduler pre-deployed in the first operating system starts the computer program implementing this embodiment in the target operating environment, and starts the target application. Based on this, after the target application is started, the computer program implementing this embodiment executes the method in this embodiment, that is, first obtains at least one application process of the target application running in the target operating environment.

[0087] In one implementation, when obtaining the target application running in the target operating environment in step 101, the first system interface of the second operating system can be used, such as the interface of CreateToolhelp32Snapshot, the interface of Process32First, and the interface of Process32Next.

[0088] Step 102: Obtain a target window belonging to an application process in a target running environment.

[0089] In step 102, when obtaining the target window, the second system interface of the second operating system may be used, such as the interface of CreateToolhelp32Snapshot, the interface of Process32First, and the interface of Process32Next.

[0090] Step 103: Identify the button controls in the target window to obtain a button list.

[0091] The button list contains at least one button control. Figure 2 As shown in , the form of the home page after the social application is started includes a login button control and a logout button control.

[0092] Specifically, in step 103, the button control in the target window may be identified by using the third system interface of the second operating system, such as the interface of EnumChildWindows and the interface of AccessibleObjectFromWindow.

[0093] Step 104: Perform a mouse click operation on the button control in the button list to obtain a test result corresponding to the button control.

[0094] The test result indicates whether the adapter enables the target application to provide services in the target operating environment.

[0095] Specifically, in step 104, the fourth system interface of the second operating system may be used to perform a mouse click operation on the button controls in the button list to obtain the test result, such as the interface of SetCursorPos and the interface of mouse_event.

[0096] For example, in step 104, the SetCursorPos interface is used to position the mouse to the position where the button control is located; then, the mouse_event is used to perform the mouse click operation.

[0097] With the help of the above-mentioned technical scheme, in a method for testing an adapter of an application provided by the present application, when a target application developed based on a second operating system runs in a target operating environment constructed based on an adapter in a first operating system, an application process of the target application in the target operating environment is obtained. After obtaining the button controls in the window corresponding to each application process, a mouse click operation is performed on these button controls, so that the test results of the button controls can be obtained. The test results of these button controls can characterize whether the adapter enables the target application to provide services in the target operating environment. This testing process does not need to rely on developers, and the adapter can be tested by testing the button controls of the target application, thereby improving the testing efficiency of the adapter.

[0098] In one implementation, when obtaining at least one application process of the target application running in the target running environment in step 101, it can be implemented in the following manner: Figure 3 As shown in:

[0099] Step 301: Generate a process snapshot in the target operating environment.

[0100] For example, in this embodiment, the first sub-interface in the first system interface in the second operating system, such as the CreateToolhelp32Snapshot interface, can be used to generate process snapshots of each process in the target operating environment, and the process snapshots include process information of the processes.

[0101] Step 302: Process the process snapshot to obtain a first process list in the target operating environment.

[0102] The first process list includes at least one process.

[0103] For example, in this embodiment, the second sub-interface in the first system interface in the second operating system, such as the Process32First interface and the Process32Next interface, can be used to traverse the process snapshots of each process, and then identify the various processes in the target running environment, thereby obtaining a first process list composed of these processes.

[0104] Step 303: Filter the newly added processes in the first process list relative to the processes in the second process list to obtain at least one application process of the target application in the target operating environment.

[0105] The second process list includes at least one process. The processes in the second process list are processes in the target operating environment before the target application is started. In a specific implementation, the processes in the second process list can be obtained using the first system interface in the second operating system, such as the interface of CreateToolhelp32Snapshot, the interface of Process32First, and the interface of Process32Next.

[0106] Specifically, in step 303, the processes in the first process list may be compared with the processes in the second process list, and the processes included in the first process list that do not have the same processes in the second process list may be added as new processes to obtain at least one application process of the target application in the target operating environment.

[0107] In one implementation, when obtaining the target window belonging to the application process in the target running environment in step 102, it can be implemented in the following manner: Figure 4 As shown in:

[0108] Step 401: Obtain an initial window in the target operating environment.

[0109] The initial window is all top-level windows in the target operating environment. For example, in this embodiment, the first sub-interface in the second system interface in the second operating system, such as EnumWindows, can be used to enumerate all top-level windows in the target operating environment, that is, the initial window.

[0110] Step 402: Obtain process information of the process to which the initial window belongs.

[0111] For example, in this embodiment, the second sub-interface in the second system interface in the second operating system, such as the GetWindowThreadProcessId interface, can be used to check the window handle of each initial window to obtain the process information of the process to which each initial window belongs. The process information at least includes information such as the process identification ID.

[0112] Step 403: According to the process information, the target window belonging to the application process in the initial window is filtered out.

[0113] For example, in step 403, the process information of the process to which the initial window belongs can be compared with the application process of the target application, and then the target window whose process information of the process to which the initial window belongs is consistent with the application process of the target application is screened out, that is, the target window belonging to the application process of the target application.

[0114] In one implementation, in step 103, a target mode may be used to obtain a button control whose control type is a button type in the target window.

[0115] The target mode may include at least one of a first mode and a second mode. The first mode and the second mode use different interface types.

[0116] For example, the interface type used in the first manner may be an enumeration type such as Enum; the interface type used in the second manner may be a type related to MSAA.

[0117] In one implementation, in step 103, a button control of a button type in the target window may be obtained in a first manner, and if the button control is not obtained in the first manner, a button control of a button type in the target window may be obtained in a second manner.

[0118] Furthermore, in this embodiment, the title information and coordinate information of the button control may be obtained, and the title information and coordinate information of the button control may be added to the button list.

[0119] Correspondingly, the test result corresponding to the button control at least includes: title information and coordinate information of the button control and process information of the process to which the button control belongs.

[0120] Specifically, the first method may include the following processing to obtain a button control, such as Figure 5 As shown in:

[0121] Step 501: using the first type of interface, enumerate the sub-windows contained in the target window to obtain the primary selected sub-window.

[0122] The first type of interface may be an interface of an enumeration type such as Enum, etc. For example, in step 501, the interface of EnumChildWindows may be used to enumerate the child windows corresponding to each top-level window, that is, the primary selection child windows.

[0123] Step 502: Obtain the class name information corresponding to each primary selected sub-window.

[0124] For example, in step 502, the class name information corresponding to each primary selected sub-window may be obtained by using the GetClassName interface. The class name information may represent the window type of the sub-window, such as a button type or an input box type.

[0125] Step 503: Filter the primary selected sub-windows whose class name information is characterized as a button type to obtain a button control.

[0126] Specifically, in step 503, the class name information may be parsed, and then the primary selected sub-window characterized by the class name information as a button type may be determined as a button control.

[0127] Furthermore, in this embodiment, the GetWindowText interface can be used to obtain the title information of the button control, and the GetWindowRect interface can be used to obtain the coordinate information of the button control, and these title information and coordinate information can be associated with the button control in its button list.

[0128] The second method may include the following processing to obtain a button control, such as Figure 6 As shown in:

[0129] Step 601: Enumerate the sub-controls contained in the target window using the second type of interface to obtain the primary selected sub-controls.

[0130] The first type of interface is different from the second type of interface, and the second type of interface may be an MSAA type interface. For example, in step 601, the AccessibleObjectFromWindow interface may be used to enumerate the controls included in the target window, that is, to initially select the sub-controls.

[0131] Step 602: Obtain the role information and status information corresponding to each primary selected sub-control.

[0132] For example, in step 602, the role information of the primary selected subcontrol may be obtained by using the interface of IAccessible::get_accRole, and the state information of the primary selected subcontrol may be obtained by using the interface of IAccessible::get_accState.

[0133] Step 603: Filter the preliminarily selected sub-controls whose role information is characterized as a button type and whose state information is characterized as a visible state to obtain a button control.

[0134] Specifically, in step 603, the role information and the state information may be parsed, and then the primary selected sub-control whose role information is characterized as a button type and whose state information is characterized as a visible state may be determined as a button control.

[0135] Furthermore, in this embodiment, the title information of the button control can be obtained by using the IAccessible::get_accName interface, and the coordinate information of the button control can be obtained by using the IAccessible::accLocation interface, and the title information and coordinate information can be associated with the button control in its button list.

[0136] In one implementation, the process from step 101 to step 104 is iteratively executed in this embodiment, for example: each time an application process corresponding to the target application is obtained, a target window belonging to the application process is obtained for the application process; then the button controls in the target window are identified to obtain a button list containing all button controls in the target window; when the target application is in an idle state, that is, the button controls are stable, a mouse click operation is performed on the first button control in the button list; in response to the mouse click operation, if a new application process is triggered, then after the application process is obtained, the target window belonging to the application process is obtained; and so on, until the mouse click operation is performed on all button controls in the button list, and then the button controls in the target window belonging to the next application process are identified; and so on, until the mouse click operation is performed on all button controls in the target window corresponding to each application process involved in the target application, so as to obtain the test results corresponding to each button control, or until a process crash event occurs after a certain mouse click operation is performed.

[0137] Specifically, based on Figure 1 In the implementation process shown in FIG. 1 , after step 103 and before step 104, steps 105 to 111 may be provided. The specific process is as follows: Figure 7 As shown in:

[0138] Step 101: After the target application is started, at least one application process of the target application running in the target running environment is obtained.

[0139] Step 102: Obtain a target window belonging to an application process in a target running environment.

[0140] Step 103: Identify the button controls in the target window to obtain a button list, and then execute step 105.

[0141] Step 105: Compare the current number of button controls identified this time with the value in the target variable. If the current number of button controls identified this time is inconsistent with the number in the target variable, execute steps 106 to 108. If the current number of button controls identified this time is consistent with the number in the target variable, execute steps 109 to 111.

[0142] The current number of button controls identified this time refers to the number of button controls obtained by executing step 103 this time. The target variable records the historical number of button controls identified last time, that is, the number of button controls obtained when step 103 was executed last time.

[0143] Step 106: When the current number of button controls identified this time is inconsistent with the number in the target variable, the current number is recorded in the target variable.

[0144] If the current quantity is different from the value in the target variable, it indicates that the target application is not in an idle state, and a button control may be loaded in the form, that is, the button control is unstable. At this time, the current quantity is recorded in the target variable.

[0145] Step 107: Add the button controls newly added to the button list among the button controls identified this time to the button list.

[0146] Specifically, in step 107, the button controls that are different from the button controls in the button list are first screened out from the button controls identified this time, that is, the button controls that are newly added to the button controls in the button list, and then the screened out button controls are added to the button list;

[0147] Alternatively, in step 107, the button controls identified this time may be added to a button list, and then the button controls in the button list may be deduplicated.

[0148] Step 108: After waiting for the first period of time, return to execute step 101.

[0149] The first duration can be set according to actual business needs, such as the application type of the target application, such as 1 second or 2 seconds. For example, if the target application is a game application, the first duration can be a larger 2 seconds; for another example, if the target application is a social application, the first duration can be a smaller 1 second.

[0150] Step 109: When the current number of button controls identified this time is consistent with the number in the target variable, add 1 to the value of the polling variable.

[0151] The value of the polling variable may be initially 0, and the value of the polling variable represents the number of times the current quantity is consistent with the quantity in the target variable.

[0152] Step 110: Determine whether the value in the polling variable reaches the target threshold; if the value in the polling variable does not reach the target threshold, execute step 111; if the value in the polling variable reaches the target threshold, execute step 104.

[0153] Step 111: After waiting for a second period of time, return to execute step 101.

[0154] Among them, when the value in the polling variable reaches the target threshold, it indicates that no button control will be recognized, that is, the target application is in an idle state, that is, the button control is stable. At this time, step 104 can be executed, otherwise, after waiting for the second time, return to step 101.

[0155] Step 104: Perform a mouse click operation on the button control in the button list to obtain a test result corresponding to the button control.

[0156] Specifically, the second duration can be set according to actual business requirements, such as the application type of the target application, such as 1 second or 2 seconds. The second duration can be the same as the first duration. The target threshold can be set according to business requirements, such as 3 or 5.

[0157] In one implementation, based on Figure 1 In the implementation process shown in FIG. 1 , after the button controls in the target window are identified in step 103 and a button list is obtained, before the mouse click operation is performed on the button controls in the button list in step 104, step 112 may be performed first in this embodiment. The specific process is as follows: Figure 8 As shown in:

[0158] Step 101: After the target application is started, at least one application process of the target application running in the target running environment is obtained.

[0159] Step 102: Obtain a target window belonging to an application process in a target running environment.

[0160] Step 103: Identify the button controls in the target window to obtain a button list, and execute step 112.

[0161] Step 112: Determine whether there is a button control in the button list that has not been clicked by the mouse. If there is a button control in the button list that has not been clicked by the mouse, execute step 104, specifically, select a button control from the button list that has not been clicked by the mouse to execute the mouse click operation to obtain a test result. If there is no button control in the button list that has not been clicked by the mouse, end the current process.

[0162] Step 104: Perform a mouse click operation on the button control in the button list to obtain a test result corresponding to the button control.

[0163] Based on this, after performing a mouse click operation on the button controls in the button list in step 104 and obtaining the test results, the method in this embodiment may further include the following processing:

[0164] Step 113: Determine whether the test result indicates that the adapter enables the target application to provide services in the target operating environment. If the test result indicates that the adapter enables the target application to provide services in the target operating environment, return to step 112 to select a button control that has not been clicked by the mouse from the button list to perform a mouse click operation until all button controls in the button list have been clicked by the mouse, thereby terminating the current process. If the test result indicates that the adapter does not enable the target application to provide services in the target operating environment, step 114 is executed.

[0165] Step 114: Generate a test report based on the test results, and the test report is used to adjust the adaptation program.

[0166] Among them, the test result indicates that the adapter enables the target application to provide services in the target operating environment, specifically: after determining that the button control is clicked by a mouse, the target application can normally respond to the mouse click operation, that is, the test result indicates that the application process to which the button control belongs does not experience a process crash event. Correspondingly, the test result indicates that the adapter makes the target application unable to provide services in the target operating environment, specifically: the test result indicates that the application process to which the button control belongs experiences a process crash event.

[0167] Based on this, in this embodiment, the system registry of the first operating system can be pre-adjusted so that the process crash event can be identified. Specifically, in this embodiment, the registration item corresponding to the process crash event in the system registry of the first operating system is modified to point to the parameter value of the computer program implementing this embodiment.

[0168] For example, in this embodiment, the value of the RegSetValueExAPIDebugger item can be called to be changed to "hotpot-autotest.exe%ld%ld", where hotpot-autotest.exe%ld%ld is a parameter value pointing to a computer program that implements this embodiment.

[0169] The above introduces an adapter testing method for an application provided in an embodiment of the present application. The following will introduce a device for executing the above-mentioned adapter testing method for an application.

[0170] See also Fig. 9 , is a schematic diagram of the structure of an adapter test device for an application provided in an embodiment of the present application. The device can be configured in an electronic device capable of data processing, such as a computer or a server. The technical solution in this embodiment is mainly used to improve the test efficiency of the adapter.

[0171] Specifically, the device in this embodiment may include the following units:

[0172] The process obtaining unit 901 is used to obtain at least one application process of the target application running in the target operating environment after the target application is started; the target operating environment is the operating environment constructed by the adapter program in the first operating system; the target application is an application developed based on the second operating system;

[0173] A window obtaining unit 902 is used to obtain a target window belonging to the application process in the target running environment;

[0174] A button identification unit 903, used for identifying the button controls in the target window to obtain a button list, wherein the button list includes at least one button control;

[0175] The click execution unit 904 is used to execute a mouse click operation on the button control in the button list to obtain a test result corresponding to the button control, wherein the test result indicates whether the adapter enables the target application to provide services in the target operating environment.

[0176] With the help of the above technical scheme, in an adapter testing device for an application provided by the present application, when a target application developed based on a second operating system runs in a target operating environment constructed based on an adapter in a first operating system, an application process of the target application in the target operating environment is obtained. After obtaining the button controls in the window corresponding to each application process, a mouse click operation is performed on these button controls, so that the test results of the button controls can be obtained. The test results of these button controls can characterize whether the adapter enables the target application to provide services in the target operating environment. This testing process does not need to rely on developers, and the adapter can be tested by testing the button controls of the target application, thereby improving the testing efficiency of the adapter.

[0177] In one implementation, the process acquisition unit 901 is specifically used to: generate a process snapshot in the target operating environment; process the process snapshot to obtain a first process list in the target operating environment, the first process list including at least one process; filter the newly added processes in the first process list relative to the processes in the second process list to obtain at least one application process of the target application in the target operating environment; wherein the second process list includes at least one process, and the processes in the second process list are processes in the target operating environment before the target application is started.

[0178] In one implementation, the window acquisition unit 902 is specifically used to: obtain an initial window in the target operating environment; the initial window is all top-level windows in the target operating environment; obtain process information of the process to which the initial window belongs; and based on the process information, filter out the target window in the initial window that belongs to the application process.

[0179] In one implementation, the button identification unit 903 is specifically used to: use the target method to obtain a button control in the target window whose control type is a button type; the target method includes at least one of a first method and a second method; wherein the interface type used by the first method is different from that used by the second method.

[0180] Specifically, the first method includes: using the first type of interface, enumerating the sub-windows contained in the target window to obtain the primary selected sub-windows; obtaining the class name information corresponding to each of the primary selected sub-windows; screening the primary selected sub-windows whose class name information is characterized as a button type to obtain a button control;

[0181] The second method includes: using a second type of interface to enumerate the sub-controls contained in the target form to obtain preliminary sub-controls; obtaining role information and status information corresponding to each of the preliminary sub-controls; filtering the preliminary sub-controls whose role information is represented as a button type and whose status information is represented as a visible state to obtain button controls; wherein the first type of interface is different from the second type of interface.

[0182] In one implementation, the button identification unit 903 is also used to: obtain the title information and coordinate information of the button control; add the title information and coordinate information of the button control to the button list; wherein the test result corresponding to the button control includes at least: the title information and coordinate information of the button control and the process information of the process to which the button control belongs.

[0183] In one implementation, after the button identification unit 903 identifies the button controls in the target window and before executing the mouse click operation on the button controls in the button list, the click execution unit 904 is further used to: compare the current number of button controls identified this time with the value in the target variable; record the historical number of button controls identified last time in the target variable; if the current number of button controls identified this time is inconsistent with the value in the target variable, record the current number in the target variable; add the button controls newly added to the button list among the button controls identified this time relative to the button list to the button list; after waiting for a first time period, trigger the process acquisition unit 901; if the current number of button controls identified this time is consistent with the value in the target variable, add 1 to the value of the polling variable; determine whether the value in the polling variable reaches the target threshold; if the value in the polling variable does not reach the target threshold, wait for a second time period and trigger the process acquisition unit 901; if the value in the polling variable reaches the target threshold, execute the mouse click operation on the button controls in the button list.

[0184] In one implementation, the click execution unit 904 is specifically used to: select a button control that has not been subjected to a mouse click operation from the button list to execute the mouse click operation to obtain a test result;

[0185] Among them, after obtaining the test results, the click execution unit 904 is also used for: when the test results characterize that the adapter enables the target application to provide services in the target operating environment, returning to execute the selection of button controls from the button list that have not been executed with the mouse click operation to perform the mouse click operation until all button controls in the button list have been executed with the mouse click operation; when the test results characterize that the adapter makes the target application unable to provide services in the target operating environment, generating a test report based on the test results, and the test report is used to adjust the adapter.

[0186] Specifically, the test result indicates that the adapter makes the target application unable to provide services in the target operating environment, including: the test result indicates that an event of a process crash occurs in the application process to which the button control belongs;

[0187] The device in this embodiment may also include the following units: Fig.10 As shown in:

[0188] The registry adjustment unit 905 is used to pre-adjust the system registry of the first operating system so that the event of the process crash can be identified.

[0189] It should be noted that the specific implementation method of each unit in this embodiment can refer to the corresponding content in the previous text and will not be described in detail here.

[0190] An embodiment of the present application further provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0191] The memory is used to store computer programs;

[0192] The processor is used to execute the computer program so that the electronic device can implement the adapter program testing method of the application program in any of the above embodiments.

[0193] Specifically, refer to Fig.11 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Fig.11 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0194] like Fig.11 As shown, the electronic device may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage device 1108 to a random access memory (RAM) 1103, for implementing the adapter program testing method of the application program of any of the above embodiments. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 1103. The processing device 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.

[0195] Typically, the following devices may be connected to the I / O interface 1105: an input device 1106 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1107 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1108 including, for example, a memory card, a hard disk, etc.; and a communication device 1109. The communication device 1109 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Fig.11 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0196] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements an adapter program testing method for any application provided in the embodiment of the present application.

[0197] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement an adapter program testing method for any application provided in an embodiment of the present application.

[0198] Taking the running of an application developed based on the Windows operating system in the Linux operating system as an example, the technical solution of the present application is illustrated below. Fig.12 As shown in:

[0199] 1. Environment preparation and test start:

[0200] The computer program implementing this embodiment can be called an automated test program. The automated test program is an independent executable file (EXE), and its operation is controlled by an external scheduler. When the test is started, the scheduler in Linux needs to complete the following tasks first:

[0201] Ensure that the target test software (i.e., the target application mentioned above) has been installed and the Wine container environment required by it has been correctly configured. Also, start the automated test program in the Wine container through the scheduler, and then start the target test software.

[0202] The completion of these two tasks marks the beginning of the test, and the automated test program enters the working state and begins to execute the test task. After the test is completed, the automated test program will generate a test report and automatically exit, and the scheduler will continue to process the generated report.

[0203] 2. Environmental monitoring and initial records:

[0204] After the automated test program is started, it first enumerates all processes in the current running environment through the system API in Windows and records the IDs of these processes so that newly created processes can be identified in subsequent operations. The specific operations include:

[0205] Use CreateToolhelp32SnapshotAPI to generate snapshots of all processes in the system;

[0206] Use Process32First and Process32NextAPI to traverse the process snapshot and record the ID, name and other information of each process in old_processes_list.

[0207] This initial recording step establishes the baseline state of the current environment, ensuring that the target test software can be correctly identified and tracked during subsequent monitoring.

[0208] 3. Automated test program crash callback settings:

[0209] In order to monitor the possible crashes of the target test software during the test process, the automated test program needs to modify the AeDebug item in the system registry. The specific operations are as follows:

[0210] The registry path is:

[0211] HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\AeDebug.

[0212] By default, the Debugger sub-item of this item is set to "winedbg%ld%ld". winedbg%ld%ld points to the original Wine debugging tool, which is used to call the Wine debugging tool when the process crashes.

[0213] Before starting the target test software, the automated test program changes the value of the Debugger item to "hotpot-autotest.exe%ld%ld" by calling the RegSetValueEx API. In this way, once a process crash occurs, the system will call the automated test program to handle the process crash event.

[0214] This step ensures that the automated testing program can capture and handle any crash events of the target software during the testing process, record abnormal information, and provide a basis for subsequent problem troubleshooting.

[0215] 4. Round Robin Monitoring and Test Process Identification:

[0216] After setting the crash callback, the automated test program enters the round-robin monitoring state and continuously monitors changes in all processes in the system. This step includes the following operations:

[0217] Use CreateToolhelp32Snapshot, Process32First and Process32Next APIs again to get snapshots of all processes in the current system;

[0218] Compare the current process list with the initially recorded old_processes_list to identify the newly added processes;

[0219] If the new process is not in old_processes_list, it is considered as a process of the target test software and recorded in new_processes_list.

[0220] In this way, the automated testing program can accurately identify the running status of the target test software and prepare for subsequent UI testing operations.

[0221] 5. Enumeration of form and UI objects:

[0222] After successfully identifying the process of the target test software, the automated test program begins to enumerate the form and UI (control) objects of the process (currently only the buttons in the form can be identified). Taking the Demo.exe program as an example, it creates form A. The enumeration process is as follows:

[0223] (1) Use EnumWindows / EnumChildWindows to identify controls:

[0224] The automated test program first calls EnumWindowsAPI to enumerate all top-level windows in the system. The automated test program checks each window handle one by one in the callback function. For example, it uses the GetWindowThreadProcessId API to obtain the process ID of window A, determines that the process ID of window A belongs to the target process in new_processes_list, and enumerates the child windows of window A. The automated test program calls the EnumChildWindows API to enumerate all its child windows.

[0225] In this process, the automated test program will process the handle of each sub-window in the callback function. The automated test program will enumerate the four sub-windows under window A in turn, call GetClassName for each sub-window to obtain the class name and check. The class name of sub-window 1 is Button, and the title is "Function 1"; the class name of sub-window 2 is Button, and the title is "Function 2"; the class name of sub-window 3 is Button, and the title is "Function 3"; the class name of sub-window 4 is Button, and the title is "Exit". Through the feature that the class name contains "Button", the automated test program identifies these sub-windows as button controls. To obtain the title of the button, the automated test program calls the GetWindowText API; to obtain the coordinate information of the button, the automated test program calls the GetWindowRect API. Finally, this information (such as handle, coordinates, title, process ID, etc.) is recorded in process_id_window_list.

[0226] (2) Use MSAA to identify button controls:

[0227] When the child control window cannot be obtained through EnumChildWindows, the automated test program will call the AccessibleObjectFromWindow API to obtain the IAccessible interface corresponding to the window handle. The details are as follows:

[0228] Enumerate the child controls in form A and use IAccessible::get_accChildCount to get the number of child controls in form A. The automated test program calls IAccessible::get_accChild one by one to get the IAccessible interface of each child control to enumerate and process each child control. For each child control, the automated test program calls IAccessible::get_accRole and IAccessible::get_accState to get the role information and state information of the control. For example, for the "Function 1", "Function 2", "Function 3" and "Exit" buttons, accRole returns ROLE_SYSTEM_PUSHBUTTON, indicating that they are button controls. If accState returns STATE_SYSTEM_FOCUSABLE and the control is visible, it is confirmed that the control is a clickable button control. The automated test program then calls IAccessible::get_accName to get the title information of the button and calls IAccessible::accLocation to get the coordinate information of the button. This information is then also recorded in process_id_window_list.

[0229] This process ensures that the automated testing program can fully cover all UI elements of the target software, preparing for subsequent simulated click testing.

[0230] 6. Idle state judgment of target test software:

[0231] After completing the enumeration of UI objects, the automated test program needs to determine whether the target software has entered the idle state to ensure that the click test is performed after the UI is stable. The specific operations are as follows:

[0232] The automated test program counts the total number of current forms and controls and saves them in the variable windows_count (the current number in the previous text);

[0233] After each enumeration, the automated test program backs up the value of windows_count to pre_windows_count (the target variable mentioned above), and then waits for 1 second to allow the target software to complete UI initialization;

[0234] Enumerate the forms and controls again and compare the result with pre_windows_count;

[0235] If the value of windows_count does not change during three consecutive rounds, the automated testing program considers that the target software has entered an idle state.

[0236] For example, after executing the form enumeration in the first loop, find 3 button controls, first determine whether the target test software is in an idle state, that is, whether the value of windows_count has not changed for 3 consecutive times. If not, wait for 1 second, regenerate the process snapshot, enumerate the forms, and then determine whether the target test software is in an idle state. Until the value of windows_count has not changed for 3 consecutive times, it can be considered that the target test software is in an idle state, and then perform a click test.

[0237] This step ensures that the automated test program only performs click testing when the software is in a stable state, avoiding erroneous operations caused by incomplete software loading.

[0238] 7. Simulate clicks and operation records:

[0239] Once the target software is confirmed to be in an idle state, the automated test program will traverse the previously recorded UI structure tree and simulate clicks on the button type controls. The operation process is as follows:

[0240] The automated test program obtains the sub-control information of each window from process_id_window_list to determine whether it is a button control (the class name contains Button or is identified as a button through MSAA);

[0241] For a certain button control, the automated test program obtains its coordinates, sets the mouse position to the button position, and uses the SetCursorPos API to complete the mouse positioning;

[0242] Call mouse_eventAPI to perform mouse click operations.

[0243] [P] After each click, the automated test program will record the name of the button clicked (i.e. title information), coordinate information, and process information of the process to which it belongs in the test report test_report. For example, if you click the 'Run' button in the target.exe process window, the record content is "Click<target.exe> (Run)[100,100]".[ / P][P]This

[0244] This series of operations ensures that the automated test program can accurately simulate user operations and record detailed test paths and results.

[0245] 8. Crash monitoring and exception handling:

[0246] After executing the simulated click, the automated test program will briefly wait for the target software to respond while continuously monitoring for crash events. The specific operations are as follows:

[0247] The automated testing program monitors whether the target test software process crashes through the previously set crash callback mechanism.

[0248] Once a process crash event is detected, the automated testing program immediately records the crash event and related information in test_report, such as "c:\windows\target.exe process crashed", and terminates the current test loop.

[0249] This mechanism ensures that the automated testing program can capture and record any abnormal situations that occur during the testing process in real time, providing support for rapid problem location.

[0250] IX. Repeated testing and final report:

[0251] If no crash event is detected after the click operation, the automated test program will repeat the above steps and continue to traverse and test all button controls that have not been clicked. After the test is completed, the automated test program will organize and generate the final test report, writing all recorded click paths, crash information and test results to C:\test_report.txt.

[0252] This process ensures comprehensive testing of the target software UI and generates detailed test reports for subsequent analysis.

[0253] 10. Automatic Exit and Scheduler Notification:

[0254] After the test task is completed, the automated test program automatically exits. The external scheduler monitors the exit of the automated test program, indicating that the test has been completed and the test report is saved, and subsequent adaptation tasks are arranged.

[0255] In summary, the technical solution in this embodiment has the following advantages:

[0256] Reduce labor costs: Automated testing procedures can replace some manual operations, especially in a large number of repetitive testing tasks, significantly reducing the need for manual participation and reducing labor costs.

[0257] Improve test efficiency: Automated testing programs can perform a large number of test tasks in batches and generate reports quickly. Compared with manual testing, automated testing programs can complete more tasks in a shorter time, greatly improving test efficiency.

[0258] Reduce human errors: The automated testing program follows the predetermined process and logic, avoiding accidental clicks or misoperations in manual operations, and reducing human errors in the testing process.

[0259] More comprehensive test coverage: Automated testing programs can traverse and click all possible UI buttons to ensure that all functional paths are tested and to maximize the discovery of potential problems.

[0260] Real-time anomaly detection and processing: Through crash monitoring and exception handling mechanisms, automated testing programs can capture and record any operations that cause software crashes in real time during the testing process, providing key data for subsequent troubleshooting.

[0261] Enhanced adaptation efficiency: The introduction of automated testing programs makes the adaptation process of a large number of Windows applications more efficient, which is of great significance to the application migration of domestic operating systems.

[0262] Support batch operations: The automated testing program can adapt multiple Windows applications at the same time in a short period of time, meeting the needs of large-scale application migration and helping to accelerate the popularization and promotion of domestic operating systems.

[0263] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0264] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0265] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0266] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk (SSD)), etc.

Claims

1. A method for testing an adapter of an application, characterized in that: The method comprises: After the target application is started, obtaining at least one application process of the target application running in a target operating environment; the target operating environment is an operating environment constructed by the adapter program in the first operating system; the target application is an application developed based on the second operating system; Obtaining an initial window in the target operating environment; the initial window is all top-level windows in the target operating environment; Filtering out a target window belonging to the application process from the initial window; Identifying a button control in the target window to obtain a button list, wherein the button list includes at least one button control; A mouse click operation is performed on a button control in the button list to obtain a test result corresponding to the button control, wherein the test result indicates whether the adapter enables the target application to provide services in the target operating environment.

2. The method according to claim 1, characterized in that The obtaining of at least one application process of the target application running in the target running environment includes: Generate a process snapshot in the target operating environment; Processing the process snapshot to obtain a first process list in the target operating environment, wherein the first process list includes at least one process; Filtering newly added processes in the first process list relative to processes in the second process list to obtain at least one application process of the target application in the target running environment; The second process list includes at least one process, and the processes in the second process list are processes in the target operating environment before the target application is started.

3. The method according to claim 1, characterized in that The step of filtering out a target window belonging to the application process from the initial window includes: Obtaining process information of the process to which the initial form belongs; According to the process information, a target window belonging to the application process in the initial window is filtered out.

4. The method according to claim 1, characterized in that: The step of identifying the button controls in the target window to obtain a button list includes: Using the target mode, obtaining a button control whose control type is a button type in the target window to obtain a button list; the target mode includes at least one of the first mode and the second mode; The first method and the second method use different interface types.

5. The method according to claim 4, characterized in that The first method includes: Using the first type of interface, enumerate the sub-windows contained in the target window to obtain the primary selected sub-windows; obtain the class name information corresponding to each of the primary selected sub-windows; filter the primary selected sub-windows whose class name information is characterized as a button type to obtain a button control; The second method includes: Using the second type of interface, enumerate the sub-controls included in the target form to obtain the primary sub-controls; obtain the role information and state information corresponding to each of the primary sub-controls; filter the primary sub-controls whose role information is characterized as a button type and whose state information is characterized as a visible state to obtain a button control; The first type of interface is different from the second type of interface.

6. The method according to claim 1, characterized in that The method further comprises: Obtain title information and coordinate information of the button control; Add the title information and coordinate information of the button control to the button list; The test result corresponding to the button control at least includes: title information and coordinate information of the button control and process information of the process to which the button control belongs.

7. The method according to claim 1, characterized in that After identifying the button controls in the target window and before performing a mouse click operation on the button controls in the button list, the method further includes: Compare the current number of button controls identified this time with the value in the target variable; the target variable records the historical number of button controls identified last time; If the current number of button controls identified this time is inconsistent with the value in the target variable, the current number is recorded in the target variable; the button controls newly added to the button list in the button controls identified this time are added to the button list; after waiting for a first period of time, the step of obtaining at least one application process of the target application running in the target running environment is executed; If the current number of button controls identified this time is consistent with the value in the target variable, add 1 to the value of the polling variable; determine whether the value in the polling variable reaches the target threshold; if the value in the polling variable does not reach the target threshold, wait for a second period of time, and then return to execute the step of obtaining at least one application process of the target application running in the target operating environment; if the value in the polling variable reaches the target threshold, execute the step of performing a mouse click operation on the button controls in the button list.

8. The method according to claim 1, characterized in that The performing a mouse click operation on the button control in the button list to obtain a test result corresponding to the button control includes: Select a button control that has not been subjected to a mouse click operation from the button list to perform the mouse click operation, so as to obtain a test result corresponding to the button control; After obtaining the test result, the method further includes: In the case where the test result indicates that the adapter enables the target application to provide services in the target running environment, returning to the step of selecting a button control from the button list that has not been subjected to the mouse click operation to perform the mouse click operation, until all the button controls in the button list are subjected to the mouse click operation; In the case where the test result indicates that the adapter program makes the target application unable to provide services in the target operating environment, a test report is generated according to the test result, and the test report is used to adjust the adapter program.

9. The method according to claim 8, characterized in that The test result indicates that the adapter makes the target application unable to provide services in the target operating environment, including: The test result indicates that an event that a process crash occurs in the application process to which the button control belongs; Wherein, the method further comprises: The system registry of the first operating system is adjusted so that the event of the process crash can be identified.

10. An application adapter testing device, characterized in that: The device comprises: a process obtaining unit, configured to obtain, after the target application is started, at least one application process of the target application running in a target operating environment; the target operating environment is an operating environment constructed by the adapter program in the first operating system; the target application is an application developed based on the second operating system; A window acquisition unit, used to acquire an initial window in the target operating environment; the initial window is all top-level windows in the target operating environment; and from the initial window, a target window belonging to the application process is screened out; A button identification unit, used for identifying the button controls in the target window to obtain a button list, wherein the button list includes at least one button control; A click execution unit is used to execute a mouse click operation on a button control in the button list to obtain a test result corresponding to the button control, wherein the test result indicates whether the adapter enables the target application to provide services in the target operating environment.