CN111858289A - Method and device for testing graphical user interface and computer readable storage medium - Google Patents
Method and device for testing graphical user interface and computer readable storage medium Download PDFInfo
- Publication number
- CN111858289A CN111858289A CN201910357829.XA CN201910357829A CN111858289A CN 111858289 A CN111858289 A CN 111858289A CN 201910357829 A CN201910357829 A CN 201910357829A CN 111858289 A CN111858289 A CN 111858289A
- Authority
- CN
- China
- Prior art keywords
- page
- tested
- page element
- similarity
- testing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 97
- 238000000034 method Methods 0.000 title claims abstract description 46
- 238000004364 calculation method Methods 0.000 claims description 9
- 238000010998 test method Methods 0.000 claims description 2
- 238000004891 communication Methods 0.000 description 6
- 239000013598 vector Substances 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000001545 Page's trend test Methods 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000013102 re-test Methods 0.000 description 1
- 238000013522 software testing Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a method for testing a graphical user interface, which comprises the following steps: when a page element ID to be tested is received, acquiring a page element to be tested corresponding to the page element ID to be tested in a page; when the page elements to be tested are not obtained, obtaining each page element in the page; calculating the similarity between the ID of each page element and the ID of the page element to be tested; and taking the page elements with the similarity meeting the preset conditions as the page elements to be tested, and testing the page elements to be tested. The invention also discloses a testing device and a storage medium for the graphical user interface. When the version of the graphical user interface is updated, the element with the slightly changed ID of the element can still be acquired and tested, so that the probability of automatic test failure after the version of the graphical user interface is updated is reduced.
Description
Technical Field
The present invention relates to the field of software testing, and in particular, to a method and an apparatus for testing a graphical user interface, and a computer-readable storage medium.
Background
A Graphical User Interface (GUI) is a main way for interaction between computer software and a User, and in order to ensure that a developed GUI can normally operate, the developed GUI needs to be tested in a GUI development process.
At present, the automatic testing of the GUI generally tests elements in the GUI page through test cases, but in the GUI development process, when the version of the GUI is updated, the ID of the element in the GUI page may also be changed, and at this time, the same test case cannot be used to acquire the element whose version is updated and whose ID is sent to be changed in the GUI page, so that the automatic testing fails after the GUI version is updated.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a method and a device for testing a graphical user interface and a computer readable storage medium, aiming at solving the problem that in the existing graphical user interface automatic test, an element with an ID changed cannot be obtained after the graphical user interface version is updated, so that the test fails.
In order to achieve the above object, the present invention provides a method for testing a graphical user interface, comprising the steps of:
When a page element ID to be tested is received, acquiring a page element to be tested corresponding to the page element ID to be tested in a page;
when the page elements to be tested are not obtained, obtaining each page element in the page;
calculating the similarity between the ID of each page element and the ID of the page element to be tested;
and taking the page elements with the similarity meeting the preset conditions as the page elements to be tested, and testing the page elements to be tested.
Preferably, after the step of calculating the similarity between the ID of each page element and the ID of the page element to be tested, the method further includes:
judging whether each similarity is larger than a preset threshold value or not;
and when at least one similarity is larger than the preset threshold, acquiring the maximum similarity in the similarities, and taking the page element corresponding to the maximum similarity as the page element meeting the preset condition.
Preferably, after the step of obtaining each page element in the page when the page element to be tested is not obtained, the method further includes:
when the page element is not acquired in the page, closing the page, and recording closing times;
Re-opening the page, and executing the step of acquiring the page element to be tested corresponding to the page element to be tested ID in the page;
and when the closing times are more than the preset times, judging that the test fails.
Preferably, after the step of determining whether each of the similarity degrees is greater than a preset threshold, the method further includes:
when the similarity is smaller than or equal to the preset threshold value, closing the page, and recording the closing times of the page;
re-opening the page, and executing the step of acquiring the page element to be tested corresponding to the page element to be tested ID in the page;
and when the closing times are more than the preset times, judging that the test fails.
Preferably, after the step of determining that the test fails, the method further includes:
and outputting prompt information of test failure.
Preferably, the calculation method of the similarity includes a cosine similarity calculation method.
Preferably, after the step of obtaining the page element to be tested corresponding to the page element to be tested ID in the page, the method further includes:
and testing the page elements to be tested when the page elements to be tested are obtained.
Preferably, after the step of testing the page element to be tested, the method further includes:
And after the test is finished, outputting the source of the page element to be tested, wherein the source of the page element to be tested is directly hit when the page element to be tested is the page element corresponding to the page element ID to be tested, and the source of the page element to be tested is similarity matching when the similarity of the page element to be tested is the page element meeting the preset condition.
In addition, to achieve the above object, the present invention further provides a testing apparatus for a graphical user interface, including: the testing method comprises a memory, a processor and a testing program of the graphical user interface, wherein the testing program of the graphical user interface is stored on the memory and can run on the processor, and when the testing program of the graphical user interface is executed by the processor, the steps of the testing method of the graphical user interface are realized.
In addition, to achieve the above object, the present invention further provides a computer storage medium, on which a test program of a graphical user interface is stored, and the test program of the graphical user interface, when executed by a processor, implements the steps of the method for testing the graphical user interface as described in any one of the above items.
According to the method, the device and the computer-readable storage medium for testing the graphical user interface, provided by the embodiment of the invention, when a page element ID to be tested is received, a page element to be tested corresponding to the page element ID to be tested is obtained in a page; when the page elements to be tested are not obtained, obtaining each page element in the page; calculating the similarity between the ID of each page element and the ID of the page element to be tested; and taking the page elements with the similarity meeting the preset conditions as the page elements to be tested, and testing the page elements to be tested. When the version of the graphical user interface is updated, the element with the slightly changed ID of the element can still be acquired and tested, so that the probability of automatic test failure after the version of the graphical user interface is updated is reduced.
Drawings
Fig. 1 is a schematic terminal structure diagram of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for testing a graphical user interface according to an embodiment of the present invention;
fig. 3 is a detailed flowchart of step S40 in fig. 2.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The main solution of the embodiment of the invention is as follows:
when a page element ID to be tested is received, acquiring a page element to be tested corresponding to the page element ID to be tested in a page;
when the page elements to be tested are not obtained, obtaining each page element in the page;
calculating the similarity between the ID of each page element and the ID of the page element to be tested;
and taking the page elements with the similarity meeting the preset conditions as the page elements to be tested, and testing the page elements to be tested.
In the prior art, the element with the changed ID cannot be acquired after the version of the graphical user interface is updated in the automatic test of the graphical user interface, so that the test fails.
The invention provides a solution, so that when the version of the graphical user interface is updated, the element with the slightly changed ID of the element can still be acquired and tested, and the probability of automatic test failure after the version of the graphical user interface is updated is reduced.
As shown in fig. 1, fig. 1 is a schematic terminal structure diagram of a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the terminal structure shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein a test program of an operating system, a network communication module, a user interface module, and a graphic user interface.
In the terminal shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to invoke a test program of the graphical user interface stored in the memory 1005 and perform the following operations:
when a page element ID to be tested is received, acquiring a page element to be tested corresponding to the page element ID to be tested in a page;
when the page elements to be tested are not obtained, obtaining each page element in the page;
calculating the similarity between the ID of each page element and the ID of the page element to be tested;
and taking the page elements with the similarity meeting the preset conditions as the page elements to be tested, and testing the page elements to be tested.
Further, the processor 1001 may call a test program of the graphical user interface stored in the memory 1005, and also perform the following operations:
judging whether each similarity is larger than a preset threshold value or not;
and when at least one similarity is larger than the preset threshold, acquiring the maximum similarity in the similarities, and taking the page element corresponding to the maximum similarity as the page element meeting the preset condition.
Further, the processor 1001 may call a test program of the graphical user interface stored in the memory 1005, and also perform the following operations:
when the page element is not acquired in the page, closing the page, and recording closing times;
re-opening the page, and executing the step of acquiring the page element to be tested corresponding to the page element to be tested ID in the page;
and when the closing times are more than the preset times, judging that the test fails.
Further, the processor 1001 may call a test program of the graphical user interface stored in the memory 1005, and also perform the following operations:
when the similarity is smaller than or equal to the preset threshold value, closing the page, and recording the closing times of the page;
re-opening the page, and executing the step of acquiring the page element to be tested corresponding to the page element to be tested ID in the page;
and when the closing times are more than the preset times, judging that the test fails.
Further, the processor 1001 may call a test program of the graphical user interface stored in the memory 1005, and also perform the following operations:
and outputting prompt information of test failure.
Further, the processor 1001 may call a test program of the graphical user interface stored in the memory 1005, and also perform the following operations:
the similarity calculation method comprises a cosine similarity calculation method.
Further, the processor 1001 may call a test program of the graphical user interface stored in the memory 1005, and also perform the following operations:
and testing the page elements to be tested when the page elements to be tested are obtained.
Further, the processor 1001 may call a test program of the graphical user interface stored in the memory 1005, and also perform the following operations:
and after the test is finished, outputting the source of the page element to be tested, wherein the source of the page element to be tested is directly hit when the page element to be tested is the page element to be tested corresponding to the page element to be tested ID, and the source of the page element to be tested is similarity matching when the similarity of the page element to be tested is the page element meeting the preset condition.
According to the scheme, when a server receives a page element ID to be tested, the server obtains a page element to be tested corresponding to the page element ID to be tested in a page; when the page elements to be tested are not obtained, obtaining each page element in the page; calculating the similarity between the ID of each page element and the ID of the page element to be tested; and taking the page elements with the similarity meeting the preset conditions as the page elements to be tested, and testing the page elements to be tested. Because the element with the ID slightly changed can still be acquired and tested when the graphical user interface version is updated, the probability of automatic test failure after the graphical user interface version is updated is reduced.
Referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of a method for testing a graphical user interface according to the present invention, where the method for testing a graphical user interface includes:
step S10, when a page element ID to be tested is received, obtaining a page element to be tested corresponding to the page element ID to be tested in a page;
in the embodiment of the invention, the server stores the test cases and the page element IDs of all page elements in the GUI page, the test cases correspond to the page element IDs, when the GUI page test is required, the server acquires the page element IDs to be tested of the page to be tested, opens the page to be tested, and matches the page elements to be tested in the page to be tested by using the page element IDs to be tested. Specifically, when the server receives a page element ID to be tested, the server obtains a page element to be tested corresponding to the page element ID to be tested from the page to be tested, that is, searches for a page element with the same ID as the page element ID to be tested from the page to be tested.
Step S20, when the page elements to be tested are not obtained, obtaining each page element in the page;
when a page element with the same ID as that of the page element to be tested exists in the page, the server directly obtains the page element to be tested according to the page element ID, and the server tests the page element to be tested directly obtained through the page element ID to be tested. When the version of the GUI page is upgraded and the like, the version of the ID of the page element in the page is changed, at the moment, the page element with the ID identical to that of the page element to be tested does not exist in the page, and the server cannot directly acquire the page element to be tested through the ID of the page element to be tested; the server detects the page and acquires all page elements in the page.
Step S30, calculating the similarity between the ID of each page element and the ID of the page element to be tested;
the server calculates the similarity between the obtained ID of each page element and the ID of the page element to be tested, and it can be understood that the method for calculating the ID similarity may be any conventional method for calculating the similarity between a character string or a text, and is not limited specifically herein. For example, the similarity calculation method includes a cosine similarity calculation method defined in a Vector Space Model (VSM). It is defined as follows:
wherein, A and B are two vectors in the middle of the vectors. When the method is used for measuring the similarity of the character strings, the character strings need to be vectorized firstly, and a bag of words model (BOW) is generally used for vectorization. For example: string1 is "applet", String2 is "app", and the word package is { 'a', 'e', 'l', 'p' }, if 0,1 is used to determine whether the element is in the word package, strings 1, 2 can be converted into: string a ═ 1111 and string b ═ 1001, then, according to the cosine equation, the string similarity can be calculated as: 0.707; the cosine similarity takes values between [ -1,1 ].
And step S40, taking the page element with the similarity meeting the preset condition as the page element to be tested, and testing the page element to be tested.
Although the page element ID in the page changes when the GUI page is subjected to version upgrade, the version number is generally changed based on the original ID, for example, the original ID of the button in the web interface is 'button _ region', and the ID of the button becomes 'button _ region _ 01' after the version upgrade, and has higher similarity with the original ID. Therefore, in the embodiment of the present invention, similar preset conditions may be set, and after the similarity between the ID of each page element and the ID of the page element to be tested is obtained through calculation, the page element of which the similarity satisfies the preset conditions is taken as the page element to be tested.
Further, referring to fig. 3, fig. 3 is a detailed flowchart of step S40 in the present embodiment, where the step S40 includes:
step S41, judging whether each similarity is larger than a preset threshold value;
step S42, when at least one of the similarities is greater than the preset threshold, obtaining a maximum similarity among the similarities, and taking a page element corresponding to the maximum similarity as a page element satisfying the preset condition.
In this embodiment, a preset threshold of the similarity is stored in the server, and only when the similarity is greater than the preset threshold, it is determined that the two IDs corresponding to the similarity have similarity, the preset threshold may be set according to an actual situation, and no specific limitation is imposed herein, for example, when the similarity is calculated in a cosine similarity calculation method, it is determined that the two IDs have similarity only if the calculated similarity is greater than 0, and therefore the preset threshold may be set to 0. And after calculating and calculating the similarity between the ID of each page element and the ID of the page element to be tested by the server, judging whether the similarity is greater than the preset threshold, and judging that the ID of at least one page element has similarity with the ID of the page element to be tested when at least one similarity is greater than the preset threshold. Then, the server obtains the maximum similarity among the similarities, and takes the page element corresponding to the maximum similarity as the page element meeting the preset condition, that is, the page element with the highest similarity between the ID of the page element and the ID of the page element to be tested as the element to be tested.
After the page element to be tested is obtained, the server tests the page element to be tested by using the test case corresponding to the page element to be tested ID, and the method for testing the obtained page element to be tested by using the test case may be any conventional test method, which is not limited specifically herein. After the test is completed, the server outputs a test result and simultaneously can output the source of the page element to be tested, wherein when the page element to be tested is a page element corresponding to the page element ID to be tested (namely directly matched according to the page element ID to be tested), the source of the page element to be tested is directly hit, and when the page element to be tested is a page element with the similarity meeting a preset condition, the source of the page element to be tested is similarity matching.
According to the technical scheme provided by the embodiment, when a server receives a page element ID to be tested, the server obtains a page element to be tested corresponding to the page element ID to be tested in a page; when the page elements to be tested are not obtained, obtaining each page element in the page; calculating the similarity between the ID of each page element and the ID of the page element to be tested; and taking the page elements with the similarity meeting the preset conditions as the page elements to be tested, and testing the page elements to be tested. When the version of the graphical user interface is updated, the element with the slightly changed ID of the element can still be obtained and tested in a mode of calculating the ID similarity, so that the probability of automatic test failure after the version of the graphical user interface is updated is reduced.
Further, on the basis of the embodiment shown in fig. 2 or fig. 3, after the step S20, the method further includes:
when the page element is not acquired in the page, closing the page, and recording closing times;
re-opening the page, and executing the step of acquiring the page element to be tested corresponding to the page element to be tested ID in the page;
and when the closing times are more than the preset times, judging that the test fails.
In the actual situation, the situation that pages such as advertisement pages are automatically popped to cover opened pages often occurs, and when the GUI page is tested, the situation that pop-up window pages such as advertisements cover the GUI page to be tested also often occurs. In this embodiment, when the server does not obtain a page element in the page, there may be an advertisement pop-up window covering the page to be tested, and the server searches for a "close button" in the page to be tested to close the page and records the closing times. And then, re-opening the page to be tested, executing the step of obtaining the page element to be tested corresponding to the page element to be tested ID in the page, and performing GUI test on the page to be tested according to the method in the embodiment. In order to prevent endless loop caused by the fact that page elements in the page cannot be acquired all the time, a preset number of times is stored in the server, and when the recorded page closing time is larger than the preset number of times, the server judges that the test fails, quits the test and outputs prompt information of 'test failure'. It is understood that the server may also output the reason of the test failure at the same time, for example, output "page element not acquired in page".
According to the technical scheme provided by the embodiment, when the page element to be tested is not obtained, the server obtains each page element in the page, and when the page element is not obtained in the page, the page is closed, and the closing times are recorded; re-opening the page, and executing the step of acquiring the page element to be tested corresponding to the page element to be tested ID in the page; and when the closing times are more than the preset times, judging that the test fails. The server can reopen the page for re-testing when the page elements are not acquired in the page, so that the test failure rate of the page to be tested, which is covered by the page such as advertisements, and cannot acquire the page elements is reduced.
Further, on the basis of any of the above embodiments, after the step S41, the method further includes:
when the similarity is smaller than or equal to the preset threshold value, closing the page, and recording the closing times of the page;
re-opening the page, and executing the step of acquiring the page element to be tested corresponding to the page element to be tested ID in the page;
and when the closing times are more than the preset times, judging that the test fails.
When the page to be detected is covered by a pop-up page such as an advertisement, the server may also acquire the page elements from the pop-up page such as the advertisement, and at this time, even if the page elements are acquired, the page elements need to be eliminated and the detection is performed again. In this embodiment, after calculating and calculating the similarity between the ID of each page element and the ID of the page element to be tested, the server determines whether each similarity is greater than the preset threshold, and when each similarity is less than or equal to the preset threshold, it indicates that the obtained ID of the page element and the ID of the page element to be tested are both low in similarity and have no similarity, and at this time, each obtained page element may come from a pop-up window such as an advertisement, and needs to be tested again. The server searches for a 'close button' in the page to be closed to close the page, and records the closing times. And then, re-opening the page to be tested, executing the step of obtaining the page element to be tested corresponding to the page element to be tested ID in the page, and performing GUI test on the page to be tested according to the method in the embodiment. In order to prevent endless loop caused by the fact that page elements in the page cannot be acquired all the time, a preset number of times is stored in the server, and when the recorded page closing time is larger than the preset number of times, the server judges that the test fails, quits the test and outputs prompt information of 'test failure'. It is understood that the server may also output the reason of the test failure at the same time, for example, output "page element not acquired in page". It should be understood that, in the embodiment, the page closing times recorded in the scheme for closing the page and recording the page closing times when the page element is not acquired in the page may be recorded separately or may be recorded in an accumulated manner, which is not limited specifically herein.
According to the technical scheme provided by the embodiment, after calculating the similarity between the ID of each page element and the ID of the page element to be tested, the server judges whether each similarity is greater than the preset threshold, closes the page when each similarity is less than or equal to the preset threshold, records the closing times of the page, reopens the page, and executes the step of acquiring the page element to be tested corresponding to the ID of the page element to be tested in the page; when the closing times are more than the preset times, judging that the test fails; when the similarity between the IDs of the page elements which are not obtained in the page and the IDs of the page elements to be tested is low, the server can reopen the page for retesting, so that the test failure rate of the page to be tested covered by the page such as the advertisement is reduced, and the obtained page elements are the page elements in the advertisement.
In addition, to achieve the above object, an embodiment of the present invention further provides a device for testing a graphical user interface, where the device for testing a graphical user interface includes: the testing method comprises a memory, a processor and a testing program of the graphical user interface, wherein the testing program of the graphical user interface is stored on the memory and can run on the processor, and when being executed by the processor, the testing program of the graphical user interface realizes the steps of the testing method of the graphical user interface according to any one of the above embodiments.
In addition, to achieve the above object, an embodiment of the present invention further provides a computer storage medium, where a test program of a graphical user interface is stored on the computer storage medium, and the test program of the graphical user interface, when executed by a processor, implements the steps of the method for testing the graphical user interface according to any one of the above embodiments.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (10)
1. A method for testing a graphical user interface is characterized by comprising the following steps:
when a page element ID to be tested is received, acquiring a page element to be tested corresponding to the page element ID to be tested in a page;
when the page elements to be tested are not obtained, obtaining each page element in the page;
calculating the similarity between the ID of each page element and the ID of the page element to be tested;
and taking the page elements with the similarity meeting the preset conditions as the page elements to be tested, and testing the page elements to be tested.
2. The method for testing a gui according to claim 1, wherein the step of using the page element having the similarity satisfying a predetermined condition as the page element to be tested comprises:
Judging whether each similarity is larger than a preset threshold value or not;
and when at least one similarity is larger than the preset threshold, acquiring the maximum similarity in the similarities, and taking the page element corresponding to the maximum similarity as the page element to be tested.
3. The method for testing a gui according to claim 1, wherein the step of obtaining each page element in the page when the page element to be tested is not obtained further comprises:
when the page element is not acquired in the page, closing the page, and recording closing times;
re-opening the page, and executing the step of acquiring the page element to be tested corresponding to the page element to be tested ID in the page;
and when the closing times are more than the preset times, judging that the test fails.
4. The method for testing a gui according to claim 2, wherein the step of determining whether each of the similarities is greater than a preset threshold further comprises:
when the similarity is smaller than or equal to the preset threshold value, closing the page, and recording the closing times of the page;
Re-opening the page, and executing the step of acquiring the page element to be tested corresponding to the page element to be tested ID in the page;
and when the closing times are more than the preset times, judging that the test fails.
5. A method for testing a graphical user interface as recited in claim 3 or 4, wherein said step of determining that the test failed further comprises:
and outputting prompt information of test failure.
6. A method for testing a graphical user interface as claimed in any one of claims 1 to 4, characterized in that the similarity is calculated in a manner comprising a cosine similarity calculation method.
7. The method for testing a graphical user interface of any one of claims 1 to 4, wherein after the step of obtaining the page element to be tested corresponding to the page element to be tested ID in the page, the method further comprises:
and testing the page elements to be tested when the page elements to be tested are obtained.
8. A method for testing a graphical user interface as recited in any of claims 1-4, wherein said step of testing said page element to be tested is followed by the steps of:
and after the test is finished, outputting the source of the page element to be tested, wherein when the page element to be tested is the page element corresponding to the page element ID to be tested, the source of the page element to be tested is directly hit, and when the page element to be tested is the page element with the similarity meeting the preset condition, the source of the page element to be tested is similarity matching.
9. A gui testing apparatus, comprising: memory, a processor and a test program of a graphical user interface stored on the memory and executable on the processor, the test program of a graphical user interface implementing the steps of the method of testing a graphical user interface according to any one of claims 1 to 8 when executed by the processor.
10. A computer storage medium, characterized in that the computer storage medium has stored thereon a test program for a graphical user interface, which when executed by a processor implements the steps of the method for testing a graphical user interface according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910357829.XA CN111858289B (en) | 2019-04-29 | 2019-04-29 | Method and device for testing graphical user interface and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910357829.XA CN111858289B (en) | 2019-04-29 | 2019-04-29 | Method and device for testing graphical user interface and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111858289A true CN111858289A (en) | 2020-10-30 |
CN111858289B CN111858289B (en) | 2024-02-27 |
Family
ID=72965522
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910357829.XA Active CN111858289B (en) | 2019-04-29 | 2019-04-29 | Method and device for testing graphical user interface and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111858289B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112988568A (en) * | 2021-02-04 | 2021-06-18 | 上海硬通网络科技有限公司 | Game testing method and device and electronic equipment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106776301A (en) * | 2016-12-01 | 2017-05-31 | 广州酷狗计算机科技有限公司 | Daughter element method of testing and device |
CN107239397A (en) * | 2017-05-17 | 2017-10-10 | 北京微影时代科技有限公司 | A kind of web automated testing methods and electronic equipment |
-
2019
- 2019-04-29 CN CN201910357829.XA patent/CN111858289B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106776301A (en) * | 2016-12-01 | 2017-05-31 | 广州酷狗计算机科技有限公司 | Daughter element method of testing and device |
CN107239397A (en) * | 2017-05-17 | 2017-10-10 | 北京微影时代科技有限公司 | A kind of web automated testing methods and electronic equipment |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112988568A (en) * | 2021-02-04 | 2021-06-18 | 上海硬通网络科技有限公司 | Game testing method and device and electronic equipment |
CN112988568B (en) * | 2021-02-04 | 2024-05-28 | 上海硬通网络科技有限公司 | Game testing method and device and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN111858289B (en) | 2024-02-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106874441B (en) | Intelligent question-answering method and device | |
CN104954353B (en) | The method of calibration and device of APK file bag | |
US8819630B2 (en) | Automatic test tool for webpage design with micro-browsers on mobile platforms | |
US9697819B2 (en) | Method for building a speech feature library, and method, apparatus, device, and computer readable storage media for speech synthesis | |
US8626786B2 (en) | Dynamic language checking | |
US20160132326A1 (en) | Source code violation matching and attribution | |
US9100434B2 (en) | Web page falsification detection apparatus and storage medium | |
CN107729246B (en) | Auxiliary test method, device and equipment for target application and storage medium | |
WO2015135452A1 (en) | Text information processing method and apparatus | |
CN109976995B (en) | Method and apparatus for testing | |
KR102441063B1 (en) | Apparatus for detecting adaptive end-point, system having the same and method thereof | |
US11270683B2 (en) | Interactive system, apparatus, and method | |
CN115328756A (en) | Test case generation method, device and equipment | |
US11290481B2 (en) | Security threat detection by converting scripts using validation graphs | |
CN110851351A (en) | Deployment environment testing method and device, computer equipment and storage medium | |
CN113961919B (en) | Malicious software detection method and device | |
CN112166419A (en) | Electronic device for detecting software bugs and method for operating the same | |
CN111538659A (en) | Interface testing method and system for service scene, electronic device and storage medium | |
CN109726110B (en) | Document testing method, device, apparatus and computer readable storage medium | |
CN108804315B (en) | Test method and device applied to dynamic development, electronic equipment and storage medium | |
Sanz et al. | Instance-based anomaly method for Android malware detection | |
EP3690772A1 (en) | Method and system for skill matching for determining skill similarity | |
CN111598122A (en) | Data verification method and device, electronic equipment and storage medium | |
US10705810B2 (en) | Automatic code generation | |
CN113535577B (en) | Application testing method and device based on knowledge graph, electronic equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |