CN109885490B - Picture comparison method and device - Google Patents

Picture comparison method and device Download PDF

Info

Publication number
CN109885490B
CN109885490B CN201910105033.5A CN201910105033A CN109885490B CN 109885490 B CN109885490 B CN 109885490B CN 201910105033 A CN201910105033 A CN 201910105033A CN 109885490 B CN109885490 B CN 109885490B
Authority
CN
China
Prior art keywords
interface
information
screenshot
structure information
interface structure
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.)
Active
Application number
CN201910105033.5A
Other languages
Chinese (zh)
Other versions
CN109885490A (en
Inventor
戴亦斌
秦星达
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Testin Information Technology Co Ltd
Original Assignee
Beijing Testin Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Testin Information Technology Co Ltd filed Critical Beijing Testin Information Technology Co Ltd
Priority to CN201910105033.5A priority Critical patent/CN109885490B/en
Publication of CN109885490A publication Critical patent/CN109885490A/en
Application granted granted Critical
Publication of CN109885490B publication Critical patent/CN109885490B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses an image contrast method, which comprises the following steps: acquiring a first interface screenshot of an interface presented when a target test instruction in a test script is operated; extracting first interface feature information of the first interface screenshot, wherein the first interface feature information comprises first interface structure information; and judging whether the first interface screenshot is the same as the second interface screenshot according to the first interface characteristic information and second interface characteristic information of the second interface screenshot, wherein the second interface characteristic information comprises second interface structure information. According to the embodiment of the invention, whether the two pictures are the same or not can be accurately and reliably judged, and the picture comparison efficiency is improved.

Description

Picture comparison method and device
Technical Field
The invention relates to the field of automatic testing, in particular to a picture comparison method and a picture comparison device.
Background
Before an application is delivered for use, the performance of the application is typically checked by application testing. When the application test is carried out, the tested application can be operated under the specified conditions by using the test tool according to the test case so as to find the application error, measure the application quality and evaluate whether the application can meet the design requirement.
Before the automatic test of the application, firstly, a tester needs to manually test the correct operation flow of the application to be tested by using a terminal device once, and screen capture and storage are carried out on key nodes of the flow. And after the testing personnel completes the testing according to the correct operation flow, an automatic testing script is generated, and then the generated automatic testing script can be used for respectively carrying out automatic testing on the application to be tested on a plurality of different terminal devices.
In addition, in the process of performing the application automation test on a plurality of different terminal devices, the same screen capture and storage are required to be performed on each key node, and the picture obtained by screen capture is automatically compared with the picture captured during manual operation, so as to confirm whether the current application automation test flow is executed correctly according to the comparison result of whether the two pictures are the same.
Therefore, a picture comparison scheme is needed to accurately and reliably determine whether two pictures are the same, thereby improving the picture comparison efficiency.
Disclosure of Invention
The embodiment of the invention provides a picture comparison scheme, aiming at accurately and reliably judging whether two pictures are the same or not and improving the picture comparison efficiency.
The embodiment of the invention adopts the following technical scheme:
in a first aspect, an embodiment of the present invention provides an image comparison method, including:
acquiring a first interface screenshot of an interface presented when a target test instruction in a test script is operated;
extracting first interface feature information of the first interface screenshot, wherein the first interface feature information comprises first interface structure information;
and judging whether the first interface screenshot is the same as the second interface screenshot according to the first interface characteristic information and second interface characteristic information of the second interface screenshot, wherein the second interface characteristic information comprises second interface structure information.
Optionally, in the image comparison method provided in the first aspect of the present application, the test script corresponds to an application to be tested; the second interface screenshot is generated based on a screenshot instruction received in the manual test process of the application to be tested and aiming at the interface, and the target test instruction is generated based on screenshot operation corresponding to the screenshot instruction.
Optionally, in the image comparison method provided in the first aspect of the present application, the determining, according to the first interface feature information and the second interface feature information of the second interface screenshot, whether the first interface screenshot is the same as the second interface screenshot includes:
when the first interface structure information is matched with the second interface structure information, determining that the first interface screenshot is the same as the second interface screenshot;
and when the first interface structure information is not matched with the second interface structure information, determining that the first interface screenshot is different from the second interface screenshot.
Optionally, in the image comparison method provided in the first aspect of the present application, the method further includes:
judging whether the first interface structure information is matched with the second interface structure information according to whether the first interface structure information and the second interface structure information both comprise the structure characteristics corresponding to the target carousel image;
if not, determining that the first interface structure information is not matched with the second interface structure information;
if so, judging whether the first interface structure information is matched with the second interface structure information according to a first difference value between the number of first dynamic graphs contained in the first structure feature information and the number of second dynamic graphs contained in the second structure feature information.
Optionally, in the image comparison method provided in the first aspect of the present application, the determining, according to a first difference between a first number of dynamic graphs included in the first structural feature information and a second number of dynamic graphs included in the second structural feature information, whether the first interface structure information and the second interface structure information are matched with each other includes:
when the first difference is larger than a first preset value, determining that the first interface structure information is not matched with the second interface structure information;
when the first difference is smaller than or equal to the first preset value, judging whether the first interface structure information is matched with the second interface structure information according to a first label identification contained in the first structure feature information and a second label identification contained in the second structure feature information, wherein the first label identification and the second label identification respectively indicate label items selected in a target navigation bar.
Optionally, in the image comparison method provided in the first aspect of the present application, the determining, according to a first tag identifier included in the first structural feature information and a second tag identifier included in the second structural feature information, whether the first interface structural information and the second interface structural information are matched with each other includes:
determining that the first interface structure information and the second interface structure information do not match when the first tag identification is different from the second tag identification;
and when the first label identification is the same as the second label identification, judging whether the first interface structure information is matched with the second interface structure information according to a third label identification contained in the first structure feature information and a fourth label identification contained in the second structure feature information, wherein the third label identification and the fourth label identification respectively indicate label items selected in a target Tab label page.
Optionally, in the image comparison method provided in the first aspect of the present application, the determining, according to a third tag identifier included in the first structural feature information and a fourth tag identifier included in the second structural feature information, whether the first interface structural information and the second interface structural information are matched with each other includes:
determining that the first interface structure information and the second interface structure information do not match when the third tag identification is different from the fourth tag identification;
and when the third tag identification is the same as the fourth tag identification, if a second difference value between the number of first buttons included in the first structural feature information and the number of second buttons included in the second structural feature information is greater than a second preset value, determining that the first interface structure information is not matched with the second interface structure information, and if the second difference value is less than or equal to the second preset value, determining that the first interface structure information is matched with the second interface structure information.
Optionally, in the image comparison method provided in the first aspect of the present application, the first interface feature information further includes first interface character information, and the second interface feature information further includes second interface character information;
wherein, when the first interface structure information is matched with the second interface structure information, determining that the first interface screenshot is the same as the second interface screenshot comprises:
and when the first interface structure information is matched with the second interface structure information and the first interface character information is matched with the second interface character information, determining that the first interface screenshot is the same as the second interface screenshot.
Optionally, in the image comparison method provided in the first aspect of the present application, the extracting first interface feature information of the first interface screenshot includes:
and inputting the first interface screenshot into a picture feature extraction model for feature extraction so as to output the first interface feature information.
In a second aspect, an embodiment of the present invention provides a picture comparison apparatus, including:
the acquisition module is used for acquiring a first interface screenshot of an interface presented when a target test instruction in the test script is operated;
the extraction module is used for extracting first interface feature information of the first interface screenshot, wherein the first interface feature information comprises first interface structure information;
and the judging module is used for judging whether the first interface screenshot is the same as the second interface screenshot according to the first interface characteristic information and second interface characteristic information of the second interface screenshot, wherein the second interface characteristic information comprises second interface structure information.
Optionally, in the image comparison apparatus provided in the second aspect of the present application, the test script corresponds to an application to be tested; the second interface screenshot is generated based on a screenshot instruction received in the manual test process of the application to be tested and aiming at the interface, and the target test instruction is generated based on screenshot operation corresponding to the screenshot instruction.
Optionally, in the image comparison apparatus provided in the second aspect of the present application, the determining module is specifically configured to:
when the first interface structure information is matched with the second interface structure information, determining that the first interface screenshot is the same as the second interface screenshot;
and when the first interface structure information is not matched with the second interface structure information, determining that the first interface screenshot is different from the second interface screenshot.
Optionally, in the image comparison apparatus provided in the second aspect of the present application, the determining module is specifically further configured to:
judging whether the first interface structure information is matched with the second interface structure information according to whether the first interface structure information and the second interface structure information both comprise the structure characteristics corresponding to the target carousel image;
if not, determining that the first interface structure information is not matched with the second interface structure information;
if so, judging whether the first interface structure information is matched with the second interface structure information according to a first difference value between the number of first dynamic graphs contained in the first structure feature information and the number of second dynamic graphs contained in the second structure feature information.
Optionally, in the image comparison apparatus provided in the second aspect of the present application, the determining module is specifically further configured to:
when the first difference is larger than a first preset value, determining that the first interface structure information is not matched with the second interface structure information;
when the first difference is smaller than or equal to the first preset value, judging whether the first interface structure information is matched with the second interface structure information according to a first label identification contained in the first structure feature information and a second label identification contained in the second structure feature information, wherein the first label identification and the second label identification respectively indicate label items selected in a target navigation bar.
Optionally, in the image comparison apparatus provided in the second aspect of the present application, the determining module is specifically further configured to:
determining that the first interface structure information and the second interface structure information do not match when the first tag identification is different from the second tag identification;
and when the first label identification is the same as the second label identification, judging whether the first interface structure information is matched with the second interface structure information according to a third label identification contained in the first structure feature information and a fourth label identification contained in the second structure feature information, wherein the third label identification and the fourth label identification respectively indicate label items selected in a target Tab label page.
Optionally, in the image comparison apparatus provided in the second aspect of the present application, the determining module is specifically further configured to:
determining that the first interface structure information and the second interface structure information do not match when the third tag identification is different from the fourth tag identification;
and when the third tag identification is the same as the fourth tag identification, if a second difference value between the number of first buttons included in the first structural feature information and the number of second buttons included in the second structural feature information is greater than a second preset value, determining that the first interface structure information is not matched with the second interface structure information, and if the second difference value is less than or equal to the second preset value, determining that the first interface structure information is matched with the second interface structure information.
Optionally, in the image comparison apparatus provided in the second aspect of the present application, the first interface characteristic information further includes first interface character information, and the second interface characteristic information further includes second interface character information;
wherein, the judging module is specifically further configured to:
and when the first interface structure information is matched with the second interface structure information and the first interface character information is matched with the second interface character information, determining that the first interface screenshot is the same as the second interface screenshot.
Optionally, in the image comparison apparatus provided in the second aspect of the present application, the extraction module is specifically configured to:
and inputting the first interface screenshot into a picture feature extraction model for feature extraction so as to output the first interface feature information.
In a third aspect, an embodiment of the present application provides an electronic device, including:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to:
acquiring a first interface screenshot of an interface presented when a target test instruction in a test script is operated;
extracting first interface feature information of the first interface screenshot, wherein the first interface feature information comprises first interface structure information;
and judging whether the first interface screenshot is the same as the second interface screenshot according to the first interface characteristic information and second interface characteristic information of the second interface screenshot, wherein the second interface characteristic information comprises second interface structure information.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium storing one or more programs that, when executed by an electronic device that includes a plurality of application programs, cause the electronic device to:
acquiring a first interface screenshot of an interface presented when a target test instruction in a test script is operated;
extracting first interface feature information of the first interface screenshot, wherein the first interface feature information comprises first interface structure information;
and judging whether the first interface screenshot is the same as the second interface screenshot according to the first interface characteristic information and second interface characteristic information of the second interface screenshot, wherein the second interface characteristic information comprises second interface structure information.
The embodiment of the invention adopts at least one technical scheme which can achieve the following beneficial effects:
in the embodiment of the invention, in the process of running the test script, the interface displayed when the target test instruction is run can be captured according to the specified test instruction in the test script, namely the target test instruction, the captured first interface capture capable of reflecting the current running progress of the test script is compared with the prestored second interface capture, and whether the two interface captures are the same or not is determined according to the first interface feature information of the first interface capture, including the first interface structure information, and the second interface feature information of the second interface capture, including the second interface structure information. Therefore, whether the two interface screenshots are the same or not is judged through the interface characteristic information corresponding to the two interface screenshots, especially, the structural characteristic information corresponding to the two interface screenshots is fully considered, namely, the structural compositions of the two interface screenshots are fully compared, so that whether the two pictures are the same or not can be accurately and reliably judged, and the picture comparison efficiency is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
fig. 1 is a schematic flowchart of a picture comparison method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of another method for comparing pictures according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a picture comparison apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For the application automation test process stated in the background section, before the application automation test, firstly, a tester needs to manually test the correct operation flow of the application to be tested by using a terminal device, and screen capture and storage are performed on key nodes of the flow. And after the testing personnel completes the testing according to the correct operation flow, an automatic testing script is generated, and then the generated automatic testing script can be used for respectively carrying out automatic testing on the application to be tested on a plurality of different terminal devices.
In addition, in the process of performing the application automation test on a plurality of different terminal devices, the same screen capture storage needs to be performed on each key node, and the picture obtained by screen capture is automatically compared with the picture captured during manual operation, so as to confirm whether the terminal device is operating correctly according to the test flow corresponding to the test script when performing the application automation test, that is, when the set node is executed, whether the current application automation test is executed correctly is confirmed by comparing with the screen capture obtained in the manual test process.
Currently, the existing picture contrast techniques are divided into pixel full contrast and similarity contrast. Although the comparison speed for judging whether the pictures are the same is high and the accuracy is high in the mode of pixel complete comparison, the comparison of the content change conditions of the pictures under the same resolution can only be realized; the similarity contrast mode has certain universality by extracting picture features for comparison, but the similarity contrast effect is not ideal when the pixel difference of two pictures is large and the picture content changes dynamically.
Therefore, the image comparison technology cannot fundamentally solve the problem that the image comparison result is inaccurate under the conditions that the resolution of the image is greatly different and the content of the image is dynamically changed. Therefore, the picture comparison scheme of the embodiment of the invention is required to realize accurate and reliable picture comparison, and improve the accuracy of the judgment result of whether two pictures are the same, thereby improving the picture comparison efficiency.
The technical solutions provided by the embodiments of the present invention are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a picture comparison method according to an embodiment of the present invention.
Referring to fig. 1, a picture comparison method provided in an embodiment of the present invention is executed by a terminal device, and the method may specifically include:
step S101: and acquiring a first interface screenshot of an interface presented when a target test instruction in the test script is operated.
Step S103: and extracting first interface feature information of the first interface screenshot, wherein the first interface feature information comprises first interface structure information.
Step S105: and judging whether the first interface screenshot is the same as the second interface screenshot according to the first interface characteristic information and second interface characteristic information of the second interface screenshot, wherein the second interface characteristic information comprises second interface structure information.
In the embodiment of the invention, in the process of running the test script by the terminal device, the interface displayed when the target test instruction is run can be captured according to the specified test instruction in the test script, namely the target test instruction, and the captured first interface capture capable of reflecting the current running progress of the test script is compared with the prestored second interface capture, and specifically, whether the two interface captures are the same or not can be determined according to the first interface feature information of the first interface capture, including the first interface structure information, and the second interface feature information of the second interface capture, including the second interface structure information. Therefore, whether the two interface screenshots are the same or not is judged through the interface characteristic information corresponding to the two interface screenshots, especially, the structural characteristic information corresponding to the two interface screenshots is fully considered, namely, the structural compositions of the two interface screenshots are fully compared, whether the two images are the same or not can be accurately and reliably judged, and therefore the image comparison efficiency is improved.
Optionally, in the embodiment of the present invention, in consideration that when two interface screenshots are compared, the two interface screenshots are compared according to interface structure information included in the interface feature information of the interface screenshots, and after a human being automatically divides the pictures into a plurality of modules when comparing the pictures, whether the two pictures are the same is determined by comparing whether the common content in the two pictures is the same. Therefore, the resolution problem and the content dynamic change problem of the two interface screenshots do not need to be considered, that is, the first interface screenshot and the second interface screenshot can have different resolutions, and the content of the first interface screenshot and the content of the second interface screenshot can dynamically change, so that the accuracy of the result of the picture comparison scheme in the embodiment of the invention is not influenced. Therefore, for application scenes with large resolution difference among pictures and dynamic change of picture contents, the result accuracy of the picture comparison scheme provided by the embodiment of the invention is obviously improved.
Optionally, in the image comparison method according to the embodiment of the present invention, the test script corresponds to an application to be tested; the second interface screenshot is generated based on a screenshot instruction received in a manual test process of the application to be tested and aiming at the interface, and the target test instruction is generated based on screenshot operation corresponding to the screenshot instruction.
It can be understood that the picture comparison method of the embodiment of the present invention can be applied to the field of application automation test, and in the process of manually testing an application to be tested according to a correct test flow by a user, the second interface screenshot can be obtained according to the screenshot instruction input by the user, and the test script for the application to be tested is automatically generated after the manual test process is completed, so that the target test instruction included in the test script for the application to be tested is generated based on the screenshot operation corresponding to the screenshot instruction in the manual test process. Therefore, in the process of carrying out the application automation test according to the test script, the first interface screenshots corresponding to the second interface screenshots in a one-to-one mode can be sequentially generated, so that whether the execution of the automation test flow of the application to be tested is correct or not is confirmed according to the comparison result of whether the first interface screenshots and the second interface screenshots are the same, that is, whether the application automation test flow is correctly monitored or not can be realized, and the efficiency of the application automation test is favorably improved.
Optionally, for the screenshot of the interface of the application to be tested, the dynamic change of the picture content may refer to various small pictures that may change in real time on the interface of the application to be tested.
Optionally, in the image comparison method according to the embodiment of the present invention, the step S105 may be specifically executed as:
and judging whether the first interface screenshot is the same as the second interface screenshot according to the first interface structure information and the second interface structure information.
It can be understood that whether the first interface screenshot and the second interface screenshot are the same may be determined by determining whether the first interface structure information is matched with the second interface structure information. Therefore, when two interface screenshots are compared, structural information of each interface screenshot is considered, and the integral structural composition of the interface screenshot cannot be changed due to the fact that whether the resolution of the picture is the same and whether the interface corresponding to the target test instruction to be applied to be tested comprises the small picture which changes in real time, so that the picture comparison method is efficient and accurate.
Further, the image comparison method according to the embodiment of the present invention may include:
when the first interface structure information is matched with the second interface structure information, determining that the first interface screenshot is the same as the second interface screenshot;
and when the first interface structure information is not matched with the second interface structure information, determining that the first interface screenshot is different from the second interface screenshot.
It can be understood that when the interface structure information of the two interface screenshots is matched, the interface screenshots obtained in the manual testing process and the interface screenshots obtained in the automatic testing process are directed at interfaces corresponding to the same testing process steps of the application to be tested, and the two interface screenshots can be considered to be the same; and when the interface structure information of the two interface screenshots is not matched, the interface screenshots obtained in the manual testing process and the interface screenshots obtained in the automatic testing process aim at interfaces corresponding to different testing process steps of the application to be tested, and the two interface screenshots can be considered to be different.
Optionally, in the image comparison method according to the embodiment of the present invention, the first interface structure information of the first interface screenshot and the second interface structure information of the second interface screenshot may include structure features corresponding to the target carousel image, that is, the structure features of the first interface screenshot and the second interface screenshot, which correspond to the set test flow node, of the same carousel image. The target carousel image in the application to be tested generally appears on the upper portion of an interface of the terminal equipment, one image is converted at intervals of several seconds, for example, a panning application, a Tencent video and other playing applications are provided, and the carousel image is provided on a home page of the applications.
Then, the above-mentioned determining whether the first interface screenshot and the second interface screenshot are the same according to the first interface structure information and the second interface structure information may be specifically implemented as:
judging whether the first interface structure information is matched with the second interface structure information according to whether the first interface structure information and the second interface structure information both comprise the structural characteristics corresponding to the target carousel image;
if not, determining that the first interface structure information is not matched with the second interface structure information;
if so, judging whether the first interface structure information is matched with the second interface structure information according to a first difference value between the number of the first dynamic graphs contained in the first structure feature information and the number of the second dynamic graphs contained in the second structure feature information.
It can be understood that, under the condition that an interface corresponding to a target test instruction presentation of an application to be tested should have a recorded broadcast diagram, if only one of the interface structure information of the first interface screenshot and the second interface screenshot which correspond to one another includes a structure feature corresponding to the target carousel diagram, it indicates that the two interface structure information are not matched, that is, the two interface screenshots are different, that is, the automated test flow executed according to the test script is inaccurate. If the interface structure information of the two interface screenshots includes the structure characteristics corresponding to the target carousel image, in order to ensure the accuracy of the image comparison result, the images may be further compared according to the number of the dynamic images in the first interface structure information and the second interface structure information.
Further optionally, in the image comparison method according to the embodiment of the present invention, determining whether the first interface structure information and the second interface structure information are matched according to a first difference between a first number of dynamic images included in the first structure feature information and a second number of dynamic images included in the second structure feature information includes:
when the first difference is larger than a first preset value, determining that the first interface structure information is not matched with the second interface structure information;
and when the first difference is smaller than or equal to a first preset value, judging whether the first interface structure information is matched with the second interface structure information according to a first label identification contained in the first structure characteristic information and a second label identification contained in the second structure characteristic information, wherein the first label identification and the second label identification respectively indicate the label items selected in the target navigation bar.
It can be understood that, under the condition that an interface corresponding to a target test instruction presentation of an application to be tested should have a dynamic graph, if a difference between numbers of dynamic graphs respectively corresponding to interface structure information of a first interface screenshot and a second interface screenshot which correspond to one another is large, that is, a first difference between the numbers of the two dynamic graphs is greater than a first preset value, for example, a difference is half, it indicates that the two interface structure information are not matched, that is, the two interface screenshots are different, that is, an automated test procedure executed according to a test script is inaccurate. If the difference between the numbers of the dynamic images corresponding to the interface structure information of the two interface screenshots is not large, in order to ensure the accuracy of the image comparison result, the images can be further compared according to the specified label marks corresponding to the target navigation bar in the first interface structure information and the second interface structure information.
Further optionally, in the image comparison method according to the embodiment of the present invention, determining whether the first interface structure information and the second interface structure information are matched according to a first tag identifier included in the first structure feature information and a second tag identifier included in the second structure feature information, includes:
when the first label identification is different from the second label identification, determining that the first interface structure information is not matched with the second interface structure information;
and when the first label identification is the same as the second label identification, judging whether the first interface structure information is matched with the second interface structure information according to a third label identification contained in the first structure characteristic information and a fourth label identification contained in the second structure characteristic information, wherein the third label identification and the fourth label identification respectively indicate the label items selected in the target Tab label page.
It can be understood that, under the condition that an interface corresponding to a target test instruction presentation of an application to be tested should have a navigation bar, if the corresponding label identifiers used for indicating the selected label item in the target navigation bar are different for the interface structure information of the first interface screenshot and the second interface screenshot which correspond one to one, for example, for a bottom navigation bar of a panning application, one label identifier indicates that the rightmost label item is selected, and the other label identifier indicates that the leftmost label is selected, it is indicated that the two interface structure information are not matched, that is, the two interface screenshots are different, that is, an automated test flow executed according to a test script is inaccurate. If the corresponding label identifiers used for indicating the selected label items in the target navigation bar are the same for the interface structure information of the two interface screenshots, in order to ensure the accuracy of the image comparison result, the image comparison can be further performed according to the specified label identifiers corresponding to the target Tab label pages in the first interface structure information and the second interface structure information.
Further optionally, in the image comparison method according to the embodiment of the present invention, determining whether the first interface structure information and the second interface structure information are matched according to a third tag identifier included in the first structure feature information and a fourth tag identifier included in the second structure feature information, includes:
when the third label identification is different from the fourth label identification, determining that the first interface structure information is not matched with the second interface structure information;
and when the third label identification is the same as the fourth label identification, if a second difference value between the number of first buttons contained in the first structure characteristic information and the number of second buttons contained in the second structure characteristic information is greater than a second preset value, determining that the first interface structure information is not matched with the second interface structure information, and if the second difference value is less than or equal to the second preset value, determining that the first interface structure information is matched with the second interface structure information.
It can be understood that, under the condition that an interface corresponding to a target test instruction presentation of an application to be tested should have a Tab page, if interface structure information of a first interface screenshot and a second interface screenshot which correspond one to one respectively correspond to different Tab identifiers for indicating a selected Tab item in the target Tab page, it indicates that the two interface structure information are not matched, that is, the two interface screenshots are different, that is, an automated test flow executed according to a test script is inaccurate. If the interface structure information of the two interface screenshots respectively corresponds to the same label identifier for indicating the selected label item on the target Tab page, in order to ensure the accuracy of the image comparison result, the image comparison can be further performed according to the number of buttons in the first interface structure information and the second interface structure information.
It can be further understood that, under the condition that the interface corresponding to the target test instruction presentation of the application to be tested should have buttons, if the difference between the numbers of the buttons respectively corresponding to the interface structure information of the first interface screenshot and the second interface screenshot which correspond one to one is large, that is, the second difference between the numbers of the two buttons is larger than a second preset value, for example, half of the difference is large, it indicates that the two interface structure information are not matched, that is, the two interface screenshots are different, that is, the automated test procedure executed according to the test script is inaccurate. If the number of the buttons respectively corresponding to the interface structure information of the two interface screenshots is not large, the two interface structure information are matched, that is, the two interface screenshots are the same, that is, the automated test flow executed according to the test script is accurate.
It should be noted that the interface structure information in the embodiment of the present invention includes, but is not limited to, the above contents, and may be determined according to the specific interface condition of the application to be tested, so that the picture comparison scheme in the embodiment of the present invention is applicable to an automated testing process for different applications to be tested. In addition, the preset value can be set according to actual test requirements.
Optionally, in the image comparison method according to the embodiment of the present invention, the first interface feature information further includes first interface character information, and the second interface feature information further includes second interface character information;
when the first interface structure information is matched with the second interface structure information, determining that the first interface screenshot is the same as the second interface screenshot, wherein the method comprises the following steps:
and when the first interface structure information is matched with the second interface structure information and the first interface character information is matched with the second interface character information, determining that the first interface screenshot is the same as the second interface screenshot.
It can be understood that, in the image comparison method of the embodiment of the present invention, in addition to performing comparison according to the structural features of the interface screenshot, comparison may also be performed in combination with the character features of the interface screenshot, and specifically, when the interface structural information and the interface character information of the two interface screenshots are both matched, it is determined that the two interface screenshots are the same, so as to further ensure the accuracy of the image comparison result.
Optionally, the interface character information of the interface screenshot may include text information, digital information, and the like.
Optionally, under the condition that the interface character information of the two interface screenshots is the same or the difference degree is within the allowable range, the interface character information of the two interface screenshots can be determined to be matched; the specific judgment standard can be determined according to the actual test requirement adaptability.
Optionally, in the image comparison method according to the embodiment of the present invention, the step S103 may specifically include the following steps:
and inputting the first interface screenshot into a picture feature extraction model for feature extraction so as to output first interface feature information.
It can be understood that, in the image comparison method according to the embodiment of the present invention, an ai (artificial intelligence) artificial intelligence technology may be adopted to extract the feature information of the image, that is, feature extraction is performed by training an image feature extraction model.
It should be noted that, when training the image feature extraction model, the training is first obtained, that is, a large number of image samples with different resolutions and dynamically changeable image contents can be obtained, and the image samples can be calibrated, that is, the image samples are calibrated for feature information to indicate the feature information of each image sample. Then, based on these training samples, a training set validation set for model training may be determined. Optionally, the number of samples in the training set and the verification set may be flexibly adjusted, for example, 65% of the training samples are used as the training set for training the image feature extraction model, and the remaining 35% of the training samples are used as the verification set for verifying whether the output of the image feature extraction model meets the requirement.
Optionally, in the case that the image feature extraction model of the embodiment of the present invention is used to extract the first interface structure information of the first interface screenshot, the image feature extraction model may include a yolo (young Only Look once) model for performing deep learning target detection and realizing image structure feature extraction; in the case that the picture feature extraction model of the embodiment of the present invention is used to extract the first interface character information of the first interface screenshot, the picture feature extraction model may include a CTPN (Detecting Text in Natural Image with connectivity Text forward Network, Text detection based on a Network of connected Text candidate frames) model used to perform picture character feature extraction, so as to implement Text detection of a Natural scene, so as to detect a Text information position in the Natural scene. Both the YOLO model and the CTPN model are deep learning models based on CNN (Convolutional Neural Networks).
In addition, optionally, in other embodiments of the present invention, an ocr (optical Character recognition) optical Character recognition technology may also be used to extract Character features from the picture.
It should be noted that, for second interface feature information of the second interface screenshot, the terminal device may receive the second interface screenshot in advance, and before comparing the second interface screenshot with the first interface screenshot, extract the second interface feature information by using the image feature extraction model, or directly receive the second interface feature information extracted by the image feature extraction model.
In the following, referring to fig. 2, taking an application to be tested as an example of an panning application, a picture comparison scheme according to an embodiment of the present invention is specifically described, and specifically, whether screenshots of two home page interfaces of the panning application are the same or not may be compared, including the following steps:
step S201: determining screenshots of a first page interface, a first interface screenshot and a second interface screenshot of two Taobao application home page interfaces.
The first interface screenshot and the second interface screenshot can be obtained by screen capture of two terminal devices with different resolutions.
Step S202: extracting structural feature information of the first interface screenshot and the second interface screenshot, wherein the structural feature information comprises structural features corresponding to a carousel image, a navigation bar (or a status bar), common controls (such as a search bar, buttons and the like), a dynamic image and the like.
Optionally, an AI image search technique is used to extract the structural feature information, and a YOLO model may be mainly used.
Step S203: and extracting character characteristic information of the first interface screenshot and the second interface screenshot, wherein the character characteristic information comprises contents such as characters and numbers.
Optionally, an AI text extraction technique may be mainly used.
Step S204: and judging whether the structural feature information of the first interface screenshot and the second interface screenshot both comprises structural features corresponding to the carousel pictures, namely judging whether the carousel pictures are both in the first interface screenshot and the second interface screenshot, if so, executing a step S205, and otherwise, determining that the two interface screenshots are different.
Step S205: and judging whether the difference between the numbers of the dynamic images contained in the two pieces of structural feature information is more than 50%, if so, executing a step S206, otherwise, determining that the screenshots of the two interfaces are different.
Step S206: and judging whether the two structural feature information indicate that the label items selected in the bottom navigation bar are the same or not, if so, executing a step S207, otherwise, determining that the two interface screenshots are different.
Step S207: and judging whether the numbers displayed in the shopping cart icons indicated by the two character characteristic information are consistent, if so, executing a step S208, otherwise, determining that the two interface screenshots are different or determining that the two interface screenshots have slight changes.
Step S208: and judging whether the two structural feature information indicate that the label items selected on the Tab page are the same or not, if so, executing a step S209, and otherwise, determining that the two interface screenshots are different.
Step S209: and judging whether the difference between the numbers of the buttons contained in the two pieces of structural feature information is more than 50%, if so, executing a step S210, and otherwise, determining that the screenshots of the two interfaces are different.
Step S210: and determining that the screenshot of the first interface is the same as the screenshot of the second interface.
By last, need acquire the first interface screenshot of home page when the automatic test is WABAO APP at present to and acquire the second interface screenshot of home page when the tester tests WABAO APP manually, and then judge two screenshots whether be the same interface. Because pan bao APP home page has carousel picture and dynamic change content, so there is very big difference to the content of the screenshot of pan bao APP home page twice, if adopt traditional contrast mode, very big probability can judge different interfaces, and judge through above-mentioned a series of structural feature information, character feature information and can confirm that two interfaces screenshot are the same, under the condition that the content changes, if the structure does not change, still be the same interface. Therefore, the image comparison result is more accurate and reliable.
Fig. 3 is a schematic structural diagram of a picture comparison apparatus according to an embodiment of the present invention.
Referring to fig. 3, the apparatus may specifically include: an obtaining module 301, an extracting module 303 and a judging module 305, wherein:
an obtaining module 301, configured to obtain a first interface screenshot of an interface presented when a target test instruction in a test script is run;
the extracting module 303 is configured to extract first interface feature information of the first interface screenshot, where the first interface feature information includes first interface structure information;
the determining module 305 is configured to determine whether the first interface screenshot is the same as the second interface screenshot according to the first interface feature information and second interface feature information of the second interface screenshot, where the second interface feature information includes second interface structure information.
Preferably, in the image comparison apparatus provided in the embodiment of the present invention, the test script corresponds to an application to be tested;
the second interface screenshot is generated based on a screenshot instruction received in a manual test process of the application to be tested and aiming at the interface, and the target test instruction is generated based on screenshot operation corresponding to the screenshot instruction.
Preferably, in the image comparison apparatus provided in the embodiment of the present invention, the determining module 305 is specifically configured to:
when the first interface structure information is matched with the second interface structure information, determining that the first interface screenshot is the same as the second interface screenshot;
and when the first interface structure information is not matched with the second interface structure information, determining that the first interface screenshot is different from the second interface screenshot.
Preferably, in the image comparison apparatus provided in the embodiment of the present invention, the determining module 305 is further configured to:
judging whether the first interface structure information is matched with the second interface structure information according to whether the first interface structure information and the second interface structure information both comprise the structural characteristics corresponding to the target carousel image;
if not, determining that the first interface structure information is not matched with the second interface structure information;
if so, judging whether the first interface structure information is matched with the second interface structure information according to a first difference value between the number of the first dynamic graphs contained in the first structure feature information and the number of the second dynamic graphs contained in the second structure feature information.
Preferably, in the image comparison apparatus provided in the embodiment of the present invention, the determining module 305 is further configured to:
when the first difference is larger than a first preset value, determining that the first interface structure information is not matched with the second interface structure information;
and when the first difference is smaller than or equal to a first preset value, judging whether the first interface structure information is matched with the second interface structure information according to a first label identification contained in the first structure characteristic information and a second label identification contained in the second structure characteristic information, wherein the first label identification and the second label identification respectively indicate the label items selected in the target navigation bar.
Preferably, in the image comparison apparatus provided in the embodiment of the present invention, the determining module 305 is further configured to:
when the first label identification is different from the second label identification, determining that the first interface structure information is not matched with the second interface structure information;
and when the first label identification is the same as the second label identification, judging whether the first interface structure information is matched with the second interface structure information according to a third label identification contained in the first structure characteristic information and a fourth label identification contained in the second structure characteristic information, wherein the third label identification and the fourth label identification respectively indicate the label items selected in the target Tab label page.
Preferably, in the image comparison apparatus provided in the embodiment of the present invention, the determining module 305 is further configured to:
when the third label identification is different from the fourth label identification, determining that the first interface structure information is not matched with the second interface structure information;
and when the third label identification is the same as the fourth label identification, if a second difference value between the number of first buttons contained in the first structure characteristic information and the number of second buttons contained in the second structure characteristic information is greater than a second preset value, determining that the first interface structure information is not matched with the second interface structure information, and if the second difference value is less than or equal to the second preset value, determining that the first interface structure information is matched with the second interface structure information.
Optionally, in the image comparison apparatus provided in the embodiment of the present invention, the first interface characteristic information further includes first interface character information, and the second interface characteristic information further includes second interface character information;
the determining module 305 is further configured to:
and when the first interface structure information is matched with the second interface structure information and the first interface character information is matched with the second interface character information, determining that the first interface screenshot is the same as the second interface screenshot.
Optionally, in the image comparison apparatus provided in the embodiment of the present invention, the extraction module 303 is specifically configured to:
and inputting the first interface screenshot into a picture feature extraction model for feature extraction so as to output first interface feature information.
Therefore, in the process of running the test script, the embodiment of the present invention may capture an interface presented when the target test instruction is run according to the specified test instruction in the test script, that is, the target test instruction, compare the captured first interface capture capable of reflecting the current running progress of the test script with the pre-stored second interface capture, and specifically determine whether the two interface captures are the same according to the first interface feature information of the first interface capture including the first interface structure information and the second interface feature information of the second interface capture including the second interface structure information. Therefore, whether the two interface screenshots are the same or not is judged through the interface characteristic information corresponding to the two interface screenshots, especially, the structural characteristic information corresponding to the two interface screenshots is fully considered, namely, the structural compositions of the two interface screenshots are fully compared, so that whether the two pictures are the same or not can be accurately and reliably judged, and the picture comparison efficiency is improved.
In addition, as for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to part of the description of the method embodiment. Further, it should be noted that, among the respective components of the apparatus of the present invention, the components thereof are logically divided according to the functions to be realized, but the present invention is not limited thereto, and the respective components may be newly divided or combined as necessary.
Fig. 4 is a schematic diagram of a hardware structure of an electronic device implementing various embodiments of the present invention.
Referring to fig. 4, the electronic device 400 includes, but is not limited to: radio frequency unit 401, network module 402, audio output unit 403, input unit 404, sensor 405, display unit 406, user input unit 407, interface unit 408, memory 409, processor 410, and power supply 411. Those skilled in the art will appreciate that the configuration of electronic device 400 shown in fig. 4 does not constitute a limitation of electronic devices that may include more or fewer components than shown, or some components may be combined, or a different arrangement of components. In the embodiment of the present invention, the electronic device 400 includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted terminal, a wearable device, a pedometer, and the like.
Wherein, the processor 410 is configured to execute the following processes:
acquiring a first interface screenshot of an interface presented when a target test instruction in a test script is operated;
extracting first interface feature information of the first interface screenshot, wherein the first interface feature information comprises first interface structure information;
and judging whether the first interface screenshot is the same as the second interface screenshot according to the first interface characteristic information and second interface characteristic information of the second interface screenshot, wherein the second interface characteristic information comprises second interface structure information.
In the embodiment of the invention, in the process of running the test script, the interface displayed when the target test instruction is run can be captured according to the specified test instruction in the test script, namely the target test instruction, the captured first interface capture capable of reflecting the current running progress of the test script is compared with the prestored second interface capture, and whether the two interface captures are the same or not is determined according to the first interface feature information of the first interface capture, including the first interface structure information, and the second interface feature information of the second interface capture, including the second interface structure information. Therefore, whether the two interface screenshots are the same or not is judged through the interface characteristic information corresponding to the two interface screenshots, especially, the structural characteristic information corresponding to the two interface screenshots is fully considered, namely, the structural compositions of the two interface screenshots are fully compared, so that whether the two pictures are the same or not can be accurately and reliably judged, and the picture comparison efficiency is improved.
It should be understood that, in the embodiment of the present invention, the radio frequency unit 401 may be used for receiving and sending signals during a message sending and receiving process or a call process, and specifically, receives downlink data from a base station and then processes the received downlink data to the processor 410; in addition, the uplink data is transmitted to the base station. Typically, radio unit 401 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. Further, the radio unit 401 can also communicate with a network and other devices through a wireless communication system.
The electronic device 400 provides the user with wireless broadband internet access via the network module 402, such as assisting the user in emailing, browsing web pages, and accessing streaming media.
The audio output unit 403 may convert audio data received by the radio frequency unit 401 or the network module 402 or stored in the memory 409 into an audio signal and output as sound. Also, the audio output unit 403 may also provide audio output related to a specific function performed by the electronic apparatus 400 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 403 includes a speaker, a buzzer, a receiver, and the like.
The input unit 404 is used to receive audio or video signals. The input Unit 404 may include a Graphics Processing Unit (GPU) 4041 and a microphone 4042, and the Graphics processor 4041 processes image data of a still picture or video obtained by an image capturing apparatus (such as a camera) in a video capturing mode or an image capturing mode. The processed image frames may be displayed on the display unit 406. The image frames processed by the graphic processor 4041 may be stored in the memory 409 (or other storage medium) or transmitted via the radio frequency unit 401 or the network module 402. The microphone 4042 may receive sound, and may be capable of processing such sound into audio data. The processed audio data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit 401 in case of the phone call mode.
The electronic device 400 also includes at least one sensor 405, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor includes an ambient light sensor that adjusts the brightness of the display panel 4061 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 4061 and/or the backlight when the electronic apparatus 400 is moved to the ear. As one type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of an electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), and vibration identification related functions (such as pedometer, tapping); the sensors 405 may also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be described in detail herein.
The display unit 406 is used to display information input by the user or information provided to the user. The Display unit 406 may include a Display panel 4061, and the Display panel 4061 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
The user input unit 407 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device. Specifically, the user input unit 407 includes a touch panel 4071 and other input devices 4072. Touch panel 4071, also referred to as a touch screen, may collect touch operations by a user on or near it (e.g., operations by a user on or near touch panel 4071 using a finger, a stylus, or any suitable object or attachment). The touch panel 4071 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 410, receives a command from the processor 410, and executes the command. In addition, the touch panel 4071 can be implemented by using various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the touch panel 4071, the user input unit 407 may include other input devices 4072. Specifically, the other input devices 4072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a track ball, a mouse, and a joystick, which are not described herein again.
Further, the touch panel 4071 can be overlaid on the display panel 4061, and when the touch panel 4071 detects a touch operation thereon or nearby, the touch operation is transmitted to the processor 410 to determine the type of the touch event, and then the processor 410 provides a corresponding visual output on the display panel 4061 according to the type of the touch event. Although in fig. 4, the touch panel 4071 and the display panel 4061 are two independent components to implement the input and output functions of the electronic device, in some embodiments, the touch panel 4071 and the display panel 4061 may be integrated to implement the input and output functions of the electronic device, and the implementation is not limited herein.
The interface unit 408 is an interface for connecting an external device to the electronic apparatus 400. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 408 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic apparatus 400 or may be used to transmit data between the electronic apparatus 400 and an external device.
The memory 409 may be used to store software programs as well as various data. The memory 409 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 409 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 410 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the electronic device and processes data by operating or executing software programs and/or modules stored in the memory 409 and calling data stored in the memory 409, thereby performing overall monitoring of the electronic device. Processor 410 may include one or more processing units; preferably, the processor 410 may integrate an application processor, which mainly handles operating systems, user pages, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 410.
The electronic device 400 may further include a power supply 411 (e.g., a battery) for supplying power to various components, and preferably, the power supply 411 may be logically connected to the processor 410 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system.
In addition, the electronic device 400 includes some functional modules that are not shown, and are not described in detail herein.
Preferably, an embodiment of the present invention further provides an electronic device, which includes a processor 410, a memory 409, and a computer program that is stored in the memory 409 and can be run on the processor 410, and when being executed by the processor 410, the computer program implements each process of the above-mentioned embodiment of the image comparison method, and can achieve the same technical effect, and in order to avoid repetition, details are not described here again.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the above-mentioned embodiment of the image comparison method, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
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 apparatus 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 apparatus. 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 apparatus that comprises the element.
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 solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as 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.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (6)

1. A method for comparing pictures, comprising:
acquiring a first interface screenshot of an interface presented when a target test instruction in a test script is operated;
extracting first interface feature information of the first interface screenshot, wherein the first interface feature information comprises first interface structure information;
judging whether the first interface screenshot is the same as the second interface screenshot according to the first interface feature information and second interface feature information of the second interface screenshot, wherein the second interface feature information comprises second interface structure information;
the test script corresponds to an application to be tested;
the second interface screenshot is generated based on a screenshot instruction received in the manual test process of the application to be tested and aiming at the interface, and the target test instruction is generated based on screenshot operation corresponding to the screenshot instruction;
the judging whether the first interface screenshot is the same as the second interface screenshot according to the first interface feature information and the second interface feature information of the second interface screenshot comprises the following steps:
when the first interface structure information is matched with the second interface structure information, determining that the first interface screenshot is the same as the second interface screenshot;
when the first interface structure information is not matched with the second interface structure information, determining that the first interface screenshot is different from the second interface screenshot;
further comprising:
judging whether the first interface structure information is matched with the second interface structure information according to whether the first interface structure information and the second interface structure information both comprise structure characteristic information corresponding to a target carousel image;
if not, determining that the first interface structure information is not matched with the second interface structure information;
if so, judging whether the first interface structure information is matched with the second interface structure information according to a first difference value between the number of first dynamic pictures contained in the first structure feature information and the number of second dynamic pictures contained in the second structure feature information;
the determining, according to a first difference between a first number of dynamic graphs included in the first structural feature information and a second number of dynamic graphs included in the second structural feature information, whether the first interface structure information and the second interface structure information are matched includes:
when the first difference is larger than a first preset value, determining that the first interface structure information is not matched with the second interface structure information;
when the first difference is smaller than or equal to the first preset value, judging whether the first interface structure information is matched with the second interface structure information according to a first label identification contained in the first structure feature information and a second label identification contained in the second structure feature information, wherein the first label identification and the second label identification respectively indicate label items selected in a target navigation bar.
2. The method according to claim 1, wherein the determining whether the first interface structure information and the second interface structure information match according to a first tag identifier included in the first structure feature information and a second tag identifier included in the second structure feature information includes:
determining that the first interface structure information and the second interface structure information do not match when the first tag identification is different from the second tag identification;
and when the first label identification is the same as the second label identification, judging whether the first interface structure information is matched with the second interface structure information according to a third label identification contained in the first structure feature information and a fourth label identification contained in the second structure feature information, wherein the third label identification and the fourth label identification respectively indicate label items selected in a target Tab label page.
3. The method according to claim 2, wherein the determining whether the first interface structure information and the second interface structure information match according to a third tag identifier included in the first structure feature information and a fourth tag identifier included in the second structure feature information includes:
determining that the first interface structure information and the second interface structure information do not match when the third tag identification is different from the fourth tag identification;
and when the third tag identification is the same as the fourth tag identification, if a second difference value between the number of first buttons included in the first structural feature information and the number of second buttons included in the second structural feature information is greater than a second preset value, determining that the first interface structure information is not matched with the second interface structure information, and if the second difference value is less than or equal to the second preset value, determining that the first interface structure information is matched with the second interface structure information.
4. The method according to any one of claims 1 to 3, wherein the first interface characteristic information further comprises first interface character information, and the second interface characteristic information further comprises second interface character information;
wherein, when the first interface structure information is matched with the second interface structure information, determining that the first interface screenshot is the same as the second interface screenshot comprises:
and when the first interface structure information is matched with the second interface structure information and the first interface character information is matched with the second interface character information, determining that the first interface screenshot is the same as the second interface screenshot.
5. The method according to any one of claims 1 to 3, wherein the extracting first interface feature information of the first interface screenshot comprises:
and inputting the first interface screenshot into a picture feature extraction model for feature extraction so as to output the first interface feature information.
6. A picture comparison device, comprising:
the acquisition module is used for acquiring a first interface screenshot of an interface presented when a target test instruction in the test script is operated;
the extraction module is used for extracting first interface feature information of the first interface screenshot, wherein the first interface feature information comprises first interface structure information;
the judging module is used for judging whether the first interface screenshot is the same as the second interface screenshot according to the first interface characteristic information and second interface characteristic information of the second interface screenshot, wherein the second interface characteristic information comprises second interface structure information;
the test script corresponds to an application to be tested;
the second interface screenshot is generated based on a screenshot instruction received in a manual test process of the application to be tested and aiming at the interface, and the target test instruction is generated based on screenshot operation corresponding to the screenshot instruction;
the judgment module is specifically configured to:
when the first interface structure information is matched with the second interface structure information, determining that the first interface screenshot is the same as the second interface screenshot;
when the first interface structure information is not matched with the second interface structure information, determining that the first interface screenshot is different from the second interface screenshot;
judging whether the first interface structure information is matched with the second interface structure information according to whether the first interface structure information and the second interface structure information both comprise structure characteristic information corresponding to the target carousel image;
if not, determining that the first interface structure information is not matched with the second interface structure information;
if so, judging whether the first interface structure information is matched with the second interface structure information according to a first difference value between the number of first dynamic pictures contained in the first structure feature information and the number of second dynamic pictures contained in the second structure feature information;
when the first difference is larger than a first preset value, determining that the first interface structure information is not matched with the second interface structure information;
and when the first difference is smaller than or equal to a first preset value, judging whether the first interface structure information is matched with the second interface structure information according to a first label identification contained in the first structure characteristic information and a second label identification contained in the second structure characteristic information, wherein the first label identification and the second label identification respectively indicate the label items selected in the target navigation bar.
CN201910105033.5A 2019-02-01 2019-02-01 Picture comparison method and device Active CN109885490B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910105033.5A CN109885490B (en) 2019-02-01 2019-02-01 Picture comparison method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910105033.5A CN109885490B (en) 2019-02-01 2019-02-01 Picture comparison method and device

Publications (2)

Publication Number Publication Date
CN109885490A CN109885490A (en) 2019-06-14
CN109885490B true CN109885490B (en) 2022-02-15

Family

ID=66927890

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910105033.5A Active CN109885490B (en) 2019-02-01 2019-02-01 Picture comparison method and device

Country Status (1)

Country Link
CN (1) CN109885490B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110888812B (en) * 2019-11-26 2023-11-07 国核自仪系统工程有限公司 Test system and test method for response time of terminal page
CN111209938A (en) * 2019-12-27 2020-05-29 广东轩辕网络科技股份有限公司 Automatic progress monitoring method, electronic equipment and storage medium
CN114782725B (en) * 2022-06-21 2022-10-04 北京尽微致广信息技术有限公司 Method, device and storage medium for comparing user interface image difference

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106021095A (en) * 2016-05-06 2016-10-12 北京邮电大学 A push mechanism-based Android application automated testing method
CN108287891A (en) * 2018-01-18 2018-07-17 维沃移动通信有限公司 A kind of application information method for pushing and server
CN108874392A (en) * 2018-05-10 2018-11-23 中国联合网络通信集团有限公司 User's guideline interface generation method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9852049B2 (en) * 2014-05-27 2017-12-26 International Business Machines Corporation Screenshot validation testing

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106021095A (en) * 2016-05-06 2016-10-12 北京邮电大学 A push mechanism-based Android application automated testing method
CN108287891A (en) * 2018-01-18 2018-07-17 维沃移动通信有限公司 A kind of application information method for pushing and server
CN108874392A (en) * 2018-05-10 2018-11-23 中国联合网络通信集团有限公司 User's guideline interface generation method and device

Also Published As

Publication number Publication date
CN109885490A (en) 2019-06-14

Similar Documents

Publication Publication Date Title
CN110109593B (en) Screen capturing method and terminal equipment
CN109656827B (en) Control tree generation method and terminal equipment
CN109885490B (en) Picture comparison method and device
CN109947650B (en) Script step processing method, device and system
CN108616448B (en) Information sharing path recommendation method and mobile terminal
CN109951889B (en) Internet of things network distribution method and mobile terminal
CN109726121B (en) Verification code obtaining method and terminal equipment
CN109495616B (en) Photographing method and terminal equipment
CN106776301B (en) Subelement testing method and device
CN109495638B (en) Information display method and terminal
CN109901761B (en) Content display method and mobile terminal
CN110908627A (en) Screen projection method and first electronic device
CN110069407B (en) Function test method and device for application program
CN109947988B (en) Information processing method and device, terminal equipment and server
CN110096203B (en) Screenshot method and mobile terminal
CN109815349B (en) Information acquisition method and terminal equipment
CN110909776A (en) Image identification method and electronic equipment
CN108108338B (en) Lyric processing method, lyric display method, server and mobile terminal
CN107809515B (en) Display control method and mobile terminal
CN111130995B (en) Image control method, electronic device, and storage medium
CN110908751B (en) Information display and collection method and device, electronic equipment and medium
CN109871324B (en) Control operation method and device
CN108509126B (en) Picture processing method and mobile terminal
CN113190646A (en) User name sample labeling method and device, electronic equipment and storage medium
CN107844203B (en) Input method candidate word recommendation method and mobile terminal

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20210721

Address after: 100016 no.4301, No.52 Jiuxianqiao hospital, Chaoyang District, Beijing

Applicant after: BEIJING TESTIN INFORMATION TECHNOLOGY Co.,Ltd.

Address before: Room 2016, building 2, No.8, Fenghuang Third Road, Zhongxin Guangzhou Knowledge City, Guangzhou 510260, Guangdong Province

Applicant before: GUANGZHOU TESTIN INFORMATION TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant