CN109783379B - Script execution exception determining method and device - Google Patents

Script execution exception determining method and device Download PDF

Info

Publication number
CN109783379B
CN109783379B CN201910003840.6A CN201910003840A CN109783379B CN 109783379 B CN109783379 B CN 109783379B CN 201910003840 A CN201910003840 A CN 201910003840A CN 109783379 B CN109783379 B CN 109783379B
Authority
CN
China
Prior art keywords
script
execution
interface screenshot
recording
determining
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
CN201910003840.6A
Other languages
Chinese (zh)
Other versions
CN109783379A (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 CN201910003840.6A priority Critical patent/CN109783379B/en
Publication of CN109783379A publication Critical patent/CN109783379A/en
Application granted granted Critical
Publication of CN109783379B publication Critical patent/CN109783379B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a script execution abnormity determining method, which comprises the following steps: acquiring a first execution interface screenshot and a first recording interface screenshot when a target control corresponding to a first script step in a test script is determined, and a matching result of a second execution interface screenshot and a second recording interface screenshot when a target control corresponding to a second script step in the test script is determined, wherein the second script step comprises a preset number of script steps executed before the first script step in the test script; determining an execution result of a third script step in the test script, wherein the third script step is a last script step executed before the first script step; and determining whether the execution of the test script is abnormal or not according to the first execution interface screenshot, the first recording interface screenshot, the matching result and the execution result. By adopting the embodiment of the invention, whether the execution of the test script is abnormal can be determined.

Description

Script execution exception determining method and device
Technical Field
The invention relates to the field of terminals, in particular to a script execution abnormity determining method and device.
Background
Before an Application (APP) is released, functions and performances of the APP need to be tested, running conditions of the APP need to be tested on multiple terminals, whether the functions of the APP meet expectations or not is checked, and compatibility on different terminals is achieved.
The script refers to a series of instructions of a specific test, and because the control corresponding to the script step may have the phenomena of incomplete control attribute information, or a plurality of controls with the same attribute, and the like, in the process of an automatic test, the wrong control is easily found when the control is searched, so that the execution of the corresponding script step is abnormal, and further the execution of the whole script is abnormal.
Therefore, it is necessary to provide a script execution exception determining method for determining whether a script executes an exception.
Disclosure of Invention
The embodiment of the invention provides a script execution exception determining method.
In order to solve the technical problem, the invention is realized as follows:
in a first aspect, a method for determining a script execution exception is provided, where the method includes:
the method comprises the steps of obtaining a first execution interface screenshot and a first recording interface screenshot when a target control corresponding to a first script step in a test script is determined, and obtaining a matching result of a second execution interface screenshot and a second recording interface screenshot when a target control corresponding to a second script step in the test script is determined, wherein the first script step is any one script step in the test script, and the second script step comprises a preset number of script steps which are executed in the test script before the first script step;
determining an execution result of a third script step in the test script, wherein the third script step is a last script step executed before the first script step;
and determining whether the execution of the test script is abnormal or not according to the first execution interface screenshot, the first recording interface screenshot, the matching result and the execution result.
In a second aspect, a method for determining a script execution exception is provided, the method including:
the method comprises the steps of obtaining a first execution parameter and a first recording parameter when a target control corresponding to a first script step in a test script is determined, and obtaining a matching result of a second execution parameter and a second recording parameter when a target control corresponding to a second script step in the test script is determined, wherein the first script step is any one script step in the test script, and the second script step comprises a preset number of script steps which are executed before the first script step in the test script;
determining an execution result of a third script step in the test script, wherein the third script step is a last script step executed before the first script step;
and determining whether the execution of the test script is abnormal or not according to the first execution parameter, the first recording parameter, the matching result and the execution result.
In a third aspect, a method for determining a result of executing a script step is provided, the method comprising:
acquiring a first execution interface screenshot and a first recording interface screenshot when the target control corresponding to the first script step is determined;
acquiring a second execution interface screenshot and a second recording interface screenshot when a target control corresponding to a second script step is determined, wherein the second script step is the last script step executed before the first script step;
and determining an execution result of the second script step according to the first execution interface screenshot, the first recording interface screenshot, the second execution interface screenshot and the second recording interface screenshot.
In a fourth aspect, there is provided a script execution abnormality determination apparatus including:
a first matching result obtaining module, configured to obtain a first execution interface screenshot and a first recording interface screenshot when a target control corresponding to a first script step in the test script is determined, and obtain a matching result of a second execution interface screenshot and a second recording interface screenshot when a target control corresponding to a second script step in the test script is determined, where the first script step is any one script step in the test script, and the second script step includes a preset number of script steps that are executed before the first script step in the test script;
a first execution result determining module, configured to determine an execution result of a third script step in the test script, where the third script step is a last script step executed before the first script step;
and the first script execution abnormity determining module is used for determining whether the execution of the test script is abnormal according to the first execution interface screenshot, the first recording interface screenshot, the matching result and the execution result.
In a fifth aspect, there is provided a script execution abnormality determination apparatus, the apparatus including:
a second matching result obtaining module, configured to obtain a first execution parameter and a first recording parameter when determining a target control corresponding to a first script step in the test script, and obtain a matching result of a second execution parameter and a second recording parameter when determining a target control corresponding to a second script step in the test script, where the first script step is any one script step in the test script, and the second script step includes a preset number of script steps that are executed before the first script step in the test script;
a second execution result determining module, configured to determine an execution result of a third script step in the test script, where the third script step is a last script step executed before the first script step;
and the second script execution abnormity determining module is used for determining whether the execution of the test script is abnormal according to the first execution parameter, the first recording parameter, the matching result and the execution result.
In a sixth aspect, there is provided a script step execution result determination apparatus including:
the first execution interface screenshot obtaining module is used for obtaining a first execution interface screenshot and a first recording interface screenshot when the target control corresponding to the first script step is determined;
a second execution interface screenshot obtaining module, configured to obtain a second execution interface screenshot and a second recording interface screenshot when a target control corresponding to a second script step is determined, where the second script step is a previous script step executed before the first script step;
and the second script step execution result determining module is used for determining the execution result of the second script step according to the first execution interface screenshot, the first recording interface screenshot, the second execution interface screenshot and the second recording interface screenshot.
In a seventh aspect, a terminal device is characterized by comprising: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method according to the first aspect.
In an eighth aspect, a terminal device, comprising: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method according to the second aspect.
In a ninth aspect, a terminal device, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method according to the third aspect.
A tenth aspect provides a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, realizes the steps of the method according to the first aspect.
In an eleventh aspect, a computer-readable storage medium is provided, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the method according to the second aspect.
In a twelfth aspect, a computer-readable storage medium is provided, characterized in that the computer-readable storage medium has stored thereon a computer program, which when executed by a processor implements the steps of the method according to the third aspect.
In the embodiment of the invention, a first execution interface screenshot and a first recording interface screenshot when a target control corresponding to a first script step in a test script is determined are obtained, and a matching result of a second execution interface screenshot and a second recording interface screenshot when a target control corresponding to a second script step in the test script is determined; determining an execution result of a third script step in the test script; and determining whether the execution of the test script is abnormal or not according to the first execution interface screenshot, the first recording interface screenshot, the matching result and the execution result. The determination of whether the execution of the script is abnormal can be realized.
In the embodiment of the invention, a first execution parameter and a first recording parameter when a target control corresponding to a first script step in a test script is determined are obtained, and a matching result of a second execution parameter and a second recording parameter when a target control corresponding to a second script step in the test script is determined; determining an execution result of a third script step in the test script; and determining whether the execution of the test script is abnormal or not according to the first execution parameter, the first recording parameter, the matching result and the execution result. The determination of whether the execution of the script is abnormal can be realized.
In the embodiment of the invention, a first execution interface screenshot and a first recording interface screenshot when a target control corresponding to a first script step is determined are obtained; acquiring a second execution interface screenshot and a second recording interface screenshot when the target control corresponding to the second script step is determined; and determining an execution result of the second script step according to the first execution interface screenshot, the first recording interface screenshot, the second execution interface screenshot and the second recording interface screenshot. The determination of whether the execution of the script step is abnormal can be achieved.
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 flowchart illustrating a method for determining a script execution exception according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for determining a script execution exception according to another embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for determining a script execution exception according to another embodiment of the present invention;
FIG. 4 is a flowchart illustrating a method for determining a script execution exception according to another embodiment of the present invention;
FIG. 5 is a flowchart illustrating a method for determining a result of executing a script step according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a script execution exception determining apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a script execution exception determining apparatus according to another embodiment of the present invention;
FIG. 8 is a schematic structural diagram of a device for determining the execution result of a script step according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of a terminal 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.
An embodiment of the present invention provides a method for determining a script execution exception, which is shown in fig. 1 and includes:
102, obtaining a first execution interface screenshot and a first recording interface screenshot when a target control corresponding to a first script step in a test script is determined, and obtaining a matching result of a second execution interface screenshot and a second recording interface screenshot when a target control corresponding to a second script step in the test script is determined, wherein the first script step is any script step in the test script, and the second script step comprises a preset number of script steps executed before the first script step in the test script.
The test script is divided into two states of recording and executing, the test script comprises a plurality of script steps, the preset number is 3, the first script step is the 6 th step as an example, and the second script step is 3 steps which are closest to the 6 th step before the 6 th step, namely, the 3 rd step, the 4 th step and the 5 th step; the first execution interface screenshot is a terminal interface screenshot when the target control corresponding to the step 6 is determined when the test script is in an execution state; the first recording interface screenshot is a terminal interface screenshot when the target control corresponding to the step 6 is determined when the test script is in a recording state; similarly, the second execution interface screenshot is a terminal interface screenshot when the target control corresponding to the steps 3, 4 and 5 is determined when the test script is in the execution state; the second recording interface screenshot is the terminal interface screenshot when the target control corresponding to the steps 3, 4 and 5 is determined when the test script is in the recording state; the specific operation of the script step can be clicking or asserting the corresponding control, and the control corresponding to the script step is a target control; the matching result includes a match and a mismatch.
It should be noted that, taking any one of the preset number of script steps as a fourth script step, an implementation manner of step 102 may be:
step S1, obtaining a matching result of a fourth execution interface screenshot and a fourth recording interface screenshot when the target control corresponding to the fourth script step is determined;
and step S2, acquiring a matching result of the second execution interface screenshot and the second recording interface screenshot when the target control corresponding to the second script step is determined based on the matching result of the execution interface screenshot and the recording interface screenshot when the target control corresponding to each script step in the preset number of script steps is determined.
The implementation manner may specifically be exemplified as follows:
if the second script step is the 3 rd, 4 th or 5 th step, the fourth script step is any one of the 3 rd, 4 th or 5 th step; thus, the matching result of the second script step taking the 3 rd, 4 th and 5 th steps as a whole can be determined by respectively determining the matching results of the 3 rd, 4 th and 5 th steps; when determining the matching result of the execution interface screenshot and the recording interface screenshot, a first matching threshold value can be preset, the matching degree of the execution interface screenshot and the recording interface screenshot is not lower than the first matching threshold value, the execution interface screenshot and the recording interface screenshot are considered to be matched, and the matching degree is not lower than the first matching threshold value, so that the execution interface screenshot and the recording interface screenshot are not matched.
Based on the above, the matching result of the second execution interface screenshot and the second recording interface screenshot is obtained through the matching result of the execution interface screenshot and the recording interface screenshot when the target control corresponding to each script step in the preset number of script steps is performed, the matching result of the execution interface screenshot and the recording interface screenshot when the target control corresponding to each script step in the preset number of script steps performed before the first script step can be analyzed as a whole, and the accuracy for determining the execution abnormity of the script can be higher.
Further, one implementation manner of step S2 may be:
and under the condition that the matching results of the execution interface screenshot and the recording interface screenshot when the target control corresponding to each script step in the preset number of script steps are not matched, determining that the matching results of the execution interface screenshot and the recording interface screenshot when the target control corresponding to the second script step is not matched.
Specifically, the matching result of the second script step is determined to be unmatched only if the matching results of the script steps constituting the second script step are all unmatched.
Based on the method, the matching result of the execution interface screenshot and the recording interface screenshot when the target control corresponds to the second script step can be determined according to the matching result of the execution interface screenshot and the recording interface screenshot when the target control corresponds to each script step in the preset number of script steps, so that the determined matching result of the second execution interface screenshot and the second recording interface screenshot is more accurate.
Step 104: and determining an execution result of a third script step in the test script, wherein the third script step is a last script step executed before the first script step.
Wherein, the first script step may be the 3 rd step, and the second script step is the previous step of the 3 rd step, i.e. the 2 nd step.
One implementation of step 104 may be:
step S1, acquiring a third execution interface screenshot and a third recording interface screenshot when the target control corresponding to the third script step is determined;
and step S2, determining the execution result of the third script step according to the first execution interface screenshot, the first recording interface screenshot, the third execution interface screenshot and the third recording interface screenshot.
Based on this, the execution result of the previous script step executed before the script step is determined through the execution interface screenshot and the recording section screenshot of the previous script step executed before the script step, so that the determination of the execution result of the previous script step is simpler and more convenient.
Further, one implementation manner of step S2 may be:
under the condition that the first recording interface screenshot is matched with the third recording interface screenshot and the first execution interface screenshot is matched with the third execution interface screenshot, determining that the execution result of the third script step is normal;
and under the condition that the first recording interface screenshot is not matched with the third recording interface screenshot and the first execution interface screenshot is not matched with the third execution interface screenshot, determining that the execution result of the third script step is normal.
The implementation manner may specifically be exemplified as follows:
when determining whether the recording interface screenshots of two adjacent script steps are matched and determining whether the execution interface screenshots of two adjacent script steps are matched, a second matching threshold value can be preset, the matching degree of the recording interface screenshots of two adjacent script steps or the matching degree of the execution interface screenshots of two adjacent script steps is not lower than the second matching threshold value, the recording interface screenshots are considered to be matched, and the matching degree is lower than the second matching threshold value, the recording interface screenshots are not considered to be matched.
When the recorded interface screenshots are matched and the executed interface screenshots are matched, the execution result of the script step is normal;
and when the recorded interface screenshots are not matched and the executed interface screenshots are not matched, the execution result of the script step is normal execution.
Based on this, specifically, the execution result of the previous script step can be determined according to whether the recording interface screenshot of a certain script step is matched with the recording interface screenshot of the previous script step, and whether the script step is matched with the execution interface screenshot of the previous script step, so that the determination of the execution result of the previous script step is more accurate and simpler.
Step 106: and determining whether the execution of the test script is abnormal or not according to the first execution interface screenshot, the first recording interface screenshot, the matching result and the execution result.
Based on the method, whether the execution of the test script is abnormal or not can be determined through whether the first execution interface screenshot is matched with the first recording interface screenshot or not, the matching result of the second execution interface screenshot and the second recording interface screenshot and the execution result of the third script step.
One implementation of step 106 may be:
and S1, determining that the execution of the test script is abnormal under the condition that the execution result is normal, the first execution interface screenshot is not matched with the first recording interface screenshot, and the matching result of the second execution interface screenshot and the second recording interface screenshot is not matched.
The implementation manner may specifically be exemplified as follows:
if the test script is determined to be abnormal or not, if the step 5 has been executed and the target control corresponding to the step 6 has been determined, and the preset number is 3, the execution result in the step 5 is normal, the step 6 determines that the first execution interface screenshot and the first recording interface screenshot of the corresponding target control are not matched, and if the matching results of the execution interface screenshot and the recording interface screenshot in the steps 3, 4 and 5 are not matched, the execution of the test script is abnormal.
Based on this, when the execution result is normal execution, the first execution interface screenshot is not matched with the first recording interface screenshot, and the matching result is not matched, the execution of the test script is determined to be abnormal, the execution of the test script can be determined to be abnormal according to the multiple script steps, and the determination of the script execution abnormity is more reliable.
Another embodiment of the present invention provides a method for determining a script execution exception, which is shown in fig. 2 and includes:
step 202, obtaining a first execution interface screenshot and a first recording interface screenshot when determining a target control corresponding to a first script step in the test script, and obtaining a matching result of a second execution interface screenshot and a second recording interface screenshot when determining a target control corresponding to a second script step in the test script, wherein the first script step is any script step in the test script, and the second script step comprises a preset number of script steps executed in the test script before the first script step.
And 204, acquiring a third execution interface screenshot and a third recording interface screenshot when the target control corresponding to the third script step is determined, wherein the third script step is the last script step executed before the first script step.
Step 206, determining that the execution result of the third script step is normal when the first recording interface screenshot is matched with the third recording interface screenshot and the first execution interface screenshot is matched with the third execution interface screenshot;
and under the condition that the first recording interface screenshot is not matched with the third recording interface screenshot and the first execution interface screenshot is not matched with the third execution interface screenshot, determining that the execution result of the third script step is normal.
And 208, determining that the execution of the test script is abnormal under the condition that the execution result is normal, the first execution interface screenshot is not matched with the first recording interface screenshot, and the matching result of the second execution interface screenshot and the second recording interface screenshot is not matched.
Based on the method, the execution result of the third script step is determined through the matching result of the first recording interface screenshot and the third recording interface screenshot and the matching result of the first execution interface screenshot and the third execution interface screenshot, and whether the first execution interface screenshot is matched with the first recording interface screenshot or not and the matching result of the second execution interface screenshot and the second recording interface screenshot can be used for more accurately determining whether the script is abnormally executed or not.
Another embodiment of the present invention provides a method for determining a script execution exception, which is shown in fig. 3 and includes:
step 302, obtaining a first execution parameter and a first recording parameter when determining a target control corresponding to a first script step in the test script, and determining a matching result of a second execution parameter and a second recording parameter when determining a target control corresponding to a second script step in the test script, wherein the first script step is any one script step in the test script, and the second script step includes a preset number of script steps executed in the test script before the first script step;
step 304, determining an execution result of a third script step in the test script, where the third script step is a last script step executed before the first script step;
step 306, determining whether the execution of the test script is abnormal according to the first execution parameter, the first recording parameter, the matching result and the execution result.
The execution parameter or the recording parameter may be windows info, which is used to store window information, and is an output parameter of a getwindows info API (to retrieve information about a specified window), the execution parameter is windows info when the test script is executed, and the recording parameter is windows info when the test script is recorded. When the execution parameters and the recording parameters are used to determine whether the script execution is abnormal, the method is similar to the method for determining whether the script execution is abnormal by using the execution interface screenshot and the recording interface screenshot, and details are not repeated here.
For the embodiment corresponding to fig. 3, it can be determined whether the execution of the test script is abnormal or not by whether the first execution parameter is matched with the first recording parameter, the matching result of the second execution parameter with the second recording parameter, and the execution result of the third script step.
One implementation of step 306 may be:
and S1, determining that the execution of the test script is abnormal under the condition that the execution result is normal, the first execution parameter is not matched with the first recording parameter, and the matching result of the second execution parameter and the second recording parameter is not matched.
The implementation manner may specifically be exemplified as follows:
when determining whether the script execution is abnormal, if the test script has already executed the 5 th step and has already determined that the target control corresponding to the 6 th step has a preset number of 3, the execution result of the 5 th step is normal, the 6 th step determines that the first execution parameter and the first recording parameter are not matched when the corresponding target control is determined, and the matching results of the second execution parameter and the second recording parameter of the 3 rd, 4 th, 5 th steps are not matched, the execution of the test script is abnormal.
Therefore, when the execution result is normal, the first execution parameter is not matched with the first recording parameter, and the matching result is not matched, the execution of the test script is determined to be abnormal, so that the determination of the execution abnormality of the test script is more accurate and simpler.
Another embodiment of the present invention provides a method for determining a script execution exception, which is shown in fig. 4 and includes:
step 402, determining whether a first execution interface screenshot and a first recording interface screenshot of a target control corresponding to the first script step in the test script are matched;
if yes, go to step 412, otherwise go to step 404;
step 404, whether a first execution parameter and a first recording parameter when determining a target control corresponding to the first script step in the test script can be obtained;
if yes, go to step 406, otherwise go to step 408;
step 406, whether the first execution parameter is matched with the first recording parameter;
if yes, go to step 412, otherwise go to step 410;
step 408, determining whether the second execution interface screenshot and the second recording interface screenshot of the target control corresponding to the second script step in the test script are not matched;
if yes, go to step 410, if no, go to step 412;
step 410, determining that the execution of the test script is abnormal;
step 412, determining that the execution of the test script is normal.
Based on this, when determining whether the execution of the test script is abnormal, the execution of the test script is determined to be abnormal according to the first execution interface screenshot and the first recording interface screenshot, the second execution interface screenshot and the second recording interface screenshot, or the first execution interface screenshot and the first recording interface screenshot are not matched, and when the first execution parameter is obtained, the execution of the test script is determined to be abnormal according to the first execution parameter, the first recording parameter, the second execution parameter and the second recording parameter, and the execution result of the third script step, so that the determination of the execution of the script is more accurate and diversified.
An embodiment of the present invention provides a method for determining a script step execution result, which is shown in fig. 5 and includes:
502, acquiring a first execution interface screenshot and a first recording interface screenshot when a target control corresponding to the first script step is determined;
step 504, obtaining a second execution interface screenshot and a second recording interface screenshot when the target control corresponding to the second script step is determined, wherein the second script step is the last script step executed before the first script step;
step 506, determining an execution result of the second script step according to the first execution interface screenshot, the first recording interface screenshot, the second execution interface screenshot and the second recording interface screenshot.
Specifically, the second script step is a script step previous to the first script step.
For the embodiment corresponding to fig. 5, the execution result of the second script step can be determined by the first execution interface screenshot, the first recording interface screenshot, the second execution interface screenshot and the second recording interface screenshot.
One implementation of step 506 may be:
step S1, determining that the execution result of the second script step is abnormal when the first recording interface screenshot is matched with the second recording interface screenshot and the first execution interface screenshot is not matched with the second execution interface screenshot;
and step S2, determining that the execution result of the second script step is abnormal execution under the condition that the first recording interface screenshot is not matched with the second recording interface screenshot and the first execution interface screenshot is matched with the second execution interface screenshot.
Step S3, determining that the execution result of the second script step is normal when the first recording interface screenshot is matched with the second recording interface screenshot and the first execution interface screenshot is matched with the second execution interface screenshot;
and step S4, determining that the execution result of the second script step is normal when the first recording interface screenshot is not matched with the second recording interface screenshot and the first execution interface screenshot is not matched with the second execution interface screenshot.
The implementation manner may specifically be exemplified as follows:
when determining whether the recording interface screenshots of two adjacent script steps are matched or not, or whether the execution interface screenshots of two adjacent script steps are matched or not, presetting a third matching threshold, and if the matching degree of the recording interface screenshots of two adjacent script steps is not lower than the third matching threshold, considering that the recording interface screenshots of two adjacent script steps are matched, and if the matching degree is lower than the third matching threshold, considering that the recording interface screenshots of two adjacent script steps are not matched; and if the matching degree of the screenshots of the execution interfaces of the two adjacent script steps is not lower than a third matching threshold, the screenshots of the execution interfaces of the two adjacent script steps are considered to be matched, and if the matching degree is lower than the third matching threshold, the screenshots of the execution interfaces of the two adjacent script steps are not considered to be matched.
When the recorded interface screenshots are matched and the executed interface screenshots are matched, the execution result of the script step is normal;
and when the recorded interface screenshots are not matched and the executed interface screenshots are not matched, the execution result of the script step is normal execution.
When the recorded interface screenshots are matched and the execution interface screenshots are not matched, the execution result of the script step is execution abnormity, and the execution abnormity under the condition can be the click error of the target control;
when the recorded interface screenshots are not matched and the execution interface screenshots are matched, the execution result of the script step is execution abnormity, and the execution abnormity under the condition can be that the target control clicks no reaction.
Based on this, specifically, according to whether the recording interface screenshot of a certain script step is matched with the recording interface screenshot of the previous script step, and whether the execution interface screenshot of the script step is matched with the execution interface screenshot of the previous script step, the execution result of the previous script step can be determined more accurately and simply.
In addition, for simplicity of explanation, the above-described method embodiments are described as a series of acts or combinations, but it should be understood by those skilled in the art that the present invention is not limited by the order of acts or steps described, as some steps may be performed in other orders or simultaneously according to the present invention. Furthermore, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Fig. 6 is a schematic structural diagram of a script execution exception determining apparatus according to an embodiment of the present invention, and referring to fig. 6, the apparatus may specifically include: a first matching result obtaining module 602, a first execution result determining module 604, and a first script execution exception determining module 606, wherein:
a first matching result obtaining module 602, configured to obtain a first execution interface screenshot and a first recording interface screenshot when a target control corresponding to a first script step in a test script is determined, and obtain a matching result of a second execution interface screenshot and a second recording interface screenshot when a target control corresponding to a second script step in the test script is determined, where the first script step is any one script step in the test script, and the second script step includes a preset number of script steps that are executed before the first script step in the test script;
a first execution result determining module 604, configured to determine an execution result of a third script step in the test script, where the third script step is a last script step executed before the first script step;
a first script execution exception determining module 606, configured to determine whether execution of the test script is abnormal according to the first execution interface screenshot, the first recording interface screenshot, the matching result, and the execution result.
For the embodiment corresponding to fig. 6, whether the execution of the test script is abnormal can be determined by whether the first execution interface screenshot is matched with the first recording interface screenshot, the matching result of the second execution interface screenshot and the second recording interface screenshot, and the execution result of the third script step.
Optionally, the first matching result obtaining module includes:
a first matching result acquisition unit configured to:
taking any one of the preset number of script steps as a fourth script step,
obtaining a matching result of a fourth execution interface screenshot and a fourth recording interface screenshot when the target control corresponding to the fourth script step is determined;
and acquiring a matching result of the second execution interface screenshot and the second recording interface screenshot when the target control corresponding to the second script step is determined based on the matching result of the execution interface screenshot and the recording interface screenshot when the target control corresponding to each script step in the preset number of script steps is determined.
Optionally, the first matching result obtaining unit includes:
a first matching result obtaining subunit configured to:
and under the condition that the matching results of the execution interface screenshot and the recording interface screenshot when the target control corresponding to each script step in the preset number of script steps are not matched, determining that the matching results of the execution interface screenshot and the recording interface screenshot when the target control corresponding to the second script step is not matched.
Optionally, the first execution result determining module includes:
a first execution result determination unit configured to:
acquiring a third execution interface screenshot and a third recording interface screenshot when the target control corresponding to the third script step is determined;
and determining an execution result of the third script step according to the first execution interface screenshot, the first recording interface screenshot, the third execution interface screenshot and the third recording interface screenshot.
Optionally, the first execution result determining unit includes:
a first execution result determination subunit to:
under the condition that the first recording interface screenshot is matched with the third recording interface screenshot and the first execution interface screenshot is matched with the third execution interface screenshot, determining that the execution result of the third script step is normal;
and under the condition that the first recording interface screenshot is not matched with the third recording interface screenshot and the first execution interface screenshot is not matched with the third execution interface screenshot, determining that the execution result of the third script step is normal.
Optionally, the first script execution exception determining module includes:
a first script execution exception determination unit to:
and determining that the execution of the test script is abnormal under the condition that the execution result is normal, the first execution interface screenshot is not matched with the first recording interface screenshot, and the matching result of the second execution interface screenshot and the second recording interface screenshot is not matched.
Fig. 7 is a schematic structural diagram of a script execution exception determining apparatus according to another embodiment of the present invention, and referring to fig. 7, the apparatus may specifically include: a second matching result obtaining module 702, a second execution result obtaining module 704, and a second script execution exception determining module 706, wherein:
a second matching result obtaining module 702, configured to obtain a first execution parameter and a first recording parameter when determining a target control corresponding to a first script step in a test script, and obtain a matching result of a second execution parameter and a second recording parameter when determining a target control corresponding to a second script step in the test script, where the first script step is any one script step in the test script, and the second script step includes a preset number of script steps that are executed before the first script step in the test script;
a second execution result determining module 704, configured to determine an execution result of a third script step in the test script, where the third script step is a last script step executed before the first script step;
a second script execution exception determining module 706, configured to determine whether the execution of the test script is abnormal according to the first execution parameter, the first recording parameter, the matching result, and the execution result.
For the embodiment corresponding to fig. 7, it can be determined whether the execution of the test script is abnormal or not by whether the first execution parameter is matched with the first recording parameter or not, the matching result of the second execution parameter with the second recording parameter, and the execution result of the third script step.
Optionally, the second script execution exception determining module includes:
a second script execution exception determination unit to:
and determining that the execution of the test script is abnormal under the condition that the execution result is normal, the first execution parameter is not matched with the first recording parameter, and the matching result of the second execution parameter and the second recording parameter is not matched.
Fig. 8 is a schematic structural diagram of a device for determining a script step execution result according to another embodiment of the present invention, and referring to fig. 8, the device may specifically include: a first execution interface screenshot obtaining module 802, a second execution interface screenshot obtaining module 804 and a second script step execution result determining module 806.
A first execution interface screenshot obtaining module 802, configured to obtain a first execution interface screenshot and a first recording interface screenshot when the target control corresponding to the first script step is determined;
a second execution interface screenshot obtaining module 804, configured to obtain a second execution interface screenshot and a second recording interface screenshot when a target control corresponding to a second script step is determined, where the second script step is a previous script step executed before the first script step;
a second script step execution result determining module 806, configured to determine an execution result of the second script step according to the first execution interface screenshot, the first recording interface screenshot, the second execution interface screenshot, and the second recording interface screenshot.
For the embodiment corresponding to fig. 8, the execution result of the second script step can be determined by the first execution interface screenshot, the first recording interface screenshot, the second execution interface screenshot, and the second recording interface screenshot.
Optionally, the module for determining the execution result of the second script step includes:
a second script step execution result determination unit for:
determining that the execution result of the second script step is execution abnormity under the condition that the first recording interface screenshot is matched with the second recording interface screenshot and the first execution interface screenshot is not matched with the second execution interface screenshot;
and under the condition that the first recording interface screenshot is not matched with the second recording interface screenshot and the first execution interface screenshot is matched with the second execution interface screenshot, determining that the execution result of the second script step is abnormal execution.
Under the condition that the first recording interface screenshot is matched with the second recording interface screenshot and the first execution interface screenshot is matched with the second execution interface screenshot, determining that the execution result of the second script step is normal;
and under the condition that the first recording interface screenshot is not matched with the second recording interface screenshot and the first execution interface screenshot is not matched with the second execution interface screenshot, determining that the execution result of the second script step is normal.
The device provided by the embodiment of the present invention can implement each process implemented by the device in the method embodiments of fig. 1 to fig. 5, and is not described herein again to avoid repetition. 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.
Figure 9 is a schematic diagram of a hardware structure of a terminal device implementing various embodiments of the present invention,
the terminal device 900 includes but is not limited to: a radio frequency unit 901, a network module 902, an audio output unit 903, an input unit 904, a sensor 905, a display unit 906, a user input unit 907, an interface unit 908, a memory 909, a processor 910, and a power supply 911. Those skilled in the art will appreciate that the terminal device configuration shown in fig. 9 does not constitute a limitation of the terminal device, and that the terminal device may include more or fewer components than shown, or combine certain components, or a different arrangement of components. In the embodiment of the present invention, the terminal device 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.
The radio frequency unit 901 is configured to obtain a first execution interface screenshot and a first recording interface screenshot when a target control corresponding to a first script step in a test script is determined, and a matching result of a second execution interface screenshot and a second recording interface screenshot when a target control corresponding to a second script step in the test script is determined;
a processor 910, configured to determine an execution result of a third script step in the test script, where the third script step is a last script step executed before the first script step;
and determining whether the execution of the test script is abnormal or not according to the first execution interface screenshot, the first recording interface screenshot, the matching result and the execution result.
Whether the execution of the test script is abnormal or not can be determined through whether the first execution interface screenshot is matched with the first recording interface screenshot or not, the matching result of the second execution interface screenshot and the second recording interface screenshot and the execution result of the third script step.
It should be understood that, in the embodiment of the present invention, the radio frequency unit 901 may be used for receiving and sending signals during a message transmission and reception process or a call process, and specifically, after receiving downlink data from a base station, the downlink data is processed by the processor 910; in addition, the uplink data is transmitted to the base station. Generally, the radio frequency unit 901 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. In addition, the radio frequency unit 901 can also communicate with a network and other devices through a wireless communication system.
The terminal device provides wireless broadband internet access to the user through the network module 902, such as helping the user send and receive e-mails, browse webpages, access streaming media, and the like.
The audio output unit 903 may convert audio data received by the radio frequency unit 901 or the network module 902 or stored in the memory 909 into an audio signal and output as sound. Also, the audio output unit 903 may also provide audio output related to a specific function performed by the terminal apparatus 900 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 903 includes a speaker, a buzzer, a receiver, and the like.
The input unit 904 is used to receive audio or video signals. The input Unit 904 may include a Graphics Processing Unit (GPU) 9041 and a microphone 9042, and the Graphics processor 9041 processes image data of a still picture or video obtained by an image capturing device (such as a camera) in a video capture mode or an image capture mode. The processed image frames may be displayed on the display unit 906. The image frames processed by the graphic processor 9041 may be stored in the memory 909 (or other storage medium) or transmitted via the radio frequency unit 901 or the network module 902. The microphone 9042 can receive sounds and can process such sounds 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 901 in case of the phone call mode.
The terminal device 900 also includes at least one sensor 905, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor includes an ambient light sensor that can adjust the brightness of the display panel 9061 according to the brightness of ambient light, and a proximity sensor that can turn off the display panel 9061 and/or backlight when the terminal device 900 is moved to the ear. As one of the motion sensors, the 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 terminal device posture (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration identification related functions (such as pedometer, tapping), and the like; the sensors 905 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 are not described in detail herein.
The display unit 906 is used to display information input by the user or information provided to the user. The Display unit 906 may include a Display panel 9061, and the Display panel 9061 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 907 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the terminal device. Specifically, the user input unit 907 includes a touch panel 9071 and other input devices 9072. The touch panel 9071, also referred to as a touch screen, may collect touch operations by a user on or near the touch panel 9071 (e.g., operations by a user on or near the touch panel 9071 using a finger, a stylus, or any other suitable object or accessory). The touch panel 9071 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 910, receives a command from the processor 910, and executes the command. In addition, the touch panel 9071 may be implemented by using various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The user input unit 907 may include other input devices 9072 in addition to the touch panel 9071. Specifically, the other input devices 9072 may include, but are not limited to, a physical keyboard, function keys (such as a volume control key, a switch key, and the like), a track ball, a mouse, and a joystick, which are not described herein again.
Further, the touch panel 9071 may be overlaid on the display panel 9061, and when the touch panel 9071 detects a touch operation on or near the touch panel 9071, the touch panel is transmitted to the processor 910 to determine the type of the touch event, and then the processor 910 provides a corresponding visual output on the display panel 9061 according to the type of the touch event. Although in fig. 9, the touch panel 9071 and the display panel 9061 are implemented as two independent components to implement the input and output functions of the terminal device, in some embodiments, the touch panel 9071 and the display panel 9061 may be integrated to implement the input and output functions of the terminal device, which is not limited herein.
The interface unit 908 is an interface for connecting an external device to the terminal apparatus 900. 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 908 may be used to receive input (e.g., data information, power, etc.) from external devices and transmit the received input to one or more elements within the terminal apparatus 900 or may be used to transmit data between the terminal apparatus 900 and external devices.
The memory 909 may be used to store software programs as well as various data. The memory 909 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 for 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 909 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 910 is a control center of the terminal device, connects various parts of the entire terminal device with various interfaces and lines, and performs various functions of the terminal device and processes data by running or executing software programs and/or modules stored in the memory 909 and calling data stored in the memory 909, thereby performing overall monitoring of the terminal device. Processor 910 may include one or more processing units; preferably, the processor 910 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It is to be appreciated that the modem processor described above may not be integrated into processor 910.
The terminal device 900 may further include a power supply 911 (e.g., a battery) for supplying power to various components, and preferably, the power supply 911 may be logically connected to the processor 910 through a power management system, so as to manage charging, discharging, and power consumption management functions through the power management system.
In addition, the terminal device 900 includes some functional modules that are not shown, and are not described in detail here.
Preferably, an embodiment of the present invention further provides a terminal device, which includes a processor 910, a memory 909, and a computer program that is stored in the memory 909 and can be run on the processor 910, and when the computer program is executed by the processor 910, the computer program implements each process of the above-mentioned method for determining a script execution exception, 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 method for determining a script execution exception, 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 (3)

1. A script execution exception determining method, comprising:
the method comprises the steps of obtaining a first execution parameter and a first recording parameter when a target control corresponding to a first script step in a test script is determined, and obtaining a matching result of a second execution parameter and a second recording parameter when a target control corresponding to a second script step in the test script is determined, wherein the first script step is any one script step in the test script, and the second script step comprises a preset number of script steps which are executed before the first script step in the test script;
determining an execution result of a third script step in the test script, wherein the third script step is a last script step executed before the first script step;
and determining whether the execution of the test script is abnormal or not according to the first execution parameter, the first recording parameter, the matching result and the execution result.
2. The method of claim 1, wherein determining whether the execution of the test script is abnormal according to the first execution parameter, the first recording parameter, the matching result, and the execution result comprises:
and determining that the execution of the test script is abnormal under the condition that the execution result is normal, the first execution parameter is not matched with the first recording parameter, and the matching result of the second execution parameter and the second recording parameter is not matched.
3. A script execution exception determining apparatus, comprising:
the second matching result acquisition module is used for acquiring a first execution parameter and a first recording parameter when a target control corresponding to a first script step in a test script is determined, and acquiring a matching result of a second execution parameter and a second recording parameter when a target control corresponding to a second script step in the test script is determined, wherein the first script step is any one script step in the test script, and the second script step comprises a preset number of script steps which are executed in the test script before the first script step;
a second execution result determining module, configured to determine an execution result of a third script step in the test script, where the third script step is a last script step executed before the first script step;
and the second script execution abnormity determining module is used for determining whether the execution of the test script is abnormal according to the first execution parameter, the first recording parameter, the matching result and the execution result.
CN201910003840.6A 2019-01-03 2019-01-03 Script execution exception determining method and device Active CN109783379B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910003840.6A CN109783379B (en) 2019-01-03 2019-01-03 Script execution exception determining method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910003840.6A CN109783379B (en) 2019-01-03 2019-01-03 Script execution exception determining method and device

Publications (2)

Publication Number Publication Date
CN109783379A CN109783379A (en) 2019-05-21
CN109783379B true CN109783379B (en) 2022-02-08

Family

ID=66499818

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910003840.6A Active CN109783379B (en) 2019-01-03 2019-01-03 Script execution exception determining method and device

Country Status (1)

Country Link
CN (1) CN109783379B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111026667B (en) * 2019-12-09 2023-05-05 北京乐学帮网络技术有限公司 Script execution method and device and electronic equipment

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100543701C (en) * 2007-12-25 2009-09-23 中兴通讯股份有限公司 A kind of method and system that realize embedded software unconventionality testing
CN101339534B (en) * 2008-06-17 2010-10-13 金蝶软件(中国)有限公司 Software test apparatus and test method
US9448915B2 (en) * 2011-04-13 2016-09-20 Accenture Global Services Limited Modular script designer for next generation testing system
CN104866414B (en) * 2014-02-24 2018-07-06 腾讯科技(深圳)有限公司 The test method of application program, apparatus and system
CN105740151B (en) * 2016-02-03 2018-05-08 惠州Tcl移动通信有限公司 A kind of mobile terminal UI controls check processing method and system
CN106021095B (en) * 2016-05-06 2018-11-30 北京邮电大学 A kind of Android application automated testing method based on push-mechanism
CN107066376A (en) * 2016-12-15 2017-08-18 中国航天科工集团第四研究院第四总体设计部 A kind of automatic test verification method tested for GUI
CN108536597A (en) * 2018-04-11 2018-09-14 上海达梦数据库有限公司 A kind of terminal test method, device, terminal device and storage medium

Also Published As

Publication number Publication date
CN109783379A (en) 2019-05-21

Similar Documents

Publication Publication Date Title
CN108845853B (en) Application program starting method and mobile terminal
CN109078319B (en) Game interface display method and terminal
CN108279948B (en) Application program starting method and mobile terminal
CN110109593B (en) Screen capturing method and terminal equipment
CN109947650B (en) Script step processing method, device and system
CN109343788B (en) Operation control method of mobile terminal and mobile terminal
CN110096203B (en) Screenshot method and mobile terminal
CN108958593B (en) Method for determining communication object and mobile terminal
CN110659098A (en) Data updating method and device, terminal equipment and storage medium
CN107765954B (en) Application icon updating method, mobile terminal and server
CN110990679A (en) Information searching method and electronic equipment
CN110069407B (en) Function test method and device for application program
CN109284146B (en) Light application starting method and mobile terminal
CN111061446A (en) Display method and electronic equipment
CN108628534B (en) Character display method and mobile terminal
CN108093119B (en) Strange incoming call number marking method and mobile terminal
CN111310165B (en) Account switching or registering method and electronic equipment
CN111130995B (en) Image control method, electronic device, and storage medium
CN111427644B (en) Target behavior identification method and electronic equipment
CN110730013B (en) Method for improving transmission stray and mobile terminal
CN109857673B (en) Control identification method and device
CN110471682B (en) Application program updating method and mobile terminal
CN109871324B (en) Control operation method and device
CN109491572B (en) Screen capturing method of mobile terminal and mobile terminal
CN109660657B (en) Application program control method and device

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: 20210716

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