Terminal system interface layout comparison method and electronic device
Through target detection and Graph structure similarity calculation, the image matching method solves the problem of low accuracy and high threshold in terminal system interface layout comparison, achieving automated and efficient interface comparison, and is suitable for a variety of terminal devices.
Patent Information
- Application Number
- CN202210924021.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-02
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2042-08-02
AI Technical Summary
In the comparison of terminal system interface layouts in the existing technology, the image matching method is affected by the background and information prompts, has low accuracy and requires writing scripts, which increases the tester's threshold and workload.
Obtain the target object information on the terminal system interface through target detection, build a Graph structure to reflect the layout, calculate the similarity of the Graph structure to determine the interface consistency, and achieve automated and efficient interface comparison.
It lowers the entry threshold for testers, improves the accuracy and efficiency of terminal system interface testing, and is suitable for terminal equipment of different brands and models.
Smart Images

Figure CN116048682B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a terminal system interface layout comparison method and electronic equipment. Background Art
[0002] When testing terminal products, it is necessary to compare the differences in the system interface layout of the terminal products. To this end, the current common solution in the industry is to use the image matching method to write a corresponding script to achieve a comparison of the differences in the terminal system interface layout. However, this solution has the following problems: the image matching method is used for comparison, which is to determine the difference between the terminal system interface to be tested and the template terminal system interface by detecting the pixel difference between the image corresponding to the terminal system interface to be tested and the image corresponding to the template terminal system interface. When using this method for comparison, the difference in the background (wallpaper) of the terminal system interface will affect the comparison results, and the information prompts at the application icons on the terminal system interface will also affect the comparison results. In addition, this solution requires script writing, which places high demands on testers. Summary of the invention
[0003] The present application provides a terminal system interface layout comparison method and electronic device, which can realize the difference comparison of terminal system interface layouts.
[0004] In order to achieve the above objectives, this application adopts the following technical solutions:
[0005] In a first aspect, the present application provides a terminal system interface layout comparison method, the method comprising:
[0006] Obtain the terminal system interface to be tested. Perform target detection on the terminal system interface to be tested, and obtain information about all target objects on the terminal system interface to be tested. Among them, the target object includes an icon and / or text, and the information of the target object includes the position information of the target object on the terminal system interface to be tested. Based on the information of all target objects on the terminal system interface to be tested, calculate the relative position relationship between each target object on the terminal system interface to be tested. According to the relative position relationship between each target object on the terminal system interface to be tested, construct a first Graph structure. Each vertex in the first Graph structure corresponds to a target object on the terminal system interface to be tested, and the edges connecting the vertices in the first Graph structure are used to characterize the relative position relationship between the target objects corresponding to the vertices. Calculate the similarity between the first Graph structure and the second Graph structure. Determine the consistency of the layout of the terminal system interface to be tested and the layout of the template terminal system interface based on the calculated similarity.
[0007] It should be understood that the second Graph structure is the Graph structure corresponding to the template terminal system interface. The above scheme provided by the present application obtains the information of the target object on the terminal system interface by performing target detection on the terminal system interface, thereby constructing the Graph structure corresponding to the terminal system interface. The constructed Graph structure can reflect the layout of the corresponding terminal system interface, including the target objects of the terminal system interface and the relative position relationship between each target object. In this way, by mapping the terminal system interface layout to the Graph structure, the similarity of the two terminal system interface layouts can be used to reflect the similarity of the two terminal system interface layouts, and the comparison of the two terminal system interface layouts can be achieved. Specifically, the above scheme provided by the present application calculates the similarity of the Graph structure corresponding to the terminal system interface layout to be tested (i.e., the first Graph structure) and the Graph structure corresponding to the template terminal system interface layout (i.e., the second Graph structure), and the similarity of the two Graph structures can be obtained. The similarity can reflect the similarity of the terminal system interface layout to be tested and the template terminal system interface layout, thereby realizing the judgment of whether the terminal system interface layout to be tested is consistent with the template terminal system interface layout. When the scheme provided by the present application is applied to the terminal system interface test, there is no need to write a script, which can reduce the entry threshold for testers. It can also realize automated and efficient testing and improve the accuracy of testing.
[0008] In a possible implementation manner of the first aspect, the relative position relationship between the target objects on the above-mentioned terminal system interface to be tested may include one target object being located in any of the following positions of another target object: directly above, directly below, directly to the left, directly to the right, upper left, upper right, lower left and lower right.
[0009] That is to say, the first Graph structure can be constructed based on the eight positional relationships between the target objects on the interface of the terminal system to be tested, so as to map the interface layout of the terminal system to be tested to the first Graph structure.
[0010] In a possible implementation of the first aspect, the above-mentioned construction of the first Graph structure according to the relative position relationship between each target object on the interface of the terminal system to be tested may include: for each target object, respectively performing the following steps to construct the first Graph structure: according to the relative position relationship between each target object on the interface of the terminal system to be tested, searching for the second target object closest to the first target object in each preset direction of multiple preset directions. If the second target object is found, constructing a directed edge from the vertex corresponding to the first target object to the vertex corresponding to the second target object. The first target object is any target object in the interface of the terminal system to be tested.
[0011] Among them, the edges connecting the vertices in the first Graph structure are used to represent the relative position relationship between the target objects corresponding to the vertices, including: a directed edge from one vertex to another vertex in the first Graph structure, which is used to represent the relative position relationship between one vertex and the target object corresponding to another vertex.
[0012] In a possible implementation of the first aspect, the above-mentioned multiple preset directions include: upper right, right, lower right and lower. Alternatively, the multiple preset directions include: right, right, lower right, lower and left. Alternatively, the multiple preset directions include: lower right, lower, lower left and left. Alternatively, the multiple preset directions include: lower, left, upper left and upper left. Alternatively, the multiple preset directions include: lower left, left, upper left and upper. Alternatively, the multiple preset directions include: left, upper left, upper and upper right. Alternatively, the multiple preset directions include: upper left, upper, upper right and right. Alternatively, the multiple preset directions include: upper, right, right and lower right.
[0013] That is to say, a target object may be located in one of the above-mentioned 8 directions (i.e., directly above, directly below, directly to the left, directly to the right, upper left, upper right, lower left and lower right) of another target object. However, when constructing the first Graph structure, only 4 directions are selected from these 8 directions as preset directions. And the selected 4 preset directions are opposite to the other 4 preset directions that are not selected. If directly above and directly below are opposite, then after selecting directly above as the preset direction, there is no need to select directly below as the preset direction. In this way, for each target object on the interface of the terminal system to be tested, it is only necessary to search for the second target object closest to it in the 4 preset directions, which can reduce the computational complexity and avoid the appearance of repeated edges in the Graph structure, thereby reducing the amount of calculation and improving processing efficiency.
[0014] In a possible implementation of the first aspect, the similarity between the first Graph structure and the second Graph structure can be calculated in the following manner: the first Graph structure and the second Graph structure are used as inputs, and a preset graph similarity calculation model based on a neural network is run to obtain the similarity between the first Graph structure and the second Graph structure. The preset graph similarity calculation model based on a neural network has a function of performing similarity calculation on a set of input Graph structures to obtain the similarity of the set of input Graph structures.
[0015] In a possible implementation of the first aspect, the method further includes: calculating the relative distance between each target object on the interface of the terminal system to be tested based on the information of all target objects on the interface of the terminal system to be tested. The above calculation of the similarity between the first Graph structure and the second Graph structure can also be carried out in the following manner: obtaining first input data, the first input data including the first Graph structure and the relative distance between the target objects corresponding to the vertices connected by directed edges in the first Graph structure. Obtaining second input data, the second input data including the second Graph structure and the relative distance between the target objects corresponding to the vertices connected by directed edges in the second Graph structure. Calculating the similarity between the first Graph structure and the second Graph structure based on the first input data and the second input data.
[0016] In this way, by combining the relative distance data between the target objects corresponding to the vertices connected by directed edges in the two Graph structures, the similarity of the two Graph structures is calculated, and the accuracy of the calculation result is better, which can achieve a more accurate comparison of the corresponding terminal system interfaces.
[0017] In a possible implementation of the first aspect, the consistency of the interface layout of the terminal system to be tested and the interface layout of the template terminal system is determined according to the calculated similarity, including: if the similarity is greater than or equal to a preset similarity threshold, then the interface layout of the terminal system to be tested is determined to be consistent with the interface layout of the template terminal system. If the similarity is less than the preset similarity threshold, then the interface layout of the terminal system to be tested is determined to be inconsistent with the interface layout of the template terminal system.
[0018] In a possible implementation manner of the first aspect, the target object includes an icon and text. The target object information also includes type information of the target object, and the type information may be used to indicate that the target object is an icon or text.
[0019] The above-mentioned calculation of the relative position relationship between each target object on the interface of the terminal system to be tested is based on the information of all target objects on the interface of the terminal system to be tested, including: based on the type information of the target object on the interface of the terminal system to be tested and the position information of the target object on the interface of the terminal system to be tested, respectively calculating the relative position relationship between each icon on the interface of the terminal system to be tested and the relative position relationship between each text.
[0020] The above-mentioned first Graph structure may include a third Graph structure and a fourth Graph structure. Wherein, the first Graph structure is constructed according to the relative position relationship between each target object on the interface of the terminal system to be tested, including: constructing a third Graph structure based on the relative position relationship between each icon on the interface of the terminal system to be tested. Each vertex in the third Graph structure corresponds to an icon on the interface of the terminal system to be tested, and the edges connecting the vertices in the third Graph structure are used to characterize the relative position relationship between the icons corresponding to the vertices. The fourth Graph structure is constructed based on the relative position relationship between each text on the interface of the terminal system to be tested. Each vertex in the fourth Graph structure corresponds to a text on the interface of the terminal system to be tested, and the edges connecting the vertices in the fourth Graph structure are used to characterize the relative position relationship between the texts corresponding to the vertices.
[0021] Correspondingly, the second Graph structure includes a fifth Graph structure and a sixth Graph structure. The fifth Graph structure is a Graph structure corresponding to the icon in the template terminal system interface, and the sixth Graph structure is a Graph structure corresponding to the text in the template terminal system interface.
[0022] In a possible implementation manner of the first aspect, before calculating the similarity between the first Graph structure and the second Graph structure, the method may further include:
[0023] Perform target detection on the template terminal system interface to obtain information about all target objects on the template terminal system interface. The target object includes an icon or text, and the target object information includes position information of the target object on the template terminal system interface. Based on the information of all icons on the template terminal system interface, calculate the relative position relationship between the icons on the template terminal system interface. According to the relative position relationship between the icons on the terminal system interface to be tested, construct a fifth Graph structure. Each vertex in the fifth Graph structure corresponds to an icon on the template terminal system interface, and the edges connecting the vertices in the fifth Graph structure are used to characterize the relative position relationship between the icons corresponding to the vertices. Based on the information of all texts on the template terminal system interface, calculate the relative position relationship between the texts on the template terminal system interface. According to the relative position relationship between the texts on the terminal system interface to be tested, construct a sixth Graph structure. Each vertex in the sixth Graph structure corresponds to a text on the template terminal system interface, and the edges connecting the vertices in the sixth Graph structure are used to characterize the relative position relationship between the texts corresponding to the vertices.
[0024] In a possible implementation manner of the first aspect, the calculating the similarity between the first Graph structure and the second Graph structure includes: calculating a similarity S1 between the third Graph structure and the fifth Graph structure; and calculating a similarity S2 between the fourth Graph structure and the sixth Graph structure.
[0025] The above-mentioned determining the consistency of the interface layout of the terminal system to be tested and the interface layout of the template terminal system according to the calculated similarity includes: determining the consistency of the interface layout of the terminal system to be tested and the interface layout of the template terminal system based on the similarity S1 and the similarity S2.
[0026] In a possible implementation of the first aspect, the above-mentioned determination of the consistency between the interface layout of the terminal system to be tested and the interface layout of the template terminal system based on the similarity S1 and the similarity S2 includes: if the similarity S1 is greater than or equal to a preset similarity threshold, and the similarity S2 is greater than or equal to the preset similarity threshold, then the interface layout of the terminal system to be tested is determined to be consistent with the interface layout of the template terminal system. If the similarity S1 is less than the preset similarity threshold, or the similarity S2 is less than the preset similarity threshold, then the interface layout of the terminal system to be tested is determined to be inconsistent with the interface layout of the template terminal system.
[0027] Based on the above technical solution, the Graph structure (third Graph structure) corresponding to the icon in the terminal system interface to be tested, the Graph structure (fourth Graph structure) corresponding to the text in the terminal system interface to be tested, the Graph structure (fifth Graph structure) corresponding to the icon in the template terminal system interface, and the Graph structure (sixth Graph structure) corresponding to the text in the template terminal system interface can be constructed respectively. In this way, the comparison of the icon layout in the terminal system interface to be tested and the template terminal system interface, as well as the comparison of the text layout in the terminal system interface to be tested and the template terminal system interface can be realized respectively. And based on the layout consistency requirements of the target objects of the type of icons and the target objects of the type of text on the terminal system interface layout, different / same preset similarity thresholds can be set for the similarity S1 of the third Graph structure and the fifth Graph structure, and the similarity S2 of the fourth Graph structure and the sixth Graph structure, to obtain the final result of the consistency determination of the terminal system interface layout to be tested and the template terminal system interface layout. Or different / same weights are set for S1 and S2, and the final similarity value is obtained through weighted calculation, and the final result of the consistency determination of the terminal system interface layout to be tested and the template terminal system interface layout is obtained based on the final similarity value. That is to say, based on the above technical solution, the comparison parameters and comparison methods can be flexibly adjusted according to the test requirements.
[0028] In a possible implementation of the first aspect, the obtaining of the system interface of the terminal to be tested includes: receiving the system interface of the terminal to be tested from the terminal to be tested, where the system interface of the terminal to be tested is obtained by taking a screenshot of the terminal to be tested. Alternatively, receiving a screen recording video from the terminal to be tested, extracting image frames from the screen recording video, and using the image frames as the system interface of the terminal to be tested.
[0029] In a possible implementation of the first aspect, the above-mentioned target detection is performed on the terminal system interface to be tested to obtain information about all target objects on the terminal system interface to be tested, including: taking the terminal system interface to be tested as input, running a preset target detection model, and outputting information about all target objects on the terminal system interface to be tested. The preset target detection model has the function of performing target detection on the input terminal system interface and obtaining information corresponding to the target on the input terminal system interface.
[0030] In a possible implementation of the first aspect, the method further includes: constructing a training set. The training set includes multiple sets of training sample data pairs, each set of training sample data pairs includes a training sample image and annotation information corresponding to the training sample image. The training sample image is a terminal system interface. The annotation information corresponding to the training sample image is information about a target object on the terminal system interface. The training sample image in the training sample data pair is used as an input sample, and the annotation information corresponding to the training sample image is used as an output sample to train the target detection model.
[0031] In a possible implementation of the first aspect, the method further includes: constructing a verification set. The verification set includes multiple groups of verification sample data pairs, each group of verification sample data pairs includes a verification sample image and annotation information corresponding to the verification sample image. Among them, the verification sample image is a terminal system interface. The annotation information corresponding to the verification sample image is the information of the target object on the terminal system interface. After using at least one group of training sample data pairs to train the target detection model, the verification sample image in the verification set is used as the input of the target detection model, the target detection model is run, and the corresponding detection result is output. The annotation information corresponding to the verification sample image in the verification set is compared with the detection result to determine the accuracy of the target detection model. When the accuracy is less than the preset threshold t, the parameters of the target detection model are readjusted, and the target detection model is retrained using the training set. When the accuracy is greater than or equal to the preset threshold t, the target detection model is saved as the preset target detection model.
[0032] In a possible implementation of the first aspect, before calculating the relative position relationship between each target object on the interface of the terminal system to be tested based on the information of all target objects on the interface of the terminal system to be tested, the method further includes: if the total number of target objects on the interface of the terminal system to be tested is the same as the total number of target objects on the interface of the template terminal system, and the proportion of the same type of target objects on the interface of the terminal system to be tested and the interface of the template terminal system is the same, then calculating the relative position relationship between each target object on the interface of the terminal system to be tested based on the information of all target objects on the interface of the terminal system to be tested.
[0033] In a possible implementation of the first aspect, the method further includes: if the total number of target objects on the interface of the terminal system to be tested is different from the total number of target objects on the interface of the template terminal system, then determining that the layout of the interface of the terminal system to be tested is inconsistent with the layout of the interface of the template terminal system. Alternatively, if the proportions of the same type of target objects on the test terminal system interface and the template terminal system interface are different, then determining that the layout of the interface of the terminal system to be tested is inconsistent with the layout of the interface of the template terminal system.
[0034] That is to say, the total number of target objects on the terminal system interface to be tested and the total number of target objects on the template terminal system interface, as well as the proportion of target objects of the same type on the terminal system interface to be tested and the template terminal system interface can be compared first. If the total number of target objects or the proportion of target objects of the same type on the terminal system interface to be tested and the template terminal system interface are inconsistent, it can be determined that the layout of the terminal system interface to be tested is inconsistent with the layout of the template terminal system interface. In this way, the test results can be quickly obtained without constructing the Graph structure and comparing the graph similarity, thereby improving the test efficiency.
[0035] Moreover, only when the total number of target objects on the terminal system interface to be tested is the same as the total number of target objects on the template terminal system interface, the proportion of the same type of target objects on the terminal system interface to be tested and the template terminal system interface is the same, and the similarity between the Graph structure corresponding to the terminal system interface to be tested and the Graph structure corresponding to the template terminal system interface is greater than or equal to the preset similarity threshold, will the layout of the terminal system interface to be tested be deemed to be consistent with the layout of the template terminal system interface, thereby enabling more rigorous testing of the terminal system interface layout to be tested.
[0036] In a second aspect, an electronic device is provided, which has the function of implementing the method described in the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0037] In a third aspect, the present application provides an electronic device comprising a memory and one or more processors; the memory and the processor are coupled; wherein computer program code is stored in the memory, and the computer program code comprises computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the terminal system interface layout comparison method as in the first aspect above and any possible implementation method thereof.
[0038] In a fourth aspect, the present application provides an electronic device, comprising: a processor; the processor is used to couple with a memory, and after reading instructions in the memory, execute the terminal system interface layout comparison method as described in the first aspect and any possible implementation method thereof according to the instructions.
[0039] In a fifth aspect, the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the terminal system interface layout comparison method in the first aspect and any possible implementation method thereof.
[0040] In a sixth aspect, the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the terminal system interface layout comparison method in the above-mentioned first aspect and any possible implementation thereof.
[0041] In a seventh aspect, the present application provides a device (for example, the device may be a chip system), the device including a processor for supporting an electronic device to implement the functions involved in the first aspect above. In one possible design, the device also includes a memory for storing program instructions and data necessary for the electronic device. When the device is a chip system, it may be composed of a chip, or may include a chip and other discrete devices.
[0042] It can be understood that the beneficial effects that can be achieved by the above-mentioned second aspect to the third aspect can refer to the beneficial effects of the first aspect and any possible implementation method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A schematic diagram of a software test structure in an embodiment of the present application;
[0044] Figure 2 This is a schematic diagram of a template mobile phone system interface in an embodiment of the present application;
[0045] Figure 3A This is a schematic diagram of a mobile phone system interface layout with garbled text in an embodiment of the present application;
[0046] Figure 3BA schematic diagram of a mobile phone system interface layout showing missing icons in an embodiment of the present application;
[0047] Figure 3C This is a schematic diagram of an icon position shift in a mobile phone system interface layout in an embodiment of the present application;
[0048] Figure 3D This is a schematic diagram of a mobile phone system interface to be tested in an embodiment of the present application;
[0049] Figure 4 A schematic diagram of a terminal system interface layout comparison method provided in an embodiment of the present application;
[0050] Figure 5 A schematic diagram of the hardware structure of a terminal provided in an embodiment of the present application;
[0051] Figure 6 A flowchart of a terminal system interface layout comparison method provided in an embodiment of the present application;
[0052] Fig. 7A This is a target detection model training flow chart in an embodiment of the present application;
[0053] Figure 7B A target marking schematic diagram in an embodiment of the present application;
[0054] Figure 7C This is a target detection model training flow chart in an embodiment of the present application;
[0055] Figure 8 A schematic diagram of the relative position relationship between targets in an embodiment of the present application;
[0056] Fig.9A In the embodiments of this application, Figure 2 A fifth Graph structure diagram of the template mobile phone system interface construction shown;
[0057] Fig. 9B In the embodiments of this application, Figure 2 A sixth Graph structure diagram of the template mobile phone system interface construction shown;
[0058] Fig. 9C In the embodiments of this application, Figure 3A A fourth Graph structure diagram of a mobile phone system interface construction is shown;
[0059] Fig.9D In the embodiments of this application, Figure 3B A third Graph structure diagram of a mobile phone system interface is shown;
[0060] Fig.9E In the embodiments of this application, Figure 3C A third Graph structure diagram of a mobile phone system interface is shown;
[0061] Fig.9F In the embodiments of this application, Figure 3D A third Graph structure diagram of a mobile phone system interface is shown;
[0062] Figure 9G In the embodiments of this application, Figure 3D A fourth Graph structure diagram of a mobile phone system interface construction is shown;
[0063] Fig.10 This is a flow chart for comparing a system interface of a terminal to be tested with a system interface of a template terminal in an embodiment of the present application;
[0064] Fig.11 A schematic diagram of a chip system according to an embodiment of the present application. DETAILED DESCRIPTION
[0065] It should be noted that in the embodiments of the present application, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first", "second", etc. may explicitly or implicitly include one or more of the features.
[0066] The directional terms mentioned in the embodiments of the present application, such as "up", "down", "left", "right", etc., are only references to the directions of the drawings, or are for the purpose of better and clearer explanation and understanding of the embodiments of the present application, rather than indicating or implying that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the embodiments of the present application.
[0067] In the description of the embodiments of the present application, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0068] To facilitate understanding of the technical solution of this application, the technologies involved in this application are introduced below.
[0069] Graph structure: It is composed of a set of vertices and a set of edges between vertices. Vertices are nodes in the graph structure, and edges are the connections between vertices. It is usually expressed as: G(V,E), where G represents a graph structure, V is the set of vertices in the graph structure G, and E is the set of edges in the graph structure G. If V = {v1,v2,...,v n}, |V| can be used to represent the number of vertices in the Graph structure G, also known as the order of the Graph structure G, E = {(u,v)|u∈V,v∈V}, |E| can be used to represent the number of edges in the Graph structure G, where (u,v) represents the edge between vertex u and vertex v. Graph structures can be divided into directed graphs and undirected graphs according to direction: for a Graph structure, if each edge has no direction, the Graph structure is called an undirected graph. For a Graph structure, if each edge has a direction (such as pointing from one vertex to another vertex), the Graph structure is called a directed graph. Some edges of a Graph structure have numbers associated with it. This number associated with the edge of the Graph structure is called a weight. For example Fig.9A In the graph structure shown, img1-img11 represent vertices in the graph structure, and the lines between the vertices represent edges in the graph structure. The edges in the graph structure are directed, and it is a directed graph.
[0070] Object Detection: The target-based task is to find all the target objects (elements) of interest in the image, determine their categories (Classification) and their locations (Location) in the image, which is one of the core issues in the field of computer vision.
[0071] Software testing: Software testing includes unit testing, service testing, and user interface (UI) testing. Unit testing refers to checking and verifying the smallest testable unit (smallest testable functional module) in the software. UI testing is performed manually or using automated testing tools. It is an important part of the software testing cycle. Its purpose is to verify whether the application has the required functions and whether they are user-friendly, and to ensure that all UI elements meet the required specifications, which is not only conducive to improving software quality, but also can guarantee the user experience when using the final application. Reference Figure 1 , Figure 1 A schematic diagram for software testing is shown in Figure 1. Figure 1 As shown, from unit testing to UI testing, the more complete the test is, the more time it takes.
[0072] When performing UI testing on a terminal, it is necessary to detect errors such as garbled text, missing icons, and icon position offset in the terminal system interface layout to be tested. Figure 2 and Figure 3A-3C , introduces various problems that may exist in the above terminal system interface layout. Figure 2 The following is a schematic diagram of a normal mobile phone system interface (template mobile phone system interface). Figure 3A-3C This is a diagram of various errors that occur in the mobile phone system interface. Figure 2 The template terminal system interface in Figure 3A The interface shown has garbled text, specifically corresponding to Figure 2 The text of "email" is displayed as garbled characters; Figure 3B The interface shown has missing icons, specifically corresponding to Figure 2 The "Music" and "Sports Health" icons are missing; Figure 3C The icon position is offset in the interface shown, specifically corresponding to Figure 2 For the above problem, the difference between the interface layout of the terminal system to be tested and the interface layout of the template terminal system can be compared to identify whether there is an error in the interface layout of the terminal system to be tested.
[0073] Existing solutions, such as the existing methods of using appium tools, eggplant tools or airtest tools to test the terminal system interface, use image matching to achieve the difference comparison of the layout of two terminal system interfaces. In other words, the existing solutions determine the difference between the terminal system interface to be tested and the template terminal system interface by detecting the pixel difference between the image corresponding to the terminal system interface to be tested and the image corresponding to the template terminal system interface. When using this method to compare, the difference in the background (wallpaper) used by the terminal will have a greater impact on the comparison results, and the information prompts at the terminal system application icons will also affect the comparison results.
[0074] For example, taking the above terminal as a mobile phone, see Figure 2 and Figure 3D , Figure 2 and Figure 3D The schematic diagrams of a template mobile phone system interface and a mobile phone system interface to be tested are shown respectively. The layout of the mobile phone system interfaces corresponding to the two are essentially the same, but because the backgrounds used by the two are different, the display time is different, and whether there is prompt information on the icons of the two is different. Specifically, Figure 2 The template mobile phone system interface shown is the same as Figure 3DThe wallpapers used in the system interface of the tested mobile phone are different. Figure 2 The time on the template mobile phone system interface is 08:55, and Figure 3D The time shown on the system interface of the mobile phone to be tested is 09:20. Figure 2 There is no information prompt in the upper right corner of the two corresponding icons on the template mobile phone system interface. Figure 3D The system interface of the mobile phone to be tested shown has two icons with information prompts in the upper right corner. Then, when comparing the template mobile phone system interface and the mobile phone system interface to be tested based on the pixel difference between the corresponding images of the template mobile phone system interface and the mobile phone system interface to be tested, the above difference will lead to pixel differences between the corresponding images of the template mobile phone system interface and the mobile phone system interface to be tested, which may lead to the comparison conclusion that the layout of the template mobile phone system interface and the mobile phone system interface to be tested are different, thereby misjudging that there is an error in the mobile phone system interface to be tested. Therefore, the existing solution of using image matching to achieve the difference comparison of the layout of the two terminal system interfaces has low accuracy.
[0075] In addition, the existing solution requires script writing for testing, and script writing requires a certain foundation, so the solution has a high code foundation requirement for testers. In addition, when different terminals have different parameters such as type, brand, model, resolution, screen ratio, etc., it will also have a great impact on the terminal system interface layout. The terminal system version iteration is fast, there are many models, and the overall number is constantly growing. Simply relying on manual testing (such as beta testing) requires a large number of testers, a large workload, and excessive human and material resources.
[0076] In view of the above problems, the present application provides a terminal system interface layout comparison method and electronic device. Figure 4 , Figure 4 FIG. 1 shows a schematic diagram of the terminal system interface layout comparison method provided by the present application. Figure 4As shown, the method includes: obtaining the interface of the terminal system to be tested. Performing target detection on the interface of the terminal system to be tested to obtain information of all target objects on the interface of the terminal system to be tested. Wherein, the target object includes an icon and / or text. The information of the target object includes the position information of the target object on the interface of the terminal system to be tested. Based on the information of all target objects on the interface of the terminal system to be tested, the relative position relationship between each target object on the interface of the terminal system to be tested is calculated. According to the relative position relationship between each target object on the interface of the terminal system to be tested, a first Graph structure is constructed. Each vertex in the first Graph structure corresponds to a target object on the interface of the terminal system to be tested, and the edges connecting the vertices in the first Graph structure can represent the relative position relationship between the target objects corresponding to the vertices. Calculating the similarity between the first Graph structure and the second Graph structure. Wherein, the second Graph structure is the Graph structure corresponding to the template terminal system interface. According to the calculated similarity, the consistency of the layout of the terminal system interface to be tested and the layout of the template terminal system interface is determined.
[0077] It should be understood that the second Graph structure in the embodiment of the present application can be constructed in a manner similar to that of constructing the first Graph structure, namely, obtaining the template terminal system interface. Target detection is performed on the template terminal system interface to obtain information on all target objects on the template terminal system interface. Among them, the target object includes an icon and / or text. The information of the target object includes the position information of the target object on the template terminal system interface. Based on the information of all target objects on the template terminal system interface, the relative position relationship between each target object on the template terminal system interface is calculated. According to the relative position relationship between each target object on the template terminal system interface, a second Graph structure is constructed. Each vertex in the second Graph structure corresponds to a target object on the template terminal system interface, and the edges connecting the vertices in the second Graph structure can represent the relative position relationship between the target objects corresponding to the vertices.
[0078] In this way, the first Graph structure can reflect the interface layout of the terminal system to be tested. The second Graph structure can reflect the interface layout of the template terminal system. Therefore, the consistency of the interface layout of the terminal system to be tested and the interface layout of the template terminal system can be determined based on the similarity between the first Graph structure and the second Graph structure to obtain a consistency comparison result.
[0079] The solution provided in the embodiment of the present application performs target detection on the terminal system interface to obtain information about the target object on the terminal system interface, thereby constructing a Graph structure corresponding to the terminal system interface. The constructed Graph structure can reflect the layout of the corresponding terminal system interface, including the target objects of the terminal system interface and the relative positional relationship between each target object. In this way, by mapping the terminal system interface layout to the Graph structure, the similarity of the Graph structures corresponding to the two terminal system interface layouts can be used to reflect the similarity of the two terminal system interface layouts, thereby realizing the comparison of the two terminal system interface layouts. Specifically, the embodiment of the present application calculates the similarity between the Graph structure corresponding to the interface layout of the terminal system to be tested (i.e., the first Graph structure) and the Graph structure corresponding to the interface layout of the template terminal system (i.e., the second Graph structure), and can obtain the similarity of the two Graph structures. The similarity can reflect the similarity between the interface layout of the terminal system to be tested and the interface layout of the template terminal system, and can be used to determine whether the interface layout of the terminal system to be tested is consistent with the interface layout of the template terminal system. That is, if the obtained similarity is greater than or equal to the preset similarity threshold, it means that the similarity between the interface layout of the terminal system to be tested and the interface layout of the template terminal system is high, and it can be considered that the interface layout of the terminal system to be tested is consistent with the interface layout of the template terminal system, and there is no error in the interface layout of the terminal system to be tested; if the similarity is less than the preset similarity threshold, it means that the interface layout of the terminal system to be tested is inconsistent with the interface layout of the template terminal system, and the difference between the two is large, and it can be considered that there is an error in the interface layout of the terminal system to be tested. When the scheme provided by the embodiment of the present application is applied to the system interface test of the terminal, there is no need to write a script, which can reduce the entry threshold for testers. Moreover, the solution provided in the embodiment of the present application can be applied to terminals with different brands, models, resolutions, screen-to-body ratios and other parameters for system interface testing, thereby realizing automated testing, reducing the workload of manual testing, improving the efficiency of terminal system consistency testing, and improving the accuracy of testing.
[0080] The implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0081] The terminal to be tested in the embodiment of the present application can be a mobile phone, a smart watch, a computer (such as a tablet computer, a laptop computer, a desktop computer, etc.), a television, etc.
[0082] The electronic device in the embodiment of the present application can be a mobile phone, a computer, a local server, a cloud server, etc. The following takes the mobile phone as an example to introduce the hardware structure of the electronic device. Figure 5 , is a schematic diagram of the hardware structure of an electronic device 500 provided in an embodiment of the present application. Figure 5As shown, the electronic device 500 may include: a processor 510, an external memory interface 520, an internal memory 521, a universal serial bus (USB) interface 530, a charging management module 540, a power management module 541, a battery 542, an antenna 1, an antenna 2, a mobile communication module 550, a wireless communication module 560, an audio module 570, a speaker 570A, a receiver 570B, a microphone 570C, an earphone interface 570D, a sensor module 580, a button 590, a motor 591, an indicator 592, a camera 593, a display screen 594, and a subscriber identification module (SIM) card interface 595, etc.
[0083] Among them, the above-mentioned sensor module 580 may include sensors such as pressure sensor, gyroscope sensor, air pressure sensor, magnetic sensor, acceleration sensor, distance sensor, proximity light sensor, fingerprint sensor, temperature sensor, touch sensor, ambient light sensor and bone conduction sensor.
[0084] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 500. In other embodiments, the electronic device 500 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0085] The processor 510 may include one or more processing units, for example, the processor 510 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0086] The controller may be the nerve center and command center of the electronic device 500. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0087] The processor 510 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 510 is a cache memory. The memory may store instructions or data that the processor 510 has just used or cyclically used. If the processor 510 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 510, and thus improves the efficiency of the system.
[0088] In some embodiments, the processor 510 may include one or more interfaces. It is understood that the interface connection relationship between the modules illustrated in this embodiment is only a schematic illustration and does not constitute a structural limitation on the electronic device 500. In other embodiments, the electronic device 500 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0089] The charging management module 540 is used to receive charging input from a charger. While the charging management module 540 is charging the battery 542 , it can also power the electronic device through the power management module 541 .
[0090] The power management module 541 is used to connect the battery 542, the charging management module 540 and the processor 510. The power management module 541 receives input from the battery 542 and / or the charging management module 540, and supplies power to the processor 510, the internal memory 521, the external memory, the display screen 594, the camera 593, and the wireless communication module 560.
[0091] The wireless communication function of the electronic device 500 can be implemented through the antenna 1, the antenna 2, the mobile communication module 550, the wireless communication module 560, the modem processor and the baseband processor.
[0092] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. In some embodiments, antenna 1 of electronic device 500 is coupled with mobile communication module 550, and antenna 2 is coupled with wireless communication module 560, so that electronic device 500 can communicate with the network and other devices through wireless communication technology.
[0093] The electronic device 500 implements the display function through a GPU, a display screen 594, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 594 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 510 may include one or more GPUs, which execute program instructions to generate or change display information.
[0094] The display screen 594 is used to display images, videos, etc. The display screen 594 includes a display panel. For example, the display screen 594 can be a touch screen.
[0095] The electronic device 500 can realize the shooting function through ISP, camera 593, video codec, GPU, display screen 594 and application processor.
[0096] The ISP is used to process the data fed back by the camera 593. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 593.
[0097] The camera 593 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 500 may include N cameras 593, where N is a positive integer greater than 1.
[0098] The DSP is used to process digital signals, and in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 500 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0099] Video codecs are used to compress or decompress digital videos. The electronic device 500 may support one or more video codecs. Thus, the electronic device 500 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0100] NPU is a neural network (NN) computing processor, which can quickly process input information and continuously self-learn by drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain. NPU can realize applications such as intelligent cognition of electronic device 500, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0101] The external memory interface 520 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 500. The external memory card communicates with the processor 510 through the external memory interface 520 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0102] The internal memory 521 may be used to store computer executable program codes, which include instructions. The processor 510 executes various functional applications and data processing of the electronic device 500 by running the instructions stored in the internal memory 521. For example, in an embodiment of the present application, the processor 510 may execute the instructions stored in the internal memory 521, and the internal memory 521 may include a program storage area and a data storage area.
[0103] The program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 500 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 521 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0104] The electronic device 500 can implement audio functions such as music playing and recording through the audio module 570, the speaker 570A, the receiver 570B, the microphone 570C, the headphone jack 570D, and the application processor.
[0105] The buttons 590 include a power button, a volume button, etc. The motor 591 can generate a vibration prompt. The indicator 592 can be an indicator light, which can be used to indicate the charging status, power change, messages, missed calls, notifications, etc.
[0106] The SIM card interface 595 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device 500 by inserting the SIM card interface 595 or pulling the SIM card interface 595 out. The electronic device 500 can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 595 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
[0107] The gyroscope sensor may be a three-axis gyroscope, which is used to track the state changes of the electronic device 500 in six directions. The acceleration sensor is used to detect the movement speed, direction, and displacement of the electronic device 500. In the embodiment of the present application, the electronic device 500 may detect the state and position of the electronic device 500 through the gyroscope sensor and the acceleration sensor. When the state and position of the electronic device 500 change significantly compared to the initial position and initial state, the electronic device 500 may remind the user to correct the state and position of the electronic device 500 in time on the display screen 594 in real time.
[0108] The methods in the following embodiments can all be implemented in the electronic device 500 having the above hardware structure.
[0109] The present application embodiment provides a terminal system interface layout comparison method, which can be applied to the above-mentioned electronic device 500, and the electronic device 500 is used as a test device (test system) to compare the interface layout of the terminal system to be tested with the interface layout of the template terminal system. Figure 6 , Figure 6 The flowchart of the terminal system interface layout comparison method provided by the present application is shown. Figure 6 As shown, the method may include steps S601-S606.
[0110] The present application embodiment provides a terminal system interface layout comparison method, including:
[0111] S601. The electronic device 500 obtains a system interface of a terminal to be tested.
[0112] In some embodiments, the electronic device 500 may receive a system interface of the terminal to be tested from the terminal to be tested. The system interface of the terminal to be tested is obtained by taking a screenshot of the terminal to be tested.
[0113] In other embodiments, the electronic device 500 may receive a screen recording video from the terminal to be tested, and extract image frames from the screen recording video, and use the image frames as the system interface of the terminal to be tested.
[0114] It should be understood that when the system interface layout of the terminal to be tested is detected, it is also necessary to obtain the system interface of the template terminal. To obtain the system interface of the template terminal, a method similar to that of obtaining the system interface of the terminal to be tested can be used. For example, the electronic device 500 can receive a template terminal system interface from a template terminal. The template terminal system interface is obtained by taking a screenshot of the template terminal. Alternatively, the electronic device 500 can receive a screen recording video from the template terminal, extract image frames from the screen recording video, and use the image frames as the template terminal system interface. It should be understood that the template terminal system interface can be obtained in advance before the system interface layout of the terminal to be tested is detected, or it can be obtained when the system interface layout of the terminal to be tested is detected. The embodiment of the present application does not limit the time for obtaining the template terminal system interface.
[0115] The solution provided by the embodiment of the present application can be applied to terminals with different brands, models, resolutions, screen-to-body ratios and other parameters for system interface testing. However, it should be understood that when different mobile phones have different parameters such as brand, model, resolution, screen-to-body ratio, etc., the system interface layout of the terminal will also have a greater impact. Therefore, when the system interface layout of the terminal to be tested is detected, it is necessary to select a template terminal according to the following requirements: when there is no error in the system interface layout of the terminal to be tested (i.e., the display is normal), its system interface layout is consistent with the system interface layout of the template terminal. For example, the template terminal can select a device with the same device type and model as the terminal to be tested, and the same system (including the same system type and the same system version) as the template terminal. Of course, the selection range of the template terminal is not limited to this, even if it is a device of different models (such as different sizes, unequal resolutions, etc.) and different system versions from the terminal to be tested, such as the terminal to be tested and the template terminal are mobile phones of different models and different system versions, as long as the interface layout of the mobile phone to be tested is displayed normally, the interface layout of the mobile phone to be tested is consistent with the interface layout of the template mobile phone, then the template mobile phone can be used to detect the interface layout of the mobile phone to be tested. That is to say, using the solution provided by the embodiment of the present application, the same template mobile phone system interface and its corresponding Graph structure can be applied to the detection of the system interface layout of mobile phones to be tested of multiple models and system versions. Therefore, the embodiment of the present application can effectively solve the problem of interface layout consistency detection across terminal models and system versions.
[0116] Through this step, the system interface of the terminal to be tested can be obtained; in this way, in the subsequent steps, the target object information on the system interface of the terminal to be tested can be obtained based on the system interface of the terminal to be tested obtained in this step, and the target object information on the system interface of the terminal to be tested can be compared with the target object information on the template terminal system interface, so as to determine the consistency between the system interface of the terminal to be tested and the system interface of the template terminal.
[0117] S602. The electronic device 500 performs target detection on the terminal system interface to be tested, and obtains information about all target objects on the terminal system interface to be tested, wherein the target objects include icons and / or texts, and the information about the target objects includes location information of the target objects on the terminal system interface to be tested.
[0118] In some embodiments, the terminal system interface to be tested can be subjected to target detection by a preset target detection model to obtain information about all target objects on the terminal system interface to be tested. Specifically, the terminal system interface to be tested is used as input, the preset target detection model is run, and information about all target objects on the terminal system interface to be tested is output. The preset target detection model has the function of performing target detection on the input terminal system interface and obtaining information about the target objects on the input terminal system interface.
[0119] In some embodiments, the target object on the terminal system interface to be tested includes icons and texts. In this embodiment, the information of the target object includes type information of the target object and location information of the target object on the terminal system interface to be tested. Target detection is performed on the terminal system interface to be tested, that is, the type information of the target object (including icons and texts) on the terminal system interface to be tested and the location information of the target object on the terminal system interface to be tested are detected.
[0120] In combination with the above two embodiments, target detection is performed on the terminal system interface to be tested through a preset target detection model to obtain information of all target objects on the terminal system interface to be tested. Among them, the target objects on the terminal system interface to be tested include icons and texts, and the target object information includes the type information of the target object and the location information of the target object on the terminal system interface to be tested.
[0121] It should be understood that a preset target detection model can also be used to perform target detection on the template terminal system interface. Among them, the target object includes an icon and / or text. The information of the target object includes the type information of the target object and the location information of the target object on the template terminal system interface. Target detection is performed on the template terminal system interface, that is, the type information of the target object (including icons and text) on the terminal system interface to be tested and the location information of the target object on the template terminal system interface are detected. Of course, target detection on the template terminal system interface can be completed in advance before the layout of the terminal system interface to be tested is detected, and the embodiment of the present application does not limit the time for target detection on the template terminal system interface.
[0122] In some embodiments, the above method also includes training to obtain a preset target detection model.
[0123] Exemplarily, training a preset target detection model may include the following steps:
[0124] Construct a training set. The training set includes multiple sets of training sample data pairs, each set of training sample data pairs includes a training sample image and the annotation information corresponding to the training sample image. The training sample image is the terminal system interface; the annotation information corresponding to the training sample image is the information of the target object on the terminal system interface. The training sample image in the training sample data pair is used as the input sample, and the annotation information corresponding to the training sample image is used as the output sample to train the target detection model.
[0125] Exemplarily, training a preset target detection model may further include the following steps:
[0126] Construct a validation set. The validation set includes multiple sets of validation sample data pairs, each set of validation sample data pairs includes a validation sample image and annotation information corresponding to the validation sample image. The validation sample image is the terminal system interface; the annotation information corresponding to the validation sample image is the information of the target object on the terminal system interface. After using at least one set of training sample data pairs to train the target detection model, the validation sample image in the validation set is used as the input of the target detection model, the target detection model is run, and the corresponding detection result is output. Compare the annotation information corresponding to the validation sample image in the validation set with the detection result to determine the accuracy of the target detection model. If the accuracy is less than the preset threshold t, readjust the parameters of the target detection model, and retrain the target detection model using the training set. If the accuracy is greater than or equal to the preset threshold t, save the target detection model as the preset target detection model.
[0127] For example, reference Fig. 7A , Fig. 7A A training process of a target detection model is shown. The training process can be performed by the electronic device 500, or by a server or other device. In other words, the target detection model can also be trained on a server or other device, and then sent to the electronic device 500, and the electronic device 500 uses the trained target detection model as a preset target detection model for target detection on the terminal system interface to be tested, which is not limited in the present embodiment of the application.
[0128] The training process may include steps S701 - S703 .
[0129] S701. Construct a sample data set. The sample data set includes multiple (large) groups of sample data pairs, each of which includes a sample image and annotation information corresponding to the sample image. The sample image is a terminal system interface, and the annotation information corresponding to the sample image is information about a target object on the terminal system interface.
[0130] In some embodiments, the method for acquiring the terminal system interface in this step may be similar to the method for acquiring the terminal system interface to be tested in the above step S601.
[0131] In other embodiments, the terminal system interface in this step may also come from an open source data set.
[0132] In some embodiments, the labeling information corresponding to the sample image in this step is obtained by the following method: labeling the sample image with the target object, using an image labeling tool (such as LabelImg) to label the sample image with the target object (including icons and / or text), and the labeling tool can generate the labeling information corresponding to the sample image (generally stored in an xml or json file). The result of labeling the sample image with the image labeling tool is shown in FIG. Figure 7B shown.
[0133] S702. Divide the sample data set into a training set (Train Set) and a validation set (Validation Set).
[0134] It should be understood that the sample data set is divided to obtain a training set, a validation set and a test set (Test Set). Exemplarily, the sample data set can be divided into a training set, a validation set and a test set in a ratio of 6:2:2. Among them, the training set is used to train the target detection model. Among them, the validation set is used to verify the performance of the current target detection model after each training round during the training process of the target detection model, and to provide a reference for further optimizing the target detection model, wherein optimizing the target detection model includes adjusting the parameters of the target detection model, including loss function, optimizer, number of trainings and other parameters. The test set is used to test the performance of the target detection model finally obtained.
[0135] S703. Train the target detection model so that the trained target detection model has the function of performing target detection on the terminal system interface to be tested and obtaining information of all target objects on the terminal system interface to be tested.
[0136] It should be understood that during the training process of the target detection model, after each training round, the performance of the current target detection model can be verified based on the verification set.
[0137] For example, Figure 7C As shown, the above step S703 may include S7031-S7036.
[0138] S7031. Use sample images in the training set as input samples and annotation information corresponding to the sample images in the training set as output samples to train the target detection model.
[0139] S7032. Use the sample images in the validation set as input to the target detection model, run the target detection model, and output the corresponding detection results.
[0140] S7033. Determine the accuracy of the target detection model based on the annotation information corresponding to the sample image in the validation set and the detection result corresponding to the sample image output by the target detection model.
[0141] S7034, determine whether the accuracy is greater than or equal to the preset threshold t, if the accuracy is less than the preset threshold t, execute S7035; if the accuracy is greater than or equal to the preset threshold t, execute S7036;
[0142] S7035. Re-adjust the parameters of the target detection model and retrain the target detection model using the training set (ie, return to S7031).
[0143] S7036. Save the target detection model as a preset target detection model.
[0144] It should be understood that after obtaining the preset target detection model, the performance of the preset target detection model can be tested based on the test set.
[0145] Exemplarily, the target detection model may adopt a deep learning model, such as a fast region-based convolutional neural network (Faster Region-based Convolutional Neural Network, Faster R-CNN), a region-based full convolutional network (Region-based Fully Convolutional Net, R-FCN), a single-shot detector (Single-Shot Detector, SSD), etc. The embodiment of the present application does not limit the structure and implementation algorithm of the target detection model.
[0146] In some embodiments, performing target detection on the terminal system interface to be tested to obtain information on all target objects on the terminal system interface to be tested includes: performing target detection on the terminal system interface to be tested to obtain the terminal system interface to be tested marked with multiple target detection boxes (or bounding boxes), each target detection box corresponding to a target object on the terminal system interface to be tested. Each target detection box carries type information of the corresponding target object and position information of the corresponding target object on the terminal system interface to be tested (such as two-dimensional coordinates of four vertices of the target detection box on the terminal system interface to be tested).
[0147] S603. The electronic device 500 calculates the relative position relationship between each target object on the interface of the terminal system to be tested based on the information of all target objects on the interface of the terminal system to be tested.
[0148] In some embodiments, Figure 8 The relative position relationship between the target objects on the interface of the terminal system to be tested may include one target object being located at any of the following positions of another target object: directly above, directly below, directly to the left, directly to the right, upper left, upper right, lower left, and lower right. In other words, one target object may be located at one of the above eight positions of another target object.
[0149] Exemplarily, the position information of the target object on the interface of the terminal system to be tested includes the two-dimensional coordinates of four vertices of the target detection box corresponding to the target object on the interface of the terminal system to be tested.
[0150] Exemplarily, the width direction of the terminal system interface is taken as the x-axis, and the direction from left to right of the terminal system interface is taken as the positive direction of the x-axis.
[0151] For two target objects (such as target object one and target object two), draw a ray from the midpoint of the upper edge of the target detection frame corresponding to target object one to the upper side (such as the ray is 90° to the positive direction of the x-axis). If the target detection frame corresponding to target object two intersects with the ray, it can be determined that target object two is located directly above target object one.
[0152] For two target objects (such as target object one and target object two), draw a ray from the midpoint of the bottom edge of the target detection frame corresponding to target object one to the bottom (such as the ray is 270° with the positive direction of the x-axis). If the target detection frame corresponding to target object two intersects with the ray, it can be determined that target object two is located directly below target object one.
[0153] For two target objects (such as target object one and target object two), draw a ray from the midpoint of the left side of the target detection frame corresponding to target object one to the due left (such as the ray is 180° with the positive direction of the x-axis). If the target detection frame corresponding to target object two intersects with the ray, it can be determined that target object two is located to the due left of target object one.
[0154] For two target objects (such as target object one and target object two), draw a ray from the midpoint of the right side of the target detection frame corresponding to target object one to the right (such as the ray is 0° with the positive direction of the x-axis). If the target detection frame corresponding to target object two intersects with the ray, it can be determined that target object two is located to the right of target object one.
[0155] For two target objects (such as target object one and target object two), draw a ray from the upper left vertex of the target detection frame corresponding to target object one to the upper left (such as the ray is 135° with the positive direction of the x-axis). If the target detection frame corresponding to target object two intersects with the ray, it can be determined that target object two is located at the upper left of target object one.
[0156] For two target objects (such as target object one and target object two), draw a ray from the upper right vertex of the target detection frame corresponding to target object one to the upper right (such as the ray is 45° to the positive direction of the x-axis). If the target detection frame corresponding to target object two intersects with the ray, it can be determined that target object two is located to the upper right of target object one.
[0157] For two target objects (such as target object one and target object two), draw a ray from the lower left vertex of the target detection box corresponding to target object one to the lower left (such as the ray is 225° with the positive direction of the x-axis). If the target detection box corresponding to target object two intersects with the ray, it can be determined that target object two is located at the lower left of target object one.
[0158] For two target objects (such as target object one and target object two), draw a ray from the lower right vertex of the target detection box corresponding to target object one to the lower right (such as the ray is 315° with the positive direction of the x-axis). If the target detection box corresponding to target object two intersects with the ray, it can be determined that target object two is located at the lower right of target object one.
[0159] S604. The electronic device 500 constructs a first Graph structure according to the relative positional relationship between each target object on the interface of the terminal system to be tested. Each vertex in the first Graph structure corresponds to a target object on the interface of the terminal system to be tested. The edges connecting the vertices in the first Graph structure are used to characterize the relative positional relationship between the target objects corresponding to the vertices.
[0160] In this way, the first Graph structure can reflect the interface layout of the terminal system to be tested. In this way, the similarity between the first Graph structure and the second Graph structure can be used to reflect whether the interface layout of the terminal system to be tested is consistent with the interface layout of the template terminal system.
[0161] In some embodiments, for each target object on the interface of the terminal system to be tested, the following steps are performed respectively to construct a first Graph structure: according to the relative position relationship between the target objects on the interface of the terminal system to be tested, the second target object closest to the first target object is searched in each of a plurality of preset directions. If the second target object is found, a directed edge from the vertex corresponding to the first target object to the vertex corresponding to the second target object is constructed. The first target object is any target object in the interface of the terminal system to be tested. The edges connecting the vertices in the above-mentioned first Graph structure are used to characterize the relative position relationship between the target objects corresponding to the vertices, including: a directed edge from one vertex to another vertex in the first Graph structure, which is used to characterize the relative position relationship between the target objects corresponding to one vertex and another vertex.
[0162] In some embodiments, the multiple preset directions include: upper right, right, lower right, and lower. Alternatively, the multiple preset directions include: right, lower right, lower, and lower left. Alternatively, the multiple preset directions include: lower right, lower, lower left, and left. Alternatively, the multiple preset directions include: lower, lower left, left, and upper left. Alternatively, the multiple preset directions include: lower left, left, upper left, and upper. Alternatively, the multiple preset directions include: left, upper left, upper, and upper right. Alternatively, the multiple preset directions include: upper left, upper, upper right, and right. Alternatively, the multiple preset directions include: upper, upper right, right, and lower right.
[0163] That is to say, referring to Figure 8 , a target object may be located in one of the eight directions of another target object. However, when constructing the first Graph structure, only four directions are selected from the eight directions as preset directions. And the four selected preset directions are opposite to the other four preset directions that are not selected. For example, if directly above and directly below are opposite, then after selecting directly above as the preset direction, there is no need to select directly below as the preset direction. In this way, for each target object on the interface of the terminal system to be tested, it is only necessary to search for the second target object closest to it in the four preset directions, which can reduce the computational complexity and avoid duplicate edges in the Graph structure, thereby reducing the amount of calculation and improving processing efficiency.
[0164] Exemplarily, the first Graph structure constructed above can be saved using a corresponding adjacency matrix (AdjacencyMatrix) M1. The adjacency matrix M1 is a matrix used to represent the adjacency relationship between vertices. For a Graph structure containing n vertices, the corresponding adjacency matrix M1 is an n-order square matrix, that is, an n×n matrix. The elements of the adjacency matrix M1 can indicate whether there are directed edges connecting the corresponding vertices of the corresponding Graph structure. Let the element in the i-th row and j-th column of the adjacency matrix M1 be M1[i, j]. If the vertex v of the Graph structure corresponding to M1[i, j] i and v j There are directed edges between them, that is, there are v i to v j directed edge, then M1[i, j] = 1; if M1[i, j] corresponds to the vertex v of the Graph structure i and v j There are no directed edges between them, that is, no v i to v j directed edge, then M1[i,j]=0.
[0165] It should be understood that the second Graph structure can also be constructed in a similar manner to the above-mentioned construction of the first Graph structure. Of course, the second Graph structure can be constructed in advance before the interface layout of the terminal system to be tested is detected, and the embodiment of the present application does not limit the execution time of constructing the second Graph structure.
[0166] S605. The electronic device 500 calculates the similarity between the first Graph structure and the second Graph structure, wherein the second Graph structure is the Graph structure corresponding to the template terminal system interface.
[0167] The embodiment of the present application does not limit the algorithm for calculating the similarity of two Graph structures.
[0168] In some embodiments, a graph similarity calculation model based on a neural network can be used to calculate the similarity between two graph structures (such as a first graph structure and a second graph structure), that is, the first graph structure and the second graph structure are taken as input, and the preset graph similarity calculation model based on a neural network is run to obtain the similarity between the first graph structure and the second graph structure. Among them, the preset graph similarity calculation model based on a neural network has the function of performing similarity calculation on a set of input graph structures to obtain the similarity of a set of input graph structures.
[0169] The above-mentioned graph similarity calculation model based on neural network can adopt a neural network approach to fast graph similarity calculation (SimGNN) model, etc.
[0170] SimGNN calculates the similarity of graph structures, including the following steps: for a set of input graph structures (such as Graph1 and Graph2), they are respectively represented by vectors (i.e., graph embedding), and then the similarity is calculated based on the vectors corresponding to the graphs. Representing the graph structure by vectors includes: first, one-hot encoding (i.e., one-hot encoding, also known as one-bit effective encoding) is performed on different vertices in the graph structure to obtain the one-hot vector corresponding to the graph structure. For example, a graph structure has 8 nodes, and 8 one-hot vectors can be obtained accordingly. All the one-hot vectors corresponding to the graph structure are used as the input of the graph convolutional network, and feature extraction is performed through the graph convolutional network to obtain the node-level embedding vector (Node-LevelEmbeddings) corresponding to the graph structure. Based on the node-level embedding vector corresponding to the graph structure, the attention mechanism is used to obtain the graph-level embedding vector (Graph-Level Embeddings) corresponding to the graph structure. The neural tensor network (NTN) is used to calculate the similarity of the graph-level embedding vectors corresponding to the two graph structures, that is, the graph-level embedding vectors corresponding to the two graph structures are input into the neural tensor network, and the neural tensor network is used to extract features and output a similarity vector. In addition, in order to further consider the information of local nodes, pairwise node comparison (Pairwise Node Comparison) is performed based on the node-level embedding vectors corresponding to the two graph structures to obtain a correlation matrix, which is converted into a histogram feature. Finally, the similarity vector output by the neural tensor network is concatenated with the histogram feature obtained by pairwise node comparison, and then the dimension is compressed through several fully connected layers (FC) to obtain the final graph similarity score. The traditional graph structure similarity calculation method needs to calculate the similarity of subgraphs that are isomorphic to the large graph in turn, which is highly complex and takes a lot of time. Compared with the traditional graph structure similarity calculation method, the use of SimGNN to calculate the similarity between two graph structures is more efficient and faster.
[0171] In other embodiments, the relative distance between the target objects on the interface of the terminal system to be tested can also be calculated based on the information of the target objects on the interface of the terminal system to be tested. Calculating the similarity between the first Graph structure and the second Graph structure includes: obtaining first input data, the first input data includes the first Graph structure and the relative distance between the target objects corresponding to the vertices connected by the directed edges in the first Graph structure; obtaining second input data, the second input data includes the second Graph structure and the relative distance between the target objects corresponding to the vertices connected by the directed edges in the second Graph structure; calculating the similarity between the first Graph structure and the second Graph structure based on the first input data and the second input data.
[0172] In some embodiments, the above input data (such as the first input data or the second input data) can be saved using a corresponding adjacency matrix M2. For a Graph structure containing n vertices, the corresponding adjacency matrix M2 is an n-order square matrix, that is, an n×n matrix. The elements of the adjacency matrix M2 can indicate whether there are directed edges connecting the corresponding vertices of the corresponding Graph structure, and the relative distances between the target objects corresponding to the corresponding vertices. Let the element of the i-th row and j-th column of the adjacency matrix M2 be M2[i, j]. If the vertex v of the Graph structure corresponding to M2[i, j] i and v j There are directed edges between them, that is, there are v i to v j directed edge, and vertex v i and v j The relative distance between the corresponding target objects is d ij , then M[i, j] = d ij ; If the vertex v of the Graph structure corresponding to M2[i, j] i and v j There are no directed edges between them, that is, no v i to v j If there is a directed edge, then M2[i, j] = ∞, or M2[i, j] = Null, that is, the element is empty.
[0173] Among them, the vertex v of the Graph structure i and v j The relative distance between the corresponding target objects can be obtained as follows: Let vertex v i and v j The corresponding target objects are Target i and Target j , Target i and Target jThe corresponding target detection frames are BB i and BB j According to BB i and BB j The two-dimensional coordinates of the four vertices of BB on the interface of the terminal system to be tested are calculated. i and BB j The center point P i and P j The two-dimensional coordinates on the interface of the terminal system to be tested. i and P j The two-dimensional coordinates on the interface of the terminal system to be tested are obtained by P i and P j The relative distance between i and P j The relative distance between them is used as Target i and Target j The relative distance d ij .
[0174] S606. The electronic device 500 determines the consistency between the interface layout of the terminal system to be tested and the interface layout of the template terminal system according to the similarity between the first Graph structure and the second Graph structure.
[0175] If the similarity between the first Graph structure and the second Graph structure calculated by this step is greater than or equal to the preset similarity threshold, it means that the similarity between the first Graph structure and the second Graph structure is high, it can be considered that the interface layout of the terminal system to be tested is consistent with the interface layout of the template terminal system, and there is no error in the interface of the terminal system to be tested; if the similarity is less than the preset similarity threshold, it means that there is a large difference between the two Graph structures, it can be considered that the interface layout of the terminal system to be tested is inconsistent with the interface layout of the template terminal system, that is, there is an error in the interface of the terminal system to be tested, and the group of data can be recorded and saved to facilitate the subsequent positioning of the error position on the interface of the terminal system to be tested.
[0176] In some embodiments, in the above step S604, the first Graph structure is a total Graph structure constructed for all target objects, including all icons and / or all texts, on the terminal system interface to be tested detected in step S602. Assuming that the total number of target objects on the terminal system interface to be tested is N1, the number of vertices on the total Graph structure is N1.
[0177] It should be understood that the corresponding second Graph structure is a total Graph structure constructed for all target objects of the template terminal system interface, including all icons and / or all texts. Assuming that the total number of target objects on the template terminal system interface is N2, the number of vertices on the total Graph structure is N2.
[0178] Correspondingly, in the above step S605, calculating the similarity between the first Graph structure and the second Graph structure is calculating the similarity between the above two total Graph structures.
[0179] Correspondingly, in the above step S606, the consistency of the interface layout of the terminal system to be tested and the interface layout of the template terminal system is determined based on the similarity between the first Graph structure and the second Graph structure, that is, based on the similarity of the above two total Graph structures, the consistency of the interface layout of the terminal system to be tested and the interface layout of the template terminal system is determined. Specifically, if the similarity is greater than or equal to the preset similarity threshold, it is determined that the interface layout of the terminal system to be tested is consistent with the interface layout of the template terminal system. If the similarity is less than the preset similarity threshold, it is determined that the interface layout of the terminal system to be tested is inconsistent with the interface layout of the template terminal system.
[0180] In other embodiments, in the above step S602, the target object detected on the terminal system interface to be tested includes an icon and text, and the information of the target object includes type information of the target object and location information of the target object on the terminal system interface to be tested. The type information of the target object is used to indicate whether the target object is an icon or text.
[0181] Accordingly, in the above step S603, the relative position relationship between each icon and each text on the terminal system interface to be tested is calculated based on the type information of the target object and the position information of the target object on the terminal system interface to be tested.
[0182] Correspondingly, in the above step S604, the first Graph structure includes the third Graph structure and the fourth Graph structure.
[0183] For example, suppose the number of icons and texts on the terminal system interface to be tested is N and 11 and N 12 .
[0184] Based on the relative position relationship between the icons of the terminal system interface to be tested detected in step S602, a third Graph structure is constructed. The number of vertices in the third Graph structure is N. 11Each vertex in the third Graph structure corresponds to an icon on the system interface of the terminal to be tested, and the edges connecting the vertices in the third Graph structure can represent the relative positional relationship between the icons corresponding to the vertices.
[0185] Based on the relative position relationship between the texts in the terminal system interface to be tested detected in step S2, a fourth Graph structure is constructed. The number of vertices in the fourth Graph structure is N. 12 Each vertex in the fourth Graph structure corresponds to a text on the interface of the terminal system to be tested, and the edges connecting the vertices in the fourth Graph structure are used to represent the relative position relationship between the texts corresponding to the vertices.
[0186] Correspondingly, the second Graph structure includes a fifth Graph structure and a sixth Graph structure. The fifth Graph structure is a Graph structure corresponding to the icon in the template terminal system interface, and the sixth Graph structure is a Graph structure corresponding to the text in the template terminal system interface.
[0187] For example, suppose the number of icons and texts on the template terminal system interface is N and 21 and N 22 .
[0188] Based on the information of all icons on the template terminal system interface, the relative position relationship between the icons on the template terminal system interface is calculated. According to the relative position relationship between the icons on the terminal system interface to be tested, a fifth Graph structure is constructed. The number of vertices in the fifth Graph structure is N. 21 Each vertex in the fifth Graph structure corresponds to an icon on the template terminal system interface, and the edges connecting the vertices in the fifth Graph structure are used to represent the relative positional relationship between the icons corresponding to the vertices.
[0189] Based on the information of all the texts on the template terminal system interface, the relative position relationship between the various texts on the template terminal system interface is calculated. According to the relative position relationship between the various texts on the terminal system interface to be tested, a sixth Graph structure is constructed. The number of vertices in the sixth Graph structure is N. 22 Each vertex in the sixth Graph structure corresponds to a text on the template terminal system interface, and the edges connecting the vertices in the sixth Graph structure are used to represent the relative position relationship between the texts corresponding to the vertices.
[0190] Take the terminal as a mobile phone as an example, see Figure 9A-9F , Figure 9A-9F Some schematic diagrams of constructing Graph structures for mobile phone system interfaces are shown. Fig.9A For Figure 2 A fifth Graph structure diagram of the template mobile phone system interface construction shown in FIG. Fig. 9B For Figure 2 A sixth Graph structure diagram of the template mobile phone system interface construction shown in FIG. Fig. 9C For Figure 3A A fourth Graph structure diagram of the mobile phone system interface is shown. Fig.9D For Figure 3B A third Graph structure diagram of the mobile phone system interface is shown. Fig.9E For Figure 3C A third Graph structure diagram of a mobile phone system interface is shown. Fig.9F For Figure 3D A third Graph structure diagram of the mobile phone system interface is shown. Figure 9G For Figure 3D A fourth Graph structure diagram of the mobile phone system interface is shown. It should be noted that: Figure 9A-9G It is only used to simply illustrate the contents of various Graph structures in the embodiments of the present application. The actual Graph structure may include more or fewer vertices and / or edges than shown in the figure. Figure 9A-9G The illustrated Graph structure does not constitute a specific limitation on the actual Graph structure.
[0191] Correspondingly, in the above step S605, calculating the similarity between the first Graph structure and the second Graph structure includes: calculating the similarity S1 between the third Graph structure and the fifth Graph structure; and calculating the similarity S2 between the fourth Graph structure and the sixth Graph structure.
[0192] Accordingly, in the above step S606, the consistency between the interface layout of the terminal system to be tested and the interface layout of the template terminal system is determined according to the calculated similarity, including: based on the similarity S1 and the similarity S2, the consistency between the interface layout of the terminal system to be tested and the interface layout of the template terminal system is determined.
[0193] In some embodiments, based on the similarity S1 and the similarity S2, the consistency of the interface layout of the terminal system to be tested and the interface layout of the template terminal system is determined, and the method is: if the similarity S1 between the third Graph structure and the fifth Graph structure is greater than or equal to the preset similarity threshold T, and the similarity S2 between the fourth Graph structure and the sixth Graph structure is greater than or equal to the preset similarity threshold T, it means that the similarity between the first Graph structure and the second Graph structure is high, and it can be determined that the interface layout of the terminal system to be tested is consistent with the interface layout of the template terminal system. On the contrary, if one of the similarity S1 between the third Graph structure and the fifth Graph structure and the similarity S2 between the fourth Graph structure and the sixth Graph structure is less than the preset similarity threshold T, it is determined that the interface layout of the terminal system to be tested is inconsistent with the interface layout of the template terminal system. The comparison logic is shown in Table 1.
[0194] Table 1 Comparison logic
[0195]
[0196] Through the solution provided by this embodiment, only when the similarity S1 between the third Graph structure and the fifth Graph structure, and the similarity S2 between the fourth Graph structure and the sixth Graph structure are both greater than or equal to the preset similarity threshold T, will it be determined that the interface layout of the terminal system to be tested is consistent with the interface layout of the template terminal system, thereby achieving a more rigorous test of the interface layout of the terminal system to be tested.
[0197] In other embodiments, based on the similarity S1 and the similarity S2, the consistency of the interface layout of the terminal system to be tested and the interface layout of the template terminal system is determined by: setting a weight W1 for the similarity S1 between the third Graph structure and the fifth Graph structure, and setting a weight W2 for the similarity S2 between the fourth Graph structure and the sixth Graph structure, and obtaining a final similarity value S through weighted calculation, S=S1W1+S2W2. Based on the final similarity value S, the comparison result of the interface of the terminal system to be tested and the interface of the template terminal system is obtained. For example, if the final similarity value S is greater than or equal to the preset similarity threshold T, it is considered that the interface layout of the terminal system to be tested is consistent with the interface layout of the template terminal system; if the final similarity value S is less than the preset similarity threshold T, it is considered that the interface layout of the terminal system to be tested is inconsistent with the interface layout of the template terminal system.
[0198] Through the scheme provided in this embodiment, different / same weights can be set for the similarity S1 between the third Graph structure and the fifth Graph structure, and the similarity S2 between the fourth Graph structure and the sixth Graph structure, based on the layout consistency requirements for the target objects of the icon type and the target objects of the text type on the terminal system interface layout. For example, if the layout consistency requirements for the target objects of the icon type on the terminal system interface layout are higher, a larger weight can be set for S1, and a relatively smaller weight can be set for S2, that is, W1>W2. In this way, different weights can be assigned to the Graph structures constructed for different types of target objects according to the test requirements, so that the comparison parameters can be flexibly adjusted to make the comparison method and results meet the test requirements.
[0199] In other embodiments, based on the similarity S1 and the similarity S2, the consistency of the interface layout of the terminal system to be tested and the interface layout of the template terminal system is determined by: setting a first preset similarity threshold T1 for the similarity S1 between the third Graph structure and the fifth Graph structure, and setting a second preset similarity threshold T2 for the similarity S2 between the fourth Graph structure and the sixth Graph structure. If the similarity S1 between the third Graph structure and the fifth Graph structure is greater than or equal to the first preset similarity threshold T1, and the similarity S2 between the fourth Graph structure and the sixth Graph structure is greater than or equal to the second preset similarity threshold T2, then it is determined that the interface layout of the terminal system to be tested is consistent with the interface layout of the template terminal system. On the contrary, if one of the similarity S1 between the third Graph structure and the fifth Graph structure and the similarity S2 between the fourth Graph structure and the sixth Graph structure is less than the corresponding threshold, then it is determined that the interface layout of the terminal system to be tested is inconsistent with the interface layout of the template terminal system.
[0200] Through the scheme provided in this embodiment, different / same preset similarity thresholds can be set for the similarity S1 between the third Graph structure and the fifth Graph structure, and the similarity S2 between the fourth Graph structure and the sixth Graph structure, based on the layout consistency requirements for the target objects of the icon type and the target objects of the text type on the terminal system interface layout. For example, if the layout consistency requirements for the target objects of the icon type on the terminal system interface layout are higher, a larger preset similarity threshold can be set for S1, and a relatively smaller preset similarity threshold can be set for S2, that is, T1>T2. In this way, different preset similarity thresholds can be assigned to the Graph structures constructed for different types of target objects according to the test requirements, so that the comparison parameters and comparison methods can be flexibly adjusted to meet the test requirements.
[0201] In some embodiments, see Fig.10, Fig.10 A flow chart comparing the terminal system interface to be tested and the template terminal system interface is shown. Fig.10 As shown, before calculating the relative position relationship between each target object on the interface of the terminal system to be tested based on the information of all target objects on the interface of the terminal system to be tested in step S603, it also includes: comparing the total number of target objects on the interface of the terminal system to be tested and the interface of the template terminal system. Suppose the total number of target objects on the interface of the terminal system to be tested is N1, and the total number of target objects on the interface of the template terminal system is N2. If the total number of target objects on the interface of the terminal system to be tested is different from that on the interface of the template terminal system, that is, N1≠N2, it is determined that the layout of the interface of the terminal system to be tested is inconsistent with that of the template terminal system; if the total number of target objects on the interface of the terminal system to be tested and the interface of the template terminal system are the same, that is, N1=N2, then further compare the proportion of the same type of target objects on the interface of the terminal system to be tested and the interface of the template terminal system. Suppose the number of icons and texts on the interface of the terminal system to be tested is N respectively. 11 and N 12 , the number of icons and texts on the template terminal system interface are N 21 and N 22 , if N 11 / N1≠N 21 / N2,N 12 / N1≠N 22 / N2, that is, the proportion of the same type of target objects on the test terminal system interface and the template terminal system interface is different, then it is determined that the layout of the terminal system interface to be tested is inconsistent with the layout of the template terminal system interface; if N 11 / N1=N 21 / N2,N 12 / N1=N 22 / N2, then execute step S603 to calculate the relative position relationship between the target objects on the interface of the terminal system to be tested based on the information of all the target objects on the interface of the terminal system to be tested, and further execute the above S604-S606 to determine whether the layout of the interface of the terminal system to be tested is consistent with the layout of the interface of the template terminal system.
[0202] Through the scheme provided by this embodiment, only when the total number of target objects on the terminal system interface to be tested is the same as the total number of target objects on the template terminal system interface, the proportion of the same type of target objects on the terminal system interface to be tested and the template terminal system interface is the same, and the similarity between the Graph structure corresponding to the terminal system interface to be tested and the Graph structure corresponding to the template terminal system interface is greater than or equal to the preset similarity threshold, will the layout of the terminal system interface to be tested be determined to be consistent with the layout of the template terminal system interface, thereby achieving a more stringent test of the layout of the terminal system interface to be tested. In addition, using the scheme provided by this embodiment, the total number of target objects on the terminal system interface to be tested is compared with the total number of target objects on the template terminal system interface, and the proportion of the same type of target objects on the terminal system interface to be tested and the template terminal system interface is compared. If the total number of target objects or the proportion of the same type of target objects on the terminal system interface to be tested and the template terminal system interface are inconsistent, it can be determined that the layout of the terminal system interface to be tested is inconsistent with the layout of the template terminal system interface. In this way, the test results can be quickly obtained without the need to construct the Graph structure and compare the graph similarity, thereby improving the test efficiency.
[0203] Based on the technical solution provided by the above-mentioned embodiments of the present application, there is no need to use the control method. It is possible to use the target object detection method based on deep learning algorithms to obtain the terminal system interface elements and fully explore the topological invariance information in the terminal system interface. Using a more robust Graph structure to model the terminal system interface content and compare it based on the Graph structure can solve the problem of different terminal resolution differences, realize the automation of system interface layout comparison across terminal models, and effectively improve the consistency test efficiency across terminal models. And there is no need to write scripts, which can lower the entry threshold for testers.
[0204] Some other embodiments of the present application provide an electronic device having the function of implementing the method described in the above method embodiment. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0205] Exemplarily, an embodiment of the present application provides an electronic device, the electronic device comprising:
[0206] The data acquisition module is used to acquire the system interface of the terminal to be tested, that is, to implement the function of step S601 in the above method embodiment.
[0207] The target object detection module is used to perform target detection on the terminal system interface to be tested and obtain information of all target objects on the terminal system interface to be tested, that is, to implement the function of step S602 in the above method embodiment.
[0208] The relative position relationship detection module is used to calculate the relative position relationship between each target object on the interface of the terminal system to be tested based on the information of each target object on the interface of the terminal system to be tested, that is, to implement the function of step S603 in the above method embodiment.
[0209] The Graph structure construction module is used to construct a first Graph structure according to the relative position relationship between each target object on the interface of the terminal system to be tested. Each vertex in the first Graph structure corresponds to a target object on the interface of the terminal system to be tested. The edges connecting the vertices in the first Graph structure are used to characterize the relative position relationship between the target objects corresponding to the vertices. That is, it is used to implement the function of step S604 in the above method embodiment.
[0210] The similarity calculation module is used to calculate the similarity between the first Graph structure and the second Graph structure, wherein the second Graph structure is the Graph structure corresponding to the template terminal system interface, that is, to implement the function of step S605 in the above method embodiment.
[0211] The comparison module determines the consistency between the interface layout of the terminal system to be tested and the interface layout of the template terminal system according to the similarity between the first Graph structure and the second Graph structure, that is, it is used to implement the function of step S606 in the above method embodiment.
[0212] Some other embodiments of the present application provide an electronic device, which may include: a memory and one or more processors.
[0213] The memory is coupled to the processor. The memory stores computer program code, which includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the steps in the above method embodiment to achieve the corresponding functions. The structure of the electronic device can refer to Figure 5 The structure of the electronic device 500 is shown.
[0214] The present application also provides a chip system, such as Fig.11 As shown, the chip system 1100 includes at least one processor 1101 and at least one interface circuit 1102. The chip system is used to support the electronic device to implement the functions involved in the above method embodiment.
[0215] The processor 1101 and the interface circuit 1102 can be interconnected via lines. For example, the interface circuit 1102 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 1102 can be used to send signals to other devices (such as the processor 1101). Exemplarily, the interface circuit 1102 can read instructions stored in the memory and send the instructions to the processor 1101. When the instructions are executed by the processor 1101, the electronic device can execute the various steps in the above method embodiment. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiments of the present application.
[0216] The embodiment of the present application also provides a computer storage medium, which includes computer instructions, and when the computer instructions are executed on a computer, the computer executes each step in the above method embodiment to achieve corresponding functions. For example, the computer may be the above electronic device 500.
[0217] The embodiment of the present application further provides a computer program product, which, when executed on a computer, enables the computer to execute each step in the above method embodiment and implement each corresponding function. For example, the computer may be the above electronic device 500.
[0218] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0219] Each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0220] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk.
[0221] The above is only a specific implementation of the embodiment of the present application, but the protection scope of the embodiment of the present application is not limited thereto, and any changes or replacements within the technical scope disclosed in the embodiment of the present application should be included in the protection scope of the embodiment of the present application. Therefore, the protection scope of the embodiment of the present application should be based on the protection scope of the claims.
Claims
1. A terminal system interface layout comparison method, characterized in that: include: Get the terminal system interface to be tested; Performing target detection on the terminal system interface to be tested to obtain information of all target objects on the terminal system interface to be tested; wherein the target objects include icons and / or texts, and the target object information includes location information of the target objects on the terminal system interface to be tested; Based on the information of all target objects on the interface of the terminal system to be tested, the relative position relationship between the target objects on the interface of the terminal system to be tested is calculated; According to the relative position relationship between the target objects on the interface of the terminal system to be tested, the target object closest to the target object is searched in multiple preset directions of each target object to construct a first Graph structure; wherein each vertex in the first Graph structure corresponds to a target object on the interface of the terminal system to be tested, and the edges connecting the vertices in the first Graph structure are used to characterize the relative position relationship between the target objects corresponding to the vertices; the first Graph structure includes a third Graph structure and a fourth Graph structure, the third Graph structure is a Graph structure corresponding to the icon on the interface of the terminal system to be tested, and the fourth Graph structure is a Graph structure corresponding to the text on the interface of the terminal system to be tested; Calculating the similarity between the first Graph structure and the second Graph structure; wherein the second Graph structure is a Graph structure corresponding to the template terminal system interface, the second Graph structure includes a fifth Graph structure and a sixth Graph structure, the fifth Graph structure is a Graph structure corresponding to an icon in the template terminal system interface, and the sixth Graph structure is a Graph structure corresponding to a text in the template terminal system interface; the calculating the similarity between the first Graph structure and the second Graph structure includes: calculating the similarity between the third Graph structure and the fifth Graph structure and calculating the similarity between the fourth Graph structure and the sixth Graph structure; The consistency between the interface layout of the terminal system to be tested and the interface layout of the template terminal system is determined according to the calculated similarity; wherein the situation that the interface layout of the terminal system to be tested is consistent with the interface layout of the template terminal system at least includes that the similarity between the first Graph structure and the second Graph structure is greater than or equal to a preset similarity threshold; or, the similarity between the third Graph structure and the fifth Graph structure is greater than or equal to the preset similarity threshold, and the similarity between the fourth Graph structure and the sixth Graph structure is greater than or equal to the preset similarity threshold.
2. The method according to claim 1, characterized in that The relative position relationship between the target objects on the interface of the terminal system to be tested includes one target object being located at any of the following positions of another target object: directly above, directly below, directly to the left, directly to the right, upper left, upper right, lower left and lower right.
3. The method according to claim 1 or 2, characterized in that: The step of searching for the nearest target object in multiple preset directions of each target object according to the relative position relationship between the target objects on the interface of the terminal system to be tested, and constructing a first Graph structure includes: For each target object, perform the following steps to construct the first Graph structure: According to the relative position relationship between the target objects on the interface of the terminal system to be tested, searching for a second target object closest to the first target object in each of the plurality of preset directions; If the second target object is found, constructing a directed edge from the vertex corresponding to the first target object to the vertex corresponding to the second target object; Wherein, the first target object is any target object in the terminal system interface to be tested; The edges connecting the vertices in the first Graph structure are used to characterize the relative position relationship between the target objects corresponding to the vertices, including: a directed edge from one vertex to another vertex in the first Graph structure, which is used to characterize the relative position relationship between the one vertex and the target object corresponding to the other vertex.
4. The method according to claim 3, characterized in that The multiple preset directions include: upper right, right, lower right and below; Alternatively, the plurality of preset directions include: directly to the right, lower right, directly below, and lower left; Alternatively, the plurality of preset directions include: lower right, directly below, lower left and directly left; Alternatively, the plurality of preset directions include: directly below, lower left, directly left and upper left; Alternatively, the plurality of preset directions include: lower left, directly left, upper left and directly above; Alternatively, the plurality of preset directions include: directly left, upper left, directly above, and upper right; Alternatively, the plurality of preset directions include: upper left, directly above, upper right and directly right; Alternatively, the plurality of preset directions include: directly above, upper right, directly right, and lower right.
5. The method according to any one of claims 1 to 4, characterized in that The calculating the similarity between the first Graph structure and the second Graph structure includes: Taking the first Graph structure and the second Graph structure as input, running a preset graph similarity calculation model based on a neural network, and obtaining the similarity between the first Graph structure and the second Graph structure; The preset neural network-based graph similarity calculation model has the function of performing similarity calculation on a set of input graph structures to obtain the similarity of the set of input graph structures.
6. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Based on the information of all target objects on the interface of the terminal system to be tested, the relative distance between each target object on the interface of the terminal system to be tested is calculated; The calculating the similarity between the first Graph structure and the second Graph structure includes: Acquire first input data, where the first input data includes the first Graph structure and relative distances between target objects corresponding to vertices connected by directed edges in the first Graph structure; Acquire second input data, where the second input data includes the second Graph structure and relative distances between target objects corresponding to vertices connected by directed edges in the second Graph structure; The similarity between the first Graph structure and the second Graph structure is calculated according to the first input data and the second input data.
7. The method according to any one of claims 1 to 6, characterized in that The step of determining the consistency between the interface layout of the terminal system to be tested and the interface layout of the template terminal system according to the calculated similarity includes: If the similarity is greater than or equal to a preset similarity threshold, it is determined that the interface layout of the terminal system to be tested is consistent with the interface layout of the template terminal system; If the similarity is less than a preset similarity threshold, it is determined that the interface layout of the terminal system to be tested is inconsistent with the interface layout of the template terminal system.
8. The method according to claim 1, characterized in that: The target object includes an icon and a text; the information of the target object also includes type information of the target object; the type information of the target object is used to indicate that the target object is an icon or a text; The calculating the relative position relationship between the target objects on the interface of the terminal system to be tested based on the information of all the target objects on the interface of the terminal system to be tested comprises: Based on the type information of the target object on the interface of the terminal system to be tested and the position information of the target object on the interface of the terminal system to be tested, respectively calculating the relative position relationship between each icon and the relative position relationship between each text on the interface of the terminal system to be tested; The step of searching for the nearest target object in multiple preset directions of each target object according to the relative position relationship between the target objects on the interface of the terminal system to be tested, and constructing a first Graph structure includes: Based on the relative positional relationship between the icons on the interface of the terminal system to be tested, the third Graph structure is constructed; wherein each vertex in the third Graph structure corresponds to an icon on the interface of the terminal system to be tested, and the edges connecting the vertices in the third Graph structure are used to represent the relative positional relationship between the icons corresponding to the vertices; Based on the relative position relationship between the texts on the interface of the terminal system to be tested, the fourth Graph structure is constructed; wherein each vertex in the fourth Graph structure corresponds to a text on the interface of the terminal system to be tested, and the edges connecting the vertices in the fourth Graph structure are used to characterize the relative position relationship between the texts corresponding to the vertices.
9. The method according to claim 1 or 8, characterized in that: Before calculating the similarity between the first Graph structure and the second Graph structure, the method further includes: Performing target detection on the template terminal system interface to obtain information of all target objects on the template terminal system interface; wherein the target object includes an icon or text, and the target object information includes location information of the target object on the template terminal system interface; Based on the information of all icons on the template terminal system interface, the relative position relationship between the icons on the template terminal system interface is calculated; according to the relative position relationship between the icons on the terminal system interface to be tested, the fifth Graph structure is constructed; wherein each vertex in the fifth Graph structure corresponds to an icon on the template terminal system interface, and the edges connecting the vertices in the fifth Graph structure are used to characterize the relative position relationship between the icons corresponding to the vertices; Based on the information of all the texts on the template terminal system interface, the relative position relationship between the various texts on the template terminal system interface is calculated; according to the relative position relationship between the various texts on the terminal system interface to be tested, the sixth Graph structure is constructed; wherein each vertex in the sixth Graph structure corresponds to a text on the template terminal system interface, and the edges connecting the vertices in the sixth Graph structure are used to characterize the relative position relationship between the texts corresponding to the vertices.
10. The method according to claim 1, characterized in that The determining, based on the similarity S1 and the similarity S2, the consistency between the interface layout of the terminal system to be tested and the interface layout of the template terminal system includes: If the similarity S1 is greater than or equal to a preset similarity threshold, and the similarity S2 is greater than or equal to a preset similarity threshold, it is determined that the interface layout of the terminal system to be tested is consistent with the interface layout of the template terminal system; If the similarity S1 is smaller than a preset similarity threshold, or the similarity S2 is smaller than a preset similarity threshold, it is determined that the interface layout of the terminal system to be tested is inconsistent with the interface layout of the template terminal system.
11. The method according to any one of claims 1 to 10, characterized in that The step of obtaining the terminal system interface to be tested includes: receiving the system interface of the terminal to be tested from the terminal to be tested, where the system interface of the terminal to be tested is obtained by taking a screenshot of the terminal to be tested; or, Receive a screen recording video from the terminal to be tested, extract image frames from the screen recording video, and use the image frames as the system interface of the terminal to be tested.
12. The method according to any one of claims 1 to 11, characterized in that The performing target detection on the terminal system interface to be tested to obtain information of all target objects on the terminal system interface to be tested includes: Taking the terminal system interface to be tested as input, running a preset target detection model, and outputting information of all target objects on the terminal system interface to be tested; The preset target detection model has the function of performing target detection on the input terminal system interface and obtaining information corresponding to the target on the input terminal system interface.
13. The method according to claim 12, characterized in that The method further comprises: Constructing a training set; the training set includes multiple sets of training sample data pairs, each set of training sample data pairs includes a training sample image and annotation information corresponding to the training sample image; the training sample image is a terminal system interface; the annotation information corresponding to the training sample image is information of a target object on the terminal system interface; The training sample images in the training sample data pair are used as input samples, and the annotation information corresponding to the training sample images are used as output samples to train the target detection model.
14. The method according to claim 13, characterized in that The method further comprises: Constructing a verification set; the verification set includes multiple groups of verification sample data pairs, each group of verification sample data pairs includes a verification sample image and annotation information corresponding to the verification sample image; the verification sample image is a terminal system interface; the annotation information corresponding to the verification sample image is information of a target object on the terminal system interface; After using at least one set of the training sample data to train the target detection model, using the verification sample images in the verification set as input to the target detection model, running the target detection model, and outputting corresponding detection results; Comparing the annotation information corresponding to the verification sample image in the verification set with the detection result to determine the accuracy of the target detection model; When the accuracy is less than a preset threshold t, readjust the parameters of the target detection model and retrain the target detection model using the training set; When the accuracy is greater than or equal to a preset threshold t, the target detection model is saved as the preset target detection model.
15. The method according to any one of claims 1 to 14, characterized in that Before calculating the relative position relationship between the target objects on the interface of the terminal system to be tested based on the information of all the target objects on the interface of the terminal system to be tested, the method further includes: If the total number of target objects on the terminal system interface to be tested is the same as the total number of target objects on the template terminal system interface, and the proportion of target objects of the same type on the terminal system interface to be tested and the template terminal system interface is the same, then based on the information of all target objects on the terminal system interface to be tested, the relative position relationship between each target object on the terminal system interface to be tested is calculated.
16. The method according to claim 15, characterized in that The method further comprises: If the total number of target objects on the interface of the terminal system to be tested is different from the total number of target objects on the interface of the template terminal system, it is determined that the interface layout of the terminal system to be tested is inconsistent with the interface layout of the template terminal system; or, If the proportions of the same type of target objects on the test terminal system interface and the template terminal system interface are different, it is determined that the layout of the terminal system interface to be tested is inconsistent with the layout of the template terminal system interface.
17. An electronic device, characterized in that: The electronic device includes a memory and one or more processors; the memory and the processor are coupled; wherein computer program code is stored in the memory, and the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1-16.
18. A computer-readable storage medium, characterized in that: The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in any one of claims 1 to 16.
