Graphical interface test method and device, electronic equipment and readable storage medium
By obtaining the element ID and area picture in the graphical interface test to determine the success of the operation, the problem of unknown test results caused by unchanged function option attributes is solved, and the accuracy and efficiency of the test are improved.
Patent Information
- Application Number
- CN202310239508.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-07
- Publication Date
- 2024-09-10
AI Technical Summary
During the automated testing of the graphical interface, if the function option attributes have not changed, it cannot be determined whether the operation was successful, resulting in unknown test results.
By receiving the instruction of the operable object of the graphical interface being operated, the element ID is obtained, and the area picture is obtained according to the ID, and it is judged whether the area picture matches the expected picture to determine whether the operation is successful or not.
There is no need to use function option attributes, which avoids attribute failure problems, improves the accuracy and efficiency of testing, and can accurately judge operation results.
Smart Images

Figure CN118626362A
Abstract
Description
Technical Field
[0001] The present application relates to the field of graphical interface technology, and in particular to a graphical interface testing method, device, electronic device and readable storage medium. Background Art
[0002] In the process of automated testing of graphical user interfaces (GUIs), it is often necessary to obtain the properties of function options (also called buttons) to determine whether the operation is successfully executed. For example, when selecting a function option or checking a checkbox, it is usually necessary to check whether the function option properties have changed to determine whether the function option has been selected successfully.
[0003] In some cases, after selecting a function option or checking a checkbox, you need to check that the function option properties have not changed, and thus you cannot know the test results. Summary of the invention
[0004] The present application provides a graphical interface testing method, device, electronic device and readable storage medium, which can obtain test results without any change in the function option attributes.
[0005] The present application provides a graphical interface testing method, comprising:
[0006] Receiving instructions for operating operable objects of the graphical interface;
[0007] When receiving an instruction that the operable object is operated, obtaining an element ID of the operable object;
[0008] According to the element ID of the operable object, obtain the element and the area image corresponding to the element;
[0009] It is determined whether the area image is consistent with the expected image to determine whether the operable object is successfully operated.
[0010] Furthermore, the element ID of the operable object includes an operable object identifier, an interface element type corresponding to the operable object, and an interface element path.
[0011] Further, obtaining the area image corresponding to the element ID according to the element ID of the operable object includes:
[0012] According to the interface element type and the interface element path, an area image corresponding to the operable object is obtained.
[0013] Furthermore, acquiring the area image corresponding to the operable object according to the interface element type and the interface element path includes:
[0014] According to the interface element type and the interface element path, the coordinate range of the operable object display is acquired through the interface display coordinate attribute, wherein the coordinate range of the operable object display includes a string list of the upper left corner coordinates and the lower right corner coordinates;
[0015] The coordinate range displayed by the operable object is converted into the area image.
[0016] Further, the expected picture includes an expected picture when the operable object is not operated, and an expected picture when the operable object is operated;
[0017] The determining whether the area image is consistent with the expected image, so as to determine whether the operable object is successfully operated, includes:
[0018] If the area image is the same as the expected image that has not been operated, it is determined that the operable object has not been successfully operated;
[0019] If the area image is the same as the expected image to be operated, it is determined that the operable object is successfully operated.
[0020] The present application provides a graphical interface testing device, comprising:
[0021] An instruction receiving module, used to receive instructions for operating an operable object of the graphical interface;
[0022] An element ID obtaining module, configured to obtain the element ID of the operable object upon receiving an instruction for operating the operable object;
[0023] A region image acquisition module, used to obtain an element and a region image corresponding to the element according to the element ID of the operable object;
[0024] The judgment module is used to judge whether the area image is consistent with the expected image, so as to judge whether the operable object is successfully operated.
[0025] Further, the element ID of the operable object includes the operable object identifier, the interface element type and the interface element path corresponding to the operable object; the region image acquisition module includes: a region image acquisition submodule;
[0026] The area image acquisition submodule is used to acquire the area image corresponding to the operable object according to the interface element type and the interface element path.
[0027] Furthermore, the regional image acquisition submodule includes: a coordinate range acquisition unit and a conversion unit;
[0028] The coordinate range obtaining unit is used to obtain the coordinate range of the operable object display according to the interface element type and the interface element path through the interface display coordinate attribute, wherein the coordinate range of the operable object display includes a string list of the upper left corner coordinates and the lower right corner coordinates;
[0029] The conversion unit is used to convert the coordinate range displayed by the operable object into the area image.
[0030] Further, the expected picture includes an expected picture when the operable object is not operated, and an expected picture when the operable object is operated;
[0031] The judgment module is specifically configured to: if the area image is the same as the expected image that has not been operated, determine that the operable object has not been operated successfully;
[0032] If the area image is the same as the expected image to be operated, it is determined that the operable object is successfully operated.
[0033] The present application provides an electronic device, comprising one or more processors, for implementing any of the methods described above.
[0034] The present application provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the method described in any one of the above items is implemented.
[0035] In some embodiments, the graphical interface testing method of the present application receives an instruction for operating an operable object of the graphical interface; upon receiving the instruction for operating the operable object, obtains an element and an area image corresponding to the element according to the element ID of the operable object; and determines whether the area image matches the expected image to determine whether the operable object is successfully operated. In the embodiment of the present application, the area image corresponding to the element ID is obtained through the element ID of the operable object to determine whether the operable object is successfully operated. In this way, the test result can be obtained through the element ID of the operable object, without using the operable object attributes, and avoiding the situation where the test result cannot be known due to the failure of the operable object attributes, thereby improving the accuracy of the test. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 The figure is a flow chart of a method for testing a graphical interface provided in an embodiment of the present application;
[0037] Figure 2 The figure is a schematic diagram of the application implementation process of the graphical interface testing method provided in the embodiment of the present application;
[0038] Figure 3 Shown Figure 1A schematic diagram of a specific flow chart of the test method of the graphical interface shown;
[0039] Figure 4 The figure shows a module schematic diagram of a test device of a graphical interface provided in an embodiment of the present application;
[0040] Figure 5 Shown is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of the present specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of the present specification as detailed in the appended claims.
[0042] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0043] In the related art, it is necessary to take a screenshot of a selected operable object, find the displayed coordinate range of the operable object through the screenshot, and then compare the screenshot with the reference image to determine whether the operable object and its attributes have changed.
[0044] In order to solve the technical problem that the properties of the operable object have not changed and the test results cannot be known, an embodiment of the present application provides a testing method for a graphical interface, which receives an instruction for an operable object of the graphical interface to be operated; upon receiving the instruction for the operable object to be operated, obtains the element and the area image corresponding to the element according to the element ID of the operable object; and determines whether the area image meets the expected image to determine whether the operation of the operable object is successful.
[0045] In the embodiment of the present application, the element ID of the operable object is used to obtain the area image corresponding to the element ID to determine whether the operable object is successfully operated. In this way, the test result can be obtained through the element ID of the operable object, without using the operable object attributes, and avoiding the situation where the test result cannot be obtained due to the invalidity of the operable object attributes, thereby improving the accuracy of the test.
[0046] The graphical interface testing method provided in the embodiment of the present application is applied to electronic devices. Specifically, the electronic device may be, but is not limited to, a central control screen of a vehicle, a desktop computer, a portable computer, a smart mobile terminal, etc. This is not limited here, and any electronic device that can implement the embodiment of the present application belongs to the protection scope of the present application.
[0047] The electronic device can be used as an automated testing platform, and the graphical interface software can be installed on the electronic device, and then the test can be completed on the electronic device. Of course, the graphic interface of the electronic device itself can also be tested, or the web page of the graphic interface of the electronic device itself can be tested. The execution process of the graphical interface testing method is described in detail below.
[0048] Figure 1 The figure is a flow chart of the graphical interface testing method provided in the embodiment of the present application.
[0049] like Figure 1 As shown, the test method of the graphical interface may include but is not limited to the following steps 110 to 140:
[0050] Step 110: receiving an instruction for operating an operable object of the graphical interface.
[0051] The above-mentioned graphical interface may be a graphical interface of the application software. For example, the application software may include, but is not limited to, a test vehicle software for controlling the functions of other vehicle components. The functions of other vehicle components include, for example, the control and adjustment functions of air conditioners, lights, seats, doors, windows, and other components in the central control screen. In addition to the above-mentioned scenarios of the functions of other vehicle components, other similar scenarios may be used.
[0052] The operable objects of the graphical interface may reflect the functional options displayed in the graphical interface. The operable objects of the graphical interface may include one or more operable objects. The operable objects are displayed through the operated area. The operable objects may include, but are not limited to, functional options (also called function buttons).
[0053] Of course, the operable object may be a user-operable operation button that is displayed fixedly at a fixed position on a graphical interface. For example, control adjustment buttons for air conditioners, lights, seats, doors, windows, etc. The operable object may be a user-operable operation button that is displayed scrollingly at a fixed position on a graphical interface.
[0054] The above step 110 may further include receiving an instruction to operate one or more operable objects among the multiple operable objects of the graphical interface. The operation may be, but is not limited to, focus and / or selection. These operated operable objects are used as objects to be tested or function options a to implement subsequent testing of the graphical interface.
[0055] After the above step 110, the method further includes preparing a reference image file before testing function option a to obtain reference image file a for use as an expected image for subsequent testing. Figure 2 In the application example, the process of obtaining the reference image file a is as follows: Step 201, manually obtain the reference image file of the function option a before the first test, wherein the reference image file of the function option a includes the selected image a1 and the unselected image a2. Specifically, when manually testing the case, the selected image a1 and the unselected image a2 of the function option a are manually captured after the graphical interface jumps as the reference image file.
[0056] Step 120: upon receiving an instruction that the operable object is to be operated, obtaining an element ID of the operable object.
[0057] The instruction for operating the operable object may include, but is not limited to, the element ID of the operable object. The element ID is used to reflect the uniqueness of the operable object displayed in the graphical interface. The element ID of the operable object is a unique identifier, which refers to the interface element ID corresponding to the operable object. The element ID of the operable object may include, but is not limited to, the operable object identifier, the interface element type corresponding to the operable object, and the interface element path. In this embodiment, the effectiveness and accuracy of obtaining the element ID are improved.
[0058] The operable object identifier may be, but is not limited to, a behavior object character string.
[0059] The above interface element types and element paths refer to element positioning methods and corresponding element values. These element positioning methods and corresponding element values can be established in the appium framework or implemented in other web page frameworks.
[0060] For example, the automated testing platform writes a packaged interface behavior interface "find element" to implement element location. This interface implements the behavior of focusing or selecting the interface element of the operable object. The interface parameters may include, but are not limited to, the behavior object string, the interface element type, and the interface element path. This interface behavior interface is a packaged interface behavior interface of the automated testing platform. Figure 2 In the application example, the specific behavior execution process is as follows: Step 202, click to select function option a.
[0061] The above step 120 may further include, when receiving an instruction that the operable object is operated, obtaining the element positioning method and the corresponding element value contained in the element ID of the operable object. Among them, the embodiment of the present application supports any one or more combinations of four positioning methods: id positioning, class positioning, name positioning and xpath positioning. Behavior object string: the action to be performed by the interface "find element", the string corresponding to the "click" for selection is "click".
[0062] Step 130, obtaining the element and the area image corresponding to the element according to the element ID of the operable object.
[0063] The instructions for operating the operable objects may be, but are not limited to, instructions for user focus or selection, which can be used as input for testing the graphical interface.
[0064] The above step 130 may further include the following two steps: 1) obtaining the element positioning method and the corresponding element value contained in the element ID of the operable object, and obtaining the element corresponding to the element ID. 2) obtaining the area image corresponding to the element according to the element corresponding to the element ID.
[0065] Step 140, determine whether the region image is consistent with the expected image, so as to determine whether the operable object is successfully operated. The expected image is used to reflect the expected result that needs to be achieved corresponding to the operated instruction.
[0066] In the related art, it is necessary to take a screenshot of a selected operable object, find the corresponding image in the image library through the screenshot, and then compare the corresponding image with the expected image for testing. However, the graphical interface testing method of the embodiment of the present application directly uses the element ID of the operable object to obtain the element and the area image corresponding to the element, which is more accurate and convenient, and improves the efficiency of subsequent testing.
[0067] Figure 3 Shown Figure 1 A schematic diagram of the specific flow of the testing method of the graphical interface shown.
[0068] like Figure 3 As shown, the above step 130 may further include the following step 131, obtaining the area image corresponding to the operable object according to the interface element type and the interface element path. In this way, the area image of the element can be found through the interface element path, thereby improving the accuracy of obtaining the area image corresponding to the operable object.
[0069] Exemplarily, the automated testing platform writes a packaged interface behavior interface "ele screen" to implement screen selection. The interface implements the behavior of obtaining the area image and expected image corresponding to the element for subsequent comparison. The interface parameters include the relative path of the selected image a1 and the unselected area image a2 of the expected image relative to the element area image, the interface element type, and the interface element path.
[0070] The area images corresponding to the above elements are the images corresponding to the elements selected during testing.
[0071] continue Figure 3 As shown, the above step 131 may further include the following (1) to (2):
[0072] (1) According to the interface element type and interface element path, the coordinate range of the operable object display is obtained through the interface display coordinate attribute, where the coordinate range of the operable object display includes a string list of the upper left corner coordinates and the lower right corner coordinates. (2) The coordinate range of the operable object display is converted into an area image.
[0073] There are multiple ways to convert the coordinate range of the operable object displayed in (2) into a region image. In one embodiment of the conversion method, regular expressions, map functions, etc. The map function implements the mapping between a function and all elements of an input list.
[0074] The above interface display coordinate attributes may include, but are not limited to, the bounds attribute of the function option. The bounds attribute of the function option describes the position and size of the function option in its own coordinate system.
[0075] Exemplarily, first, obtain the bounds attribute of function option a and generate the coordinate range t1 of the operable object display. Then, obtain the area image displayed by function option a through the coordinate range. Then, compare the area image corresponding to the operable object with the expected image to determine whether it is focused or successfully selected. In certain scenarios, it is not possible to directly verify the button selection state through button attributes. The embodiment of the present application obtains the coordinate range of the operable object display through the bounds attribute, and verifies the selection state of the operable object through the screen display within the coordinate range. This verification method is closer to the actual user usage scenario, and the verification can be completed only according to the element type, element path and corresponding expected image. It not only solves the problem that the button selection state cannot be verified directly through button attributes, but also improves the accuracy of the test by accurately grasping the test results.
[0076] In such Figure 2In the application example, the process of generating the area image corresponding to function option a is as follows: Step 203, obtain the bounds attribute of function option a and generate the coordinate range t1 displayed by function option a. Step 204, convert the coordinate range t1 into a tuple t2 through a regular expression. Step 205, take a screenshot of the coordinate area in the t2 tuple and generate the area image corresponding to function option a. The detailed description is as follows:
[0077] For the above step 130 of “obtaining the area image corresponding to the element”, the operable object object1 is obtained through the element type and the element path, and then the element area image is obtained.
[0078] The above method obtains the operation object object1 through the element type and element path, and then obtains the element area image as follows <1> to <3> Steps to achieve:
[0079] <1> , Use get_attribute to obtain the attribute bounds method to obtain the coordinate range t1 displayed by the operable object object1. t1 is composed of two string lists, which are the x,y coordinates of the upper left corner and the x,y coordinates of the lower right corner of the operable object object1.
[0080] <2> Use the regular expression to convert the two lists in the above coordinate range t1 into a single list coord_list = re.findall(r"\d+\.?\d*",t1), and use the map mapping function to convert the single list into a one-dimensional tuple t2 = tuple(map(int,coord_list)), where the tuple t2 contains the x,y coordinates of the upper left corner and lower right corner of the above operable object object1;
[0081] <3> Capture the coordinate area image in the t2 tuple PIL.Image.open(a3).crop(str(t2)).save(a3). The screenshot file a3 is the area image corresponding to the operable object object1.
[0082] Combined with the above Figure 1 and Figure 3 The expected pictures shown above include expected pictures when the operable object is not operated, and expected pictures when the operable object is operated. The above step 140 may further include comparing the similarity between the region picture and the expected picture, determining whether the region picture is the same as the expected picture, and then determining whether the operable object is successfully operated. Further, if the region picture is the same as the expected picture that has not been operated, it is determined that the operable object is not successfully operated; if the region picture is the same as the expected picture that has been operated, it is determined that the operable object is successfully operated.
[0083] There are many ways to implement the above-mentioned comparison of the regional picture and the expected picture. In one implementation, the regional picture and the expected picture are processed separately, the Hash algorithm is used, and the Hamming distance between the regional picture and the expected picture is calculated to compare the similarity between the regional picture and the expected picture. Among them, the Hash algorithm may include any one of the mean hash algorithm (aHash), the difference hash algorithm, the perceptual hash algorithm (pHash) and the difference hash algorithm (dHash). In another implementation, the Hamming distance between the regional picture and the expected picture is calculated to compare the similarity between the regional picture and the expected picture. Of course, there may be other ways to compare the similarity between the regional picture and the expected picture, which will not be given one by one here.
[0084] In such Figure 2 For example, the test result output process in the application example is as follows: Step 206, the screenshot file a3 is compared with the reference image file a1 and the reference image file a2 respectively, and it is determined whether the screenshot file a3 is consistent with the reference image file a1 or the reference image file a2. If the screenshot file a3 is consistent with the reference image file a1, step 207 is executed. If the screenshot file a3 is consistent with the reference image file a2, step 208 is executed. Step 207, it is determined that the function option a is successfully selected. Step 208, it is determined that the function option a is not selected, that is, the function option a is not successfully selected. Step 209, output the test result.
[0085] The following is an example of the mean hash algorithm combined with the Hamming distance. The details are as follows.
[0086] 1>, compress the screenshot file a3 into 16*16 (or 8*8), draw a grayscale image, and generate a pixel point structure feature sequence a1.
[0087] 2>, compress the reference image file a1 and the reference image file a2 by 16*16 (or 8*8), draw a grayscale image, and generate structural feature sequences a1 and a2 composed of pixel values.
[0088] 3>, use the mean hash algorithm to calculate the elements in the pixel structure feature sequence a1 and a2 one by one, and create a new string list b1 to store the calculation results. Mean hash algorithm: calculate the pixel average value, and then take out each pixel value and compare it with the average value. If it is greater than the average value, it is 1, otherwise it is 0, and generate the string list b1 and string list b2 of the hash sequence.
[0089] 4>, use the mean hash algorithm to operate the elements in the pixel structure feature sequence a3 one by one, and create a new string list b3 to store the operation results. Mean hash algorithm: calculate the pixel average value, then take out each pixel value and compare it with the average value, if it is greater than the average value, it is 1, otherwise it is 0, and generate the string list b3 of the hash sequence.
[0090] 5>, compare the string lists of string list b1 and string list b3, and calculate the Hamming distance. Also, compare the string lists of string list b2 and string list b3, and calculate the Hamming distance. Hamming distance: The steps required to convert a set of binary data into another set of data, which can measure the difference between two images. The smaller the Hamming distance, the higher the similarity. The Hamming distance is 0, that is, the area image is the same as the expected image. If the string list b1 and the string list b3 are similar, it can be determined that the operable object a is selected or has the focus; if the string list b2 and the string list b3 are similar, it can be determined that the operable object a is not selected or has not the focus.
[0091] 6>. Based on the Hamming distance result, the automated testing platform outputs the result of the test step.
[0092] Figure 4 Shown is a module schematic diagram of a graphical interface testing device provided in an embodiment of the present application.
[0093] Based on the same application concept as the above method, the present application embodiment also proposes a graphical interface testing device, such as Figure 4 As shown, the graphical interface test device includes the following modules:
[0094] The instruction receiving module 31 is used to receive instructions for operating an operable object of the graphical interface;
[0095] The element ID obtaining module 32 is used to obtain the element ID of the operable object when receiving an instruction that the operable object is operated;
[0096] The region image acquisition module 33 is used to obtain the element and the region image corresponding to the element according to the element ID of the operable object;
[0097] The judging module 34 is used to judge whether the area image is consistent with the expected image, so as to judge whether the operable object is successfully operated.
[0098] In some embodiments, the element ID of the operable object includes the operable object identifier, the interface element type and the interface element path corresponding to the operable object; the region image acquisition module includes: a region image acquisition submodule;
[0099] The area image acquisition submodule is used to obtain the area image corresponding to the operable object according to the interface element type and the interface element path.
[0100] In some embodiments, the region image acquisition submodule includes: a coordinate range acquisition unit and a conversion unit;
[0101] A coordinate range obtaining unit, used to obtain the coordinate range of the operable object display according to the interface element type and the interface element path through the interface display coordinate attribute, wherein the coordinate range of the operable object display includes a string list of the upper left corner coordinates and the lower right corner coordinates;
[0102] The conversion unit is used to convert the coordinate range displayed by the operable object into an area image.
[0103] In some embodiments, the expected picture includes an expected picture when the operable object is not operated, and an expected picture when the operable object is operated;
[0104] The judgment module is specifically used to: if the area image is the same as the expected image that has not been operated, determine that the operable object has not been operated successfully;
[0105] If the region image is the same as the expected image being operated, it is determined that the operable object is successfully operated.
[0106] The implementation process of the functions and effects of each module / submodule / unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.
[0107] Figure 5 Shown is a structural block diagram of an electronic device 40 provided in an embodiment of the present application.
[0108] like Figure 5 As shown, the electronic device 40 includes one or more processors 41 for implementing the graphical interface testing method as described above.
[0109] In some embodiments, the electronic device 40 may include a computer-readable storage medium 49, which may store a program that can be called by the processor 41 and may include a non-volatile storage medium. In some embodiments, the electronic device 40 may include a memory 48 and an interface 47. In some embodiments, the electronic device 40 may also include other hardware according to actual applications.
[0110] The computer-readable storage medium 49 of the embodiment of the present application stores a program thereon, which, when executed by the processor 41, is used to implement the graphical interface testing method described above.
[0111] The present application may take the form of a computer program product implemented on one or more computer-readable storage media 49 (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-readable storage media 49 include permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer-readable storage media 49 include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0112] The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.
[0113] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the phrase "includes a ..." defines an element, and does not exclude the presence of other identical elements in the process, method, commodity or device including the element.
Claims
1. A graphical interface testing method, characterized in that: include: Receiving instructions for operating operable objects of the graphical interface; When receiving an instruction that the operable object is operated, obtaining an element ID of the operable object; According to the element ID of the operable object, obtain the element and the area image corresponding to the element; It is determined whether the area image is consistent with the expected image to determine whether the operable object is successfully operated.
2. The graphical interface testing method according to claim 1, characterized in that: The element ID of the operable object includes an operable object identifier, an interface element type corresponding to the operable object, and an interface element path.
3. The graphical interface testing method according to claim 2, characterized in that: The obtaining, according to the element ID of the operable object, a region image corresponding to the element ID, includes: According to the interface element type and the interface element path, an area image corresponding to the operable object is obtained.
4. The graphical interface testing method according to claim 3, characterized in that: The acquiring, according to the interface element type and the interface element path, a region image corresponding to the operable object includes: According to the interface element type and the interface element path, the coordinate range of the operable object display is acquired through the interface display coordinate attribute, wherein the coordinate range of the operable object display includes a string list of the upper left corner coordinates and the lower right corner coordinates; The coordinate range displayed by the operable object is converted into the area image.
5. The graphical interface testing method according to claim 1, characterized in that: The expected picture includes an expected picture when the operable object is not operated and an expected picture when the operable object is operated; The determining whether the area image is consistent with the expected image, so as to determine whether the operable object is successfully operated, includes: If the area image is the same as the expected image that has not been operated, it is determined that the operable object has not been successfully operated; If the area image is the same as the expected image to be operated, it is determined that the operable object is successfully operated.
6. A graphical interface testing device, characterized in that: include: An instruction receiving module, used to receive instructions for operating an operable object of the graphical interface; An element ID obtaining module, configured to obtain the element ID of the operable object upon receiving an instruction for operating the operable object; A region image acquisition module, used to obtain an element and a region image corresponding to the element according to the element ID of the operable object; The judgment module is used to judge whether the area image is consistent with the expected image, so as to judge whether the operable object is successfully operated.
7. The graphical interface testing device according to claim 6, characterized in that: The element ID of the operable object includes an operable object identifier, an interface element type corresponding to the operable object, and an interface element path; The regional image acquisition module includes: a regional image acquisition submodule; The area image acquisition submodule is used to acquire the area image corresponding to the operable object according to the interface element type and the interface element path.
8. The graphical interface testing device according to claim 7, characterized in that: The regional image acquisition submodule includes: a coordinate range acquisition unit and a conversion unit; The coordinate range obtaining unit is used to obtain the coordinate range of the operable object display according to the interface element type and the interface element path through the interface display coordinate attribute, wherein the coordinate range of the operable object display includes a string list of the upper left corner coordinates and the lower right corner coordinates; The conversion unit is used to convert the coordinate range displayed by the operable object into the area image.
9. An electronic device, characterized in that: It comprises one or more processors, and is used to implement the graphical interface testing method as described in any one of claims 1-5.
10. A computer-readable storage medium, characterized in that: A program is stored thereon, and when the program is executed by a processor, the graphical interface testing method as described in any one of claims 1 to 5 is implemented.
