CN110032510B - Application testing method and device - Google Patents
Application testing method and device Download PDFInfo
- Publication number
- CN110032510B CN110032510B CN201910171594.5A CN201910171594A CN110032510B CN 110032510 B CN110032510 B CN 110032510B CN 201910171594 A CN201910171594 A CN 201910171594A CN 110032510 B CN110032510 B CN 110032510B
- Authority
- CN
- China
- Prior art keywords
- interface
- contour
- target
- unmarked
- interfaces
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The invention discloses an application testing method and device. Wherein, the method comprises the following steps: when a current running interface of a target application is tested on a terminal, detecting that an unmarked interface appears on the terminal; identifying a first object with a target graph in an unmarked interface; in the case that the first object is recognized, performing a first operation on the first object; and under the condition that the next interface is detected to be the current operation interface, determining that the current operation interface is in a state of being allowed to execute the test operation, and executing the test operation on the current operation interface on the terminal. The invention solves the technical problem of lower testing efficiency in the related technology.
Description
Technical Field
The invention relates to the field of computers, in particular to an application testing method and device.
Background
In the conventional automatic application test, various abnormal situations are often encountered, especially various unexpected bullet boxes (such as a mobile phone system bullet box, an operation activity bullet box in an application, etc.) and unknown interfaces, and scripts are generally difficult to process, and unless human intervention is performed, the script cannot automatically return to the test process to continue the test, and the original test task has to be quitted.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides an application testing method and device, which at least solve the technical problem of low testing efficiency of application in the related technology.
According to an aspect of an embodiment of the present invention, there is provided an application testing method, including:
when a current running interface of a target application is tested on a terminal, detecting that an unmarked interface appears on the terminal, wherein the unmarked interface is used for making the current running interface incapable of being tested, the unmarked interface is different from a pre-marked interface, and the pre-marked interface is used for testing the target application;
identifying a first object with a target graph in the unmarked interface, wherein the first object is an object allowing a first operation to be executed, and the first operation is used for enabling the unmarked interface to jump to a next interface;
performing the first operation on the first object if the first object is identified;
and under the condition that the next interface is detected to be the current operation interface, determining that the current operation interface is in a state of being allowed to execute the test operation, and executing the test operation on the current operation interface on the terminal.
According to another aspect of the embodiments of the present invention, there is also provided an applied test apparatus, including:
the device comprises a first detection module, a second detection module and a third detection module, wherein the first detection module is used for detecting that an unmarked interface appears on a terminal when a current running interface of a target application is tested on the terminal, the unmarked interface is used for preventing the current running interface from being executed with test operation, the unmarked interface is different from a pre-marked interface, and the pre-marked interface is used for testing the target application;
a first identification module, configured to identify a first object having a target graphic in the unlabeled interface, where the first object is an object that allows a first operation to be performed, and the first operation is used to jump the unlabeled interface to a next interface;
a first execution module, configured to execute the first operation on the first object if the first object is identified;
a first determining module, configured to determine that the current running interface is in a state of being allowed to perform the test operation when it is detected that the next interface is the current running interface, and perform the test operation on the current running interface on the terminal.
Optionally, the apparatus further comprises:
a second identifying module, configured to identify a second object in the unlabeled interface if the first object is not identified, where the second object is an object on a native control carried by a system running the target application, the second object is an object that allows a second operation to be performed, and the second operation is used to cause the unlabeled interface to jump to the next interface;
and the second execution module is used for executing the second operation on the second object under the condition that the second object is identified.
Optionally, the apparatus further comprises:
a third identification module, configured to identify, in the case that the second object is not identified, a third object with a target text in the unlabeled interface, where the third object is an object that allows a third operation to be performed, and the third operation is used to jump the unlabeled interface to the next interface;
a third execution module, configured to execute the third operation on the third object if the third object is identified.
Optionally, the apparatus further comprises:
a fourth identification module, configured to identify a fourth object in the unmarked interface if the third object is not identified, where the fourth object is an operable object in the pre-marked interface;
and the fourth execution module is used for executing a fourth operation on the fourth object under the condition that the fourth object is identified, wherein the fourth operation is an operation executed on the fourth object in the process of testing the target application.
Optionally, the unlabeled interface includes a plurality of interfaces, wherein the fourth identifying module includes:
the interface processing device comprises a first determining unit, a second determining unit and a judging unit, wherein the first determining unit is used for determining a pre-labeled interface corresponding to each interface in the plurality of interfaces, and the pre-labeled interface corresponding to each interface is a pre-labeled interface with the highest similarity with each interface;
and the identifying unit is used for identifying the fourth object in the plurality of interfaces according to the sequence from high operation priority to low operation priority of the pre-labeled interface corresponding to each interface, wherein the pre-labeled interface with high operation priority is preferentially operated in the process of testing the target application.
Optionally, the identification unit includes:
a first identifying subunit, configured to identify, according to an order from high to low of operation priorities of pre-labeled interfaces corresponding to each interface, the fourth object in other interfaces except for a bottommost interface in the multiple interfaces, where the bottommost interface is an interface with the lowest corresponding operation priority;
and the second identification subunit is used for identifying the fourth object in the bottommost layer interface according to the number of the bottommost layer interfaces.
Optionally, the second identifying subunit is configured to:
under the condition that the number of the bottommost interfaces is not lower than a target threshold value, clustering the bottommost interfaces according to the highest similarity between the bottommost interfaces and interfaces labeled in advance to obtain a plurality of interface sets, wherein each interface set in the plurality of interface sets comprises one or more bottommost interfaces;
and identifying the fourth object in the bottommost interface included in each interface set according to the sequence from high to low of the number of the bottommost interfaces included in each interface set in the plurality of interface sets.
Optionally, the first identification module includes:
the extracting unit is used for extracting a key outline from the acquired interface screenshot of the unmarked interface to obtain an outline drawing;
the detection unit is used for detecting a target contour which accords with the target graph from the contour map;
and a second determining unit, configured to determine that the first object is recognized when the target contour is detected, where an object having the target contour in the unmarked interface is the first object.
Optionally, the detection unit includes:
a first extraction subunit, configured to extract a first candidate contour matching the size of the target contour from the contour map;
a second extraction subunit, configured to extract, from the first candidate contours, second candidate contours having a graphic feature of the target contour;
a third extraction subunit, configured to extract a first keypoint set and a second keypoint set from the contour map according to a position of a center point of the second candidate contour and a position relationship between the center point of the target contour and a target keypoint, where the target keypoint includes a first target keypoint located within a region where the target contour is located and a second target keypoint located outside the region where the target contour is located, the first keypoint set includes the center point of the second candidate contour and a point on the second candidate contour corresponding to the first target keypoint, and the second keypoint set includes a point on the second candidate contour corresponding to the second target keypoint;
a determining subunit, configured to determine that the second candidate contour is the target contour if all the points included in the first keypoint set fall within the region divided by the second candidate contour and all the points included in the second keypoint set fall outside the region divided by the second candidate contour.
Optionally, the apparatus further comprises:
the intercepting module is used for intercepting an image of the screening outline from the outline map for the screening outline which does not accord with the target graph in the outline map;
the extraction module is used for extracting a key contour from the image of the screening contour to obtain a contour map of the screening contour;
the second detection module is used for detecting a target contour which accords with the target graph from the contour map of the screening contour;
and the second determining module is used for determining and identifying the first object under the condition that the target contour is detected, wherein the object with the target contour in the unmarked interface is the first object.
Optionally, the apparatus further comprises:
and the third detection module is used for detecting whether the next interface is the unmarked interface or not under the condition that the next interface is not the current operation interface.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium, characterized in that the storage medium stores therein a computer program, wherein the computer program is configured to execute the method described in any one of the above when executed.
According to another aspect of the embodiments of the present invention, there is also provided an electronic apparatus, including a memory and a processor, wherein the memory stores therein a computer program, and the processor is configured to execute the method described in any one of the above through the computer program.
In the embodiment of the invention, when a current running interface of a target application is tested on a terminal, an unmarked interface is detected to appear on the terminal, wherein the unmarked interface is used for preventing the current running interface from being tested, the unmarked interface is different from a pre-marked interface, and the pre-marked interface is used for testing the target application; identifying a first object with a target graph in the unmarked interface, wherein the first object is an object allowing a first operation to be executed, and the first operation is used for enabling the unmarked interface to jump to a next interface; in the case that the first object is recognized, performing a first operation on the first object; under the condition that the next interface is detected to be the current running interface, determining that the current running interface is in a state of being allowed to execute test operation, executing a test operation mode on the current running interface on the terminal, identifying a first object which can enable the interface to jump in a graphic identification mode on the unmarked interface on the terminal when the current running interface of the target application is tested, if the first object is identified, executing a first operation on the first object to enable the interface to jump from the unmarked interface to the next interface, if the next interface is the current running interface which is currently tested, continuing testing the application, and therefore, the current running interface can automatically return to the tested interface from the unmarked interface in the application testing process, the test can automatically go on, and the technical effect of improving the test efficiency of the application is achieved, and the technical problem of low testing efficiency applied in the related technology is solved.
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 application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a schematic diagram of an alternative applied test method according to an embodiment of the invention;
FIG. 2 is a schematic diagram of an application environment of an alternative testing method for an application according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an alternative applied test method according to an alternative embodiment of the invention;
FIG. 4 is a first schematic diagram of a test method according to another alternative application of an alternative embodiment of the present invention;
FIG. 5 is a second schematic diagram of another alternative applied test method according to an alternative embodiment of the present invention;
FIG. 6 is a third schematic diagram of another alternative applied test method according to an alternative embodiment of the invention;
FIG. 7 is a fourth schematic diagram of another alternative applied test method according to an alternative embodiment of the present invention;
FIG. 8 is a fifth schematic illustration of another alternative applied test method according to an alternative embodiment of the present invention;
FIG. 9 is a sixth schematic illustration of a test method according to another alternative application of an alternative embodiment of the present invention;
FIG. 10 is a seventh schematic illustration of a testing method according to another alternative application of an alternative embodiment of the present invention;
FIG. 11 is a diagram eight of another alternative applied test method in accordance with an alternative embodiment of the present invention;
FIG. 12 is a ninth schematic illustration of another alternative applied test method according to an alternative embodiment of the present invention;
FIG. 13 is a ten schematic diagram of another alternative applied test method according to an alternative embodiment of the invention;
FIG. 14 is a schematic diagram of a test apparatus according to an alternative application of an embodiment of the present invention;
FIG. 15 is a schematic diagram of an application scenario of an alternative application testing method according to an embodiment of the present invention; and
FIG. 16 is a schematic view of an alternative electronic device according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, 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 only a part of the embodiments of the present invention, and not all of the embodiments. 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.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of an embodiment of the present invention, there is provided a method for testing an application, as shown in fig. 1, the method including:
s102, when a current running interface of a target application is tested on a terminal, detecting that an unmarked interface appears on the terminal, wherein the unmarked interface is used for preventing the current running interface from being tested, the unmarked interface is different from a pre-marked interface, and the pre-marked interface is used for testing the target application;
s104, identifying a first object with a target graph in the unmarked interface, wherein the first object is an object allowing a first operation to be executed, and the first operation is used for enabling the unmarked interface to jump to a next interface;
s106, under the condition that the first object is identified, performing a first operation on the first object;
and S108, under the condition that the next interface is detected to be the current operation interface, determining that the current operation interface is in a state of being allowed to execute the test operation, and executing the test operation on the current operation interface on the terminal.
Optionally, in this embodiment, the test method applied above may be applied to a hardware environment formed by the terminal 202 shown in fig. 2. As shown in fig. 2, when a current running interface of a target application is tested on a terminal 202, it is detected that an unlabeled interface appears on the terminal 202, where the unlabeled interface is used to make it impossible to perform a test operation on the current running interface, the unlabeled interface is different from a pre-labeled interface, and the pre-labeled interface is used to test the target application; the terminal 202 identifies a first object with a target graph in the unmarked interface, wherein the first object is an object allowing a first operation to be executed, and the first operation is used for enabling the unmarked interface to jump to a next interface; in the case where the first object is recognized, the terminal 202 performs a first operation on the first object; under the condition that the next interface is detected to be the current running interface, the terminal 202 determines that the current running interface is in a state of being allowed to execute the test operation, and executes the test operation on the current running interface on the terminal.
Optionally, in this embodiment, the test method of the application may be, but is not limited to, applied to a scenario of testing a target application. The target application may be, but not limited to, various types of applications, such as an online education application, an instant messaging application, a community space application, a game application, a shopping application, a browser application, a financial application, a multimedia application, a live broadcast application, and the like. In particular, the method can be applied to, but not limited to, the scenario of testing the multimedia application, or can also be applied to, but not limited to, the scenario of testing the game application, so as to improve the efficiency of testing the application. The above is only an example, and this is not limited in this embodiment.
Optionally, in this embodiment, the process of testing the currently running interface of the target application may include, but is not limited to, a test process in which a test path is preset, and the currently running interface may be considered as an interface that should appear currently when an operation is performed according to the preset test path, for example: taking the process of entering into the battle scene in the game test as an example, the test path can be set as follows: the terminal desktop clicks a game client icon to switch to a game login interface, clicks a game starting button to switch to a game hall interface, clicks a fight button to switch to a mode selection interface, clicks a matching mode to switch to a team building interface, clicks the game starting button to switch to a matching process interface, waits for a certain time to enter a game role selection interface, counts down a certain time to enter a game loading interface, and enters a game operation scene after a game is loaded.
Optionally, in this embodiment, the interface labeled in advance may refer to any interface in a preset test path, or may refer to an interface to which switching should be performed currently when the interface is executed according to the preset test path.
Optionally, in this embodiment, the unlabeled interface is different from the pre-labeled interface for testing the target application, and the unlabeled interface may include, but is not limited to, the following cases: and the popped active interface, the system control interface, the interfaces of other applications, the interface which is popped up due to the fact that the operation is not carried out according to the preset operation process in the target application test process, and the like in the target application running process.
Optionally, in this embodiment, the target graphics may include, but are not limited to, graphics having the meaning of closing, canceling, returning, advancing, determining, and the like, such as: crosses, arrows, circles, pairs, etc.
Optionally, in this embodiment, when an object with a target graphic is identified in the unlabeled interface and the object can be subjected to the first operation, the first operation is performed on the object, so that the interface displayed on the terminal jumps from the unlabeled interface to the next interface. The first operation may include, but is not limited to, a click operation, a touch operation, a slide operation, and the like.
For example: the method has the characteristics of light weight and high efficiency, is composed of a series of C functions and a small number of C + + classes, provides interfaces of languages such as Python, Ruby, MATLAB and the like, realizes a plurality of general algorithms in the aspects of image processing and Computer Vision, identifies graphic buttons with return or closing characteristics such as X, and C + + and the like, respectively models different graphics, writes the algorithms to filter multiple noise points of pictures, extract the characteristics of the graphics profiles and the like, and simultaneously solves the problem of high filtering target graphics profile error rate of the Opencv native match algorithm, and has high identification accuracy.
In an alternative embodiment, taking the test of the test path as an example, as shown in fig. 3, after the game starting button is clicked to switch to the game lobby interface, a recommended bullet frame of the game activity is displayed on the running interface of the game client, so that the terminal cannot detect the match button in the game lobby interface, at this time, it can be determined that an unlabeled interface is detected on the terminal, where the unlabeled interface is the recommended bullet frame of the game activity, and a first object having a target graphic (cross "×") is identified in the recommended bullet frame of the game activity, where the first object is an object allowing a click operation to be performed, and the click operation is used to close the recommended bullet frame of the game activity so as to jump back to the game lobby interface. The terminal identifies the first object, performs clicking operation on the first object, determines that the game hall interface is in a state of being allowed to perform testing operation under the condition that the terminal is detected to jump back to the game hall interface, performs testing operation (clicking a fight button) on the game hall interface on the terminal, switches the running picture of the terminal to a mode selection interface, and continues to perform testing on the testing path.
It can be seen that, through the above steps, when a current running interface of a target application is tested, a first object capable of making an interface jump is identified on an unmarked interface on a terminal in a pattern identification manner, if the first object is identified, a first operation is executed on the first object, so that the interface jumps from the unmarked interface to a next interface, and if the next interface is the current running interface which is currently tested, the application can be tested continuously, so that the tested interface can be automatically returned from the unmarked interface which appears in the application testing process, and the test can be automatically carried out, thereby realizing the technical effect of improving the testing efficiency of the application, and further solving the technical problem of low testing efficiency of the application in the related technology.
As an optional scheme, after identifying the first object with the target graph in the unmarked interface, the method further includes:
s1, under the condition that the first object is not identified, identifying a second object in the unlabeled interface, wherein the second object is an object on a native control carried by a system running the target application, the second object is an object allowing a second operation to be executed, and the second operation is used for enabling the unlabeled interface to jump to the next interface;
s2, in case that the second object is recognized, performing a second operation on the second object.
Optionally, in this embodiment, if the first object capable of enabling the interface to jump is not found in the unmarked interface through the graph recognition, the second object capable of enabling the interface to jump in the unmarked interface is recognized in a manner of recognition by the system native control. So that the interface can jump back to the current running interface to continue testing.
Optionally, in this embodiment, when an object in the native control is identified in the unlabeled interface and the object can be performed with the second operation, the second operation is performed on the object, so that the interface displayed on the terminal jumps from the unlabeled interface to the next interface. The second operation may include, but is not limited to, a click operation, a touch operation, a slide operation, and the like.
For example: and recognizing a Native control, filtering out buttons such as 'return, confirmation, cancel, reject, accept, agree, confirm, yes and allow', and executing click operation. By clicking these buttons, the system popup of most cell phones can be closed.
In an alternative embodiment, the process of filtering out and operating the text buttons with specific characteristics by identifying the Native control is as follows:
Step 2, operation is carried out: when all the character buttons with specific characteristics under the current unmarked interface are found, a click method in an automatic test frame is sequentially called for each button, the coordinates of the central point of the button are clicked, and whether the click is effective or not is judged (after the click, if the button disappears, the click is effective).
As an optional scheme, after identifying the second object in the unmarked interface, the method further includes:
s1, under the condition that the second object is not identified, identifying a third object with a target character in the unmarked interface, wherein the third object is an object allowing a third operation to be executed, and the third operation is used for jumping the unmarked interface to the next interface;
s2, in case that the third object is recognized, a third operation is performed on the third object.
Optionally, in this embodiment, if a second object capable of enabling the interface to jump is not found in the unmarked interface through the native control object recognition, a target character having the meaning of closing, canceling, returning, advancing, determining, and the like in the unmarked interface is recognized in a character recognition manner, and a third object capable of enabling the interface to jump is identified. So that the interface can jump back to the current running interface to continue testing.
Optionally, in this embodiment, when an object with target text is identified in the unlabeled interface and the object can be subjected to a third operation, the third operation is performed on the object, so that the interface displayed on the terminal jumps from the unlabeled interface to the next interface. The third operation may include, but is not limited to, a click operation, a touch operation, a slide operation, and the like.
For example: text buttons with return properties, such as "return, ok, cancel, reject, accept, agree, confirm, yes, allow" and the like buttons, are identified by OCR (Optical Character Recognition, which is a technique for translating text content on a picture into computer text by detecting a picture). By clicking the buttons, system pop-up boxes of most mobile phones can be closed, pop-up boxes of various operation activities or prompts in part of applications can be closed, and part of interfaces which are not marked can be retreated to interfaces which are marked in advance.
In an alternative embodiment, the process of identifying and operating a text button with a specific feature by OCR is as follows:
And step 2, performing operation: when all the character buttons with specific characteristics under the current unmarked interface are found, a click method in an automatic test frame is sequentially called for each button, the coordinates of the central point of the button are clicked, and whether the click is effective or not is judged (after the click, if the button disappears, the click is effective).
As an optional solution, after identifying the third object with the target text in the unmarked interface, the method further includes:
s1, under the condition that the third object is not identified, identifying a fourth object in the unmarked interface, wherein the fourth object is an operable object in the interface marked in advance;
and S2, in the case that the fourth object is identified, executing a fourth operation on the fourth object, wherein the fourth operation is the operation executed on the fourth object in the process of testing the target application.
Optionally, in this embodiment, when the interface fails to jump in any of the three recognition manners, the interface jumps by recognizing whether there is a known operable object in the unmarked interface.
As an optional scheme, the unlabeled interface includes a plurality of interfaces, where identifying the fourth object in the unlabeled interface includes:
s1, determining a pre-labeled interface corresponding to each interface in the plurality of interfaces, wherein the pre-labeled interface corresponding to each interface is the pre-labeled interface with the highest similarity to each interface;
s2, identifying fourth objects in the interfaces according to the sequence from high to low of the operation priority of the pre-labeled interface corresponding to each interface, wherein the pre-labeled interface with high operation priority is preferentially operated in the process of testing the target application.
Optionally, in this embodiment, if there are multiple interfaces that are not labeled, the fourth object in the multiple interfaces may be identified according to the order from high to low of the operation priority of the interface that is labeled in advance and corresponds to each interface.
Optionally, in this embodiment, if the target application automation test framework records which known interfaces and which actionable objects exist in the known interfaces, when an unknown interface is encountered, it may be identified whether the actionable objects in the known interfaces exist in the currently unknown interface. Through the operation on the objects, the popup boxes of various operation activities or prompts in part of the application can be closed, and part of the unknown interface can be retreated into the known interface.
Optionally, in this embodiment, identifying, according to the order from high to low of the operation priority of the pre-labeled interface corresponding to each interface, a fourth object in the multiple interfaces includes:
s1, identifying fourth objects in other interfaces except the interface at the lowest layer in the plurality of interfaces according to the sequence of the operation priorities of the interfaces labeled in advance corresponding to each interface from high to low, wherein the interface at the lowest layer is the interface with the lowest operation priority;
and S2, identifying a fourth object in the bottommost interface according to the number of the bottommost interfaces.
Optionally, in this embodiment, identifying the fourth object in the bottom-most interface according to the number of the bottom-most interfaces includes:
s1, clustering the interfaces of the lowest layer according to the highest similarity between the interfaces of the lowest layer and interfaces labeled in advance to obtain a plurality of interface sets under the condition that the number of the interfaces of the lowest layer is not lower than a target threshold value, wherein each interface set in the plurality of interface sets comprises one or more interfaces of the lowest layer;
s2, according to the sequence that the number of the bottommost interfaces included in each interface set in the plurality of interface sets is from high to low, identifying a fourth object in the bottommost interfaces included in each interface set.
In an alternative embodiment, the process of identifying and operating the operable objects in the existing known interface is as follows:
For example: the automated test framework records that there is a button as shown in fig. 6 in the known "backpack" interface, and the button as shown in fig. 7 can be identified in the unknown "title" interface.
And step 2, performing operation: when the operable objects of all known interfaces under the current unknown interface are found, sequentially operating each object according to the operation type of the object recorded by the automatic framework and judging whether the operation is effective or not according to the priority (after the operation, if the object disappears, the operation is effective).
As an alternative, identifying the first object having the target graphic in the unlabeled interface includes:
s1, extracting key contours from the acquired interface screenshots of the interfaces which are not marked to obtain a contour map;
s2, detecting a target contour conforming to the target graph from the contour map;
and S3, under the condition that the target contour is detected, determining that the first object is identified, wherein the object with the target contour in the unmarked interface is the first object.
Optionally, in this embodiment, when an unknown interface is encountered, it is first identified whether a graphic having a close feature or a back feature exists in the current interface in a CV manner, such as buttons "x", "←", and the like. By clicking the 'x' button, the system pop-up boxes of part of the mobile phones can be closed, and the pop-up boxes of various operation activities or prompts in most games can be closed. Rollback from an unknown interface to the previous known interface can be accomplished by clicking the "←" button.
Alternatively, in the present embodiment, taking an "x" button as an example in the process of identifying and operating a graphic button with a specific feature through the CV, the key contour may be extracted in, but is not limited to, the following manner:
and intercepting the interface screenshot of the current unknown interface by utilizing an automatic testing main thread. The key profile of the current interface screenshot is then filtered out. Because the game interface is usually rich in content, if noise point filtering is not performed and the key outline is prominent, more wrong judgments and missed judgments are easily generated, in the embodiment, the extraction of the key outline of the interface is realized aiming at the search of the x outline, and the process comprises the following steps:
step (1), converting the original color game interface screenshot into a gray picture by using a cvtColor method of opencv;
step (2), performing a round of bilateral filtering (adopting a bilatelfilter method of opencv) on the converted picture to highlight a boundary;
step (3), performing one round of Gaussian filtering (adopting the Gaussian method of opencv) on the picture subjected to bilateral filtering to eliminate noise points;
step (4), carrying out binarization on the self-adaptive threshold value of the image subjected to Gaussian filtering by adopting an adaptive threshold method of opencv;
step (5), performing edge detection on the binarized picture by using an opencv Laplacian method;
and (6) extracting the key contour of the image after edge detection by using a findContours method of opencv.
For different games, if the x outline is extracted, the input parameters of each opencv method need to be adjusted according to the characteristics of the game picture so as to achieve the best effect. Moreover, for the same game, aiming at different graphic shapes, the combination algorithm of noise point filtering and key outline highlighting can be adjusted according to the graphic characteristics. As shown in FIG. 8, the original game interface screenshot is on the left, and the interface outline without filtering is on the right. As shown in fig. 9, is an interface profile diagram with key profiles filtered out.
As an alternative, detecting a target contour that conforms to the target pattern from the contour map includes:
s1, extracting a first candidate contour matched with the size of the target contour from the contour map;
s2, extracting a second candidate contour with the graphic feature of the target contour from the first candidate contour;
s3, extracting a first key point set and a second key point set from the contour map according to the position of the central point of the second candidate contour and the position relationship between the central point of the target contour and the target key point, wherein the target key points comprise a first target key point located in the region where the target contour is located and a second target key point located outside the region where the target contour is located, the first key point set comprises the central point of the second candidate contour and a point corresponding to the first target key point on the second candidate contour, and the second key point set comprises a point corresponding to the second target key point on the second candidate contour;
s4, in a case where the points included in the first keypoint set all fall within the region into which the second candidate contour is divided, and the points included in the second keypoint set all fall outside the region into which the second candidate contour is divided, determining the second candidate contour as the target contour.
Optionally, in this embodiment, taking filtering the "x" contour as an example, the opencv native matchShapes may compare the two contours to obtain similar values, but actual tests find that the conclusion obtained by this algorithm is not accurate, and more false and false judgments may be generated. Therefore, in this example, the matchShapes profile contrast filter "x" profile is not used. The flow of implementing the filtering of the "x" profile is as follows:
step (a), judging whether the contour size is proper: the height and width of the outline can be obtained through a boundingRef algorithm of opencv, wherein the height is set as h, and the width is set as w; and the shorter of the height and the width of the original screenshot picture of the game interface is X. (ii) a qualified profile, 0.02< w/X <0.15 and 0.02< h/X <0.15 (where 0.02 and 0.15 are empirical values, adjustable as a function of the actual conditions);
step (b), judging whether the contour is symmetrical: the number of contour points on the left side of the central point is approximately equal to the number of contour points on the right side of the central point, the number of contour points on the upper side of the central point is approximately equal to the number of contour points on the lower side of the central point, and the aspect ratio of the contours is approximately 1;
step (c), selecting key points and judging whether the key points are contained in the contour: as shown in fig. 10, 9 key points are selected for determination. Setting the coordinates of a central point A5 as (x, y), the height of the profile as h and the width as w; then point A1 is taken as (x-w/3, y-h/3), point A2 is taken as (x-w/3, y + h/3), point A3 is taken as (x + w/3, y + h/3), point A4 is taken as (x + w/3y-h/3), point B1 is taken as (x, y-h/3), point B2 is taken as (x + w/3, y), point B3 is taken as (x, y + h/3), point B4 is taken as (x-w/3, y). The eligible contours are all contained within a contour, and none of B1, B2, B3, and B4 are contained within a contour, a1, a2, A3, a4, and a 5. Through the above steps, an "x" profile can be identified, as shown in fig. 11.
As an optional scheme, after detecting the target contour conforming to the target pattern from the contour map, the method further includes:
s1, for the screening outline which does not accord with the target graph in the outline graph, intercepting the image of the screening outline from the outline graph;
s2, extracting key contours from the images of the screened contours to obtain contour maps of the screened contours;
s3, detecting a target contour which accords with the target graph from the contour map of the screened contour;
and S4, under the condition that the target contour is detected, determining that the first object is identified, wherein the object with the target contour in the unmarked interface is the first object.
Optionally, in this embodiment, the missing determination is reduced by: since the x button is usually small in the game interface, the periphery often surrounds a complex image special effect, which easily causes the image outline not to be extracted correctly. As shown in FIG. 12, the original "x" button map is on the left, and the extracted false contour is on the right.
Therefore, for the contour which is determined not to be "x", another round of detection is required to reduce the rate of missing determination. Namely, the picture corresponding to the outline area is extracted in the original color game interface screenshot according to the outline attribute. And (4) carrying out noise point filtering and key contour highlighting again on the new picture to extract a key contour, and then carrying out a round of X contour filtering. The specific implementation process is as follows:
step (A), the algorithm of key contour extraction: carrying out fixed threshold binarization on the color picture by using a threshold method of opencv (the threshold is obtained by calculating according to a picture histogram and is the average value of the maximum 2 values of the y axis in the histogram and the value of the x axis); converting the binarized picture into a gray image (by adopting the cvtColor method of opencv); performing a round of bilateral filtering (adopting a bilatelfilter method of opencv) on the converted picture to highlight the boundary; performing one round of Gaussian filtering (adopting a GaussianBlur method of opencv) on the picture subjected to bilateral filtering to eliminate noise; carrying out binarization on the self-adaptive threshold value of the image subjected to Gaussian filtering by adopting an adaptive threshold method of opencv; and extracting key outlines of the processed pictures by using a findContours method of opencv. The corrected profile is shown in fig. 13. And (B) filtering the X outline by the same algorithm.
And then, operating the searched object with the "x", and when all the "x" buttons under the current unknown interface are found, sequentially calling a click method in an automatic test frame for each button, clicking the coordinates of the center point of the "x" button, and judging whether the click is effective (after the click, if the "x" button disappears, the click is effective).
As an optional scheme, in the case that it is detected that the next interface is not the current running interface, the method further includes:
s1, detecting whether the next interface is an unmarked interface.
Optionally, in this embodiment, if it is detected that the next interface is an unmarked interface, steps S104 to S108 are repeatedly performed.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention or portions thereof contributing to the prior art 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 device (which may be a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
According to another aspect of the embodiments of the present invention, there is also provided an application testing apparatus for implementing the above-described application testing method, as shown in fig. 14, the apparatus including:
1) the first detection module 1402 is configured to detect that an unmarked interface appears on the terminal when a current running interface of the target application is tested on the terminal, where the unmarked interface is used to make it impossible to perform a test operation on the current running interface, the unmarked interface is different from a pre-marked interface, and the pre-marked interface is used to test the target application;
2) a first identifying module 1404, configured to identify a first object having a target graphic in an unmarked interface, where the first object is an object that is allowed to be subjected to a first operation, and the first operation is used to jump the unmarked interface to a next interface;
3) a first executing module 1406 for executing a first operation on the first object if the first object is identified;
4) a first determining module 1408, configured to determine that the currently running interface is in a state of being allowed to perform the test operation if it is detected that the next interface is the currently running interface, and perform the test operation on the currently running interface on the terminal.
Optionally, the apparatus further comprises:
the second identification module is used for identifying a second object in the unmarked interface under the condition that the first object is not identified, wherein the second object is an object on a native control carried by a system for running the target application, the second object is an object allowing a second operation to be executed, and the second operation is used for enabling the unmarked interface to jump to a next interface;
and the second execution module is used for executing a second operation on the second object under the condition that the second object is identified.
Optionally, the apparatus further comprises:
the third identification module is used for identifying a third object with target characters in the unmarked interface under the condition that the second object is not identified, wherein the third object is an object allowing a third operation to be executed, and the third operation is used for jumping the unmarked interface to the next interface;
and the third execution module is used for executing a third operation on the third object under the condition that the third object is identified.
Optionally, the apparatus further comprises:
the fourth identification module is used for identifying a fourth object in the unmarked interface under the condition that the third object is not identified, wherein the fourth object is an operable object in the interface marked in advance;
and the fourth execution module is used for executing a fourth operation on the fourth object under the condition that the fourth object is identified, wherein the fourth operation is an operation executed on the fourth object in the process of testing the target application.
Optionally, the unlabeled interface includes a plurality of interfaces, wherein the fourth identifying module includes:
the interface processing device comprises a first determining unit, a second determining unit and a judging unit, wherein the first determining unit is used for determining a pre-labeled interface corresponding to each interface in a plurality of interfaces, and the pre-labeled interface corresponding to each interface is a pre-labeled interface with the highest similarity with each interface;
and the identifying unit is used for identifying a fourth object in the plurality of interfaces according to the sequence from high to low of the operation priority of the pre-labeled interface corresponding to each interface, wherein the pre-labeled interface with high operation priority is preferentially operated in the process of testing the target application.
Optionally, the identification unit comprises:
the first identification subunit is used for identifying fourth objects in other interfaces except for the interface at the lowest layer in the plurality of interfaces according to the order from high to low of the operation priority of the interface which is labeled in advance and corresponds to each interface, wherein the interface at the lowest layer is the interface with the lowest corresponding operation priority;
and the second identification subunit is used for identifying the fourth object in the bottommost interface according to the number of the bottommost interfaces.
Optionally, the second identifying subunit is configured to:
under the condition that the number of the bottommost interfaces is not lower than a target threshold value, clustering the bottommost interfaces according to the highest similarity between the bottommost interfaces and interfaces labeled in advance to obtain a plurality of interface sets, wherein each interface set in the plurality of interface sets comprises one or more bottommost interfaces;
and identifying a fourth object in the bottommost interfaces included in each interface set according to the sequence from high to low of the number of the bottommost interfaces included in each interface set in the plurality of interface sets.
Optionally, the first identification module comprises:
the extracting unit is used for extracting a key outline from the acquired interface screenshot of the unmarked interface to obtain an outline drawing;
the detection unit is used for detecting a target contour which accords with the target graph from the contour map;
and the second determining unit is used for determining and identifying the first object under the condition that the target contour is detected, wherein the object with the target contour in the unmarked interface is the first object.
Optionally, the detection unit comprises:
a first extraction subunit, configured to extract a first candidate contour matching the size of the target contour from the contour map;
a second extraction subunit, configured to extract a second candidate contour having the graphic feature of the target contour from the first candidate contour;
the third extraction subunit is configured to extract a first keypoint set and a second keypoint set from the contour map according to a position of a center point of the second candidate contour and a position relationship between the center point of the target contour and the target keypoint, where the target keypoints include a first target keypoint located within a region where the target contour is located and a second target keypoint located outside the region where the target contour is located, the first keypoint set includes a center point of the second candidate contour and a point on the second candidate contour corresponding to the first target keypoint, and the second keypoint set includes a point on the second candidate contour corresponding to the second target keypoint;
and the determining subunit is configured to determine the second candidate contour as the target contour when all the points included in the first keypoint set fall within the region divided by the second candidate contour, and all the points included in the second keypoint set fall outside the region divided by the second candidate contour.
Optionally, the apparatus further comprises:
the intercepting module is used for intercepting an image of the screened outline from the outline map for the screened outline which does not accord with the target graph in the outline map;
the extraction module is used for extracting the key outline from the image of the screened outline to obtain an outline image of the screened outline;
the second detection module is used for detecting a target contour which accords with the target graph from the contour map of the screened contour;
and the second determining module is used for determining and identifying the first object under the condition that the target contour is detected, wherein the object with the target contour in the unmarked interface is the first object.
Optionally, the apparatus further comprises:
and the third detection module is used for detecting whether the next interface is an unmarked interface or not under the condition that the next interface is not the current operation interface.
The application environment of the embodiment of the present invention may refer to the application environment in the above embodiments, but is not described herein again. The embodiment of the invention provides an optional specific application example of the connection method for implementing the real-time communication.
As an alternative embodiment, the testing method of the application can be applied, but not limited to, in the scenario of performing automated testing on a game application as shown in fig. 15. In this scenario, the following steps can be performed to process an unknown interface during the hand-trip automated test, so that the interface is rolled back to a known test interface. The treatment process comprises the following steps:
step 1: firstly, when a main thread of the automatic test of the hand tour discovers that a current interface is an unexpected unknown interface, starting to enter a comprehensive processing flow of the unknown interface, and initializing the count to 0;
step 2: and judging the processing flow of entering a single unknown interface for the second time. If the number of times of counting is less than or equal to 5, adding 1 to the counting, and entering the step 3-1; if the number is more than 5, the process is exited, and the 'processing invalidation' is returned to the hand game automation test main thread; the method comprises the steps of firstly, processing a single unknown interface, then, processing the current page, and finally, judging whether the current page is an unknown interface or not, if so, judging whether the current page is an unknown interface, if not, judging whether the current page is an unknown interface or not, if not, judging whether the current page is an unknown interface, if not, judging whether the current page is an unknown interface, if the current page is an unknown interface, if the current unknown interface, judging is an unknown interface, if the current page is an unknown interface, and if the current is an unknown interface, if the current page is an unknown interface, if the current interface, and if the current is an unknown interface, if the current is an unknown interface, if the current is the current interface is the current is an unknown interface, and if the current page is not, and if the current is not, if the current interface, if the current is the current interface is the current page is the current, if the current is the current, and if the current is the.
Step 3-1: whether buttons such as 'x', 'going through' and the like exist under the current interface is identified through CV. If one or more buttons are identified, operating the buttons in sequence and judging whether the operation is effective or not;
step 3-2: if an effective operation is performed (namely, after the operation, the operated object disappears from the current interface), jumping to step 7; otherwise, continuing to carry out the step 4-1;
step 4-1: whether buttons such as 'return, confirmation, cancel, reject, accept, agree, confirm, yes, allow' and the like exist under the current interface is judged by identifying the Native control; if one or more buttons are identified, operating the buttons in sequence and judging whether the operation is effective or not;
step 4-2: if an effective operation is performed (namely, after the operation, the operated object disappears from the current interface), jumping to step 7; otherwise, continuing to carry out the step 5-1;
step 5-1: identifying whether buttons such as 'return, confirm, cancel, reject, accept, agree, confirm, yes and allow' exist under the current interface through OCR; if one or more buttons are identified, operating the buttons in sequence and judging whether the operation is effective or not;
step 5-2: if an effective operation is performed (namely, after the operation, the operated object disappears from the current interface), jumping to step 7; otherwise, continuing to carry out the step 6-1;
step 6-1: and searching whether the operable objects in the original known interface exist in the current unknown interface. Starting searching from the interface of the highest level; when the lowest level interfaces are searched, if the number of all the lowest level interfaces exceeds 150, clustering the interfaces, and preferentially searching objects in the interfaces with a large number of similarities; if one or more operable objects are identified, sequentially operating the objects according to the priority, and judging whether the operation is effective or not;
step 6-2: if an effective operation is performed (namely, after the operation, the operated object disappears from the current interface), jumping to step 7; otherwise, jumping to the step 2;
and 7: a determination is made whether to return to a known interface. If returning to the known interface, exiting the process and returning to the 'effective processing' to the hand-trip automation test main thread; if not, continue with step 2.
Optionally, in this embodiment, identifying and extracting a graphical button with a specific feature from a picture may also be implemented by machine learning.
Through the process, in the automatic test process of the hand game, if a bullet box or an unknown interface is encountered, operable objects (such as buttons of closing, returning, canceling, determining and the like or operable objects in the original known interface) with specific characteristics under the current interface can be intelligently identified through various identification algorithms, the objects are operated according to the priority, the bullet boxes of various mobile phone systems or bullet boxes in games can be effectively closed, interface switching can also be effectively completed, the known interface is returned, the original automatic execution process is continued, test interruption is avoided, the stability and fault tolerance of the test are greatly improved, and the manual intervention cost is reduced.
When various unexpected mobile phone system pop boxes, in-game pop boxes and other unknown interfaces are encountered, operable objects with specific characteristics under the current interface can be intelligently identified, various pop boxes can be effectively closed through operating the objects, and interface switching can also be effectively completed, so that the known interfaces are returned to continue the original automatic execution process. On the one hand, the manual intervention cost is reduced, and on the other hand, the stability and fault tolerance of the automatic test are greatly improved.
Automated testing of hand games is inevitable with various unexpected system frames, in-game operational or prompt frames, and other unknown interfaces. Through the process, the automatic test framework can automatically process unknown interfaces without human intervention, so that the human input cost is reduced, and the stability and fault tolerance of the automatic test are greatly improved.
According to still another aspect of an embodiment of the present invention, there is also provided an electronic device for performing the test of the above-described application, as shown in fig. 16, the electronic device including: one or more processors 1602 (only one of which is shown), in which a computer program is stored, a memory 1604, a sensor 1606, an encoder 1608, and a transmission 1610, the processors being arranged to perform the steps of any of the method embodiments described above by means of the computer program.
Optionally, in this embodiment, the electronic apparatus may be located in at least one network device of a plurality of network devices of a computer network.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, when a current running interface of a target application is tested on a terminal, detecting that an unmarked interface appears on the terminal, wherein the unmarked interface is used for making the current running interface incapable of executing test operation, the unmarked interface is different from a pre-marked interface, and the pre-marked interface is used for testing the target application;
s2, identifying a first object with a target graph in the unmarked interface, wherein the first object is an object allowing a first operation to be executed, and the first operation is used for making the unmarked interface jump to a next interface;
s3, in case that the first object is recognized, performing a first operation on the first object;
and S4, determining that the current running interface is in a state of being allowed to execute the test operation under the condition that the next interface is detected to be the current running interface, and executing the test operation on the current running interface on the terminal.
Alternatively, it can be understood by those skilled in the art that the structure shown in fig. 16 is only an illustration, and the electronic device may also be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 16 is a diagram illustrating a structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 16, or have a different configuration than shown in FIG. 16.
The memory 1602 may be used to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for testing applications in the embodiments of the present invention, and the processor 1604 executes various functional applications and data processing by running the software programs and modules stored in the memory 1602, that is, implements the control method of the target component. The memory 1602 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1602 can further include memory located remotely from the processor 1604, which can be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 1610 is used for receiving or transmitting data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 1610 includes a Network adapter (NIC), which can be connected to a router via a Network cable and other Network devices so as to communicate with the internet or a local area Network. In one example, the transmission device 1610 is a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
Wherein the memory 1602 is used for storing, among other things, application programs.
Embodiments of the present invention also provide a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, when a current running interface of a target application is tested on a terminal, detecting that an unmarked interface appears on the terminal, wherein the unmarked interface is used for making the current running interface incapable of executing test operation, the unmarked interface is different from a pre-marked interface, and the pre-marked interface is used for testing the target application;
s2, identifying a first object with a target graph in the unmarked interface, wherein the first object is an object allowing a first operation to be executed, and the first operation is used for making the unmarked interface jump to a next interface;
s3, in case that the first object is recognized, performing a first operation on the first object;
and S4, determining that the current running interface is in a state of being allowed to execute the test operation under the condition that the next interface is detected to be the current running interface, and executing the test operation on the current running interface on the terminal.
Optionally, the storage medium is further configured to store a computer program for executing the steps included in the method in the foregoing embodiment, which is not described in detail in this embodiment.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.
Claims (13)
1. A method for testing an application, comprising:
when a current running interface of a target application is tested on a terminal, detecting that an unmarked interface appears on the terminal, wherein the unmarked interface is used for making the current running interface incapable of being tested, the unmarked interface is different from a pre-marked interface, and the pre-marked interface is used for testing the target application;
identifying a first object with a target graph in the unmarked interface, wherein the first object is an object allowed to be executed with a first operation, and the first operation is used for jumping the unmarked interface to a next interface and comprises the following steps: extracting a key outline from the acquired interface screenshot of the unmarked interface to obtain an outline drawing; detecting a target contour conforming to the target pattern from the contour map; determining to identify the first object under the condition that the target contour is detected, wherein the object with the target contour in the unmarked interface is the first object;
in the case that the first object is identified, performing the first operation on the first object;
under the condition that the next interface is detected to be the current operation interface, determining that the current operation interface is in a state of being allowed to execute the test operation, and executing the test operation on the current operation interface on the terminal;
detecting a target contour conforming to the target pattern from the contour map includes: extracting a first candidate contour matched with the size of the target contour from the contour map; extracting a second candidate contour having the graphic feature of the target contour from the first candidate contour; extracting a first key point set and a second key point set from the contour map according to the position of the central point of the second candidate contour and the position relation between the central point of the target contour and the target key point, wherein the target key points comprise a first target key point located in the area of the target contour and a second target key point located outside the area of the target contour, the first key point set comprises the central point of the second candidate contour and a point corresponding to the first target key point on the second candidate contour, and the second key point set comprises a point corresponding to the second target key point on the second candidate contour; determining the second candidate contour as the target contour in the case that the points included in the first keypoint set all fall within the region into which the second candidate contour is divided, and the points included in the second keypoint set all fall outside the region into which the second candidate contour is divided.
2. The method of claim 1, wherein after identifying the first object having the target graphic in the unmarked interface, the method further comprises:
under the condition that the first object is not identified, identifying a second object in the unmarked interface, wherein the second object is an object on a native control carried by a system running the target application, the second object is an object allowing a second operation to be executed, and the second operation is used for enabling the unmarked interface to jump to the next interface;
performing the second operation on the second object if the second object is identified.
3. The method of claim 2, wherein after identifying a second object in the unlabeled interface, the method further comprises:
under the condition that the second object is not identified, identifying a third object with a target character in the unmarked interface, wherein the third object is an object which is allowed to be executed with a third operation, and the third operation is used for jumping the unmarked interface to the next interface;
performing the third operation on the third object if the third object is identified.
4. The method of claim 3, wherein after identifying a third object having a target text in the unlabeled interface, the method further comprises:
under the condition that the third object is not identified, identifying a fourth object in the unmarked interface, wherein the fourth object is an operable object in the pre-marked interface;
and in the case that the fourth object is identified, executing a fourth operation on the fourth object, wherein the fourth operation is an operation executed on the fourth object in the process of testing the target application.
5. The method of claim 4, wherein the unlabeled interface comprises a plurality of interfaces, wherein identifying the fourth object in the unlabeled interface comprises:
determining a pre-labeled interface corresponding to each interface in the plurality of interfaces, wherein the pre-labeled interface corresponding to each interface is a pre-labeled interface with the highest similarity to each interface;
and identifying the fourth object in the plurality of interfaces according to the sequence from high to low of the operation priority of the pre-labeled interface corresponding to each interface, wherein the pre-labeled interface with high operation priority is preferentially operated in the process of testing the target application.
6. The method of claim 5, wherein identifying the fourth object in the plurality of interfaces according to the order of the operation priority of the pre-labeled interface corresponding to each interface from high to low comprises:
according to the sequence from high to low of the operation priority of the interface which is labeled in advance and corresponds to each interface, identifying the fourth object in other interfaces except for the interface at the lowest layer in the plurality of interfaces, wherein the interface at the lowest layer is the interface at the lowest operation priority;
and identifying the fourth object in the bottommost interface according to the number of the bottommost interfaces.
7. The method of claim 6, wherein identifying the fourth object in the bottom-most interface according to the number of the bottom-most interfaces comprises:
under the condition that the number of the bottommost interfaces is not lower than a target threshold value, clustering the bottommost interfaces according to the highest similarity between the bottommost interfaces and interfaces labeled in advance to obtain a plurality of interface sets, wherein each interface set in the plurality of interface sets comprises one or more bottommost interfaces;
and identifying the fourth object in the bottommost interface included in each interface set according to the sequence from high to low of the number of the bottommost interfaces included in each interface set in the plurality of interface sets.
8. The method of claim 1, wherein after detecting an object contour from the contour map that conforms to the object graphic, the method further comprises:
for the screening outline which does not accord with the target graph in the outline graph, cutting an image of the screening outline from the outline graph;
extracting a key contour from the image of the screening contour to obtain a contour map of the screening contour;
detecting a target contour conforming to the target pattern from the contour map of the culling contour;
and determining to identify the first object under the condition that the target contour is detected, wherein the object with the target contour in the unmarked interface is the first object.
9. The method according to any one of claims 1 to 8, wherein in the event that it is detected that the next interface is not the currently running interface, the method further comprises:
and detecting whether the next interface is the interface which is not marked.
10. A test apparatus for an application, comprising:
the terminal comprises a first detection module and a second detection module, wherein the first detection module is used for detecting that an unmarked interface appears on the terminal when a current running interface of a target application is tested on the terminal, the unmarked interface is used for preventing the current running interface from being executed with test operation, the unmarked interface is different from a pre-marked interface, and the pre-marked interface is used for testing the target application;
a first identification module, configured to identify a first object having a target graphic in the unlabeled interface, where the first object is an object that allows a first operation to be performed, and the first operation is configured to jump the unlabeled interface to a next interface, and further configured to: extracting a key contour from the acquired interface screenshot of the unmarked interface to obtain a contour map; detecting a target contour conforming to the target pattern from the contour map; under the condition that the target contour is detected, determining to identify the first object, wherein the object with the target contour in the unmarked interface is the first object;
a first execution module, configured to execute the first operation on the first object if the first object is identified;
a first determining module, configured to determine that the current running interface is in a state of being allowed to perform the test operation when it is detected that the next interface is the current running interface, and perform the test operation on the current running interface on the terminal;
the testing device is also used for detecting a target contour conforming to the target graph from the contour map and comprises the following steps: extracting a first candidate contour matched with the size of the target contour from the contour map; extracting a second candidate contour of the graphic feature with the target contour from the first candidate contour; extracting a first key point set and a second key point set from the contour map according to the position of the central point of the second candidate contour and the position relation between the central point of the target contour and the target key point, wherein the target key points comprise a first target key point located in the area of the target contour and a second target key point located outside the area of the target contour, the first key point set comprises the central point of the second candidate contour and a point corresponding to the first target key point on the second candidate contour, and the second key point set comprises a point corresponding to the second target key point on the second candidate contour; determining the second candidate contour as the target contour in the case that the points included in the first keypoint set all fall within the region into which the second candidate contour is divided, and the points included in the second keypoint set all fall outside the region into which the second candidate contour is divided.
11. The apparatus of claim 10, further comprising:
a second identification module, configured to identify, in the case that the first object is not identified, a second object in the unlabeled interface, where the second object is an object on a native control carried by a system running the target application, the second object is an object that allows a second operation to be performed, and the second operation is used to cause the unlabeled interface to jump to the next interface;
and the second execution module is used for executing the second operation on the second object under the condition that the second object is identified.
12. A storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of any of claims 1 to 9 when executed.
13. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 9 by means of the computer program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910171594.5A CN110032510B (en) | 2019-03-07 | 2019-03-07 | Application testing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910171594.5A CN110032510B (en) | 2019-03-07 | 2019-03-07 | Application testing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110032510A CN110032510A (en) | 2019-07-19 |
CN110032510B true CN110032510B (en) | 2022-05-20 |
Family
ID=67235127
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910171594.5A Active CN110032510B (en) | 2019-03-07 | 2019-03-07 | Application testing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110032510B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112286781A (en) * | 2019-07-23 | 2021-01-29 | 百度时代网络技术(北京)有限公司 | Automatic testing method, device, equipment and storage medium |
CN110968519A (en) * | 2019-12-23 | 2020-04-07 | 上海米哈游天命科技有限公司 | Game testing method, device, server and storage medium |
CN111177009A (en) * | 2019-12-31 | 2020-05-19 | 五八有限公司 | Script generation method and device, electronic equipment and storage medium |
CN113221912B (en) * | 2020-01-21 | 2024-09-06 | 腾讯科技(深圳)有限公司 | Operation key identification method, device, equipment and medium |
CN111179268B (en) * | 2020-03-18 | 2023-06-23 | 宁波均联智行科技股份有限公司 | Abnormality detection method and device for vehicle-mounted terminal and vehicle-mounted terminal |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104484273A (en) * | 2014-12-19 | 2015-04-01 | 广州博冠信息科技有限公司 | Test method for application program, device and system |
CN107330054A (en) * | 2017-06-28 | 2017-11-07 | 赵宇航 | A kind of pop-up screen method and device |
CN108090450A (en) * | 2017-12-20 | 2018-05-29 | 深圳和而泰数据资源与云技术有限公司 | Face identification method and device |
CN108153675A (en) * | 2017-12-26 | 2018-06-12 | 江苏润和软件股份有限公司 | A kind of Android application automated testing methods towards mobile cloud computing |
CN108427633A (en) * | 2017-02-15 | 2018-08-21 | 腾讯科技(深圳)有限公司 | The processing method and processing device of display interface |
CN108845930A (en) * | 2018-05-23 | 2018-11-20 | 深圳市腾讯网络信息技术有限公司 | Interface operation test method and device, storage medium and electronic device |
-
2019
- 2019-03-07 CN CN201910171594.5A patent/CN110032510B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104484273A (en) * | 2014-12-19 | 2015-04-01 | 广州博冠信息科技有限公司 | Test method for application program, device and system |
WO2016095554A1 (en) * | 2014-12-19 | 2016-06-23 | 广州博冠信息科技有限公司 | Test method, device and system for application |
CN108427633A (en) * | 2017-02-15 | 2018-08-21 | 腾讯科技(深圳)有限公司 | The processing method and processing device of display interface |
CN107330054A (en) * | 2017-06-28 | 2017-11-07 | 赵宇航 | A kind of pop-up screen method and device |
CN108090450A (en) * | 2017-12-20 | 2018-05-29 | 深圳和而泰数据资源与云技术有限公司 | Face identification method and device |
CN108153675A (en) * | 2017-12-26 | 2018-06-12 | 江苏润和软件股份有限公司 | A kind of Android application automated testing methods towards mobile cloud computing |
CN108845930A (en) * | 2018-05-23 | 2018-11-20 | 深圳市腾讯网络信息技术有限公司 | Interface operation test method and device, storage medium and electronic device |
Also Published As
Publication number | Publication date |
---|---|
CN110032510A (en) | 2019-07-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110032510B (en) | Application testing method and device | |
US10445569B1 (en) | Combination of heterogeneous recognizer for image-based character recognition | |
US20190188528A1 (en) | Text detection method and apparatus, and storage medium | |
CN112052781A (en) | Feature extraction model training method, face recognition device, face recognition equipment and medium | |
CN112381837B (en) | Image processing method and electronic equipment | |
CN109784414A (en) | Customer anger detection method, device and electronic equipment in a kind of phone customer service | |
CN105653171A (en) | Fingerprint identification based terminal control method, terminal control apparatus and terminal | |
CN110619333A (en) | Text line segmentation method, text line segmentation device and electronic equipment | |
CN110807110B (en) | Image searching method and device combining local and global features and electronic equipment | |
CN110162454B (en) | Game running method and device, storage medium and electronic device | |
CN112101386B (en) | Text detection method, device, computer equipment and storage medium | |
CN110781805A (en) | Target object detection method, device, computing equipment and medium | |
CN111738263A (en) | Target detection method and device, electronic equipment and storage medium | |
CN112836661A (en) | Face recognition method and device, electronic equipment and storage medium | |
CN108520263B (en) | Panoramic image identification method and system and computer storage medium | |
CN112988557A (en) | Search box positioning method, data acquisition device and medium | |
CN109919164B (en) | User interface object identification method and device | |
CN113255766B (en) | Image classification method, device, equipment and storage medium | |
CN107992872B (en) | Method for carrying out text recognition on picture and mobile terminal | |
CN111382638A (en) | Image detection method, device, equipment and storage medium | |
CN110929057A (en) | Image processing method, device and system, storage medium and electronic device | |
CN117557777A (en) | Sample image determining method and device, electronic equipment and storage medium | |
CN111353577B (en) | Multi-task-based cascade combination model optimization method and device and terminal equipment | |
CN109033797B (en) | Permission setting method and device | |
CN113591829B (en) | Character recognition method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |