An interface testing method and testing apparatus
By acquiring the display device's interface layout information and controlling the focus to move to the control under test according to the actual path, the problems of low testing efficiency and inaccurate test results in the existing technology are solved, and efficient and accurate interface testing is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JUHAOKAN TECH CO LTD
- Filing Date
- 2022-08-23
- Publication Date
- 2026-07-03
AI Technical Summary
In existing technologies, the testing efficiency of display device interfaces is low, the testing process does not match the actual application scenario, and the test results cannot reflect the problems that may occur in actual applications.
By obtaining the page layout information currently displayed on the display device interface, the relative positional relationship of the controls is determined, and a movement command is generated to control the focus to move from the current control to the control to be tested until the test is completed.
It achieves efficient automated interface testing, with the focus moving according to the actual application path, making the test results more instructive and better reflecting the problems in actual applications.
Smart Images

Figure CN115454738B_ABST
Abstract
Description
Technical Field
[0001] This application relates to automated testing technology. More specifically, it relates to an interface testing method and testing equipment. Background Technology
[0002] With increasingly rich interface menus on display devices, testing the menus of the display interface is particularly important before the display device is put into use. Currently, the testing of the display interface is carried out by manual testing or automated simulation of directly clicking on the control to be tested. However, manual testing is inefficient and prone to missing tests.
[0003] While automating the testing process by simulating direct clicks on the control under test achieves automated testing, in real-world applications, the focus typically moves to the control along a specific path to reach it. Therefore, test results obtained by directly simulating clicks on the control under test are not helpful for practical applications and do not reflect potential problems in real-world scenarios.
[0004] Therefore, existing technologies suffer from low testing efficiency, inconsistent testing processes with actual application scenarios, and test results that fail to reflect potential problems in real-world application scenarios. Summary of the Invention
[0005] To address, or at least partially address, the aforementioned technical problems, this application provides an interface testing method and testing equipment, which can solve the problems of low testing efficiency, inconsistent testing process with actual application scenarios, and test results that fail to reflect potential problems in actual application scenarios in the existing technology.
[0006] In a first aspect, embodiments of this application provide an interface testing method, the method comprising: obtaining first page layout information of a first page currently displayed on a display device, the first page layout information being used to characterize that the first page includes multiple controls, the display area of each control on the first page, and an identifier corresponding to each control, the multiple controls including a first control where the focus is located in the interface under test, and a control to be tested; executing the following step S1 to move the focus of the display device from the first control to a second control; if the second control is not a control to be tested, determining the second control as the first control, returning to execute step S1, until the second control is a control to be tested; if the second control is a control to be tested, determining that the testing of the interface under test is completed;
[0007] Step S1 includes:
[0008] Based on the display area of the first control and the display area of the control to be tested in the first page layout information, a first relative positional relationship between the first control and the control to be tested is determined; according to the first relative positional relationship, a movement instruction is determined, which instructs the display device to control the focus to move from the first control to the second control in a specified direction, wherein the second control is closer to the control to be tested relative to the first control; the movement instruction is sent to the display device; a response message is received from the display device, which instructs the display device to control the focus to move to the third control based on the movement instruction, and the response message carries the identifier of the third control; if the identifier of the third control matches the identifier of the second control, it is determined that the focus has moved to the second control; and it is determined whether the second control is the control to be tested.
[0009] Secondly, this application provides a testing device, comprising: a communicator configured to receive and send messages; and a controller configured to: acquire first page layout information of a first page currently displayed on a display device, the first page layout information being used to characterize that the first page includes multiple controls, the display area of each control on the first page, and an identifier corresponding to each control, the multiple controls including a first control where the focus is located in the interface under test, and a control to be tested; execute the following step S1 to move the focus of the display device from the first control to a second control; if the second control is not the control to be tested, determine the second control as the first control, return to execute step S1, until the second control is the control to be tested; if the second control is the control to be tested, determine that the test of the interface under test is complete;
[0010] Step S1 includes:
[0011] Based on the display area of the first control and the display area of the control to be tested in the first page layout information, a first relative positional relationship between the first control and the control to be tested is determined; according to the first relative positional relationship, a movement instruction is determined, which instructs the display device to control the focus to move from the first control to the second control in a specified direction, wherein the second control is closer to the control to be tested relative to the first control; the movement instruction is sent to the display device; a response message is received from the display device, which instructs the display device to control the focus to move to the third control based on the movement instruction, and the response message carries the identifier of the third control; if the identifier of the third control matches the identifier of the second control, it is determined that the focus has moved to the second control; and it is determined whether the second control is the control to be tested.
[0012] Thirdly, this application provides a computer-readable storage medium, comprising: storing a computer program on the computer-readable storage medium, wherein when the computer program is executed by a processor, it implements the interface testing method as shown in the first aspect.
[0013] Fourthly, this application provides a computer program product, characterized in that it includes: when the computer program product is run on a computer, causing the computer to implement the interface testing method as shown in the first aspect.
[0014] Compared with the prior art, the technical solution provided in this application has the following advantages: In this application embodiment, the first page layout information of the first page currently displayed on the interface to be tested in the display device is obtained. The first page layout information is used to characterize that the first page includes multiple controls, the display area of each control in the first page, and the identifier corresponding to each control. The multiple controls include the first control where the focus is in the interface to be tested, and the control to be tested. The following step S1 is executed to move the focus of the display device from the first control to the second control. If the second control is not the control to be tested, the second control is determined to be the first control, and the execution of step S1 is returned until the second control is the control to be tested. If the second control is the control to be tested, the test of the interface to be tested is determined to be completed. The test includes the following steps: Step S1 includes: determining a first relative positional relationship between the first control and the control to be tested based on the display area of the first control and the display area of the control to be tested in the first page layout information; determining a movement instruction based on the first relative positional relationship, the movement instruction being used to instruct the display device to control the focus to move from the first control to the second control in a specified direction, the second control being closer to the control to be tested relative to the first control; sending the movement instruction to the display device; receiving a response message from the display device, the response message being used to instruct the display device to control the focus to move to the third control based on the movement instruction, the response message carrying the identifier of the third control; determining that the focus has moved to the second control if the identifier of the third control matches the identifier of the second control; and determining whether the second control is the control to be tested. Therefore, based on the currently displayed first page and the first control where the focus is located, the movement command to move to the control under test is determined, and the focus on the interface under test on the display device is controlled to move according to the movement command. This realizes automated testing of the focus movement of the interface under test, which is highly efficient. Furthermore, during the test, the focus moves to the control under test along a certain path, which is more in line with the actual application scenario. Therefore, the test results are more instructive and can reflect more problems that may occur in actual applications during the testing phase, thus improving the effectiveness of the test. Attached Figure Description
[0015] To more clearly illustrate the implementation methods in the embodiments of this application or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings.
[0016] Figure 1One of the flowcharts of an interface testing method according to some embodiments is shown;
[0017] Figure 2 One of the schematic diagrams illustrating page layout information according to some embodiments is shown;
[0018] Figure 3 A second schematic diagram illustrating page layout information according to some embodiments is shown;
[0019] Figure 4 A third schematic diagram illustrating page layout information according to some embodiments is shown;
[0020] Figure 5 A second flowchart illustrating an interface testing method according to some embodiments is shown;
[0021] Figure 6 A fourth illustration shows page layout information according to some embodiments;
[0022] Figure 7 Fifth illustration shows page layout information according to some embodiments;
[0023] Figure 8 A sixth schematic diagram illustrating page layout information according to some embodiments is shown;
[0024] Figure 9 The third flowchart illustrates an interface testing method according to some embodiments;
[0025] Figure 10 Seventh illustration shows page layout information according to some embodiments;
[0026] Figure 11 A fourth flowchart illustrating an interface testing method according to some embodiments is shown;
[0027] Figure 12 Eighth illustration shows page layout information according to some embodiments;
[0028] Figure 13 The fifth flowchart illustrates an interface testing method according to some embodiments;
[0029] Figure 14 A flowchart of an interface testing method according to some embodiments is shown as diagram six;
[0030] Figure 15 A flowchart of an interface testing method according to some embodiments is shown as diagram seven;
[0031] Figure 16 A schematic diagram of an interface testing apparatus according to some embodiments is shown. Detailed Implementation
[0032] To make the objectives and implementation methods of this application clearer, the exemplary implementation methods of this application will be clearly and completely described below with reference to the accompanying drawings of the exemplary embodiments of this application. Obviously, the exemplary embodiments described are only some embodiments of this application, and not all embodiments.
[0033] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0034] The terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms are interchangeable where appropriate.
[0035] The terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device that includes a range of components is not necessarily limited to all of the components that are clearly listed, but may include other components that are not clearly listed or that are inherent to such product or device.
[0036] In the embodiments of this application, such as Figure 1 As shown, an interface testing method is provided. The following description uses a testing device as the execution subject to illustrate the interface testing method provided in this application. The method may include steps 101 to 111 as described below.
[0037] 101. Obtain the first page layout information of the first page currently displayed on the interface to be tested in the display device. The first page layout information is used to characterize that the first page includes multiple controls, the display area of each control on the first page, and the corresponding identifier of each control. The multiple controls include the first control in the interface to be tested where the focus is located, and the control to be tested.
[0038] It is understood that the first page layout information can be an image of the first page currently displayed on the test interface, or it can be the identifiers, sizes, and relative positions of multiple controls obtained based on the currently displayed first page. The specific details are determined according to the actual situation, and this application embodiment does not limit them.
[0039] It is understood that a control identifier includes at least one of the following: a unique identifier, the name of the content indicated by the control, the name of the content indicated by the control (such as TV show name, movie name, variety show name, etc.), and the cover corresponding to the content (such as TV poster, movie poster, variety show poster, etc.).
[0040] For example, such as Figure 2 The first page layout information shown includes identifiers for multiple controls, such as Control 1, Control 2, etc., used to uniquely identify a control; for example... Figure 3 The first page layout information shown includes the identifiers of multiple controls. Each control identifier indicates the type of the control. Navigation controls indicate that the control is a navigation control, such as navigation control 1 for TV series, navigation control 2 for movies, and navigation control 3 for variety shows. Media asset controls indicate that the control is a video resource, such as media asset control 13 for movie 1, media asset control for movie 2, and media asset control 14 for movie 3. Sub-controls indicate that the control is associated with a certain control, such as sub-control 6 being "Favorites". Clicking sub-control 6 will add the media asset indicated by the control associated with sub-control 6 to your favorites. Sub-navigation controls are used to indicate that the control is a navigation control under a certain navigation control, such as sub-navigation control 7 being "History" in the navigation control "Movies".
[0041] It is understandable that the first control is the control where the focus is currently located, and the control to be tested is the control that the focus will eventually reach in this interface test.
[0042] Perform step S1 to move the display device control focus from the first control to the second control.
[0043] Step S1 includes steps 102 to 111 below.
[0044] 102. Based on the display area of the first control and the display area of the control to be tested in the first page layout information, determine the first relative positional relationship between the first control and the control to be tested.
[0045] 103. Determine the movement command based on the first relative position relationship.
[0046] The movement command is used to instruct the display device to move the control focus from the first control to the second control in a specified direction. The second control is closer to the control under test than the first control.
[0047] It can be understood that the first relative position relationship is used to indicate the orientation of the display area of the control to be tested in the display area of the first control, such as: the display area of the control to be tested is located below the display area of the first control.
[0048] It is understandable that movement commands can be used to indicate the direction of a single focus movement, or to indicate the number of focus movements and the direction of movement. For example, a movement command of "right" indicates that the focus moves to the right once, while a movement command of "right" or "right" (or "move right twice") indicates that the focus moves to the right twice.
[0049] It can be understood that the distance between control A and control B is the distance between the center point of the display area where control A is located and the center point of the first control area.
[0050] It can be understood that the distance between the first control and the control to be tested is the distance between the center point of the display area where the first control is located and the center point of the display area where the control to be tested is located (denoted as the first distance). The distance between the first control and the control to be tested is the distance between the center point of the display area where the second control is located and the center point of the display area where the control to be tested is located (denoted as the second distance). The second control is closer to the control to be tested than the first control, which means that the second distance is less than the first distance.
[0051] 104. Send a movement command to the display device.
[0052] 105. Receive a response message from the display device. The response message indicates that the display device has controlled the focus to move to the third control based on the movement command. The response message carries the identifier of the third control.
[0053] It is understandable that when the display device receives a movement command, it moves the focus according to the direction and number of times indicated by the movement command. When the focus reaches the third control, the display device sends the identifier of the third control where the focus is currently located to the test device.
[0054] 106. Determine whether the identifier of the third control matches the identifier of the second control.
[0055] If yes, proceed to step 107; otherwise, proceed to step 108.
[0056] 107. Move the focus to the second control.
[0057] 108. Focus movement failed.
[0058] It is understandable that the control that the test device predicts the focus will reach after moving according to the movement command is the second control, and the control that the display device actually reaches after controlling the focus to move according to the movement command is the third control. If the second control identifier and the third control identifier are the same, it means that the expected result is the same as the actual result and the focus movement is successful. If the second control identifier and the third control identifier are different, it means that the expected result is different from the actual result and the focus movement fails.
[0059] 109. Determine whether the second control is the control to be tested.
[0060] If yes, proceed to step 110; otherwise, proceed to step 111.
[0061] 110. Confirm that the testing of the interface to be tested is complete.
[0062] 111. Designate the second control as the first control.
[0063] Return to step 102 and repeat steps 102 to 111 until the second control is the control to be tested.
[0064] It is understandable that steps 102 to 111 are repeated until the second control is the control to be tested, that is, the focus is finally moved to the control to be tested.
[0065] For example, such as Figure 4 As shown, the current focus is on control 1, and control 15 is the control to be tested. Based on the display areas of control 1 and control 15 in the first page layout information, the relative positional relationship between control 1 and control 15 is determined. According to the relative positional relationship, the movement command is determined. The first movement command sent to the display interface is "down". After the display interface controls the focus to move according to the movement command, the focus moves to control 5. The second movement command sent to the display interface is "right". After the display interface controls the focus to move according to the movement command, the focus moves to control 8. The third movement command sent to the display interface is "down". After the display interface controls the focus to move according to the movement command, the focus moves to control 15. It is determined that the focus has reached control 15, and the test is complete.
[0066] In this embodiment, the first page layout information of the first page currently displayed on the interface to be tested in the display device is obtained. The first page layout information is used to characterize that the first page includes multiple controls, the display area of each control on the first page, and the identifier corresponding to each control. The multiple controls include the first control where the focus is located in the interface to be tested, and the control to be tested. The following step S1 is executed to move the focus of the display device from the first control to the second control. If the second control is not the control to be tested, the second control is determined to be the first control, and the execution of step S1 is returned until the second control is the control to be tested. If the second control is the control to be tested, the test of the interface to be tested is determined to be completed. Among them, step S1 includes: basic Based on the display areas of the first control and the control under test in the first page layout information, a first relative positional relationship between the first control and the control under test is determined. According to this first relative positional relationship, a movement command is determined, instructing the display device to move the focus from the first control to the second control in a specified direction. The second control is closer to the control under test relative to the first control. The movement command is sent to the display device. A response message is received from the display device, indicating that the display device has moved the focus to the third control based on the movement command. The response message carries the identifier of the third control. If the identifier of the third control matches the identifier of the second control, it is determined that the focus has moved to the second control. Finally, it is determined whether the second control is the control under test. Thus, based on the currently displayed first page and the first control where the focus is located, a movement command to move to the control under test is determined. The focus on the interface under test on the display device is then controlled to move according to the movement command, achieving automated testing of focus movement on the interface under test. This method is highly efficient. Furthermore, during the test, the focus moves to the control under test along a specific path, which is more consistent with actual application scenarios. Therefore, the test results are more instructive and can reflect more potential problems in actual applications during the testing phase, improving the effectiveness of the test.
[0067] In some embodiments of this application, combined with Figure 1 ,like Figure 5 As shown, before step 102 above, the interface testing method provided in this application embodiment further includes the following step 112. The above step 103 can be specifically implemented through the following steps 103a to 103f.
[0068] 112. Based on the layout information of the first page, divide the first page into multiple rows.
[0069] The row height of each row is the minimum height required for each control in the corresponding row to be a complete control. The first relative position relationship is used to indicate the position of the first control in the first row and the position of the control to be tested in the second row. The multiple rows include the first row and the second row.
[0070] For example, such as Figure 6 As shown, this is the first page to be tested. The first page is divided into 3 rows. The first row includes: control 1 to control 4, the second row includes: control 5 to control 12, and the third row includes: control 13 to control 16.
[0071] 103a. Based on the first relative position relationship, determine whether the first row and the second row are the same row.
[0072] If yes, proceed to step 103b; otherwise, proceed to step 103c.
[0073] 103b. Determine the specified direction as the direction from the first control to the second control in the first row.
[0074] It is understandable that, based on the first relative position relationship, the first row and the second row are determined to be on the same row, that is, the first control where the focus is located and the control to be tested are on the same row. If the control to be tested is to the left of the first control, the specified direction is determined to be left; if the control to be tested is to the right of the first control, the specified direction is determined to be right. The movement command can be determined based on the specified direction.
[0075] For example, such as Figure 7 As shown, the control with focus is media asset control 13, and the control to be tested is media asset control 16. The specified direction is to move to the right three times. The movement command sent to the display device can be: right, right, right (or move to the right three times), or three movement commands can be sent to the display device, with each movement command being: right. The specific way to send the command to the display device is determined according to the actual situation, and this application embodiment does not limit it.
[0076] 103c. Determine whether the first control is the preferred control in the first row.
[0077] If yes, proceed to step 103d; otherwise, proceed to step 103e.
[0078] Among them, the preferred control is the last control passed by the target path in the first row, the target path is the shortest path from the first control to the third row, and the third row is the row adjacent to the first row in the direction from the first row to the second row among multiple rows.
[0079] For example, such as Figure 8As shown, the first control is control 5, the control to be tested is control 15, the target path is a solid line segment containing an arrow, and the direction pointed to by the arrow is the direction of focus movement, so the preferred control is control 8; the target path can also be a dashed line segment containing an arrow, so the preferred control is control 12; when there are multiple shortest paths, one can be selected as the target path, or it can be determined based on the priority principle, such as: if the priority principle is up and down direction, then the shortest path is a dashed line segment containing an arrow; if the priority principle is left and right direction, then the shortest path is a solid line segment containing an arrow. The specific determination is based on the actual situation, and this application embodiment does not limit it.
[0080] 103d. Specify the direction as the movement from the first control to the third row.
[0081] 103e. Determine the specified direction as the direction from the first control to the preferred control in the first row.
[0082] It can be understood that if the focus is on the preferred control, the determined movement direction is up and down; if the focus is not on the preferred control, the determined movement direction is left and right.
[0083] 103f. Determine the movement command based on the specified direction.
[0084] It should be noted that, Figure 5 What is shown is Figure 1 Steps 101 to 103 are included in the above, wherein step 103 is implemented by steps 103a to 103f, and step 103f includes the following steps: Figure 1 Steps 104 to 111 shown herein are not repeated. Figure 5 Not shown in the image.
[0085] In this embodiment, based on the first page layout information, the first page is divided into multiple rows, and the height of each row is the minimum height required to make each control in the corresponding row a complete control. The first relative position relationship is used to indicate the position of the first control in the first row and the position of the control to be tested in the second row. The multiple rows include the first row and the second row. According to the first relative position relationship, when the first row and the second row are the same row, the specified direction is determined as the direction from the first control to the second control in the first row. According to the first relative position relationship, when the first row and the second row are not the same row, it is determined whether the first control is the preferred control in the first row. The preferred control is the last control passed by the target path in the first row, and the target path is the shortest path from the first control to the third row. The third row is a row located between the first row and the second row and adjacent to the first row, or the third row is the second row. When the first control is the preferred control, the specified direction is determined as the direction from the first control to the third row. When the first control is not the preferred control, the specified direction is determined as the direction from the first control to the preferred control in the first row. The movement instruction is determined according to the specified direction. In this way, the path from the first control to the control under test is shorter, the movement path determined by the above method is shorter, and it is closer to the movement path in the actual application scenario. The test results are more instructive and the test effect is better.
[0086] In some embodiments of this application, combined with Figure 5 ,like Figure 9 As shown, before step 103c above, the interface testing method provided in this application embodiment further includes steps 113 to 115 below, that is, after the judgment in step 103a above, otherwise steps 113 to 114 and step 103c are executed.
[0087] 113. Based on the layout information of the first page, divide the first row into multiple column objects.
[0088] The column width of each column object is the minimum width required to make each control in the corresponding column object a complete control.
[0089] 114. Determine the level of each column object according to the preset rules.
[0090] The preset rules include: a column object with only one control is at level 1; a column object with at least two controls, where none of the controls are list controls, is at level 2; and a column object with at least two controls, where each control is a list control, is at level 3. Level 1 is higher than level 2, and level 2 is higher than level 3.
[0091] 115. Among the column objects in the first row that have the highest priority and are closest to the first control, the control that is closest to the third row is identified as the preferred control.
[0092] It is understandable that list controls are used to indicate multiple controls in the same list, such as... Figure 10 The controls 9 to 12 shown are in the same list and belong to list controls; if control 8 is the cover of TV series 1 and indicates the first episode of TV series 1, then the content indicated by list controls 9 to 12 can be the second, third and fourth episodes of TV series 1.
[0093] For example, such as Figure 10 As shown, the second row is divided into four columns. The first column contains controls 5 to 7, the second column contains controls 8, the third column contains controls 9 to 11, and the fourth column contains control 12. Since the first column contains three controls and is not a list control, its level is second. The second column contains one control, making it first-level. The third column contains three controls and is a list control, making it third-level. The fourth column contains one control, making it first-level. Therefore, the highest-level controls in the second row are controls 8 and 12. Compared to control 12, control 8 is closer to control 5 (the first control). Therefore, control 8 is the preferred control.
[0094] It should be noted that in all embodiments of this application, the purpose of moving the focus is to get closer to the control to be tested, until it reaches the control to be tested.
[0095] In this embodiment, based on the first page layout information, the first row is divided into multiple column objects. The width of each column object is the minimum width required to ensure that all controls within the corresponding column object are complete controls. The level of each column object is determined according to preset rules, including: a column object containing only one control is at level one; a column object containing at least two controls (not list controls) is at level two; and a column object containing at least two controls (list controls) is at level three. Level one is higher than level two, and level two is higher than level three. The control in the column object with the highest level in the first row and closest to the first control, that is closest to the third row, is determined as the preferred control. Determining the level of each control in a row based on preset rules ensures that controls choose the optimal path when moving within a row, resulting in higher focus movement efficiency and thus improved testing efficiency.
[0096] In some embodiments of this application, combined with Figure 1 ,like Figure 11 As shown, before step 101 above, the interface testing method provided in this application embodiment further includes steps 116 to 118 below. Step 101 above can be implemented by step 101a below.
[0097] 116. Obtain the second page layout information and target position information of the second page currently displayed on the interface to be tested in the display device.
[0098] The second page layout information is used to characterize that the second page includes multiple target controls, the display area of each target control on the second page, and the corresponding identifier of each target control; the multiple target controls include the first target control where the focus is located in the interface to be tested, and the multiple target controls do not include the control to be tested; the target position information is used to characterize the position of the control to be tested in the interface to be tested.
[0099] It is understood that the target location information can be the specific location of the control to be tested in the interface to be tested (such as the second control in the third row), or the relative position relationship with the first target control, or the identifier of the required control where the control to be tested is located. The specific location information can be determined according to actual needs, and this application embodiment does not limit it.
[0100] 117. Based on the second page layout information and target position information, control the focus of the display device to move from the first target control to the required control, where the required control is one of multiple target controls.
[0101] 118. When the focus of the display device is on a required control, the interface to be tested on the display device is updated from the second page to the first page.
[0102] 101a. Receive the first page layout information from the display device.
[0103] It is understandable that there are no controls to be tested on the currently displayed second page. The control to be tested is in the row where the content of a certain sub-navigation control on the second page changes. That is, the sub-navigation control must be selected. The control to be tested will only be displayed on the interface after the page is updated. The sub-navigation control is a required control.
[0104] It is understandable that the test device determines that there is no control to be tested in the currently displayed second page, and sends a message from the test device to the display device to obtain the target position information of the control to be tested, or the test device obtains the target position information at the same time when obtaining the layout information of the second page.
[0105] It is understandable that after sending a movement command to the display device to control the display device to move the focus of the display device to the required control, the display device will send the page layout information of the required control (i.e., the first page layout information) to the test device.
[0106] For example, such as Figure 12As shown, if the focus is on sub-navigation control 1, the row that causes the content change will display media asset controls 5 to 8; if the focus is on sub-navigation control 3, the row that causes the content change will display media asset controls 9 to 12. If the control to be tested is media asset control 12, then sub-navigation control 3 is a required control.
[0107] In this embodiment, the second page layout information and target position information of the second page currently displayed on the interface to be tested in the display device are obtained. The second page layout information is used to characterize that the second page includes multiple target controls, the display area of each target control in the second page, and the identifier corresponding to each target control. The multiple target controls include the first target control where the focus is located in the interface to be tested, and the multiple target controls do not include the control to be tested. The target position information is used to characterize the position of the control to be tested in the interface to be tested. Based on the second page layout information and the target position information, the focus of the display device is controlled to move from the first target control to a required control, which is one of the multiple target controls. When the focus of the display device is located in the required control, the interface to be tested in the display device is updated from the second page to the first page. The first page layout information is received from the display device. Thus, the case where the control to be tested is not included in the currently displayed page, that is, the control to be tested is in a certain sub-navigation control (required control) in the currently displayed page, is considered. Therefore, the focus needs to be moved to the required control before subsequent movement can continue. In this way, this automated testing method is applicable to various display interfaces, has a wider range of applications, and can be used for interface testing with various layouts.
[0108] In some embodiments of this application, target location information is used to indicate that the control to be tested is in the first page corresponding to the target label control; combined with Figure 11 ,like Figure 13 As shown, step 117 above can be achieved through steps 117a to 117k below.
[0109] 117a. Based on the second page layout information and target position information, the required control among multiple target controls is determined as the target label control.
[0110] Perform step S2 to move the display device control focus from the first target control to the second target control.
[0111] Step S2 includes steps 117b to 117k as described below.
[0112] 117b. Based on the display area of the first target control and the display area of the required control in the second page layout information, determine the second relative positional relationship between the first target control and the required control.
[0113] 117c. Determine the first control command based on the second relative position relationship.
[0114] The first control instruction is used to instruct the display device to move the control focus from the first target control to the second target control in a predetermined direction. The second target control is closer to the required control than the first target control.
[0115] 117d. Send the first control command to the display device.
[0116] It is understandable that for the focus to reach the control under test, it must first reach the target label control, i.e. the required control, determine the display area where the required control is located, and determine the second relative position relationship based on the display area of the first target control and the display area of the required control.
[0117] It is understood that the first control command is determined based on the second relative position relationship. The relevant description of step 103 above can be referred to. The specific method for determining the first control command is similar to that for determining the movement command in step 103, and will not be repeated here.
[0118] 117e. Receive a first response message from the display device. The first response message is used to indicate that the display device has controlled the focus to move to the third target control based on the first control command. The first response message carries the identifier of the third target control.
[0119] 117f. Determine whether the identifier of the third target control matches the identifier of the second target control.
[0120] If yes, execute 117g; otherwise, execute 117h.
[0121] 117g, Determine the focus to move to the second target control.
[0122] 117h, Focus movement failed.
[0123] 117i. Determine whether the second target control is a required control.
[0124] If yes, proceed to step 117j; otherwise, proceed to step 117k.
[0125] 117j. Ensure that the focus of the display device has been moved to the required control.
[0126] 117k, The second target control is designated as the first target control.
[0127] Return to step 117b and repeat steps 117b to 117k until the second target control is a required control.
[0128] In this embodiment, the target location information is used to indicate that the control to be tested is on the first page corresponding to the target label control; based on the second page layout information and the target location information, the required control among multiple target controls is determined as the target label control; the following step S2 is executed to move the display device control focus from the first target control to the second target control; if the second target control is not a required control, the second target control is determined as the first target control, and the execution of step S2 is returned until the second target control becomes a required control; if the second target control is a required control, it is determined that the display device focus has moved to the required control; wherein, step S2 includes: based on the display area of the first target control and the display area of the required control in the second page layout information. The method involves determining a second relative positional relationship between a first target control and a required control. Based on this relationship, a first control instruction is determined, instructing the display device to move the focus from the first target control to a second target control in a predetermined direction. The second target control is closer to the required control relative to the first target control. The first control instruction is sent to the display device. A first response message is received from the display device, indicating that the display device has moved the focus to a third target control based on the first control instruction. This response message carries the identifier of the third target control. If the identifier of the third target control matches the identifier of the second target control, the focus is determined to have moved to the second target control. Finally, it is determined whether the second target control is a required control. This ensures that even if the control to be tested is not present on the second page, the focus moves to the required control first, allowing the control to be tested to be displayed on the first page. This makes the testing method applicable to more interfaces and more universal.
[0129] In some embodiments of this application, target position information is used to indicate the relative positional relationship between the control to be tested and the first target control in the interface to be tested; combined with Figure 11 ,like Figure 14 and Figure 15 As shown, before step 117 above, the interface testing method provided in this application embodiment further includes step 119 below, and step 117 above can also be implemented by steps 120 to 140 below.
[0130] 119. Based on the layout information of the second page, divide the second page into multiple target rows.
[0131] The row height of each target row is the minimum height required to make each control in the corresponding target row a complete control.
[0132] Based on the second page layout information and the target position information, perform the following step S3 to move the display device control focus from the first target control to the fourth target control.
[0133] Step S3 includes steps 120 to 140 below.
[0134] 120. Send a request message to the display device.
[0135] The request message is used to request a determination of whether the first target row containing the first target control includes a required control.
[0136] 121. Receive the response message corresponding to the request message from the display device.
[0137] 122. Based on the response message, determine whether the first target row includes required controls.
[0138] If yes, proceed to steps 123 to 130; otherwise, proceed to steps 131 to 140.
[0139] Where the result of step 122 is negative. Figure 14 The steps indicated by the standard number 100 are as follows: Figure 15 As shown.
[0140] For example, the request message can be a first target control identifier, and the display device confirms whether the row containing the control indicated by the first target control identifier includes a required control based on the first target control identifier; the request message can also be a control identifier to be tested, and the display device confirms the required control based on the control identifier to be tested; if the first target row does not include a required control, the response message sent is empty, otherwise the response message sent is the identifier of the required control.
[0141] It can be understood that if the first target row includes required controls, the indicated movement direction is to move left or right in the first target row. If the first target row does not include required controls, the left or right movement direction in the first target row can be determined based on the control level, etc., and then the up or down movement direction can be determined. For details, please refer to steps 103b to 103f and steps 113 to 115 above. The method for determining the movement command is similar to steps 103b to 103 and steps 113 to 115, and will not be repeated here.
[0142] 123. Based on the response message, determine the target display area of the required controls.
[0143] It is understandable that if the first target row includes required controls, the returned response message may include the identifier of the required controls, or it may include the target display area; for example... Figure 12 As shown, the returned response message is: Sub-navigation control 3, that is, the required control is sub-navigation control 3. The display area of the control can be determined based on sub-navigation control 3. Alternatively, the returned response message is: 3rd row, 3rd control, that is, the required control is the 3rd row, 3rd control, which is also sub-navigation control 3.
[0144] 124. Obtain the first display area of the first target control in the first target row from the second page layout information.
[0145] 125. Based on the relative positional relationship between the first display area and the target display area, determine the third control command.
[0146] The third control instruction is used to instruct the display device to move the control focus from the first target control to the fourth target control in the first target row. The fourth target control is a required control.
[0147] 126. Send a second control command to the display device.
[0148] 127. Receive a second response message from the display device. The second response message is used to indicate that the display device has controlled the focus to move to the sixth target control based on the second control command. The second response message carries the identifier of the sixth target control.
[0149] 128. Determine whether the identifier of the sixth target control matches the identifier of the fourth target control.
[0150] If yes, proceed to step 129; otherwise, proceed to step 130.
[0151] 129. Move the focus to the fourth target control.
[0152] Specifically, the focus is moved to the fourth target control to ensure that the fourth target control is a required control.
[0153] 130. Focus movement failed.
[0154] 131. Based on the second page layout information and target position information, determine the third relative position relationship between the first target control and the control to be tested in the interface to be tested.
[0155] 132. Determine the second control command based on the third relative position relationship.
[0156] The second control instruction is used to instruct the display device to move the control focus from the first target control to the fourth target control. The target row where the fourth target control is located is the row adjacent to the first target row in the direction from the first target row to the target row where the mandatory control is located.
[0157] 133. Send a second control command to the display device.
[0158] 134. Receive a second response message from the display device. The second response message is used to indicate that the display device has controlled the focus to move to the fifth target control based on the second control command. The second response message carries the identifier of the fifth target control.
[0159] It can be understood that moving the rows up and down is to get closer to the control under test. It can also be understood as: in the interface under test, the distance between the target row where the fifth target control is located and the control under test is less than the distance between the target row where the first target control is located and the control under test.
[0160] 135. Determine whether the identifier of the fifth target control matches the identifier of the fourth target control.
[0161] If yes, proceed to step 136; otherwise, proceed to step 137.
[0162] 136. Move the focus to the fourth target control.
[0163] 137. Focus movement failed.
[0164] 138. Determine whether the fourth target control is a required control.
[0165] If yes, proceed to step 139; otherwise, proceed to step 140.
[0166] 139. Ensure that the focus of the display device has been moved to the required control.
[0167] 140. Designate the fourth target control as the first target control.
[0168] Return to step 120 and repeat steps 120 to 140 until the fourth target control is a required control.
[0169] It should be noted that, Figure 14 After completing step 140, return. Figure 15 Continue with step 120.
[0170] It should be noted that the strategy described above for moving from the first target control to the required control is the same as the strategy for moving from the first control to the control under test. For a related description, please refer to the description of moving from the first control to the control under test above, which will not be repeated here.
[0171] In this embodiment, by dividing the second page into multiple rows, and based on the relative positional relationship between the row where the first target control is located and the row where the required control is located, the focus is first moved to the row where the required control is located, and then moved left or right to the required control. This achieves the following: when the second interface does not include the control to be tested, the focus is first moved to the required control, and then the layout information of the first page after the focus has moved to the required control is obtained from the display device. This improves the universality of the solution, making the interface testing method of this solution applicable to a variety of different interface layouts.
[0172] This application provides a testing device, comprising: a communicator configured to receive and send messages; and a controller configured to: acquire first page layout information of a first page currently displayed on a display device, the first page layout information being used to characterize that the first page includes multiple controls, the display area of each control on the first page, and the identifier corresponding to each control, the multiple controls including a first control where the focus is located in the interface under test, and a control to be tested; execute the following step S1 to move the display device's control focus from the first control to a second control; if the second control is not the control to be tested, determine the second control as the first control, return to execute step S1, until the second control is the control to be tested; if the second control is the control to be tested, determine that the test is complete. The test interface is tested; step S1 includes: determining a first relative positional relationship between the first control and the control to be tested based on the display area of the first control and the display area of the control to be tested in the first page layout information; determining a movement instruction based on the first relative positional relationship, the movement instruction being used to instruct the display device to control the focus to move from the first control to the second control in a specified direction, the second control being closer to the control to be tested relative to the first control; sending the movement instruction to the display device; receiving a response message from the display device, the response message being used to instruct the display device to control the focus to move to the third control based on the movement instruction, the response message carrying the identifier of the third control; determining that the focus has moved to the second control if the identifier of the third control matches the identifier of the second control; and determining whether the second control is the control to be tested.
[0173] Optionally, before performing step S1 to move the display device control focus from the first control to the second control, the controller is further configured to: divide the first page into multiple rows based on the first page layout information, wherein the row height of each row is the minimum height required to make each control in the corresponding row a complete control; a first relative position relationship is used to indicate the position of the first control in the first row and the position of the control to be tested in the second row; the multiple rows include the first row and the second row; the controller is specifically configured to: determine a specified direction as the direction for moving from the first control to the second control in the first row according to the first relative position relationship when the first row and the second row are in the same row, and determine a movement instruction according to the specified direction.
[0174] Optionally, the controller is specifically configured to: based on a first relative positional relationship, if the first row and the second row are not in the same row, determine whether the first control is the preferred control in the first row, wherein the preferred control is the last control passed by the target path in the first row, and the target path is the shortest path from the first control to the third row; the third row is the row adjacent to the first row in the direction from the first row to the second row among multiple rows; if the first control is the preferred control, determine the specified direction as the direction from the first control to the third row, and determine the movement instruction based on the specified direction; if the first control is not the preferred control, determine the specified direction as the direction from the first control to the preferred control in the first row, and determine the movement instruction based on the specified direction.
[0175] Optionally, the controller is specifically configured to: divide the first row into multiple column objects based on the first page layout information, with the column width of each column object being the minimum width required to make each control in the corresponding column object a complete control; determine the level of each column object according to preset rules, the preset rules including: the level of a column object containing only one control is the first level, the level of a column object containing at least two controls and whose controls are not list controls is the second level, and the level of a column object containing at least two controls and whose controls are list controls is the third level; the first level is higher than the second level, and the second level is higher than the third level; and determine the control in the column object with the highest level in the first row and the closest distance to the first control, that is closest to the third row, as the preferred control.
[0176] Optionally, before acquiring the first page layout information of the first page currently displayed on the interface under test in the display device, the controller is further configured to: acquire the second page layout information and target position information of the second page currently displayed on the interface under test in the display device; the second page layout information is used to characterize that the second page includes multiple target controls, the display area of each target control in the second page, and the identifier corresponding to each target control; the multiple target controls include the first target control where the focus is located in the interface under test, and the multiple target controls do not include the control under test; the target position information is used to characterize the position of the control under test in the interface under test; based on the second page layout information and the target position information, control the focus of the display device to move from the first target control to a required control, the required control being one of the multiple target controls; when the focus of the display device is located at the required control, the interface under test in the display device is updated from the second page to the first page; and receive the first page layout information from the display device.
[0177] Optionally, the target location information is used to indicate that the control to be tested is on the first page corresponding to the target label control; based on the second page layout information and the target location information, the required control among multiple target controls is determined as the target label control; the controller is specifically configured to: execute the following step S2 to move the display device control focus from the first target control to the second target control; if the second target control is not a required control, determine the second target control as the first target control, and return to execute step S2 until the second target control is a required control; if the second target control is a required control, determine that the display device focus has moved to the required control; wherein, step S2 includes: based on the display area of the first target control and the required control in the second page layout information... The system displays an area and determines a second relative positional relationship between a first target control and a required control. Based on this second relative positional relationship, it determines a first control instruction, which instructs the display device to move the focus from the first target control to a second target control in a predetermined direction. The second target control is closer to the required control relative to the first target control. The system sends the first control instruction to the display device and receives a first response message from the display device. This first response message indicates that the display device has moved the focus to a third target control based on the first control instruction. The first response message carries the identifier of the third target control. If the identifier of the third target control matches the identifier of the second target control, the system determines that the focus has moved to the second target control. Finally, it determines whether the second target control is a required control.
[0178] Optionally, the target position information is used to indicate the relative positional relationship between the control to be tested and the first target control in the interface to be tested; based on the second page layout information and the target position information, before controlling the focus of the display device to move from the first target control to the required control, the controller is further configured to: divide the second page into multiple target rows based on the second page layout information, the row height of each target row being the minimum height that makes each control in the corresponding target row a complete control; based on the second page layout information and the target position information, perform the following step S3 to move the focus of the display device from the first target control to the fourth target control; if the fourth target control is not a required control, determine the fourth target control as the first target control, return to execute step S3, until the fourth target control is a required control; if the fourth target control is a required control, determine that the focus of the display device has moved to the required control; wherein, step S3 includes: sending a request message to the display device, the request message being used to request whether the first target row where the first target control is located contains... The process includes: including required controls; receiving a response message from the display device corresponding to the request message; if the response message determines that the first target row does not include required controls, determining a third relative positional relationship between the first target control and the control to be tested in the interface to be tested based on second page layout information and target position information; determining a second control instruction based on the third relative positional relationship, the second control instruction instructing the display device to move the focus from the first target control to the fourth target control, the target row where the fourth target control is located being the row adjacent to the first target row in the direction from the first target row to the target row where the required controls are located; sending the second control instruction to the display device; receiving a second reply message from the display device, the second reply message instructing the display device to move the focus to the fifth target control based on the second control instruction, the second reply message carrying the identifier of the fifth target control; if the identifier of the fifth target control matches the identifier of the fourth target control, determining that the focus has moved to the fourth target control; and determining whether the fourth target control is a required control.
[0179] Optionally, the controller is specifically configured to: after receiving a response message corresponding to the request message from the display device, and if it is determined from the response message that the first target row includes a mandatory control and the target display area of the mandatory control is determined, obtain the first display area of the first target control in the first target row from the second page layout information; determine a third control instruction based on the relative positional relationship between the first display area and the target display area, the third control instruction being used to instruct the display device to move the control focus from the first target control to a fourth target control in the first target row, the fourth target control being a mandatory control; send the third control instruction to the display device; receive a second reply message from the display device, the second reply message being used to instruct the display device to move the control focus to a sixth target control based on the second control instruction, the second reply message carrying the identifier of the sixth target control; if the identifier of the sixth target control matches the identifier of the fourth target control, determine that the focus has moved to the fourth target control, thereby determining that the fourth target control is a mandatory control.
[0180] In this embodiment of the application, the testing device can implement the interface testing method provided in the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0181] In the embodiments of this application, such as Figure 16As shown, an interface testing device is also provided. The device includes: an acquisition module 1601, used to acquire first page layout information of the first page currently displayed on the interface to be tested in the display device. The first page layout information is used to characterize that the first page includes multiple controls, the display area of each control on the first page, and the identifier corresponding to each control. The multiple controls include a first control where the focus is located in the interface to be tested, and a control to be tested; an execution module 1602, used to execute the following step S1, so that the display device controls the focus to move from the first control to a second control; if the second control is not the control to be tested, the second control is determined to be the first control, and the execution step S1 is returned until the second control is the control to be tested; if the second control is the control to be tested, the test of the interface to be tested is determined to be complete; wherein, step S1 includes: a determination module 1602. 03 is used to determine the first relative positional relationship between the first control and the control to be tested based on the display area of the first control and the display area of the control to be tested in the first page layout information; according to the first relative positional relationship, a movement instruction is determined, which is used to instruct the display device to control the focus to move from the first control to the second control in a specified direction, wherein the second control is closer to the control to be tested relative to the first control; the sending module 1604 is used to send the movement instruction to the display device; the receiving module 1605 is used to receive a response message from the display device, which is used to indicate that the display device has controlled the focus to move to the third control based on the movement instruction, and the response message carries the identifier of the third control; the determining module 1603 is also used to determine that the focus has moved to the second control if the identifier of the third control matches the identifier of the second control; and to determine whether the second control is the control to be tested.
[0182] Optionally, before performing step S1 to move the display device control focus from the first control to the second control, the device further includes a division module for dividing the first page into multiple rows based on the first page layout information, wherein the row height of each row is the minimum height required to make each control in the corresponding row a complete control; the first relative position relationship is used to indicate the position of the first control in the first row and the position of the control to be tested in the second row; the multiple rows include the first row and the second row; the determining module 1603 is specifically used to determine, based on the first relative position relationship, when the first row and the second row are in the same row, the specified direction as the direction for moving from the first control to the second control in the first row, and to determine the movement instruction based on the specified direction.
[0183] Optionally, the determining module 1603 is specifically used to determine, based on the first relative positional relationship, whether the first control is the preferred control in the first row when the first row and the second row are not in the same row, wherein the preferred control is the last control passed by the target path in the first row, and the target path is the shortest path from the first control to the third row; the third row is the row adjacent to the first row in the direction from the first row to the second row among multiple rows; if the first control is the preferred control, the specified direction is determined as the direction from the first control to the third row, and a movement instruction is determined based on the specified direction; if the first control is not the preferred control, the specified direction is determined as the direction from the first control to the preferred control in the first row, and a movement instruction is determined based on the specified direction.
[0184] Optionally, before determining whether the first control is the preferred control in the first row, the division module is further configured to divide the first row into multiple column objects based on the first page layout information, wherein the column width of each column object is the minimum width that makes each control in the corresponding column object a complete control; the determination module 1603 is further configured to determine the level of each column object according to preset rules, the preset rules including: the level of a column object containing only one control is the first level, the level of a column object containing at least two controls and each control is not a list control is the second level, and the level of a column object containing at least two controls and each control is a list control is the third level; the first level is higher than the second level, and the second level is higher than the third level; the control closest to the third row among the column objects with the highest level in the first row and the closest distance to the first control is determined as the preferred control.
[0185] Optionally, the device further includes: a control module; before acquiring the first page layout information of the first page currently displayed on the interface under test in the display device, the acquisition module 1601 is further configured to acquire the second page layout information and target position information of the second page currently displayed on the interface under test in the display device, wherein the second page layout information is used to characterize that the second page includes multiple target controls, the display area of each target control in the second page, and the identifier corresponding to each target control; the multiple target controls include the first target control where the focus is in the interface under test, and the multiple target controls do not include the control under test; the target position information is used to characterize the position of the control under test in the interface under test; the control module is configured to control the focus of the display device to move from the first target control to a required control based on the second page layout information and the target position information, wherein the required control is one of the multiple target controls; when the focus of the display device is located at the required control, the interface under test in the display device is updated from the second page to the first page; the acquisition module 1601 is specifically configured to receive the first page layout information from the display device.
[0186] Optionally, the target position information is used to indicate that the control to be tested is in the first page corresponding to the target label control; the control module is specifically used to determine the mandatory control among multiple target controls as the target label control based on the second page layout information and the target position information; the execution module 1602 is also used to execute the following step S2 to move the display device control focus from the first target control to the second target control; the determining module 1603 is also used to determine the second target control as the first target control when the second target control is not a mandatory control, and return to execute step S2 until the second target control is a mandatory control; when the second target control is a mandatory control, determine that the display device focus has moved to the mandatory control; wherein, step S2 includes: the determining module 1603 is also used to determine the display area of the first target control and the mandatory control in the second page layout information. The display area is defined, and a second relative positional relationship between the first target control and the required control is determined. Based on the second relative positional relationship, a first control instruction is determined, which instructs the display device to move the focus from the first target control to the second target control in a predetermined direction. The second target control is closer to the required control relative to the first target control. The sending module 1604 is also used to send the first control instruction to the display device. The receiving module 1605 is also used to receive a first reply message from the display device, which instructs the display device to move the focus to the third target control based on the first control instruction. The first reply message carries the identifier of the third target control. The determining module 1603 is also used to determine that the focus has moved to the second target control if the identifier of the third target control matches the identifier of the second target control. The determining module 1603 is also used to determine whether the second target control is a required control.
[0187] Optionally, the target position information is used to indicate the relative positional relationship between the control to be tested and the first target control in the interface to be tested; based on the second page layout information and the target position information, before controlling the focus of the display device to move from the first target control to the required control, the division module is also used to divide the second page into multiple target rows based on the second page layout information, the row height of each target row being the minimum height that makes each control in the corresponding target row a complete control; the control module is specifically used to execute the following step S3 based on the second page layout information and the target position information, so as to move the focus of the display device from the first target control to the fourth target control; the determination module 1603 is specifically used to determine the fourth target control as the first target control when the fourth target control is not a required control, and return to execute step S3 until the fourth target control is a required control; when the fourth target control is a required control, it is determined that the focus of the display device has moved to the required control;
[0188] Step S3 includes: the sending module 1604 is further configured to send a request message to the display device, the request message being used to request whether the first target row where the first target control is located includes a mandatory control; the receiving module 1605 is further configured to receive a response message corresponding to the request message from the display device; the determining module 1603 is further configured to, if it is determined based on the response message that the first target row does not include a mandatory control, determine a third relative positional relationship between the first target control and the control to be tested in the interface to be tested based on the second page layout information and the target position information; and determine a second control instruction based on the third relative positional relationship, the second control instruction being used to instruct the display device to move the control focus from the first target control to... The fourth target control is located in a target row that is adjacent to the first target row in the direction from the first target row to the target row containing the mandatory control among multiple target rows. The sending module 1604 is also used to send a second control command to the display device. The receiving module 1605 is also used to receive a second reply message from the display device, which indicates that the display device has controlled the focus to move to the fifth target control based on the second control command. The second reply message carries the identifier of the fifth target control. The determining module 1603 is also used to determine that the focus has moved to the fourth target control if the identifier of the fifth target control matches the identifier of the fourth target control. It also determines whether the fourth target control is a mandatory control.
[0189] Optionally, step S3 further includes: after receiving a response message corresponding to the request message from the display device, the acquisition module 1601 is further configured to, if it is determined from the second page layout information that the first target control in the first target row includes a mandatory control based on the response message, and the target display area of the mandatory control is determined; the determination module 1603 is further configured to, based on the relative positional relationship between the first display area and the target display area, determine a third control instruction, the third control instruction being used to instruct the display device to move the control focus from the first target control to the fourth target control in the first target row, the fourth target control being a mandatory control; the sending module 1604 is further configured to, send the third control instruction to the display device; the receiving module 1605 is further configured to, receive a second reply message from the display device, the second reply message being used to instruct the display device to move the control focus to the sixth target control based on the second control instruction, the second reply message carrying the identifier of the sixth target control; the determination module 1603 is further configured to, if the identifier of the sixth target control matches the identifier of the fourth target control, determine that the focus has moved to the fourth target control, thereby determining that the fourth target control is a mandatory control.
[0190] In this embodiment, each module can implement the interface testing method provided in the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0191] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described interface testing method and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0192] The computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0193] The present invention provides a computer program product, comprising: when the computer program product is run on a computer, causing the computer to implement the above-described interface testing method.
[0194] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0195] For ease of explanation, the above description has been provided in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Various modifications and variations can be obtained based on the above teachings. The selection and description of the above embodiments are for the purpose of better explaining the principles and practical applications, thereby enabling those skilled in the art to better utilize the described embodiments and various different variations of embodiments suitable for specific use considerations.
Claims
1. A method for testing user interfaces, characterized in that, The method includes: Obtain the first page layout information of the first page currently displayed on the interface to be tested in the display device. The first page layout information is used to characterize that the first page includes multiple controls, the display area of each control on the first page, and the identifier corresponding to each control. The multiple controls include the first control where the focus is in the interface to be tested, and the control to be tested. Based on the first page layout information, the first page is divided into multiple rows, and the row height of each row is the minimum height that makes each control in the corresponding row a complete control. Performing step S1 causes the display device to control the focus to move from the first control to the second control, wherein step S1 includes: Based on the display area of the first control and the display area of the control to be tested in the first page layout information, a first relative positional relationship between the first control and the control to be tested is determined; the first relative positional relationship is used to indicate the position of the first control in the first row and the position of the control to be tested in the second row; the multiple rows include the first row and the second row; Based on the first relative position relationship, a movement instruction is determined. The movement instruction is used to instruct the display device to control the focus to move from the first control to the second control in a specified direction. The second control is closer to the control to be tested relative to the first control. The step of determining the movement command based on the first relative position relationship includes: Based on the first relative position relationship, when the first row and the second row are not in the same row, it is determined whether the first control is the preferred control in the first row. The preferred control is the last control passed by the target path in the first row. The target path is the shortest path from the first control to the third row. The third row is the row adjacent to the first row in the direction from the first row to the second row among the multiple rows. When the first control is the preferred control, the specified direction is determined to be the direction from the first control to the third row, and the movement instruction is determined according to the specified direction; If the first control is not the preferred control, the specified direction is determined to be the direction of moving from the first control to the preferred control in the first row, and the movement instruction is determined according to the specified direction; Send the movement command to the display device; A response message is received from the display device, the response message indicating that the display device has controlled the focus to move to a third control based on the movement command, the response message carrying the identifier of the third control; If the identifier of the third control matches the identifier of the second control, the focus is determined to move to the second control; Determine whether the second control is the control to be tested; If the second control is not the control to be tested, the second control is identified as the first control, and the process returns to step S1 until the second control is the control to be tested. If the second control is the control to be tested, then the test of the interface to be tested is completed.
2. The method according to claim 1, characterized in that, Before determining whether the first control is the preferred control in the first row, the method further includes: Based on the first page layout information, the first row is divided into multiple column objects, and the column width of each column object is the minimum width that makes each control in the corresponding column object a complete control; According to preset rules, the level of each column object is determined. The preset rules include: the level of a column object that includes only one control is the first level; the level of a column object that includes at least two controls and each control is not a list control is the second level; and the level of a column object that includes at least two controls and each control is a list control is the third level. The first level is higher than the second level, and the second level is higher than the third level. The control that is closest to the third row among the column objects with the highest level in the first row and the closest distance to the first control is determined as the preferred control.
3. The method according to any one of claims 1 to 2, characterized in that, Before obtaining the first page layout information of the first page currently displayed on the interface to be tested in the display device, the method further includes: The second page layout information and target position information of the second page currently displayed on the interface to be tested in the display device are obtained. The second page layout information is used to characterize that the second page includes multiple target controls, the display area of each target control on the second page, and the identifier corresponding to each target control. The multiple target controls include the first target control where the focus is located in the interface to be tested, and the multiple target controls do not include the control to be tested. The target position information is used to characterize the position of the control to be tested in the interface to be tested. Based on the second page layout information and the target position information, the focus of the display device is controlled to move from the first target control to a required control, wherein the required control is one of the plurality of target controls; when the focus of the display device is located at the required control, the interface to be tested in the display device is updated from the second page to the first page; The step of obtaining the first page layout information of the first page currently displayed on the interface to be tested in the display device includes: Receive the first page layout information from the display device.
4. The method according to claim 3, characterized in that, The target location information is used to indicate that the control to be tested is in the first page corresponding to the target label control; The step of controlling the focus of the display device to move from the first target control to the required control based on the second page layout information and the target position information includes: Based on the second page layout information and the target position information, the required control among the plurality of target controls is determined as the target label control; Perform the following step S2 to cause the display device to control the focus to move from the first target control to the second target control; If the second target control is not a required control, the second target control is determined as the first target control, and the process returns to step S2 until the second target control becomes a required control. If the second target control is the required control, it is determined that the focus of the display device has been moved to the required control; Step S2 includes: Based on the display area of the first target control and the display area of the required control in the second page layout information, a second relative positional relationship between the first target control and the required control is determined; Based on the second relative position relationship, a first control instruction is determined. The first control instruction is used to instruct the display device to control the focus to move from the first target control to the second target control in a predetermined direction. The second target control is closer to the required control relative to the first target control. Send the first control command to the display device; The display device receives a first response message, which indicates that the display device has controlled the focus to move to the third target control based on the first control command. The first response message carries the identifier of the third target control. If the identifier of the third target control matches the identifier of the second target control, the focus is determined to move to the second target control; Determine whether the second target control is a required control.
5. The method according to claim 3, characterized in that, The target position information is used to indicate the relative positional relationship between the control to be tested and the first target control in the interface to be tested; Before controlling the focus of the display device to move from the first target control to the required control based on the second page layout information and the target position information, the method further includes: Based on the layout information of the second page, the second page is divided into multiple target rows, and the row height of each target row is the minimum height that makes each control in the corresponding target row a complete control; The step of controlling the focus of the display device to move from the first target control to the required control based on the second page layout information and the target position information includes: Based on the second page layout information and the target position information, the following step S3 is performed to enable the display device to control the focus to move from the first target control to the fourth target control; If the fourth target control is not a required control, the fourth target control is determined as the first target control, and the process returns to step S3 until the fourth target control becomes a required control. If the fourth target control is a required control, it is determined that the focus of the display device has been moved to the required control; Step S3 includes: Send a request message to the display device, the request message being used to request determination of whether the first target row where the first target control is located includes the required control; Receive a response message corresponding to the request message from the display device; If it is determined based on the response message that the first target row does not include the required control, a third relative positional relationship between the first target control and the control to be tested in the interface to be tested is determined based on the second page layout information and the target position information. Based on the third relative positional relationship, a second control instruction is determined. The second control instruction is used to instruct the display device to control the focus to move from the first target control to the fourth target control. The target row where the fourth target control is located is the row adjacent to the first target row in the direction from the first target row to the target row where the mandatory control is located among the plurality of target rows. Send the second control command to the display device; The display device receives a second response message, which indicates that the display device has controlled the focus to move to the fifth target control based on the second control command. The second response message carries the identifier of the fifth target control. If the identifier of the fifth target control matches the identifier of the fourth target control, the focus is moved to the fourth target control. Determine whether the fourth target control is a required control.
6. The method according to claim 5, characterized in that, Step S3 further includes: After receiving a response message corresponding to the request message from the display device, and if it is determined from the response message that the first target row includes the required control, and the target display area of the required control is determined, the first display area of the first target control in the first target row is obtained from the second page layout information. Based on the relative positional relationship between the first display area and the target display area, a third control instruction is determined. The third control instruction is used to instruct the display device to control the focus to move from the first target control to the fourth target control in the first target row. The fourth target control is the required control. Send the third control command to the display device; The display device receives a second response message, which indicates that the display device has controlled the focus to move to the sixth target control based on the second control command. The second response message carries the identifier of the sixth target control. If the identifier of the sixth target control matches the identifier of the fourth target control, the focus is moved to the fourth target control to determine that the fourth target control is the required control.
7. A testing device, characterized in that, The testing equipment includes: The communicator is configured to receive and send messages; The controller is configured to: acquire the first page layout information of the first page currently displayed on the interface to be tested in the display device, wherein the first page layout information is used to characterize that the first page includes multiple controls, the display area of each control on the first page, and the identifier corresponding to each control, wherein the multiple controls include the first control where the focus is in the interface to be tested, and the control to be tested; Based on the first page layout information, the first page is divided into multiple rows, and the row height of each row is the minimum height that makes each control in the corresponding row a complete control. Performing step S1 causes the display device to control the focus to move from the first control to the second control, wherein step S1 includes: Based on the display area of the first control and the display area of the control to be tested in the first page layout information, a first relative positional relationship between the first control and the control to be tested is determined; the first relative positional relationship is used to indicate the position of the first control in the first row and the position of the control to be tested in the second row; the multiple rows include the first row and the second row; Based on the first relative position relationship, a movement instruction is determined. The movement instruction is used to instruct the display device to control the focus to move from the first control to the second control in a specified direction. The second control is closer to the control to be tested relative to the first control. The step of determining the movement command based on the first relative position relationship includes: Based on the first relative position relationship, when the first row and the second row are not in the same row, it is determined whether the first control is the preferred control in the first row. The preferred control is the last control passed by the target path in the first row. The target path is the shortest path from the first control to the third row. The third row is the row adjacent to the first row in the direction from the first row to the second row among the multiple rows. When the first control is the preferred control, the specified direction is determined to be the direction from the first control to the third row, and the movement instruction is determined according to the specified direction; If the first control is not the preferred control, the specified direction is determined to be the direction of moving from the first control to the preferred control in the first row, and the movement instruction is determined according to the specified direction; Send the movement command to the display device; A response message is received from the display device, the response message indicating that the display device has controlled the focus to move to a third control based on the movement command, the response message carrying the identifier of the third control; If the identifier of the third control matches the identifier of the second control, the focus is determined to move to the second control; Determine whether the second control is the control to be tested; If the second control is not the control to be tested, the second control is identified as the first control, and the process returns to step S1 until the second control is the control to be tested. If the second control is the control to be tested, then the test of the interface to be tested is completed.