CN110914810A - Monkey testing method and terminal - Google Patents
Monkey testing method and terminal Download PDFInfo
- Publication number
- CN110914810A CN110914810A CN201780093230.9A CN201780093230A CN110914810A CN 110914810 A CN110914810 A CN 110914810A CN 201780093230 A CN201780093230 A CN 201780093230A CN 110914810 A CN110914810 A CN 110914810A
- Authority
- CN
- China
- Prior art keywords
- application control
- terminal
- interface
- input event
- tested
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
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
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 application provides a Monkey testing method and a terminal, and the method comprises the following steps: the terminal displays an interface to be tested; the terminal carries out image processing on the interface to be tested and obtains at least one application control of the interface to be tested; the terminal determines a pseudo input event corresponding to at least one application control; the terminal performs a dummy input event. The application control is obtained through the graphic processing interface to be tested, and the testing efficiency of executing the pseudo input event on the application control is improved.
Description
The application relates to the technical field of software testing, in particular to a Monkey testing method and a terminal.
The Monkey testing process comprises: the method comprises the steps that a test program running in the terminal sends random pseudo input events such as key input, touch screen input, gesture input and the like to the terminal, so that the stability of an application program is tested, or the compatibility of the application program and the terminal is tested. If the application program is in error flash quit, it indicates that the application program has a Bug (Bug) or indicates that the application program is incompatible with the terminal.
In the prior art, a test program can randomly generate a click coordinate on an application interface and automatically trigger a pseudo input event corresponding to the click coordinate, however, the manner of randomly generating the click coordinate inevitably causes many invalid triggers, thereby causing the problem of low test efficiency.
Disclosure of Invention
The application provides a Monkey testing method and a terminal, in the application, the terminal can acquire at least one application control of an interface to be tested without randomly generating a click coordinate on the application interface, and therefore testing efficiency is improved.
In a first aspect, the present application provides a Monkey testing method, including: the terminal displays an interface to be tested; the terminal carries out image processing on the interface to be tested and obtains at least one application control of the interface to be tested; the terminal determines a pseudo input event corresponding to at least one application control; the terminal performs a dummy input event.
The beneficial effect of this application includes: by the method, at least one application control of the interface to be tested can be obtained without randomly generating a click coordinate on the application interface, so that the testing efficiency is improved.
Optionally, the image processing of the interface to be tested by the terminal to obtain at least one application control of the interface to be tested includes:
the terminal conducts binarization processing on the interface to be tested to obtain a binarization image;
the terminal carries out expansion processing on the binary image to obtain an image after the expansion processing;
the terminal carries out corrosion treatment on the expanded image to obtain at least one first area;
the terminal determines at least one application control according to the at least one first area.
The beneficial effect of this application includes: the image processing process can effectively acquire at least one application control of the interface to be tested, so that click coordinates on the application interface do not need to be randomly generated, and the testing efficiency is improved.
Optionally, after the terminal performs erosion processing on the expanded image to obtain at least one first region, the method further includes: the terminal carries out expansion processing on at least one first area to obtain at least one second area;
correspondingly, the terminal determines at least one application control according to the at least one first area, and the method comprises the following steps:
the terminal determines at least one application control according to the at least one second area.
The beneficial effect of this application includes: the accuracy of determining the application control can be improved through the secondary expansion processing of the image.
Optionally, the determining, by the terminal, at least one application control according to the at least one second area includes:
and the terminal determines a second area with the area size larger than a first preset threshold and smaller than a second preset threshold as the application control.
The beneficial effect of this application includes: by the method, the invalid second area can be screened out, so that the accuracy of determining the application control is improved.
Optionally, after the terminal performs image processing on the interface to be tested and obtains at least one application control of the interface to be tested, the method further includes: and the terminal displays each application control of the acquired at least one application control.
Optionally, the determining, by the terminal, a pseudo input event corresponding to at least one application control includes:
the terminal determines characteristic information corresponding to at least one application control respectively; and the terminal determines the pseudo input event corresponding to the at least one application control according to the characteristic information corresponding to the at least one application control.
The beneficial effect of this application includes: by the method, the pseudo input events corresponding to at least one application control can be determined in batch, so that the pseudo input events corresponding to the application controls can be executed. Thereby improving the testing efficiency.
Optionally, the feature information corresponding to the application control includes at least one of: the size of the application control, the position information of the application control in the application interface and the deflection angle of the application control relative to the horizontal direction or the vertical direction.
Optionally, the terminal performs a pseudo input event, including:
aiming at each application control in at least one application control, the terminal executes a pseudo input event corresponding to the application control;
the terminal displays an identifier at the application control which executes the pseudo input event, wherein the identifier is used for indicating that the pseudo input event corresponding to the application control is executed.
The beneficial effect of this application includes: by displaying the identification, the situation that the application control is repeatedly executed can be prevented, and the testing efficiency is further improved.
The following describes a terminal, and reference may be made to the method of the first aspect and the principles and technical effects of the alternative modes of the first aspect, which are not described herein again.
In a second aspect, the present application provides a terminal, comprising:
and the display module is used for displaying the interface to be tested.
And the processing module is used for carrying out image processing on the interface to be tested and acquiring at least one application control of the interface to be tested.
And the determining module is used for determining the pseudo input event corresponding to at least one application control.
And the execution module is used for executing the pseudo input event.
Optionally, the processing module comprises:
and the binarization processing unit is used for carrying out binarization processing on the interface to be tested to obtain a binarization image.
And the expansion processing unit is used for performing expansion processing on the binary image to obtain an image after the expansion processing.
And the corrosion processing unit is used for carrying out corrosion processing on the image after the expansion processing to obtain at least one first area.
And the determining unit is used for determining at least one application control according to the at least one first area.
Optionally, the expansion processing unit is further configured to:
performing expansion treatment on at least one first area to obtain at least one second area;
correspondingly, the determining unit is specifically configured to:
at least one application control is determined from the at least one second region.
Optionally, the determining unit is specifically configured to: and determining a second area with the area size larger than a first preset threshold and smaller than a second preset threshold as the application control.
Optionally, the display module is further configured to display each of the obtained at least one application control.
Optionally, the determining module is specifically configured to: determining characteristic information corresponding to at least one application control respectively; and determining a pseudo input event corresponding to each of the at least one application control according to the characteristic information corresponding to each of the at least one application control.
Optionally, the feature information corresponding to the application control includes at least one of: the size of the application control, the position information of the application control in the application interface and the deflection angle of the application control relative to the horizontal direction or the vertical direction.
Optionally, the execution module is specifically configured to: executing a pseudo input event corresponding to the application control aiming at each application control in at least one application control; correspondingly, the display module is further configured to display, at the application control that has executed the pseudo input event, an identifier indicating that the pseudo input event corresponding to the application control has been executed.
In a third aspect, the present application provides a terminal device, including: a processor and a memory for storing executable instructions for the processor; the processor is configured to: displaying an interface to be tested; performing image processing on the interface to be tested to obtain at least one application control of the interface to be tested; determining a pseudo input event corresponding to at least one application control; a dummy input event is performed.
Optionally, the processor is specifically configured to: carrying out binarization processing on an interface to be tested to obtain a binarization image; performing expansion processing on the binary image to obtain an image subjected to expansion processing; carrying out corrosion treatment on the image subjected to the expansion treatment to obtain at least one first area; at least one application control is determined according to the at least one first area.
Optionally, the processor is further configured to perform an expansion process on the at least one first region to obtain at least one second region; accordingly, the processor is specifically configured to: at least one application control is determined from the at least one second region.
Optionally, the processor is specifically configured to: and determining a second area with the area size larger than a first preset threshold and smaller than a second preset threshold as the application control.
Optionally, the processor is further configured to display each application control of the acquired at least one application control.
Optionally, the processor is specifically configured to: determining characteristic information corresponding to at least one application control respectively; and determining a pseudo input event corresponding to each of the at least one application control according to the characteristic information corresponding to each of the at least one application control.
Optionally, the feature information corresponding to the application control includes at least one of: the size of the application control, the position information of the application control in the application interface and the deflection angle of the application control relative to the horizontal direction or the vertical direction.
Optionally, the processor is specifically configured to: executing a pseudo input event corresponding to the application control aiming at each application control in at least one application control; displaying an identification at the application control executing the pseudo input event, wherein the identification is used for indicating that the pseudo input event corresponding to the application control is executed.
In a fourth aspect, the present application provides a computer storage medium comprising instructions that, when executed on a terminal, cause the terminal to perform the method of the first aspect or the alternatives of the first aspect.
In a fifth aspect, the present application provides a computer program product for causing a terminal to perform the method according to the first aspect or the alternatives of the first aspect when the computer program product is run on the terminal.
The application provides a Monkey testing method and a terminal. The method comprises the following steps: the terminal displays an interface to be tested; the terminal carries out image processing on the interface to be tested and obtains at least one application control of the interface to be tested; the terminal determines a pseudo input event corresponding to at least one application control; the terminal performs a dummy input event. By the method, at least one application control of the interface to be tested can be obtained without randomly generating a click coordinate on the application interface, so that the testing efficiency is improved.
Fig. 1 is a flowchart of a Monkey testing method according to an embodiment of the present application;
fig. 2 is a flowchart of a method for determining an application control according to an embodiment of the present application;
FIG. 3A is a diagram of an interface provided by an embodiment of the present application;
FIG. 3B is a diagram of an interface provided by an embodiment of the present application;
FIG. 4 is a partial schematic view of an interface provided in accordance with an embodiment of the present application;
FIG. 5 is a partial schematic view of an interface provided in accordance with an embodiment of the present application;
FIG. 6 is a partial schematic view of an interface provided in accordance with an embodiment of the present application;
FIG. 7A is a diagram of an interface provided in accordance with an embodiment of the present application;
FIG. 7B is a diagram of an interface provided in accordance with an embodiment of the present application;
fig. 8 is a flowchart of a method for determining a pseudo input event corresponding to an application control according to an embodiment of the present application;
FIG. 9 is a flowchart of a method for executing a pseudo-input event according to an embodiment of the present application;
FIG. 10A is a diagram of an interface provided in accordance with an embodiment of the present application;
FIG. 10B is a diagram of an interface provided by an embodiment of the present application;
fig. 11 is a schematic structural diagram of a terminal 110 according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of a terminal 120 according to an embodiment of the present application.
Hereinafter, some terms of art in the present application will be explained to facilitate understanding by those skilled in the art.
Monkey testing: the method comprises the steps of sending random pseudo input events such as key input, touch screen input, gesture input and the like to a terminal by running a test program in the terminal, wherein the test program is used for testing the stability of an application program or testing the compatibility of the application program and the terminal. If the application program is in error flash quit, the Bug of the application program is indicated to exist in the application program, or the application program is indicated to be incompatible with the terminal.
Image binarization: namely, the binarization processing of the image is to set the gray value of a pixel point on the image to be 0 or 255, that is, the whole image presents obvious black and white effect.
Expansion treatment: the boundary of the area with the pixel value of 1 in the binarized image is expanded by one layer, namely, the outer edge of the boundary and/or the point with the pixel value of 0 in the area are updated to the point with the pixel value of 1, and the expansion processing is mainly used for filling the tiny holes in the area.
And (3) corrosion treatment: it is opposite to the dilation process, the erosion process is mainly used to eliminate the boundary noise of the region composed of 1 pixel value in the image after the quantization, and the independent and full (no hole inside) smooth boundary region can be obtained by further erosion process to the region.
Further, as described above, in the prior art, a click coordinate on an application interface may be randomly generated by a test program, and a pseudo input event corresponding to the click coordinate is automatically triggered.
In order to solve the technical problem, the application provides a Monkey testing method and a terminal. The application scenario of the application is as follows: the terminal is provided with an Application program, the Application program can be shopping Application (APP), game APP, taxi-taking APP and the like, and the terminal realizes the test of the Application program through a loaded test program.
The terminal may be a smart phone, a tablet Computer, a Personal Computer (PC), a game console, a simulator, or the like.
Specifically, fig. 1 is a flowchart of a Monkey testing method provided in an embodiment of the present application, and as shown in fig. 1, the method includes the following steps:
step S101: the terminal displays an interface to be tested;
step S102: the terminal carries out image processing on the interface to be tested and obtains at least one application control of the interface to be tested;
step S103: the terminal determines a pseudo input event corresponding to at least one application control;
step S104: and the terminal executes the pseudo input event.
Step S101 is explained in detail as follows: the interface to be tested is the interface of the application program to be tested. First, the terminal executes a test program, thereby displaying an interface to be tested. For example: the interface to be tested can be directly opened by executing the test program; or displaying the minimized interface to be tested by executing the test program; or, displaying the interface to be tested in a hidden state by executing the test program.
The terminal determines the relative coordinate of the interface to be tested relative to the terminal screen and the area of the interface to be tested by executing the test program, and intercepts the interface to be tested according to the relative coordinate and the area of the interface to be tested.
Specifically, the terminal can determine the relative coordinates of the upper left corner pixel point and the lower right corner pixel point of the interface to be tested relative to the terminal screen through a test program, determine the area of the interface to be tested through the test program, and finally intercept the interface to be tested according to the relative coordinates of the upper left corner pixel point, the relative coordinates of the lower right corner pixel point and the area of the interface to be tested.
Or, the terminal determines the coordinates of the interface to be tested by executing the test program, and intercepts the interface to be tested according to the coordinates of the interface to be tested.
Specifically, the terminal can determine the relative coordinates of the upper left corner pixel point and the lower right corner pixel point of the interface to be tested relative to the terminal screen through a test program, and the interface to be tested can be directly intercepted according to the relative coordinates of the upper left corner pixel point and the lower right corner pixel point because the interface to be tested is generally rectangular.
It should be noted that, the application is not limited to how to display and obtain the interface to be tested by executing the test program.
Step S102 is explained in detail as follows: and the terminal carries out image processing on the interface to be tested and acquires at least one application control of the interface to be tested. The terminal can determine the pixel value of each pixel point in the interface to be tested, and then determines the application control according to the pixel value of each pixel point. The method specifically comprises the following optional modes:
one alternative is to: fig. 2 is a flowchart of a method for determining an application control according to an embodiment of the present application, and as shown in fig. 2, step S102 includes:
step S1021: the terminal conducts binarization processing on the interface to be tested to obtain a binarization image;
step S1022: the terminal carries out expansion processing on the binary image to obtain an image after the expansion processing;
step S1023: the terminal carries out corrosion treatment on the expanded image to obtain at least one first area;
step S1024: the terminal determines the at least one application control according to the at least one first area.
Specifically, step S1021 is explained as follows: and the terminal carries out binarization processing on the interface to be tested to obtain a binarization image, wherein the binarization processing comprises that the pixel value of each pixel point is 0 or 1. Namely, the binary image shows obvious black and white effect. For example: fig. 3A is a display diagram of an interface provided in an embodiment of the present application, and as shown in fig. 3A, the interface is an interface to be tested according to the present application, where each english word in the interface to be tested represents an application control, for example, the first line "PowerAW" represents an application control.
Fig. 4 is a partial schematic view of an interface provided in an embodiment of the present application, where fig. 4 is a binarized image corresponding to a letter "o" in a first row PowerAW and a letter "r" in a second row "programandfateuresaw" in fig. 3A, a pixel value of a pixel point on the letter "o" is 1, and pixel values of pixel points on an outer edge and an inner area of the letter "o" are 0. Similarly, the pixel value of the pixel on the letter "r" is 1, and the pixel on the outer edge thereof is 0. It should be noted that only a part of discrete pixels are shown in fig. 3A, and in fact, the pixels included in the binarized image corresponding to "o" and "r" are continuous pixels.
Description is made with respect to step S1022: fig. 5 is a partial schematic view of an interface provided in an embodiment of the present application, and as shown in fig. 5, a binary image is subjected to an expansion process, for example: the pixel values of the pixel points at the outer edge of "o" and inside "o" can be updated to 1 by the dilation process. Similarly, the pixel value of the pixel point at the outer edge of "r" can be updated to 1 by the dilation process.
The outer edge of the region in the application can be a region formed by pixel points, the distance between which and the region is smaller than a preset distance. The application does not limit how the outer edge of the region is determined.
Optionally, the application may also perform smoothing on the image after the expansion processing. The present application does not limit how the smoothing process is performed.
The following is explained with reference to step S1023 and step S1024: for example: after the "PowerAW" shown in the first row of fig. 3A and the "programandfeatureaw" shown in the second row are subjected to the dilation process, their respective outer edges are pixel points having a pixel value of 1. In order to divide the two rows, etching treatment is required, that is, a part of the pixels with the pixel values of 1 between the two rows is updated to be pixels with the pixel values of 0. Fig. 6 is a partial schematic view of an interface provided in an embodiment of the present application, and as shown in fig. 6, in order to divide the first row letter "o" and the second row letter "r" with respect to fig. 5, the terminal may update a part of the pixel points between "o" and "r" with the pixel value of 1 to be the pixel points with the pixel value of 0.
Further, a region in which all peripheral pixels having a pixel value of 1 are surrounded in the same row is referred to as a first region.
Optionally, after step S1023, the method further comprises: performing smoothing processing on the at least one first region; the present application does not limit the specific manner of smoothing, and any conventional method may be used.
Further, in step S1024, the size of the application control is generally compared with the specification, so that it can be determined whether the first area is the application control through the relation between the area size of the first area and the first preset threshold and the second preset threshold. Wherein the size of the application control comprises at least one of: the area of the application control, the length of the application control, and the width of the application control, and accordingly, the region size of the first region includes at least one of: the area of the first region, the length of the first region, the width of the first region, etc. This is not limited by the present application.
Taking the size of the application control as the area of the application control, and the size of the area of the first area as an example, for example: and taking the first area with the area larger than a first preset threshold and smaller than a second preset threshold in the at least one first area as an application control. Conversely, the area in the at least one first area is less than or equal to a first preset threshold value; or the first area with the area larger than or equal to the second preset threshold is not used as the application control.
It should be noted that, when the size of the application control is the area of the application control, both the first preset threshold and the second preset threshold are preset thresholds related to the area; likewise, when the size of the application control is its length, the first preset threshold and the second preset threshold are both preset thresholds with respect to length. When the size of the application control is its width, the first preset threshold and the second preset threshold are both preset thresholds with respect to the width. When the size of the application control comprises at least two items of the area of the application control, the length of the application control and the width of the application control, the first preset threshold and the second preset threshold are both preset thresholds related to the at least two items, and the preset thresholds of the at least two items are two-dimensional vectors. For example: when the size of the application control comprises the area of the application control and the length of the application control, the corresponding first preset threshold and second preset threshold are both two-dimensional vectors, the first element of the two-dimensional vector is a preset threshold related to the area, and the second element is a preset threshold related to the length.
Optionally, after step S1023, the method further comprises: and the terminal performs expansion processing on the at least one first area to obtain at least one second area. The expansion process may refer to the expansion process in step S1022, which is not described herein again.
Accordingly, in step S1024: and the terminal determines the at least one application control according to the at least one second area. The terminal may determine, as the application control, a second region in the at least one second region, where the size of the region is greater than a first preset threshold and smaller than a second preset threshold. Conversely, the size is less than or equal to a first preset threshold; or the second area with the size larger than or equal to the second preset threshold value is not used as the application control.
As described above, the size of the application control is compared with the specification, and thus it is possible to determine whether the second area is the application control by the relation between the area size of the second area and the first preset threshold and the second preset threshold. Wherein the size of the application control comprises at least one of: the area of the application control, the length of the application control, and the width of the application control, and accordingly, the region size of the second region includes at least one of: the area of the second region, the length of the second region, the width of the second region, etc. This is not limited by the present application.
Another alternative way of determining the application control is: the terminal conducts binarization processing on an interface to be tested to obtain a binarized image, the terminal determines pixel points with pixel values of 1, the distance between the pixel points is determined, the pixel points with the distances smaller than a preset threshold value are classified into a class, and an area formed by the pixel points of the same class is used as an application control.
In summary, the application control can be effectively determined through the two optional modes. And click coordinates on an application interface do not need to be randomly generated, so that the testing efficiency is improved.
Optionally, after step S102, the method further includes:
and the terminal displays each application control of the acquired at least one application control.
For example: the terminal may display the acquired application controls in a manner of highlighting, scribing, delineating, or selecting, that is, indicate which are the acquired application controls through these manners. Fig. 7A is a display diagram of an interface provided in an embodiment of the present application, and after step S101 and step S102, as shown in fig. 7A, the boxed areas are all the acquired application controls of the interface to be tested shown in fig. 3A.
Similarly, fig. 3B is another interface display diagram provided in the embodiment of the present application, fig. 7B is another interface display diagram provided in the embodiment of the present application, and after step S101 and step S102, as shown in fig. 7B, the selected areas are all the application controls of the interface to be tested shown in fig. 3B.
According to the application, the terminal can display the obtained application control in a highlight mode, a line drawing mode, a delineating mode or a selecting mode and the like, so that a tester can visually see the determined application control, and based on the application control, the tester can determine whether the test is accurate as soon as possible, and the test efficiency is improved.
For the detailed description of step S103, an alternative is: fig. 8 is a flowchart of a method for determining a pseudo input event corresponding to an application control according to an embodiment of the present application, where as shown in fig. 8, the method includes the following steps:
step S1031: the terminal determines characteristic information corresponding to at least one application control respectively;
step S1032: and the terminal determines the pseudo input event corresponding to the at least one application control according to the characteristic information corresponding to the at least one application control.
Optionally, the feature information corresponding to the application control includes at least one of: the size of the application control, the position information of the application control in the application interface and the deflection angle of the application control relative to the horizontal direction or the vertical direction.
Wherein the size of the application control comprises at least one of: an area of an application control, a length of the application control, and a width of the application control.
For example: and the terminal determines that the application control 1 should be a rectangle with a width larger than a preset threshold according to the length and the width of the application control 1, and then determines that the pseudo input event corresponding to the application control 1 is a sliding operation.
For example: and the terminal determines that the application control is a circle with the area smaller than the preset threshold according to the area of the application control 2, and then determines that the pseudo input event corresponding to the application control 2 is a click operation.
For example: and the terminal determines that the application control is a rectangle with a width larger than a preset threshold value and a deflection angle of 45 degrees relative to the horizontal direction according to the deflection angle, the length and the width of the application control 2, and determines that the pseudo input event corresponding to the application control 2 is a sliding operation, and the angle between the sliding direction of the sliding operation and the horizontal direction is 45 degrees.
Optionally, the terminal may display a corresponding relationship between at least one application control and the pseudo input event, which is specifically shown in table 1:
TABLE 1
Application control | Pseudo-random |
Application control | |
1 | Sliding operation |
Application control 2 | Click operation |
…… | …… |
Application control N | Double click operation |
Another alternative is: the terminal determines at least one pseudo input event and randomly generates a corresponding relation between at least one application control and at least one pseudo input event, and optionally, the corresponding relation may be changed periodically.
For example: the terminal determines 4 application controls and 4 pseudo input events, and in a first time period, the application control 1 corresponds to the pseudo input event 1, the application control 2 corresponds to the pseudo input event 2, the application control 3 corresponds to the pseudo input event 3, and the application control 4 corresponds to the pseudo input event 4; in the second time period, the application control 1 corresponds to the pseudo input event 4, the application control 2 corresponds to the pseudo input event 3, the application control 3 corresponds to the pseudo input event 2, and the application control 4 corresponds to the pseudo input event 1.
To describe step S104 in detail, fig. 9 is a flowchart of a method for executing a pseudo input event according to an embodiment of the present application, and as shown in fig. 9, the method includes:
step S1041: aiming at each application control in at least one application control, the terminal executes a pseudo input event corresponding to the application control;
step S1042: the terminal displays an identifier at the application control which executes the pseudo input event, wherein the identifier is used for indicating that the pseudo input event corresponding to the application control is executed.
Specifically, the pseudo input event corresponding to each application control can be determined based on the method. Based on this, each application control and its corresponding pseudo input event can be considered as a whole, the pseudo input events corresponding to each application control may be executed randomly or in a certain order, to prevent repeated operation of the same application control, application controls that have already been operated may be identified, wherein the identifier can be a number "1" in the upper right corner of the application control, or a star-shaped image in the upper right corner of the application control, or the like, or can be an application control which displays the executed pseudo input event in a display mode different from that of the application control, for example, the application control that does not execute the pseudo input event is highlighted, and the highlight is omitted when the application control has executed, which indicates that the event has been executed.
For example: firstly, determining a pseudo input event corresponding to an ith application control in at least one application control, then executing the pseudo input event corresponding to the ith application control, and after the terminal finishes executing the pseudo input event corresponding to the ith application control, displaying an identifier of the ith application control by the terminal; and then determining a pseudo input event corresponding to the (i + 1) th application control in the at least one application control, then executing the pseudo input event corresponding to the (i + 1) th application control, after the terminal finishes executing the pseudo input event corresponding to the (i + 1) th application control, displaying the identifier of the (i + 1) th application control by the terminal, and so on until all the pseudo input events corresponding to the application controls are executed, and ending. Wherein i is a positive integer greater than or equal to 1.
It should be noted that, the ith application control and the (i + 1) th application control only indicate that the pseudo input event corresponding to the ith application control is determined first, and then the pseudo input event corresponding to the (i + 1) th application control is determined, and there is no sequential limitation between the ith application control and the (i + 1) th application control. In the application, the method can determine the pseudo input events corresponding to at least one application control in batch to execute the pseudo input events corresponding to each application control. Thereby improving the testing efficiency.
Optionally, in step S104: the terminal moves a cursor or a mouse point of the terminal along with the execution of the pseudo input event while the terminal executes the pseudo input event, wherein a cursor position or a mouse point position represents a position of the pseudo input event. For example: fig. 10A is a display diagram of an interface provided by an embodiment of the present application, where as shown in fig. 10A, the cursor currently points to "PowerAW" shown in the first row, indicating that a pseudo input event is currently being performed on "PowerAW". FIG. 10B is a display diagram of an interface provided by an embodiment of the present application, as shown in FIG. 10B, with the cursor currently pointing to "VMAL" indicating that a pseudo-input event is currently being performed on "VMAL".
In the application, because the cursor or the mouse point of the terminal moves along with the execution of the pseudo input event, a tester can visually see the application control executing the pseudo input event, and based on the application control, the tester can determine whether the test is accurate as soon as possible, so that the test efficiency is improved.
In summary, the present application provides a Monkey testing method, which includes: the terminal displays an interface to be tested; the terminal carries out image processing on the interface to be tested and obtains at least one application control of the interface to be tested; and the terminal determines a pseudo input event corresponding to at least one application control and executes the pseudo input event of the at least one application control. By the method, at least one application control of the interface to be tested can be obtained without randomly generating a click coordinate on the application interface, so that the testing efficiency is improved.
Fig. 11 is a schematic structural diagram of a terminal 110 according to an embodiment of the present disclosure, where the terminal 110 may be a smart phone, a tablet, a PC, a game console, a simulator, or the like. As shown in fig. 11, the terminal 110 includes:
and the display module 111 is used for displaying the interface to be tested.
And the processing module 112 is configured to perform image processing on the interface to be tested, and obtain at least one application control of the interface to be tested.
A determining module 113, configured to determine a pseudo input event corresponding to at least one application control.
And an execution module 114 for executing the pseudo input event.
Optionally, the processing module 112 comprises:
a binarization processing unit 1121 configured to perform binarization processing on the interface to be tested to obtain a binarized image.
The expansion processing unit 1122 is configured to perform expansion processing on the binarized image to obtain an expanded image.
And an erosion processing unit 1123, configured to perform erosion processing on the expanded image to obtain at least one first region.
A determining unit 1124 for determining at least one application control according to the at least one first area.
Optionally, the expansion processing unit 1122 is further configured to perform an expansion processing on the at least one first region to obtain at least one second region; correspondingly, the determining unit 1124 is specifically configured to determine at least one application control according to the at least one second area.
Optionally, the determining unit 1124 is specifically configured to: and determining a second area with the area size larger than a first preset threshold and smaller than a second preset threshold as the application control.
Optionally, the display module 111 is further configured to display each application control of the acquired at least one application control.
Optionally, the determining module 113 is specifically configured to: determining characteristic information corresponding to at least one application control respectively; and determining a pseudo input event corresponding to each of the at least one application control according to the characteristic information corresponding to each of the at least one application control.
Optionally, the feature information corresponding to the application control includes at least one of: the size of the application control, the position information of the application control in the application interface and the deflection angle of the application control relative to the horizontal direction or the vertical direction.
Optionally, the execution module 114 is specifically configured to: executing a pseudo input event corresponding to the application control aiming at each application control in at least one application control; correspondingly, the display module 111 is further configured to display, at the application control that has executed the pseudo input event, an identifier indicating that the pseudo input event corresponding to the application control has been executed.
The present application provides a terminal, which can be used to execute the above Monkey testing method, and the implementation principle and technical effect of the terminal are similar to those of the Monkey testing method, and this is not described herein again.
Fig. 12 is a schematic structural diagram of a terminal 120 according to an embodiment of the present disclosure, where the terminal 120 may be a smart phone, a tablet, a PC, a game console, a simulator, or the like.
As shown in fig. 12, the terminal 120 includes: a processor 121 and a memory 122 for storing executable instructions of the processor 121; the processor 121 implements the Monkey test method as described above by executing the instructions.
Specifically, the processor 121 is configured to: displaying an interface to be tested; performing image processing on the interface to be tested to obtain at least one application control of the interface to be tested; determining a pseudo input event corresponding to at least one application control; a dummy input event is performed.
Optionally, the processor 121 is specifically configured to: carrying out binarization processing on an interface to be tested to obtain a binarization image; performing expansion processing on the binary image to obtain an image subjected to expansion processing; carrying out corrosion treatment on the image subjected to the expansion treatment to obtain at least one first area; at least one application control is determined according to the at least one first area.
Optionally, the processor 121 is further configured to perform an expansion process on the at least one first region to obtain at least one second region; accordingly, the processor 121 is specifically configured to: at least one application control is determined from the at least one second region.
Optionally, the processor 121 is specifically configured to: and determining a second area with the area size larger than a first preset threshold and smaller than a second preset threshold as the application control.
Optionally, the processor 121 is further configured to display each application control of the acquired at least one application control.
Optionally, the processor 121 is specifically configured to: determining characteristic information corresponding to at least one application control respectively; and determining a pseudo input event corresponding to each of the at least one application control according to the characteristic information corresponding to each of the at least one application control.
Optionally, the feature information corresponding to the application control includes at least one of: the size of the application control, the position information of the application control in the application interface and the deflection angle of the application control relative to the horizontal direction or the vertical direction.
Optionally, the processor 121 is specifically configured to: executing a pseudo input event corresponding to the application control aiming at each application control in at least one application control; displaying, at the application control that has executed the pseudo input event, an identification indicating that the pseudo input event corresponding to the application control has been executed.
The present application provides a terminal, which can be used to execute the above Monkey testing method, and the implementation principle and technical effect of the terminal are similar to those of the Monkey testing method, and this is not described herein again. Each functional unit in the embodiments of the present application 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 integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone computer program product, may be stored in a computer readable storage medium.
The present application also provides a computer program product comprising instructions which, when executed by a computer, cause the computer to carry out the functions performed by the terminal as described above.
When implemented in software, the technical solutions of the present application may be implemented in whole or in part in the form of a computer program product. The computer program product includes at least one instruction. When the instructions are loaded and executed on a computer, the processes or functions described in this application occur in whole or in part. The computer may be by computer, a special purpose computer, a network of computers, or other programmable device. The instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer may transmit from one website, computer, server, or data center to another website, computer, server, or data center via a wired means such as coaxial cable, fiber optics, Digital Subscriber Line (DSL), etc., or wirelessly such as infrared, wireless, microwave, etc.
The present application also provides a computer storage medium for storing computer software instructions for the above terminal. So that the terminal can realize the Monkey test method by executing the instruction.
The computer readable medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more available media. The usable medium may be a magnetic medium such as a floppy Disk, a hard Disk, or a magnetic tape, or a semiconductor medium such as a Solid State Disk (SSD).
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (19)
- A Monkey testing method, comprising:the terminal displays an interface to be tested;the terminal carries out image processing on the interface to be tested to obtain at least one application control of the interface to be tested;the terminal determines a pseudo input event corresponding to the at least one application control;the terminal executes the pseudo input event.
- The method of claim 1, wherein the image processing of the interface to be tested by the terminal to obtain at least one application control of the interface to be tested comprises:the terminal conducts binarization processing on the interface to be tested to obtain a binarization image;the terminal carries out expansion processing on the binary image to obtain an image after the expansion processing;the terminal carries out corrosion treatment on the expanded image to obtain at least one first area;and the terminal determines the at least one application control according to the at least one first area.
- The method of claim 2, wherein after the subjecting the expanded image to erosion processing by the terminal to obtain at least one first region, the method further comprises:the terminal performs expansion processing on the at least one first area to obtain at least one second area;correspondingly, the determining, by the terminal, the at least one application control according to the at least one first region includes:and the terminal determines the at least one application control according to the at least one second area.
- The method according to claim 3, wherein the terminal determines the at least one application control according to the at least one second area, comprising:and the terminal determines a second area with the area size larger than a first preset threshold and smaller than a second preset threshold as the application control.
- The method according to any one of claims 1 to 4, wherein the image processing of the interface to be tested by the terminal after acquiring the at least one application control of the interface to be tested further comprises:and the terminal displays each acquired application control of the at least one application control.
- The method according to any one of claims 1-5, wherein the terminal determining the pseudo input event corresponding to the at least one application control comprises:the terminal determines characteristic information corresponding to the at least one application control respectively;and the terminal determines the pseudo input event corresponding to the at least one application control according to the characteristic information corresponding to the at least one application control.
- The method of claim 6, wherein the characteristic information corresponding to the application control comprises at least one of: the size of the application control, the position information of the application control in the application interface and the deflection angle of the application control relative to the horizontal direction or the vertical direction.
- The method according to any of claims 1-7, wherein the terminal performs the pseudo input event, comprising:for each application control in the at least one application control, the terminal executes a pseudo input event corresponding to the application control;the terminal displays an identifier at the application control which executes the pseudo input event, wherein the identifier is used for indicating that the pseudo input event corresponding to the application control is executed.
- A terminal, comprising:the display module is used for displaying an interface to be tested;the processing module is used for carrying out image processing on the interface to be tested and acquiring at least one application control of the interface to be tested;the determining module is used for determining a pseudo input event corresponding to the at least one application control;and the execution module is used for executing the pseudo input event.
- The terminal of claim 9, wherein the processing module comprises:a binarization processing unit, configured to perform binarization processing on the interface to be tested to obtain a binarization image;the expansion processing unit is used for performing expansion processing on the binary image to obtain an expanded image;the corrosion processing unit is used for carrying out corrosion processing on the expanded image to obtain at least one first area;a determining unit, configured to determine the at least one application control according to the at least one first region.
- The terminal of claim 10, wherein the inflation processing unit is further configured to:performing expansion treatment on the at least one first area to obtain at least one second area;correspondingly, the determining unit is specifically configured to:determining the at least one application control according to the at least one second area.
- The terminal according to claim 11, wherein the determining unit is specifically configured to:and determining a second area with the area size larger than a first preset threshold and smaller than a second preset threshold as the application control.
- The terminal according to any of claims 9-12,the display module is further configured to display each obtained application control of the at least one application control.
- The terminal according to any of claims 9 to 13, wherein the determining module is specifically configured to:determining characteristic information corresponding to the at least one application control respectively;and determining a pseudo input event corresponding to each of the at least one application control according to the characteristic information corresponding to each of the at least one application control.
- The terminal of claim 14, wherein the feature information corresponding to the application control comprises at least one of: the size of the application control, the position information of the application control in the application interface and the deflection angle of the application control relative to the horizontal direction or the vertical direction.
- The terminal according to any of claims 9-15,the execution module is specifically configured to execute, for each application control of the at least one application control, a pseudo input event corresponding to the application control;correspondingly, the display module is further configured to display, at the application control on which the pseudo input event has been executed, an identifier, where the identifier is used to indicate that the pseudo input event corresponding to the application control has been executed.
- A terminal device, comprising: one or more processors and memory for storing executable instructions for the processors; the processor implements the method of any one of claims 1-8 by executing the instructions.
- A computer program product, characterized in that, when run on a terminal, causes the terminal to perform the method according to any of claims 1-8.
- A computer storage medium comprising instructions that, when executed on a terminal, cause the terminal to perform the method of any one of claims 1-8.
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2017/110444 WO2019090691A1 (en) | 2017-11-10 | 2017-11-10 | Monkey testing method and terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110914810A true CN110914810A (en) | 2020-03-24 |
CN110914810B CN110914810B (en) | 2022-02-01 |
Family
ID=66437485
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201780093230.9A Active CN110914810B (en) | 2017-11-10 | 2017-11-10 | Monkey testing method and terminal |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN110914810B (en) |
WO (1) | WO2019090691A1 (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111078579A (en) * | 2019-12-31 | 2020-04-28 | 河北省科学院应用数学研究所 | Monkey testing method and device and terminal equipment |
CN111581091B (en) * | 2020-04-30 | 2023-03-21 | 北京字节跳动网络技术有限公司 | Page testing method and device, readable medium and electronic equipment |
CN113722231B (en) * | 2021-09-09 | 2024-04-26 | 同盾科技有限公司 | User operation simulation method and device, electronic equipment and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150370688A1 (en) * | 2014-06-20 | 2015-12-24 | Vmware, Inc. | Automatic updating of graphical user interface element locators based on dimension comparison |
CN105335976A (en) * | 2015-10-23 | 2016-02-17 | 广州视睿电子科技有限公司 | Image processing method and device |
CN105740152A (en) * | 2016-02-04 | 2016-07-06 | 浪潮电子信息产业股份有限公司 | Pressure testing method for multi-node batch deployment system |
CN105868102A (en) * | 2016-03-22 | 2016-08-17 | 中国科学院软件研究所 | Computer vision based mobile terminal application testing system and method |
CN106383780A (en) * | 2016-09-05 | 2017-02-08 | 努比亚技术有限公司 | Monkey test method and device |
CN106815134A (en) * | 2015-11-27 | 2017-06-09 | 北京奇虎科技有限公司 | A kind of APP method of testings and device |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104063324B (en) * | 2014-07-10 | 2017-11-24 | 上海斐讯数据通信技术有限公司 | A kind of Monkey method of testings and system |
CN105607993B (en) * | 2015-09-30 | 2018-04-20 | 北京奇虎科技有限公司 | The method and apparatus that a kind of user interface UI to application is tested |
CN107193733A (en) * | 2017-05-12 | 2017-09-22 | 微梦创科网络科技(中国)有限公司 | Simulate the methods, devices and systems of Monkey tests |
-
2017
- 2017-11-10 CN CN201780093230.9A patent/CN110914810B/en active Active
- 2017-11-10 WO PCT/CN2017/110444 patent/WO2019090691A1/en active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150370688A1 (en) * | 2014-06-20 | 2015-12-24 | Vmware, Inc. | Automatic updating of graphical user interface element locators based on dimension comparison |
CN105335976A (en) * | 2015-10-23 | 2016-02-17 | 广州视睿电子科技有限公司 | Image processing method and device |
CN106815134A (en) * | 2015-11-27 | 2017-06-09 | 北京奇虎科技有限公司 | A kind of APP method of testings and device |
CN105740152A (en) * | 2016-02-04 | 2016-07-06 | 浪潮电子信息产业股份有限公司 | Pressure testing method for multi-node batch deployment system |
CN105868102A (en) * | 2016-03-22 | 2016-08-17 | 中国科学院软件研究所 | Computer vision based mobile terminal application testing system and method |
CN106383780A (en) * | 2016-09-05 | 2017-02-08 | 努比亚技术有限公司 | Monkey test method and device |
Also Published As
Publication number | Publication date |
---|---|
CN110914810B (en) | 2022-02-01 |
WO2019090691A1 (en) | 2019-05-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9122341B2 (en) | Resolving merged touch contacts | |
EP2950203B1 (en) | Application scenario identification method, power consumption management method and apparatus and terminal device | |
US9519401B2 (en) | Providing context menu based on predicted commands | |
US8549478B2 (en) | Graphical user interface input element identification | |
US20190138721A1 (en) | Dimensionality Reduction of Computer Programs | |
US20170109917A1 (en) | Method and device for erasing a writing path on an infrared electronic white board, and a system for writing on an infrared electronic white board | |
US9589136B2 (en) | Method and device for extracting message format | |
CN110914810B (en) | Monkey testing method and terminal | |
US10810113B2 (en) | Method and apparatus for creating reference images for an automated test of software with a graphical user interface | |
CN106485173B (en) | Sensitive information display method and device | |
US9280452B1 (en) | Systems and methods for generating test cases | |
CN113253878B (en) | Touch screen report point determining method and device, electronic equipment and storage medium | |
CN112083973B (en) | Window closing method and device, electronic equipment and storage medium | |
CN109815702A (en) | Safety detection method, device and the equipment of software action | |
CN110658976B (en) | Touch track display method and electronic equipment | |
US20150084889A1 (en) | Stroke processing device, stroke processing method, and computer program product | |
CN114612367A (en) | Evaluation method and device of image processing algorithm, computer equipment and storage medium | |
CN109753217B (en) | Dynamic keyboard operation method and device, storage medium and electronic equipment | |
CN107589890A (en) | A kind of mouse clicks on the response method and device for the view that is blocked | |
CN109635601B (en) | Password anti-theft method and device | |
CN104461857A (en) | Software reliability detection method and device | |
CN108228063B (en) | Preference scheme determination method and device and electronic equipment | |
WO2020133201A1 (en) | Automated identification of input elements in graphical user interface | |
CN106471445A (en) | Moved based on the discrete cursor of touch input | |
CN115048309B (en) | Non-intrusive APP software performance test method and system |
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 |