A recognition testing method suitable for multi-window switching scenarios
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-09
- Publication Date
- 2026-08-14
AI Technical Summary
但是,在实际实施过程中,发明人发现,现有技术中的软件界面,在使用过程中往往会发生多个窗口间的切换动作
[0093]上述技术方案具有如下优点或有益效果:通过在动作记录过程获取待记录窗口的记录窗口参数以及待记录控件的记录控件参数,有效识别出测试动作所对应的待记录控件,并记录相关信息,以便于在实际测试过程中根据记录到的记录窗口参数和记录控件参数获取到待测试控件,避免了现有技术中无法在多个窗口中辨认出实际需要测试的控件的问题,提高测试效率。
Smart Images

Figure CN115437936B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software testing technology, and specifically to a recognition testing method suitable for multi-window switching scenarios. Background Technology
[0002] Code testing refers to the activity of verifying that code can correctly perform specific functions through a series of test cases. Typically, code testing is conducted throughout the entire lifecycle of a software product, playing a crucial role in development, operation, and maintenance. Depending on the object of testing, it can be categorized into performance testing, security testing, compatibility testing, business logic testing, and user interface testing. User interface testing, in particular, refers to testing the software's user interface to determine whether users can achieve the expected functionality when controlling the software through the interface.
[0003] In existing technologies, there are technical solutions that record test actions using corresponding computer programs and test the software interface through methods such as scripts and key simulation. For example, the window to be tested is identified using session IDs or handles, and test actions are executed on the controls in the window to obtain test results. However, in actual implementation, the inventors found that in existing software interfaces, multiple window switching actions often occur during use. These switching actions cause the currently selected software window to shift, making it impossible to accurately locate the window that actually needs to be tested, thus preventing the test actions from being performed normally. Summary of the Invention
[0004] To address the aforementioned problems in existing technologies, a recognition testing method suitable for multi-window switching scenarios is provided.
[0005] The specific technical solution is as follows:
[0006] A recognition testing method suitable for multi-window switching scenarios includes an action recording process and a test execution process, wherein the action recording process precedes the test execution process;
[0007] During the action recording process, for at least two consecutive test actions, the following steps are executed cyclically:
[0008] Step M1: After the previous test action causes a window switch, obtain the currently displayed first window, determine the first window as the window to be recorded based on the first window parameters of the first window, and then proceed to step M2:
[0009] Step M2: Obtain the first control currently pointed to in the window to be recorded, and after confirming it as the control to be recorded based on the first control parameter of the first control, proceed to step M3;
[0010] Step M3: Establish the mapping relationship between the current test action and the recording window parameters of the window to be recorded, and the recording control parameters of the control to be recorded;
[0011] During the test execution, the following steps are performed:
[0012] Step N1: Identify that the execution result of a test action causes a window to switch, and then proceed to step N2;
[0013] Step N2: Obtain multiple second windows in the display interface, find the window to be tested based on the second window parameters of the second window and the record window parameters, and proceed to step N3;
[0014] Step N3: Obtain multiple second controls in the window to be tested, and find the control to be tested based on the second control parameters of the second controls and the recorded control parameters;
[0015] Step N4: Perform the test action on the control to be tested to obtain the test result.
[0016] Preferably, multiple lists of window parameters with different priorities are pre-set, and each priority list of window parameters contains multiple different standard window parameters.
[0017] The standard window parameters include: the window's program file name, the window's class, the window's title, and the window's position and size information;
[0018] Step M1 includes:
[0019] Step M11: After the previous test action causes a window switch, obtain the currently pointed first window and extract multiple first window parameters of the first window;
[0020] The first window parameters include: the program file name of the first window, the class of the first window, the title of the first window, and the position and size information of the first window;
[0021] Step M12: Obtain the list of highest priority window parameters to be used as window search criteria;
[0022] Step M13: Based on the window judgment conditions, judge at least one of the first window parameters to confirm whether the first window is the window to be recorded;
[0023] If so, the first window is used as the window to be recorded, and then the process proceeds to step M2;
[0024] If not, proceed to step M14;
[0025] Step M14: Use the window parameter list of the next priority as the window judgment condition, and return to step M13 until all the window parameter lists of multiple priorities are traversed. Confirm that the currently pointed first window is not the window to be recorded, judge the currently pointed first window as an invalid window, and stop recording the first window.
[0026] Preferably, the window parameter list for each priority level includes: a whitelist of filtered windows, a blacklist of filtered windows, and a list of windows to be recorded.
[0027] The list of windows to be recorded contains the standard window parameters of the windows to be recorded; the blacklist of filtered windows contains the standard window parameters of the windows to be blocked; and the whitelist of filtered windows contains the standard window parameters of the valid windows in the current priority.
[0028] Within the same priority level, the whitelist of the filtering window has a higher priority than the blacklist of the filtering window.
[0029] Each time step M13 is executed, the method for judging at least one of the first window parameters according to the window judgment condition includes:
[0030] Step M131: Compare all the first window parameters of the first window with the standard window parameters in the filter window whitelist of the current priority;
[0031] When the comparison result shows that the first window is in the whitelist of the filter window with the current priority, it indicates that the first window is the window to be recorded, and proceed to step M2;
[0032] If the comparison result indicates that the first window is not in the whitelist of the filter window with the current priority, proceed to step M132;
[0033] Step M132: Compare all the first window parameters of the first window with the standard window parameters in the filter window blacklist of the current priority;
[0034] When the comparison result shows that the first window is in the blacklist of the filter window with the current priority, it indicates that the first window is not the window to be recorded, and proceed to step M14;
[0035] When the comparison result shows that the first window is not in the blacklist of the filter window with the current priority, proceed to step M133;
[0036] Step M133: Compare all the first window parameters of the first window with the standard window parameters in the list of windows to be recorded with the current priority;
[0037] When the comparison result shows that the first window is in the list of windows to be recorded with the current priority, it indicates that the first window is the window to be recorded, and proceed to step M2;
[0038] If the comparison result shows that the first window is not in the list of windows to be recorded with the current priority, it indicates that the first window is not the window to be recorded, and the process proceeds to step M14.
[0039] Preferably, multiple lists of control parameters with different priorities are pre-set, and each priority list of control parameters contains multiple different standard control parameters.
[0040] The standard control parameters include: the control's class, the control's title, and the control's position and size information; step M2 includes:
[0041] Step M21: Obtain the first control pointed to in the window to be recorded, and extract multiple first control parameters of the first control;
[0042] The parameters of the first control include: the class of the first control, the title of the first control, and the position and size information of the first control;
[0043] Step M22: Obtain the list of parameters for the highest priority controls to be used as the criteria for control lookup;
[0044] Step M23: Based on the control judgment conditions, judge at least one of the first control parameters to confirm whether the first control is the control to be recorded;
[0045] If so, the first control is designated as the control to be recorded, and then the process proceeds to step M3;
[0046] If not, proceed to step M24;
[0047] Step M24: Use the list of control parameters of the next priority as the control judgment condition, and return to step M23 until all the control parameter lists of multiple priorities have been traversed. Confirm that the first control currently pointed to is not the control to be recorded, judge the first control currently pointed to as an invalid control, and stop recording the first control.
[0048] Preferably, the list of control parameters for each priority level includes: a whitelist of filtering controls, a blacklist of filtering controls, and a list of controls to be recorded.
[0049] The list of controls to be recorded contains the standard control parameters of the controls to be recorded; the blacklist of filters contains the standard control parameters of the controls to be blocked; and the whitelist of filters contains the standard control parameters of the valid controls in the current priority.
[0050] Within the same priority level, the whitelist of the filtering control has a higher priority than the blacklist of the filtering control.
[0051] Each time step M23 is executed, the method for judging at least one parameter of the first control according to the control judgment condition includes:
[0052] Step M231: Compare all the parameters of the first control with the standard control parameters in the whitelist of the filter controls of the current priority;
[0053] When the comparison result shows that the first control is in the whitelist of the filter controls with the current priority, it indicates that the first control is the control to be recorded, and proceeds to step M3;
[0054] If the comparison result shows that the first control is not in the whitelist of the filter controls with the current priority, proceed to step M232;
[0055] Step M232: Compare all the parameters of the first control with the standard control parameters in the filter control blacklist of the current priority;
[0056] When the comparison result shows that the first control is in the blacklist of the filter controls of the current priority, it indicates that the first control is not the control to be recorded, and proceed to step M24;
[0057] When the comparison result shows that the first control is not in the blacklist of the filter controls with the current priority, proceed to step M233;
[0058] Step M233: Compare all the first control parameters of the first control with the standard control parameters in the list of controls to be recorded with the current priority;
[0059] When the comparison result shows that the first control is in the list of controls to be recorded with the current priority, it indicates that the first control is the control to be recorded, and proceeds to step M3;
[0060] If the comparison result shows that the first control is not in the list of controls to be recorded with the current priority, it indicates that the first control is not the control to be recorded, and the process proceeds to step M24.
[0061] Preferably, before N4 performs each test action, the parameters of the test window are recorded and a comparison window is generated;
[0062] Furthermore, null values are pre-assigned to the control window parameters before the first execution of step N4;
[0063] The parameters of the comparison window include: the program file name of the window to be tested, the class of the window to be tested, the title of the window to be tested, and the position and size information of the window to be tested;
[0064] In step N1, the process of identifying whether the execution result of the test action causes the window to switch specifically includes:
[0065] Step N11: After one of the test actions is completed, collect the second window parameters for the corresponding current display window;
[0066] The second window parameters include: the program file name of the currently displayed window, the class of the currently displayed window, the title of the currently displayed window, and the position and size information of the currently displayed window;
[0067] Step N12: Compare all the second window parameters with the control window parameters corresponding to the test action, and confirm that a window switch has occurred when the second window parameters are inconsistent with the control window parameters, and then proceed to step N2.
[0068] Preferably, step N2 includes:
[0069] Step N21: Obtain multiple second windows from the current display interface, and obtain the third window parameters for each of the second windows respectively;
[0070] The third window parameters include: the program file name of the second window, the class of the second window, the title of the second window, and the position and size information of the second window;
[0071] Step N22: For each second window, sequentially filter the second window using the single third window parameter and the record window parameter, and determine whether the number of filtered second windows is one;
[0072] If so, use the second window as the test window, and then proceed to step N3;
[0073] If not, proceed to step N23;
[0074] The recording window parameters include: the program file name of the recording window, the class of the recording window, the title of the recording window, and the position and size information of the recording window;
[0075] Step N23: For each second window, generate multiple pairs of window attribute combinations based on at least two third window parameters, sequentially use each pair of window attribute combinations and the recorded window parameters to filter the second window, and determine whether the number of filtered second windows is one;
[0076] If so, use the second window as the test window, and then proceed to step N3;
[0077] If not, the second window to which the current operation is directed is used as the test window, and then the process proceeds to step N3.
[0078] Preferably, the window attribute combination in step N23 includes at least two of the following: the program file name of the second window, the class of the second window, the title of the second window, and the position and size information of the second window.
[0079] Preferably, step N3 includes:
[0080] Step N31: Obtain multiple second controls from the display area of the second window, and obtain the second control parameters of each second control respectively;
[0081] The parameters of the second control include: the type of the second control, the title of the second control, and the position and size information of the second control;
[0082] Step N32: For each of the second controls, the second controls are filtered sequentially using the individual control attributes and the recorded control parameters, and it is determined whether the number of filtered second controls is one;
[0083] If so, use the second control as the test control, and then proceed to step B3;
[0084] If not, proceed to step N33;
[0085] The recording control parameters include: the type of the recording control, the title of the recording control, and the position and size information of the recording control;
[0086] Step N33: For each of the second controls, generate multiple pairs of control attribute combinations based on at least two of the control attributes, sequentially use each pair of control attribute combinations and the recorded control parameters to filter the second controls, and determine whether the number of filtered second controls is one;
[0087] If so, use the second control as the test control, and then proceed to step N4;
[0088] If not, it indicates that the test control was not found, and the current test action is skipped.
[0089] Preferably, the control attribute combination includes:
[0090] Control type and control title, control type and control position and size information;
[0091] Control title and control type;
[0092] Control title or control type.
[0093] The above technical solution has the following advantages or beneficial effects: by obtaining the recording window parameters of the window to be recorded and the recording control parameters of the control to be recorded during the action recording process, the control to be recorded corresponding to the test action can be effectively identified and relevant information can be recorded. This allows the control to be tested to be obtained based on the recorded recording window parameters and recording control parameters during the actual test process, avoiding the problem in the prior art of not being able to identify the actual control to be tested in multiple windows and improving test efficiency. Attached Figure Description
[0094] Embodiments of the invention will be described more fully with reference to the accompanying drawings. However, the drawings are for illustration and explanation only and do not constitute a limitation on the scope of the invention.
[0095] Figure 1 This is a schematic diagram of the action recording process in an embodiment of the present invention;
[0096] Figure 2 This is a schematic diagram of the test execution process in an embodiment of the present invention;
[0097] Figure 3 This is a schematic diagram of sub-step M1 in an embodiment of the present invention;
[0098] Figure 4 This is a schematic diagram of sub-step M13 in an embodiment of the present invention;
[0099] Figure 5 This is a schematic diagram of sub-step M2 in an embodiment of the present invention;
[0100] Figure 6 This is a schematic diagram of sub-step M22 in an embodiment of the present invention;
[0101] Figure 7 This is a schematic diagram of sub-step N1 in an embodiment of the present invention;
[0102] Figure 8 This is a schematic diagram of sub-step N2 in an embodiment of the present invention;
[0103] Figure 9This is a schematic diagram of sub-step N3 in an embodiment of the present invention. Detailed Implementation
[0104] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0105] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.
[0106] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, but this is not intended to limit the scope of the invention.
[0107] This invention includes:
[0108] A recognition testing method suitable for multi-window switching scenarios includes an action recording process and a test execution process, wherein the action recording process precedes the test execution process;
[0109] like Figure 1 As shown, during the action recording process, for at least two consecutive test actions, the following steps are executed cyclically:
[0110] Step M1: After the previous test action causes a window switch, obtain the currently displayed first window, determine the first window as the window to be recorded based on the first window parameters, and then proceed to step M2:
[0111] Step M2: Obtain the first control currently pointed to in the window to be recorded, and after confirming that it is the control to be recorded based on the first control parameter of the first control, proceed to step M3;
[0112] Step M3: Establish the mapping relationship between the current test action and the recording window parameters of the window to be recorded, and the recording control parameters of the control to be recorded;
[0113] Specifically, in existing technologies, when testing multiple windows, windows are typically located using window IDs, handles, etc. However, in some situations, such as when a software application has multiple child windows or sub-interfaces, the above methods cannot effectively identify window switching and perform testing on specific child windows when switching between them occurs. For example, an instant messaging software has a session window where users can switch between different tabs to talk to each other. During tab switching, the window ID, handle, and other information do not change, making it impossible to obtain the switched child window. To address this issue, this embodiment records the recording window parameters and control parameters of the window to be recorded after a window switch for continuous test actions. This enables effective retrieval of the corresponding test window after a window switch in subsequent tests, avoiding test failures.
[0114] like Figure 2 As shown, the following steps are performed during the test execution:
[0115] Step N1: Identify that the execution result of a test action causes a window to switch, and then proceed to step N2;
[0116] Step N2: Obtain multiple second windows in the display interface, find the window to be tested based on the second window parameters and the record window parameters, and proceed to step N3;
[0117] Step N3: Obtain multiple second controls in the window to be tested, and find the control to be tested based on the second control parameters and the recorded control parameters;
[0118] Step N4: Perform test actions on the control to be tested to obtain test results.
[0119] Specifically, in response to the problem that existing technologies cannot accurately detect sub-interfaces in a window during the aforementioned testing process, this embodiment identifies the test actions and then, when a window switch occurs during the test action, sequentially locates the control to be tested in the specific window to be tested using pre-recorded record window references and record control parameters, and executes the test action, thereby enabling the test action to proceed normally.
[0120] In practice, the above testing process only applies to situations where window switching occurs. When the window does not switch, it is usually only necessary to read the data in a single window, obtain multiple controls to be tested, and execute test actions sequentially. Therefore, this solution can be combined with other window recognition methods to test windows that do not typically switch, and there are no limitations on this.
[0121] In a preferred embodiment, multiple lists of window parameters with different priorities are pre-set, and each priority list of window parameters contains multiple different standard window parameters.
[0122] Standard window parameters include: the window's program file name, the window's class, the window's title, and the window's position and size information;
[0123] like Figure 3 As shown, step M1 includes:
[0124] Step M11: After the previous test action causes a window switch, obtain the currently pointed first window and extract multiple first window parameters;
[0125] The parameters for the first window include: the program file name of the first window, the class of the first window, the title of the first window, and the position and size information of the first window;
[0126] Step M12: Obtain the list of highest priority window parameters to be used as window search criteria;
[0127] Step M13: Based on the window judgment conditions, judge at least one first window parameter to confirm whether the first window is the window to be recorded;
[0128] If so, set the first window as the window to be recorded, and then proceed to step M2;
[0129] If not, proceed to step M14;
[0130] Step M14: Use the list of window parameters of the next priority as the window judgment condition, and return to step M13. After traversing all the window parameter lists of multiple priorities, confirm that the first window currently pointed to is not the window to be recorded, judge the first window currently pointed to as an invalid window, and stop recording the first window.
[0131] Specifically, in response to the problem that existing technologies cannot accurately identify the window to be identified by simply obtaining the window through the handle, this embodiment filters multiple priority lists of window parameters in sequence to obtain the actual window to be recorded from multiple windows, thus achieving a better identification effect for the window to be recorded.
[0132] During implementation, the first window parameters are the inherent attributes of the window that are available in the first window, including the window's class, root window, program file name, position information, size information, and window title. One or more first window parameters can be selected to filter windows as needed. For example, windows can be selected only by program file name, or by a combination of class and title.
[0133] The above implementation is only one example under a specific operating system. In actual implementation, other attributes may be obtained depending on the operating system and software program type. For example, for JAVA software, the program file name, class, title, position and size information of its frame can be obtained as the first window parameters, and then the control attributes of the controls under that frame can be obtained.
[0134] As an optional implementation, the filtering range of the highest priority window parameter list is smaller than that of the next lower priority window parameter list.
[0135] Specifically, addressing the problem in existing technologies where simply obtaining a window via its handle fails to accurately identify the window to be identified, this embodiment sets different filtering conditions sequentially in window parameter lists of different priorities, progressively expanding the filtering range to achieve more accurate window finding while avoiding situations where no window can be found. Taking an instant messaging software as an example, in one embodiment, if it is necessary to test the sub-windows of the instant messaging software, the highest priority window parameter list should be set with content related to that sub-window. Only when it cannot be confirmed whether the current first window is the sub-window should the next lower priority window parameter list be used to determine whether the first window belongs to the instant messaging software. The number of priority levels can be adjusted as needed. For example, if the instant messaging software only has a two-level menu, then in this test, only two priority window parameter lists can be selected to avoid filtering irrelevant content.
[0136] In a preferred embodiment, the window parameter list for each priority includes: a whitelist of filtered windows, a blacklist of filtered windows, and a list of windows to be recorded.
[0137] The list of windows to be recorded contains the standard window parameters of the windows to be recorded; the blacklist of windows to be filtered contains the standard window parameters of the windows to be blocked; and the whitelist of windows to be filtered contains the standard window parameters of the valid windows in the current priority.
[0138] Within the same priority level, the whitelist of filtering windows has higher priority than the blacklist of filtering windows;
[0139] Then as Figure 4 As shown, each time step M13 is executed, the method for judging at least one first window parameter according to the window judgment condition includes:
[0140] Step M131: Compare all parameters of the first window with the standard window parameters in the whitelist of the current priority filter windows;
[0141] When the comparison result shows that the first window is in the whitelist of the current priority filter window, it indicates that the first window is the window to be recorded, and proceed to step M2;
[0142] If the comparison result shows that the first window is not in the whitelist of the current priority filter window, proceed to step M132;
[0143] Step M132: Compare all the parameters of the first window with the standard window parameters in the filter window blacklist of the current priority;
[0144] When the comparison result shows that the first window is in the blacklist of the current priority filter window, it indicates that the first window is not the window to be recorded, and proceed to step M14;
[0145] If the comparison result shows that the first window is not in the blacklist of filtering windows of the current priority, proceed to step M133;
[0146] Step M133: Compare all the parameters of the first window with the standard window parameters in the list of windows to be recorded with the current priority;
[0147] When the comparison result shows that the first window is in the list of windows to be recorded with the current priority, it indicates that the first window is a window to be recorded, and proceed to step M2;
[0148] If the comparison result shows that the first window is not in the list of windows to be recorded with the current priority, it indicates that the first window is not a window to be recorded, and the process proceeds to step M14.
[0149] Specifically, addressing the issue of multiple filtering windows potentially existing in a test environment, this embodiment sets up a whitelist, a blacklist, and a test filtering window list within the filtering window list. The whitelist precedes the blacklist, thus achieving a better filtering effect. The test filtering window list contains filtering windows that normally need to be tested, such as program windows, program sub-windows, pop-ups, and floating windows. The blacklist contains irrelevant programs that need to be excluded, such as input methods and antivirus software. In existing technologies, simple filtering is usually performed using only a list of windows to be recorded. However, in some cases, such as when filtering input method plugins or add-ons, interference from the blacklist can prevent accurate acquisition of the windows to be recorded. In such cases, adding the filtering windows to be recorded to the whitelist achieves filtering of these types of windows while avoiding significant modifications to the blacklist.
[0150] Furthermore, in other embodiments, the above matching process can also be manifested in other orders, such as "filter window whitelist - filter window blacklist - test filter window list; filter window whitelist - test filter window list - filter window blacklist; test filter window list - filter window whitelist - filter window blacklist; filter window whitelist - test filter window list - filter window blacklist". It is only necessary to ensure that the order of the filter window whitelist must be before the filter window blacklist, so as to avoid the filter window blacklist from blocking the window to be recorded.
[0151] In a preferred embodiment, multiple lists of control parameters with different priorities are pre-set, and each priority list of control parameters contains multiple different standard control parameters.
[0152] Standard control parameters include: the control's class, the control's title, and the control's position and size information;
[0153] like Figure 5 As shown, step M2 includes:
[0154] Step M21: Obtain the first control pointed to in the window to be recorded, and extract multiple first control parameters of the first control;
[0155] The parameters of the first control include: the class of the first control, the title of the first control, and the position and size information of the first control;
[0156] Step M22: Obtain the list of parameters for the highest priority controls to be used as the criteria for control lookup;
[0157] Step M23: Based on the control judgment conditions, judge at least one first control parameter to confirm whether the first control is the control to be recorded;
[0158] If so, designate the first control as the control to be recorded, and then proceed to step M3;
[0159] If not, proceed to step M24;
[0160] Step M24: Use the list of control parameters of the next priority as the control judgment condition, and return to step M23. After traversing all the lists of control parameters of multiple priorities, confirm that the first control currently pointed to is not the control to be recorded, judge the first control currently pointed to as an invalid control, and stop recording the first control.
[0161] Specifically, addressing the problem in existing technologies where it's difficult to effectively acquire the target control to be tested when switching between multiple windows, this embodiment obtains the first control parameters of a first control and combines the contents of these parameters to filter controls within the current window, thereby accurately identifying the controls for which test actions need to be recorded. For example, multiple windows created within the same software may each have a "close" button. In this case, it's necessary to set the aforementioned first control parameters, including the position, size, type, and name of the first control, and to comprehensively determine whether a control is the one for which test actions need to be recorded by setting a list of control parameters with different priorities.
[0162] In a preferred embodiment, the list of control parameters for each priority level includes: a whitelist of filter controls, a blacklist of filter controls, and a list of controls to be recorded.
[0163] The list of controls to be recorded contains the standard control parameters of the controls to be recorded; the blacklist of controls to be filtered contains the standard control parameters of the controls to be blocked; and the whitelist of controls to be filtered contains the standard control parameters of the valid controls in the current priority.
[0164] Within the same priority level, the whitelist of filter controls has higher priority than the blacklist of filter controls;
[0165] Then as Figure 6 As shown, each time step M23 is executed, the method for judging at least one first control parameter according to the control judgment condition includes:
[0166] Step M231: Compare all parameters of the first control with the parameters of the standard controls in the whitelist of the current priority filter controls;
[0167] When the comparison result shows that the first control is in the whitelist of filtering controls with the current priority, it indicates that the first control is the control to be recorded, and proceed to step M3;
[0168] If the comparison result shows that the first control is not in the whitelist of filtering controls with the current priority, proceed to step M232;
[0169] Step M232: Compare all parameters of the first control with the standard control parameters in the blacklist of filters of the current priority;
[0170] When the comparison result shows that the first control is in the blacklist of filtering controls of the current priority, it indicates that the first control is not the control to be recorded, and proceed to step M24;
[0171] If the comparison result shows that the first control is not in the blacklist of filtering controls with the current priority, proceed to step M233;
[0172] Step M233: Compare all parameters of the first control with the standard control parameters in the list of controls to be recorded with the current priority;
[0173] When the comparison result shows that the first control is in the list of controls to be recorded with the current priority, it indicates that the first control is the control to be recorded, and proceed to step M3;
[0174] If the comparison result shows that the first control is not in the list of controls to be recorded with the current priority, it indicates that the first control is not a control to be recorded, and the process proceeds to step M24.
[0175] During implementation, the whitelist, blacklist, and list of controls to be recorded each contain the first control parameters of multiple first controls. The first controls listed in the whitelist and the list of controls to be recorded are those that need to be triggered during the actual testing process, such as controls that need to be triggered in other steps during continuous testing tasks. The blacklist contains non-test objects, such as controls in the system interface. Typically, existing technologies use a whitelist mechanism similar to the list of controls to be recorded to filter controls. However, in this embodiment, there may be cases where controls to be recorded are covered by the blacklist in the control parameter lists of different priorities. For example, a step in the software execution may require calling controls in a non-test object program, such as the system menu or input method. In this case, generating a new set of control lists for each test action would be relatively cumbersome. To address this, the method used in this embodiment is to add the control to both the list of controls to be recorded and the whitelist, and to pre-cover the blacklist with the whitelist, thus avoiding the problem of the blacklist removing test controls by adding the control to be tested only once to the whitelist. The control attributes in the aforementioned whitelist, blacklist, and list of controls to be recorded include the control's position and size information, type, and title. During actual testing, one or more control attributes can be selected to filter controls as needed. For example, multiple operation buttons can be pre-filtered using the type and title of the control attributes, and then the actual required control can be obtained using the position and size information. It should be noted that the above judgment process is only one embodiment of a judgment step. In actual practice, the above judgment method can be used for each control identification step as needed to identify the actual action to be tested from multiple controls. For example, during the identification process, there may be multiple filtered controls. For each control, its type information should be obtained separately, and then compared with the type information recorded in the whitelist, blacklist, and list of controls to be recorded to achieve control filtering.
[0176] Furthermore, in actual implementation, the union of the aforementioned whitelist of controls and the list of test controls can be represented by multiple matching rules, and the matching process includes:
[0177] The control properties are compared with the control whitelist, control blacklist, and test control list in a specific order, with the whitelist always preceding the blacklist to prevent the blacklist from blocking the control to be tested. The specific order can be one of the following: "control whitelist - control blacklist - test control list; control whitelist - test control list - control blacklist; test control list - control whitelist - control blacklist; control whitelist - test control list - control blacklist".
[0178] In a preferred embodiment, before N4 performs each test action, the parameters of the window to be tested are recorded and a control window is generated.
[0179] Also, null values are pre-assigned to the control window parameters before the first execution of step N4;
[0180] The parameters for the test window include: the program file name of the test window, the class of the test window, the title of the test window, and the position and size information of the test window;
[0181] like Figure 7 As shown, step N1, the process of identifying whether the execution result of the test action causes the window to switch, specifically includes:
[0182] Step N11: After a test action is completed, collect the parameters of the second window for the corresponding currently displayed window;
[0183] The second window parameters include: the program file name of the currently displayed window, the class of the currently displayed window, the title of the currently displayed window, and the position and size information of the currently displayed window;
[0184] Step N12: Compare all the second window parameters with the control window parameters corresponding to the test action, and confirm that a window switch has occurred when the second window parameters are inconsistent with the control window parameters, and then proceed to step N2.
[0185] Specifically, addressing the issue in existing technologies that cannot accurately detect a second-level window switch within a given window, this embodiment records the parameters of the reference window before a specific test action during a continuous test execution process. These parameters are then compared with the parameters of the second window after the test. If a change occurs, it indicates a window switch has taken place, at which point the process can proceed to the testing procedure based on the recorded window and control parameters. If no window switch occurs, other testing methods can be used, which will not be elaborated upon here.
[0186] In a preferred embodiment, such as Figure 8 As shown, step N2 includes:
[0187] Step N21: Obtain multiple second windows from the current display interface, and obtain the third window parameters for each second window respectively;
[0188] The parameters of the third window include: the program file name of the second window, the class of the second window, the title of the second window, and the position and size information of the second window;
[0189] Step N22: For each second window, filter the second window sequentially using the single third window parameter and the record window parameter, and determine whether the number of filtered second windows is one;
[0190] If so, use the second window as the test window, and then proceed to step N3;
[0191] If not, proceed to step N23;
[0192] The recording window parameters include: the program file name of the recording window, the class of the recording window, the title of the recording window, and the position and size information of the recording window;
[0193] Step N23: For each second window, generate multiple pairs of window attribute combinations based on at least two third window parameters, and sequentially filter the second window using each pair of window attribute combinations and the recorded window parameters, and determine whether the number of filtered second windows is one.
[0194] If so, use the second window as the test window, and then proceed to step N3;
[0195] If not, use the second window that the current operation is pointing to as the test window, and then proceed to step N3.
[0196] Specifically, in addressing the issue that existing testing software often fails to accurately identify the window corresponding to the recording stage during actual testing due to factors such as software interface position changes, restarts, or system service changes, this embodiment filters the current second window by setting recording window parameters and third window parameters, thereby re-identifying the second window that needs to perform the test action, achieving a better recognition accuracy.
[0197] In a preferred embodiment, the window attribute combination in step N23 includes at least two of the following: the program file name of the second window, the class of the second window, the title of the second window, and the position and size information of the second window.
[0198] Specifically, to accurately locate the second window to be tested among multiple windows in the current display interface, this embodiment filters the second window by setting a single window attribute or a combination of window attributes. In step N23, the combination of window attributes can be adjusted according to the actual testing situation. For example, in one embodiment, the number of second windows in the display interface is relatively small; in this case, the window to be tested can be obtained using only a single window attribute, such as the window title or the window class. However, when there are many second windows in the display interface, multiple second windows are often obtained in step N22, making it impossible to perform the specified test action. In this case, step N22 combines window attributes to generate multiple window attribute combinations with a sequential order. Each window attribute combination has more window attributes than the previous one, gradually narrowing the filtering range and ultimately obtaining an accurate window to be tested.
[0199] In a preferred embodiment, such as Figure 9 As shown, step N3 includes:
[0200] Step N31: Obtain multiple second controls from the display area of the second window, and obtain the second control parameters of each second control respectively;
[0201] The parameters of the second control include: the type of the second control, the title of the second control, and the position and size information of the second control;
[0202] Step N32: For each second control, filter the second control sequentially using individual control properties and recorded control parameters, and determine whether the number of filtered second controls is one;
[0203] If so, use the second control as the test control, and then proceed to step B3;
[0204] If not, proceed to step N33;
[0205] The parameters of the record control include: the type of the record control, the title of the record control, and the position and size information of the record control;
[0206] Step N33: For each second control, generate multiple pairs of control attribute combinations based on at least two control attributes, and sequentially filter the second controls using each pair of control attribute combinations and the recorded control parameters, and determine whether the number of filtered second controls is one;
[0207] If so, use the second control as the test control, and then proceed to step N4;
[0208] If not, it means no test control was found, and the current test action will be skipped.
[0209] Specifically, in addressing the problem that existing testing software often fails to obtain controls that accurately correspond to those recorded during the actual testing process due to factors such as software interface relocation, restarts, or changes in system services, thus affecting the testing, this embodiment achieves effective control filtering by obtaining the same control attributes as those recorded during the testing phase, thereby achieving better testing accuracy.
[0210] In a preferred embodiment, the control property combination includes:
[0211] Control type and control title, control type and control position and size information;
[0212] Control title and control type;
[0213] Control title or control type.
[0214] Specifically, to accurately locate the display control to be tested among multiple controls in the current display interface, this embodiment filters the display controls by setting individual control attributes or combinations of control attributes. In step N33, the combination of control attributes can be adjusted according to the actual testing situation. For example, in one embodiment, the number of display controls in the display interface is relatively small; in this case, the control to be tested can be obtained using only a single control attribute, such as the control title or the control class. However, when there are many display controls in the display interface, multiple display controls are often obtained in step N32, making it impossible to perform the specified test action. In this case, step N33 combines control attributes to generate multiple control attribute combinations with a sequential order. Each control attribute combination has more control attributes than the previous one, gradually narrowing the filtering range and ultimately obtaining an accurate control to be tested. As another example, in another embodiment, controls in the window may shift due to window changes, making it impossible to accurately obtain the control to be tested based solely on control position and size information. In this case, the control can be obtained by using information such as the control title and / or control type, and control height.
[0215] In a preferred embodiment, when the recording window to which the test action is directed is a pop-up dialog box, the pop-up dialog box is located using the window properties of the window to which the pop-up dialog box belongs.
[0216] Specifically, addressing the issue in existing technologies where pop-up dialog boxes are frequently refreshed and created with user actions, making it impossible to accurately retrieve them using only session IDs or handles, this embodiment obtains the window attributes of the pop-up dialog box and uses these attributes to locate it. Specifically, during the recording phase, the highest-priority window list contains the window attributes corresponding to the pop-up dialog box, and the next-lower-priority window list contains the window attributes of the window to which the pop-up dialog box belongs, thus enabling the retrieval of the pop-up dialog box.
[0217] The beneficial effects of this invention are as follows: by acquiring the window attributes of the target window and the control attributes of the target control during the recording stage, the target control corresponding to the test action can be effectively identified and relevant information can be recorded. This allows the control to be tested to be obtained during the actual test based on the recorded window attributes and control attributes, avoiding the problem in the prior art of not being able to identify the actual control to be tested in multiple windows, and improving testing efficiency.
[0218] The above are merely preferred embodiments of the present invention and are not intended to limit the implementation methods and protection scope of the present invention. Those skilled in the art should recognize that any equivalent substitutions and obvious changes made based on the description and illustrations of the present invention should be included within the protection scope of the present invention.
Claims
1. A recognition testing method suitable for multi-window switching scenarios, characterized in that, It includes an action recording process and a test execution process, wherein the action recording process precedes the test execution process; During the action recording process, for at least two consecutive test actions, the following steps are executed cyclically: Step M1: After the previous test action causes a window switch, obtain the currently displayed first window, determine the first window as the window to be recorded based on the first window parameters of the first window, and then proceed to step M2: Step M2: Obtain the first control currently pointed to in the window to be recorded, and after confirming it as the control to be recorded based on the first control parameter of the first control, proceed to step M3; Step M3: Establish the mapping relationship between the current test action and the recording window parameters of the window to be recorded, and the recording control parameters of the control to be recorded; During the test execution, the following steps are performed: Step N1: Identify that the execution result of a test action causes a window to switch, and then proceed to step N2; Step N2: Obtain multiple second windows in the display interface, find the window to be tested based on the second window parameters of the second window and the recorded window parameters, and proceed to step N3; Step N3: Obtain multiple second controls in the window to be tested, and find the control to be tested based on the second control parameters of the second controls and the recorded control parameters; Step N4: Perform the test action on the control to be tested to obtain the test result; Multiple lists of window parameters with different priorities are pre-set, and each priority list of window parameters contains multiple different standard window parameters. The standard window parameters include: the window's program file name, the window's class, the window's title, and the window's position and size information; Step M1 includes: Step M11: After the previous test action causes a window switch, obtain the currently pointed first window and extract multiple first window parameters of the first window; The first window parameters include: the program file name of the first window, the class of the first window, the title of the first window, and the position and size information of the first window; Step M12: Obtain the list of highest priority window parameters to be used as the window judgment condition; Step M13: Based on the window judgment conditions, judge at least one of the first window parameters to confirm whether the first window is the window to be recorded; If so, the first window is used as the window to be recorded, and then the process proceeds to step M2; If not, proceed to step M14; Step M14: Use the window parameter list of the next priority as the window judgment condition, and return to step M13 until all the window parameter lists of multiple priorities are traversed. Confirm that the currently pointed first window is not the window to be recorded, judge the currently pointed first window as an invalid window, and stop recording the first window.
2. The identification test method according to claim 1, characterized in that, The list of window parameters for each priority level includes: a whitelist of filtered windows, a blacklist of filtered windows, and a list of windows to be recorded. The list of windows to be recorded contains the standard window parameters of the windows to be recorded; the blacklist of filtered windows contains the standard window parameters of the windows to be blocked; and the whitelist of filtered windows contains the standard window parameters of the valid windows in the current priority. Within the same priority level, the whitelist of the filtering window has a higher priority than the blacklist of the filtering window. Each time step M13 is executed, the method for judging at least one of the first window parameters according to the window judgment condition includes: Step M131: Compare all the first window parameters of the first window with the standard window parameters in the filter window whitelist of the current priority; When the comparison result shows that the first window is in the whitelist of the filter window with the current priority, it indicates that the first window is the window to be recorded, and proceed to step M2; If the comparison result indicates that the first window is not in the whitelist of the filter window with the current priority, proceed to step M132; Step M132: Compare all the first window parameters of the first window with the standard window parameters in the filter window blacklist of the current priority; When the comparison result shows that the first window is in the blacklist of the filter window with the current priority, it indicates that the first window is not the window to be recorded, and proceed to step M14; When the comparison result shows that the first window is not in the blacklist of the filter window with the current priority, proceed to step M133; Step M133: Compare all the first window parameters of the first window with the standard window parameters in the list of windows to be recorded with the current priority; When the comparison result shows that the first window is in the list of windows to be recorded with the current priority, it indicates that the first window is the window to be recorded, and proceed to step M2; If the comparison result shows that the first window is not in the list of windows to be recorded with the current priority, it indicates that the first window is not the window to be recorded, and the process proceeds to step M14.
3. The identification test method according to claim 1, characterized in that, Multiple lists of control parameters with different priorities are pre-set, and each priority list of control parameters contains multiple different standard control parameters. The standard control parameters include: the control's class, the control's title, and the control's position and size information; Step M2 includes: Step M21: Obtain the first control pointed to in the window to be recorded, and extract multiple first control parameters of the first control; The parameters of the first control include: the class of the first control, the title of the first control, and the position and size information of the first control; Step M22: Obtain the list of parameters for the highest priority controls to be used as the control judgment condition; Step M23: Based on the control judgment conditions, judge at least one of the first control parameters to confirm whether the first control is the control to be recorded; If so, the first control is designated as the control to be recorded, and then the process proceeds to step M3; If not, proceed to step M24; Step M24: Use the list of control parameters of the next priority as the control judgment condition, and return to step M23 until all the control parameter lists of multiple priorities have been traversed. Confirm that the first control currently pointed to is not the control to be recorded, judge the first control currently pointed to as an invalid control, and stop recording the first control.
4. The identification test method according to claim 3, characterized in that, The list of control parameters for each priority level includes: a whitelist of filter controls, a blacklist of filter controls, and a list of controls to be recorded. The list of controls to be recorded contains the standard control parameters of the controls to be recorded; the blacklist of filters contains the standard control parameters of the controls to be blocked; and the whitelist of filters contains the standard control parameters of the valid controls in the current priority. Within the same priority level, the whitelist of the filtering control has a higher priority than the blacklist of the filtering control. Each time step M23 is executed, the method for judging at least one parameter of the first control according to the control judgment condition includes: Step M231: Compare all the parameters of the first control with the standard control parameters in the whitelist of the filter controls of the current priority; When the comparison result shows that the first control is in the whitelist of the filter controls with the current priority, it indicates that the first control is the control to be recorded, and proceeds to step M3; If the comparison result shows that the first control is not in the whitelist of the filter controls with the current priority, proceed to step M232; Step M232: Compare all the parameters of the first control with the standard control parameters in the filter control blacklist of the current priority; When the comparison result shows that the first control is in the blacklist of the filter controls of the current priority, it indicates that the first control is not the control to be recorded, and proceed to step M24; When the comparison result shows that the first control is not in the blacklist of the filter controls with the current priority, proceed to step M233; Step M233: Compare all the first control parameters of the first control with the standard control parameters in the list of controls to be recorded with the current priority; When the comparison result shows that the first control is in the list of controls to be recorded with the current priority, it indicates that the first control is the control to be recorded, and proceeds to step M3; If the comparison result shows that the first control is not in the list of controls to be recorded with the current priority, it indicates that the first control is not the control to be recorded, and the process proceeds to step M24.
5. The identification test method according to claim 1, characterized in that, Before each test action is performed by N4, the parameters of the window to be tested are recorded, and the parameters of the control window are generated. Furthermore, null values are pre-assigned to the control window parameters before the first execution of step N4; The parameters of the comparison window include: the program file name of the window to be tested, the class of the window to be tested, the title of the window to be tested, and the position and size information of the window to be tested; In step N1, the process of identifying whether the execution result of the test action causes the window to switch specifically includes: Step N11: After one of the test actions is completed, collect the second window parameters for the corresponding current display window; The second window parameters include: the program file name of the currently displayed window, the class of the currently displayed window, the title of the currently displayed window, and the position and size information of the currently displayed window; Step N12: Compare all the second window parameters with the control window parameters corresponding to the test action, and confirm that a window switch has occurred when the second window parameters are inconsistent with the control window parameters, and then proceed to step N2.
6. The identification test method according to claim 1, characterized in that, Step N2 includes: Step N21: Obtain multiple second windows from the current display interface, and obtain the third window parameters for each of the second windows respectively; The third window parameters include: the program file name of the second window, the class of the second window, the title of the second window, and the position and size information of the second window; Step N22: For each second window, sequentially filter the second window using the single third window parameter and the record window parameter, and determine whether the number of filtered second windows is one; If so, use the second window as the test window, and then proceed to step N3; If not, proceed to step N23; The recording window parameters include: the program file name of the window to be recorded, the class of the window to be recorded, the title of the window to be recorded, and the position and size information of the window to be recorded; Step N23: For each second window, generate multiple pairs of window attribute combinations based on at least two third window parameters, sequentially use each pair of window attribute combinations and the recorded window parameters to filter the second window, and determine whether the number of filtered second windows is one; If so, use the second window as the test window, and then proceed to step N3; If not, the second window to which the current operation is directed is used as the test window, and then the process proceeds to step N3.
7. The test method according to claim 6, characterized in that, The window attribute combination in step N23 includes at least two of the following: the program file name of the second window, the class of the second window, the title of the second window, and the position and size information of the second window.
8. The test method according to claim 1, characterized in that, Step N3 includes: Step N31: Obtain multiple second controls from the display area of the second window, and obtain the second control parameters of each second control respectively; The parameters of the second control include: the type of the second control, the title of the second control, and the position and size information of the second control; Step N32: For each of the second controls, filter the second controls sequentially using the single second control parameter and the record control parameter, and determine whether the number of filtered second controls is one; If so, use the second control as the test control, and then proceed to step N4; If not, proceed to step N33; The recording control parameters include: the type of the recording control, the title of the recording control, and the position and size information of the recording control; Step N33: For each second control, generate multiple pairs of second control parameter combinations based on at least two second control parameters, and sequentially filter the second control using each pair of second control parameter combinations and the recorded control parameters, and determine whether the number of filtered second controls is one; If so, use the second control as the test control, and then proceed to step N4; If not, it indicates that the test control was not found, and the current test action is skipped.
9. The test method according to claim 8, characterized in that, The control property combination includes: Control type and control title, control type and control position and size information; Control title and control type; Control title or control type.
Citation Information
Patent Citations
Method for recording software test
CN101930399A
Method and apparatus for testing windows
CN109144864A