WO2019090691A1 - Monkey测试方法及终端 - Google Patents
Monkey测试方法及终端 Download PDFInfo
- Publication number
- WO2019090691A1 WO2019090691A1 PCT/CN2017/110444 CN2017110444W WO2019090691A1 WO 2019090691 A1 WO2019090691 A1 WO 2019090691A1 CN 2017110444 W CN2017110444 W CN 2017110444W WO 2019090691 A1 WO2019090691 A1 WO 2019090691A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- application control
- terminal
- interface
- application
- input event
- Prior art date
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
Definitions
- the present application relates to the field of software testing technologies, and in particular, to a Monkey testing method and a terminal.
- the Monkey test process includes: sending a random pseudo input event, such as key input, touch screen input, and gesture input, to the terminal through a test program running in the terminal to implement stability testing of the application, or application and terminal compatibility. Test. If the application flashes back at this time, the application has a bug, or the application is not compatible with the terminal.
- a random pseudo input event such as key input, touch screen input, and gesture input
- the prior art can randomly generate the click coordinates on the application interface through the test program, and automatically trigger the pseudo input event corresponding to the click coordinates.
- the method of randomly generating the click coordinates is bound to cause many invalid triggers, thereby causing low test efficiency. .
- the present application provides a Monkey test method and a terminal.
- a terminal can obtain at least one application control of an interface to be tested without using a click coordinate on a randomly generated application interface, thereby improving test efficiency.
- the present application provides a Monkey test method, including: displaying, by a terminal, an interface to be tested; performing, by the terminal, image processing on the test interface, acquiring at least one application control of the interface to be tested; and determining, by the terminal, a pseudo input event corresponding to the at least one application control The terminal performs a pseudo input event.
- the beneficial effects of the present application include: obtaining at least one application control of the interface to be tested by using the method, without using the click coordinates on the randomly generated application interface, thereby improving test efficiency.
- the terminal performs image processing on the test interface, and acquires at least one application control of the interface to be tested, including:
- the terminal performs binarization processing on the test interface to obtain a binarized image
- the terminal expands the binarized image to obtain an image after the expansion process
- the terminal performs an etching process on the image after the expansion process to obtain at least one first region
- the terminal determines at least one application control according to the at least one first area.
- the beneficial effects of the present application include: the image processing process can effectively obtain at least one application control of the interface to be tested, thereby eliminating the need to randomly generate click coordinates on the application interface, thereby improving test efficiency.
- the terminal performs an etching process on the image after the expansion process, and after obtaining the at least one first region, the method further includes: the terminal performing an expansion process on the at least one first region to obtain at least one second region;
- the terminal determines at least one application control according to the at least one first area, including:
- the terminal determines at least one application control according to the at least one second area.
- the beneficial effects of the present application include that the accuracy of determining the application control can be improved by the secondary expansion processing of the image.
- the terminal determines, according to the at least one second area, the at least one application control, including:
- the terminal determines the second area whose area size is greater than the first preset threshold and less than the second preset threshold as the application control.
- the beneficial effects of the present application include that the invalid second region can be screened out by the method, thereby improving the accuracy of determining the application control.
- the method further includes: displaying, by the terminal, each applied control of the acquired at least one application control.
- the terminal determines a pseudo input event corresponding to the at least one application control, including:
- the terminal determines the feature information corresponding to the at least one application control, and the terminal determines the pseudo input event corresponding to the at least one application control according to the feature information corresponding to the at least one application control.
- the beneficial effects of the present application include: determining, by the method, the pseudo input events corresponding to the at least one application control to perform pseudo input events corresponding to the respective application controls. Thereby improving test efficiency.
- the feature information corresponding to the application control includes at least one of the following: a size of the application control, location information of the application control in the application interface, and a deflection angle of the application control with respect to a horizontal direction or a vertical direction.
- the terminal performs a pseudo input event, including:
- the terminal executes a pseudo input event corresponding to the application control
- the terminal displays an identifier at the application control that has executed the pseudo input event, and the identifier is used to indicate that the pseudo input event corresponding to the application control has been executed.
- the beneficial effects of the present application include: by displaying the manner of the identification, it is possible to prevent the application control from being repeatedly executed, thereby improving the testing efficiency.
- the application provides a terminal, including:
- a display module for displaying the interface to be tested.
- the processing module 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 is configured to determine a pseudo input event corresponding to the at least one application control.
- An execution module for performing a pseudo input event is an execution module for performing a pseudo input event.
- the processing module includes:
- a binarization processing unit is configured to perform binarization processing on the interface to be tested to obtain a binarized image.
- the expansion processing unit is configured to perform expansion processing on the binarized image to obtain an image after the expansion processing.
- An etching processing unit is configured to perform an etching process on the image after the expansion process to obtain at least one first region.
- a determining unit configured to determine the at least one application control according to the at least one first region.
- the expansion processing unit is further configured to:
- the determining unit is specifically used for:
- the determining unit is specifically configured to: determine, as an application control, a second area whose area size is greater than the first preset threshold and less than the second preset threshold.
- the display module is further configured to display each of the acquired application controls of the at least one application control.
- the determining module is specifically configured to: determine feature information corresponding to the at least one application control respectively; The feature information corresponding to an application control respectively determines a pseudo input event corresponding to each of the at least one application control.
- the feature information corresponding to the application control includes at least one of the following: a size of the application control, location information of the application control in the application interface, and a deflection angle of the application control with respect to a horizontal direction or a vertical direction.
- the execution module is specifically configured to: execute, for each application control in the at least one application control, a pseudo input event corresponding to the application control; correspondingly, the display module is further configured to be at the application control that has performed the pseudo input event, A display identifier is used to indicate that a pseudo input event corresponding to the application control has been executed.
- the application provides a terminal device, including: a processor and a memory for storing executable instructions of the processor; the processor is configured to: display an interface to be tested; perform image processing on the interface to be tested, and obtain an interface to be tested At least one application control; determining a pseudo input event corresponding to the at least one application control; performing a pseudo input event.
- the processor is specifically configured to: perform binarization processing on the test interface to obtain a binarized image; perform expansion processing on the binarized image to obtain an image after the expansion process; and perform etching processing on the image after the expansion process Obtaining at least one first region; determining at least one application control based on the at least one first region.
- the processor is further configured to perform an expansion process on the at least one first area to obtain at least one second area.
- the processor is specifically configured to: determine the at least one application control according to the at least one second area.
- the processor is specifically configured to: determine, as an application control, a second area whose area size is greater than the first preset threshold and less than the second preset threshold.
- the processor is further configured to display each of the acquired application controls of the at least one application control.
- the processor is specifically configured to: determine feature information corresponding to the at least one application control respectively; and determine, according to the feature information corresponding to the at least one application control, a pseudo input event corresponding to each of the at least one application control.
- the feature information corresponding to the application control includes at least one of the following: a size of the application control, location information of the application control in the application interface, and a deflection angle of the application control with respect to a horizontal direction or a vertical direction.
- the processor is specifically configured to: execute, for each application control in the at least one application control, a pseudo input event corresponding to the application control; and display an identifier at the application control that has executed the pseudo input event, where the identifier is used to indicate The pseudo input event corresponding to the application control has been executed.
- the present application provides a computer storage medium comprising instructions for causing a terminal to perform the method of the first aspect or the optional aspect of the first aspect when the instruction is run on the terminal.
- the present application provides a computer program product, when the computer program product is run on a terminal, causing the terminal to perform the method as described in the first aspect or the optional aspect of the first aspect.
- the application provides a Monkey test method and terminal.
- the method includes: the terminal displays an interface to be tested; the terminal performs image processing on the test interface, and acquires 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; and the terminal performs a pseudo input event.
- FIG. 1 is a flowchart of a method for testing a Monkey 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 showing an interface display according to an embodiment of the present application.
- FIG. 3B is a diagram showing an interface display according to an embodiment of the present application.
- FIG. 4 is a partial schematic diagram of an interface provided by an embodiment of the present application.
- FIG. 5 is a partial schematic diagram of an interface according to an embodiment of the present application.
- FIG. 6 is a partial schematic diagram of an interface according to an embodiment of the present application.
- FIG. 7A is a diagram showing an interface display according to an embodiment of the present application.
- FIG. 7B is a diagram showing an interface display according to 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 disclosure
- FIG. 9 is a flowchart of a method for performing a pseudo input event according to an embodiment of the present application.
- FIG. 10A is a diagram showing an interface display according to an embodiment of the present application.
- FIG. 10B is a diagram showing an interface display according to 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.
- Monkey test Send random pseudo input events, such as key input, touch screen input, and gesture input, to the terminal by running the test program in the terminal.
- the test program is used to test the stability of the application, or the application and the terminal. Compatibility testing. If the application flashes back at this time, the application has a bug, or the application is incompatible with the terminal.
- Image binarization the binarization of the image, which is to set the gray value of the pixel on the image to 0 or 255, that is, to present the entire image with a distinct black and white effect.
- Expansion processing the boundary of the region formed by the pixel value of the binarized image is expanded by one layer, that is, the outer edge of the boundary and/or the pixel with the internal pixel value of the region is updated to a pixel value of 1. Point, the expansion process is mainly used to fill small holes in the area.
- Corrosion treatment it is opposite to the expansion treatment.
- the corrosion treatment is mainly used to eliminate the boundary noise of the region where the pixel value is 1 in the image after the value is obtained.
- the corrosion treatment of the region can be independent and full (internal non-porous). A smooth bordered area.
- the prior art can randomly generate the click coordinates on the application interface through the test program, and automatically trigger the pseudo input event corresponding to the click coordinate.
- the manner of randomly generating the click coordinates is bound to cause many invalid triggers. The problem of low test efficiency.
- the present application provides a Monkey test method and a terminal.
- the application scenario of the application is as follows: the terminal has installed an application, and the application may be a shopping application (Application, APP), a game APP, a taxi app, etc., and the terminal tests the application by using the loaded test program.
- the application may be a shopping application (Application, APP), a game APP, a taxi app, etc.
- the terminal tests the application by using the loaded test program.
- the terminal may be a smart phone, a tablet computer, a personal computer (PC), a game console or a simulator.
- FIG. 1 is a flowchart of a method for testing a Monkey according to an embodiment of the present application. 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 performs image processing on the test interface, and acquires at least one application control of the interface to be tested;
- Step S103 The terminal determines a pseudo input event corresponding to the at least one application control.
- Step S104 The terminal executes the pseudo input event.
- the interface to be tested is an interface of the application to be tested.
- the terminal executes a test program to display the interface to be tested.
- the test interface can be directly opened by executing the test program; or, by executing the test program, the interface to be tested is minimized; or, by executing the test program, the interface to be tested in the hidden state is displayed.
- the terminal determines the relative coordinates of the interface to be tested relative to the terminal screen and the area of the interface to be tested by executing a test procedure, and intercepts the interface to be tested according to the relative coordinates and area of the interface to be tested.
- the terminal can determine the relative coordinates of the upper left corner pixel and the lower right corner pixel relative to the terminal screen of the interface to be tested through the test program, and can determine the area of the interface to be tested through a test program, and finally according to the upper left corner pixel point.
- the relative coordinates, the relative coordinates of the pixel points in the lower right corner, and the area of the interface to be tested intercept the interface to be tested.
- the terminal determines the coordinates of the interface to be tested by executing a test procedure, and intercepts the interface to be tested according to the coordinates of the interface to be tested.
- the terminal can determine the relative coordinates of the upper left corner pixel and the lower right corner pixel of the interface to be tested relative to the terminal screen by using a test program. Since the interface to be tested is generally rectangular, it can directly be based on the pixel in the upper left corner. The relative coordinates and the relative coordinates of the lower right pixel point intercept the interface to be tested.
- the step S102 is described in detail: the terminal performs image processing on the test interface, and acquires at least one application control of the interface to be tested.
- the terminal may determine the pixel values of the respective pixels in the interface to be tested, and then determine the application control according to the pixel values of the respective pixels. Specifically, the following options are available:
- FIG. 2 is a flowchart of a method for determining an application control according to an embodiment of the present application. As shown in FIG. 2, step S102 includes:
- Step S1021 The terminal performs binarization processing on the test interface to obtain a binarized image.
- Step S1022 The terminal performs an expansion process on the binarized image to obtain an image after the expansion process
- Step S1023 The terminal performs an etching process on the image after the expansion process to obtain at least one first region;
- Step S1024 The terminal determines the at least one application control according to the at least one first area.
- step S1021 the terminal performs binarization processing on the test interface to obtain a binarized image, and the pixel value of each pixel included in the binarization process is 0 or 1. That is, the binarized image exhibits a distinct black and white effect.
- FIG. 3A is an interface display diagram provided by an embodiment of the present application. As shown in FIG. 3A , the interface is an interface to be tested according to the application, wherein 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 diagram of an interface according to an embodiment of the present application, wherein FIG. 4 is a binary image corresponding to the letter “o” in the first row of PowerAW of FIG. 3A and the letter “r” in the second row “ProgramsAndfeaturesAW” respectively.
- the pixel on the letter “o” has a pixel value of 1, and its outer edge and the pixel of the inner region have a pixel value of zero.
- the pixel value on the letter "r” has a pixel value of 1, and the pixel value of its outer edge has a pixel value of zero.
- the binarized images corresponding to “o” and “r” respectively include pixels that are consecutive pixels.
- FIG. 5 is a partial schematic diagram of an interface provided by an embodiment of the present application.
- the binarized image is expanded.
- the outer edge of the "o” can be expanded by the expansion process.
- the pixel value of the pixel inside "o” is updated to 1.
- the image of the pixel of the outer edge of "r” can be The prime value is updated to 1.
- the outer edge of the area in the present application may be an area formed by pixel points whose distance from the area is less than a preset distance. This application does not limit how to determine the outer edge of the area.
- the application may also perform smoothing on the image after the expansion process. This application does not limit how to smooth the processing.
- FIG. 6 is a partial schematic diagram of an interface according to an embodiment of the present disclosure. As shown in FIG. 6, with respect to FIG.
- the terminal may set "o" A pixel with a partial pixel value of 1 between “r” and “r” is updated to a pixel with a pixel value of zero.
- a first area an area in which all pixel points having a peripheral pixel value of 1 can be enclosed in the same line.
- the method further includes: performing smoothing processing on the at least one first area; the specific manner of the smoothing processing is not limited in the present application, and may be performed by using any existing method.
- the size of the application control is compared, so that whether the first area is an application control may be determined by the relationship between the area size of the first area and the first preset threshold and the second preset threshold.
- the size of the application control includes at least one of the following: an area of the application control, a length of the application control, and a width of the application control.
- the area size of the first area includes at least one of the following: The area, the length of the first area, and the width of the first area. This application does not limit this.
- the area size of the first area is an example of the area of the first area, for example, the area of the at least one first area is greater than the first preset threshold and less than the second
- the first area of the preset threshold can be used as an application control.
- the area in the at least one first area is less than or equal to the first preset threshold; or the first area in which the area is greater than or equal to the second preset threshold is not used as an application control.
- the first preset threshold and the second preset threshold are preset thresholds for the area; similarly, when the size of the application control is its long, Both the first preset threshold and the second preset threshold are related to a long preset threshold.
- both the first preset threshold and the second preset threshold are related to a wide preset threshold.
- the size of the application control includes at least two items of an area of the application control, a length of the application control, and a width of the application control, the first preset threshold and the second preset threshold are all about the at least two items. a preset threshold, the preset threshold of the at least two items being a two-dimensional vector.
- the corresponding first preset threshold and the second preset threshold are both two-dimensional vectors, and the first element of the two-dimensional vector is about The preset threshold for the area, the second element is the preset threshold for the long.
- the method further includes: the terminal performing an expansion process on the at least one first area to obtain at least one second area.
- the expansion process refer to the expansion process in step S1022, which is not described in this application.
- 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, the second area in the at least one second area that is larger than the first preset threshold and smaller than the second preset threshold. Instead, the size is less than or equal to the first predetermined threshold; or the second area whose size is greater than or equal to the second predetermined threshold is not used as an application control.
- the size of the application control is relatively standardized, so the size of the area of the second area can be The relationship between the threshold and the second preset threshold is determined to determine whether the second region is an application control.
- the size of the application control includes at least one of the following: an area of the application control, a length of the application control, and a width of the application control.
- the area size of the second area includes at least one of the following: The area, the length of the second area, and the width of the second area. This application does not limit this.
- Another alternative method for determining the application control is: the terminal performs binarization processing on the test interface to obtain a binarized image, and the terminal determines each pixel point with a pixel value of 1, and determines the distance between the pixels, and sets the distance A pixel point smaller than a preset threshold is divided into one class, and an area composed of pixels of the same type is used as an application control.
- the application control can be effectively determined by the above two alternative methods. It does not require the use of click coordinates on the randomly generated application interface to improve test efficiency.
- step S102 the method further includes:
- the terminal displays each of the application controls of the acquired at least one application control.
- the terminal can display the obtained application control by highlighting, scribing, delimiting, or selecting, that is, by these means, which are the obtained application controls.
- FIG. 7A is an interface display diagram according to an embodiment of the present application. After step S101 and step S102, as shown in FIG. 7A, the framed areas are all the application controls of the acquired interface to be tested shown in FIG. 3A.
- FIG. 3B is another interface display diagram provided by an embodiment of the present application
- FIG. 7B is another interface display diagram provided by an embodiment of the present application.
- the terminal can display the acquired application control by highlighting, scribing, delimiting, or selecting, so that the tester can visually see the determined application control, and based on this, the tester can determine whether the test is as soon as possible. Accurate, thus improving test efficiency.
- 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. As shown in FIG. 8, the method includes the following steps:
- Step S1031 The terminal determines feature information corresponding to the at least one application control respectively.
- Step S1032 The terminal determines, according to the feature information corresponding to the at least one application control, a pseudo input event corresponding to each of the at least one application control.
- the feature information corresponding to the application control includes at least one of the following: a size of the application control, location information of the application control in the application interface, and a deflection angle of the application control with respect to a horizontal direction or a vertical direction.
- the size of the application control includes at least one of the following: an area of the application control, a length of the application control, and a width of the application control.
- the terminal determines that the application control should be a rectangle whose width is greater than a preset threshold according to the length and width of the application control 1, and determines that the pseudo input event corresponding to the application control 1 is a sliding operation.
- the terminal determines that the application control is a circle whose area is smaller than a preset threshold according to the area of the application control 2, and determines that the pseudo input event corresponding to the application control 2 is a click operation.
- the terminal determines, according to the deflection angle, length and width of the application control 2, that the application control is a rectangle whose width is greater than a preset threshold and the deflection angle is 45 degrees with respect to the horizontal direction, and determines a pseudo input event corresponding to the application control 2 It is a sliding operation, and the sliding direction of the sliding operation is 45 degrees from the horizontal direction.
- the terminal may display a correspondence between at least one application control and a pseudo input event, as shown in Table 1:
- Application control Pseudorandom event Application control 1 Sliding operation
- the terminal determines at least one pseudo input event, and randomly generates a correspondence between the at least one application control and the at least one pseudo input event.
- the correspondence may periodically change.
- the terminal determines 4 application controls and 4 pseudo input events.
- 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
- the application control 4 corresponds to the pseudo input event 4
- 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
- the terminal corresponds to the pseudo input event 1.
- FIG. 9 is a flowchart of a method for performing a pseudo input event according to an embodiment of the present application. As shown in FIG. 9, the method includes:
- Step S1041 For each application control in the 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 that has executed the pseudo input event, and the identifier is used to indicate that the pseudo input event corresponding to the application control has been executed.
- a pseudo input event corresponding to each application control can be determined. Based on this, each application control and its corresponding pseudo input event can be regarded as a whole, and the pseudo input events corresponding to each application control can be executed randomly or in a certain order, in order to prevent repeated operations on the same application control.
- the application control that has been operated may be identified, wherein the identifier may be the number “1” in the upper right corner of the application control, or the star image in the upper right corner of the application control, or may be displayed differently from the application control.
- the method displays an application control that has executed a pseudo input event, for example, an application control that does not perform a pseudo input event is highlighted, and the highlighted one that has been executed is omitted, indicating that the event has been executed, and the application does not limit the identifier. As long as it is possible to distinguish between an application control that has executed a pseudo input event and a pseudo input event to be executed.
- i is a positive integer greater than or equal to 1.
- the i-th application control and the i+1th application control only indicate that the pseudo input event corresponding to the i-th application control is determined first, and then the pseudo input event corresponding to the i+1th application control is determined. There is no precedence limit between the i-th application control and the i+1th application control.
- the pseudo input event corresponding to the at least one application control may be batch determined by the method to execute the pseudo input event corresponding to each application control. Thereby improving test efficiency.
- step S104 while the terminal performs the pseudo input event, the cursor or the mouse point of the terminal moves together with the execution of the pseudo input event, wherein the cursor position or the mouse point position represents the position of the pseudo input event.
- FIG. 10A is an interface display diagram according to an embodiment of the present application. 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 diagram showing an interface display according to an embodiment of the present invention. As shown in FIG. 10B, the cursor currently points to “VMAL”, indicating that a pseudo input event is currently being performed on “VMAL”.
- the tester can visually see the application control that is performing the pseudo input event, based on which the tester can determine whether the test is as soon as possible. Accurate, thus improving test efficiency.
- the present application provides a Monkey test method, including: displaying, by a terminal, an interface to be tested; performing, by the terminal, image processing on the test interface, acquiring at least one application control of the interface to be tested; and determining, by the terminal, a pseudo input event corresponding to at least one application control, And executing a pseudo input event of at least one application control.
- a Monkey test method including: displaying, by a terminal, an interface to be tested; performing, by the terminal, image processing on the test interface, acquiring at least one application control of the interface to be tested; and determining, by the terminal, a pseudo input event corresponding to at least one application control, And executing a pseudo input event of at least one application control.
- 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 computer, a PC, a game console, or an emulator. As shown in FIG. 11, the terminal 110 includes:
- the display module 111 is configured to display an interface to be tested.
- 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.
- the determining module 113 is configured to determine a pseudo input event corresponding to the at least one application control.
- the execution module 114 is configured to execute a pseudo input event.
- processing module 112 includes:
- the binarization processing unit 1121 is 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 image after the expansion processing.
- the etching processing unit 1123 is configured to perform an etching process on the image after the expansion process to obtain at least one first region.
- the determining unit 1124 is configured to determine at least one application control according to the at least one first region.
- the expansion processing unit 1122 is further configured to perform an expansion process on the at least one first area to obtain at least one second area.
- the determining unit 1124 is specifically configured to determine the at least one application control according to the at least one second area.
- the determining unit 1124 is specifically configured to: determine, as an application control, a second area whose area size is greater than the first preset threshold and less than the second preset threshold.
- the display module 111 is further configured to display each of the acquired application controls of the at least one application control.
- the determining module 113 is specifically configured to: determine feature information corresponding to the at least one application control respectively; and determine, according to the feature information corresponding to the at least one application control, a pseudo input event corresponding to each of the at least one application control.
- the feature information corresponding to the application control includes at least one of the following: a size of the application control, location information of the application control in the application interface, and a deflection angle of the application control with respect to a horizontal direction or a vertical direction.
- the executing module 114 is specifically configured to: execute, for each application control in the at least one application control, a pseudo input event corresponding to the application control; correspondingly, the display module 111 is further configured to apply the pseudo input event At the control, an identifier is displayed, which is used to indicate that a pseudo input event corresponding to the application control has been executed.
- the present application provides a terminal, which can be used to perform the above-mentioned Monkey test method, and the implementation principle and technical effects thereof are similar to the principle and technical effect of the above Monkey test method, and the details are 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 computer, a PC, a game console, or a simulator.
- the terminal 120 includes a processor 121 and a memory 122 for storing executable instructions of the processor 121; the processor 121 implements the instruction to implement the Monkey test method as described above.
- the processor 121 is configured to: display an interface to be tested; perform image processing on the interface to be tested, obtain at least one application control of the interface to be tested; determine a pseudo input event corresponding to the at least one application control; and execute a pseudo input event.
- the processor 121 is specifically configured to: perform binarization processing on the test interface to obtain a binarized image; perform expansion processing on the binarized image to obtain an image after the expansion process; and etch the image after the expansion process Processing, obtaining at least one first region; determining at least one application control according to the at least one first region.
- the processor 121 is further configured to perform an expansion process on the at least one first area to obtain the at least one second area.
- the processor 121 is configured to: determine the at least one application control according to the at least one second area.
- the processor 121 is specifically configured to: determine, as an application control, a second area whose area size is greater than the first preset threshold and less than the second preset threshold.
- the processor 121 is further configured to display each of the acquired application controls of the at least one application control.
- the processor 121 is specifically configured to: determine feature information corresponding to the at least one application control respectively; and determine, according to the feature information corresponding to the at least one application control, a pseudo input event corresponding to each of the at least one application control.
- the feature information corresponding to the application control includes at least one of the following: a size of the application control, location information of the application control in the application interface, and a deflection angle of the application control with respect to a horizontal direction or a vertical direction.
- the processor 121 is configured to: execute, for each application control in the at least one application control, a pseudo input event corresponding to the application control; and display the identifier at the application control that has executed the pseudo input event, where the identifier A pseudo input event for indicating that the application control corresponds to has been executed.
- the present application provides a terminal, which can be used to perform the above-mentioned Monkey test method, and the implementation principle and technical effects thereof are similar to the principle and technical effect of the above Monkey test method, and the details are not described herein again.
- the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the 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, can be stored in a computer readable storage medium.
- the application also provides a computer program product comprising instructions which, when executed by a computer, cause the computer to perform functions as performed by the terminal described above.
- the technical solution of the present application can be implemented in whole or in part in the form of a computer program product when implemented using software.
- 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 accordance with the present application are generated in whole or in part.
- the computer can be a computer, a special purpose computer, a computer network, or other programmable device.
- the instructions may be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer may be passed from a website site, computer, server or data center Axle cable, optical fiber, digital subscriber line (DSL) and other wired methods, or infrared, wireless, microwave and other wireless methods to another site, computer, server or data center.
- a website site computer, server or data center Axle cable, optical fiber, digital subscriber line (DSL) and other wired methods, or infrared, wireless, microwave and other wireless methods to another site, computer, server or data center.
- DSL digital subscriber line
- the application also provides a computer storage medium for storing computer software instructions for use by the terminal. So that the terminal implements the above Monkey test method by executing the instruction.
- the computer readable medium can be any available media that can be accessed by a computer or a data storage device such as a server, data center, or the like that includes 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).
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
本申请提供一种Monkey测试方法及终端,该方法包括:终端显示待测试界面;终端对待测试界面进行图像处理,获取待测试界面的至少一个应用控件;终端确定至少一个应用控件对应的伪输入事件;终端执行伪输入事件。通过图形处理待测试界面获得应用控件,提高了对应用控件执行伪输入事件的测试效率。
Description
本申请涉及软件测试技术领域,尤其涉及一种Monkey测试方法及终端。
Monkey测试过程包括:通过运行在终端中的测试程序向终端发送随机的伪输入事件,如按键输入、触摸屏输入以及手势输入等,实现对应用程序的稳定性的测试,或者应用程序与终端兼容性的测试。其中,若此时应用程序出错闪退,则说明该应用程序存在漏洞(Bug),或者说明该应用程序与终端不兼容。
现有技术通过测试程序可以随机生成应用界面上的点击坐标,自动触发该点击坐标对应的伪输入事件,然而,随机生成点击坐标的方式势必造成许多的无效触发,从而造成测试效率较低的问题。
发明内容
本申请提供一种Monkey测试方法及终端,在本申请中,终端可以获取待测试界面的至少一个应用控件,而无需采用随机生成应用界面上的点击坐标,从而提高测试效率。
第一方面,本申请提供一种Monkey测试方法,包括:终端显示待测试界面;终端对待测试界面进行图像处理,获取待测试界面的至少一个应用控件;终端确定至少一个应用控件对应的伪输入事件;终端执行伪输入事件。
本申请的有益效果包括:通过该方法可以获取待测试界面的至少一个应用控件,而无需采用随机生成应用界面上的点击坐标,从而提高测试效率。
可选地,终端对待测试界面进行图像处理,获取待测试界面的至少一个应用控件,包括:
终端对待测试界面进行二值化处理,得到二值化图像;
终端对二值化图像进行膨胀处理,得到膨胀处理后的图像;
终端对膨胀处理后的图像进行腐蚀处理,得到至少一个第一区域;
终端根据至少一个第一区域确定至少一个应用控件。
本申请的有益效果包括:通过该图像处理过程可以有效的获取待测试界面的至少一个应用控件,从而无需采用随机生成应用界面上的点击坐标,进而提高测试效率。
可选地,终端对膨胀处理后的图像进行腐蚀处理,得到至少一个第一区域之后,还包括:终端对至少一个第一区域进行膨胀处理,得到至少一个第二区域;
相应的,终端根据至少一个第一区域确定至少一个应用控件,包括:
终端根据至少一个第二区域确定至少一个应用控件。
本申请的有益效果包括:通过对图像的二次膨胀处理可以提高确定应用控件的精度。
可选地,终端根据至少一个第二区域确定至少一个应用控件,包括:
终端将区域大小大于第一预设阈值且小于第二预设阈值的第二区域确定为应用控件。
本申请的有益效果包括:通过该方法可以筛掉无效的第二区域,从而提高确定应用控件的精度。
可选地,终端对待测试界面进行图像处理,获取待测试界面的至少一个应用控件之后,还包括:终端显示获取的至少一个应用控件的每个应用控件。
可选地,终端确定至少一个应用控件对应的伪输入事件,包括:
终端确定至少一个应用控件分别对应的特征信息;终端根据至少一个应用控件分别对应的特征信息确定至少一个应用控件各自对应的伪输入事件。
本申请的有益效果包括:通过该方法可以批量确定至少一个应用控件对应的伪输入事件,以执行各个应用控件对应的伪输入事件。从而提高测试效率。
可选地,应用控件对应的特征信息包括以下至少一项:应用控件的大小、应用控件在应用界面中的位置信息和应用控件相对于水平方向或者竖直方向的偏转角度。
可选地,终端执行伪输入事件,包括:
针对至少一个应用控件中的每个应用控件,终端执行应用控件对应的伪输入事件;
终端在已执行伪输入事件的应用控件处,显示标识,该标识用于指示应用控件对应的伪输入事件已被执行。
本申请的有益效果包括:通过显示所述标识的方式,可以防止应用控件被重复执行的情况,进而提高测试效率。
下面介绍终端,其实现原理和技术效果可参照第一方面涉及的方法以及第一方面的可选方式的原理和技术效果,此处不再赘述。
第二方面,本申请提供一种终端,包括:
显示模块,用于显示待测试界面。
处理模块,用于对待测试界面进行图像处理,获取待测试界面的至少一个应用控件。
确定模块,用于确定至少一个应用控件对应的伪输入事件。
执行模块,用于执行伪输入事件。
可选地,处理模块包括:
二值化处理单元,用于对待测试界面进行二值化处理,得到二值化图像。
膨胀处理单元,用于对二值化图像进行膨胀处理,得到膨胀处理后的图像。
腐蚀处理单元,用于对膨胀处理后的图像进行腐蚀处理,得到至少一个第一区域。
确定单元,用于根据至少一个第一区域确定至少一个应用控件。
可选地,膨胀处理单元还用于:
对至少一个第一区域进行膨胀处理,得到至少一个第二区域;
相应的,确定单元具体用于:
根据至少一个第二区域确定至少一个应用控件。
可选地,确定单元具体用于:将区域大小大于第一预设阈值且小于第二预设阈值的第二区域确定为应用控件。
可选地,显示模块,还用于显示获取的所述至少一个应用控件的每个应用控件。
可选地,确定模块具体用于:确定至少一个应用控件分别对应的特征信息;根据至少
一个应用控件分别对应的特征信息确定至少一个应用控件各自对应的伪输入事件。
可选地,应用控件对应的特征信息包括以下至少一项:应用控件的大小、应用控件在应用界面中的位置信息和应用控件相对于水平方向或者竖直方向的偏转角度。
可选地,执行模块具体用于:针对至少一个应用控件中的每个应用控件,执行应用控件对应的伪输入事件;相应的,显示模块还用于在已执行伪输入事件的应用控件处,显示标识,该标识用于指示应用控件对应的伪输入事件已被执行。
第三方面,本申请提供一种终端设备,包括:处理器和用于存储处理器的可执行指令的存储器;处理器用于:显示待测试界面;对待测试界面进行图像处理,获取待测试界面的至少一个应用控件;确定至少一个应用控件对应的伪输入事件;执行伪输入事件。
可选地,处理器具体用于:对待测试界面进行二值化处理,得到二值化图像;对二值化图像进行膨胀处理,得到膨胀处理后的图像;对膨胀处理后的图像进行腐蚀处理,得到至少一个第一区域;根据至少一个第一区域确定至少一个应用控件。
可选地,处理器还用于对至少一个第一区域进行膨胀处理,得到至少一个第二区域;相应的,处理器具体用于:根据至少一个第二区域确定至少一个应用控件。
可选地,处理器具体用于:将区域大小大于第一预设阈值且小于第二预设阈值的第二区域确定为应用控件。
可选地,处理器还用于显示获取的至少一个应用控件的每个应用控件。
可选地,处理器具体用于:确定至少一个应用控件分别对应的特征信息;根据至少一个应用控件分别对应的特征信息确定至少一个应用控件各自对应的伪输入事件。
可选地,应用控件对应的特征信息包括以下至少一项:应用控件的大小、应用控件在应用界面中的位置信息和应用控件相对于水平方向或者竖直方向的偏转角度。
可选地,处理器具体用于:针对至少一个应用控件中的每个应用控件,执行应用控件对应的伪输入事件;在已执行伪输入事件的应用控件处,显示标识,该标识用于指示应用控件对应的伪输入事件已被执行。
第四方面,本申请提供一种计算机存储介质,包括指令,当该指令在终端上运行时,使得终端执行如第一方面或者第一方面的可选方式所述的方法。
第五方面,本申请提供一种计算机程序产品,当该计算机程序产品在终端上运行时,使得终端执行如第一方面或者第一方面的可选方式所述的方法。
本申请提供一种Monkey测试方法及终端。该方法包括:终端显示待测试界面;终端对待测试界面进行图像处理,获取待测试界面的至少一个应用控件;终端确定至少一个应用控件对应的伪输入事件;终端执行伪输入事件。通过该方法可以获取待测试界面的至少一个应用控件,而无需采用随机生成应用界面上的点击坐标,从而提高测试效率。
图1为本申请一实施例提供的Monkey测试方法的流程图;
图2为本申请一实施例提供的确定应用控件的方法流程图;
图3A为本申请一实施例提供的界面显示图;
图3B为本申请一实施例提供的界面显示图;
图4为本申请一实施例提供的界面的局部示意图;
图5为本申请一实施例提供的界面的局部示意图;
图6为本申请一实施例提供的界面的局部示意图;
图7A为本申请一实施例提供的界面显示图;
图7B为本申请一实施例提供的界面显示图;
图8为本申请一实施例提供的确定应用控件对应的伪输入事件的方法流程图;
图9为本申请一实施例提供的执行伪输入事件的方法流程图;
图10A为本申请一实施例提供的界面显示图;
图10B为本申请一实施例提供的界面显示图;
图11为本申请一实施例提供的一种终端110的结构示意图;
图12为本申请一实施例提供的一种终端120的结构示意图。
以下,对本申请中的部分专业用语进行解释说明,以便于本领域技术人员理解。
Monkey测试:通过运行终端中的测试程序向终端发送随机的伪输入事件,如按键输入、触摸屏输入以及手势输入等,该测试程序用于实现对应用程序的稳定性的测试,或者应用程序与终端兼容性的测试。其中,若此时应用程序出错闪退,则说明该应用程序存在Bug,或者说明该应用程序与终端不兼容。
图像二值化:即对图像的二值化处理,它是将图像上的像素点的灰度值设置为0或255,也就是将整个图像呈现出明显的黑白效果。
膨胀处理:将二值化后的图像中像素值为1构成的区域的边界扩大一层,即将该边界的外边缘和/或该区域内部像素值为0的点均更新为像素值为1的点,膨胀处理主要用来填充所述区域内细小的空洞。
腐蚀处理:它与膨胀处理相反,腐蚀处理主要用来消除值化后的图像中像素值为1构成的区域的边界噪声,对所述区域再进行腐蚀处理可以得到独立、饱满(内部无孔)边界平滑的区域。
进一步的,如上所述,现有技术通过测试程序可以随机生成应用界面上的点击坐标,自动触发该点击坐标对应的伪输入事件,然而,随机生成点击坐标的方式势必造成许多的无效触发,从而造成测试效率较低的问题。
为了解决该技术问题,本申请提供一种Monkey测试方法及终端。本申请的应用场景为:终端已安装应用程序,该应用程序可以是购物应用(Application,APP)、游戏APP、打车APP等,终端通过加载的测试程序实现对应用程序的测试。
其中,该终端可以是智能手机,平板电脑,个人计算机(Personal Computer,PC)、游戏控制台或者模拟器等。
具体地,图1为本申请一实施例提供的Monkey测试方法的流程图,如图1所示,该方法包括如下步骤:
步骤S101:终端显示待测试界面;
步骤S102:终端对待测试界面进行图像处理,获取待测试界面的至少一个应用控件;
步骤S103:终端确定至少一个应用控件对应的伪输入事件;
步骤S104:终端执行所述伪输入事件。
针对步骤S101进行详细说明:待测试界面为待测应用程序的界面。首先,终端执行测试程序,从而显示待测试界面。例如:通过执行测试程序可以直接打开待测试界面;或者,通过执行测试程序显示处于最小化的待测试界面;又或者,通过执行测试程序显示处于隐藏状态的待测试界面。
终端通过执行测试程序,确定该待测试界面相对于终端屏幕的相对坐标和待测试界面的面积,并根据待测试界面的相对坐标和面积截取待测试界面。
具体地,终端通过测试程序可以确定待测试界面的左上角像素点和右下角像素点相对于终端屏幕的相对坐标,并且可以通过测试程序确定待测试界面的面积,最后根据所述左上角像素点的相对坐标、所述右下角像素点的相对坐标和待测试界面的面积截取待测试界面。
或者,终端通过执行测试程序,确定该待测试界面的坐标,并根据待测试界面的坐标截取待测试界面。
具体地,终端通过测试程序可以确定待测试界面的左上角像素点和右下角像素点相对于终端屏幕的相对坐标,由于待测试界面通常为矩形状,因此可以直接根据所述左上角像素点的相对坐标和所述右下角像素点的相对坐标截取待测试界面。
需要说明的是,本申请对如何通过执行测试程序显示并获取待测试界面不做限制。
针对步骤S102进行详细说明:终端对待测试界面进行图像处理,获取待测试界面的至少一个应用控件。终端可以确定待测试界面中各个像素点的像素值,接着根据各个像素点的像素值确定应用控件。具体包括如下几种可选方式:
一种可选方式:图2为本申请一实施例提供的确定应用控件的方法流程图,如图2所示,步骤S102包括:
步骤S1021:终端对待测试界面进行二值化处理,得到二值化图像;
步骤S1022:终端对二值化图像进行膨胀处理,得到膨胀处理后的图像;
步骤S1023:终端对膨胀处理后的图像进行腐蚀处理,得到至少一个第一区域;
步骤S1024:终端根据至少一个第一区域确定所述至少一个应用控件。
具体地,针对步骤S1021进行说明:终端对待测试界面进行二值化处理,得到二值化图像,该二值化处理包括的各个像素点的像素值为0或者1。即二值化图像呈现出明显的黑白效果。例如:图3A为本申请一实施例提供的界面显示图,如图3A所示,该界面为本申请所述的待测试界面,其中待测试界面中的每个英文单词表示一个应用控件,例如第一行“PowerAW”表示一个应用控件。
图4为本申请一实施例提供的界面的局部示意图,其中,图4是图3A第一行PowerAW中字母“o”和第二行“ProgramsAndfeaturesAW”中字母“r”分别对应的二值化图像,字母“o”上的像素点的像素值为1,它的外边缘和内部区域的像素点的像素值为0。同样,字母“r”上的像素点的像素值为1,它的外边缘的像素点的像素值为0。需要说明的是,在图3A中仅示出了部分离散的像素点,实际上,“o”和“r”分别对应的二值化图像包括的像素点为连续的像素点。
针对步骤S1022进行说明:图5为本申请一实施例提供的界面的局部示意图,如图5所示,对二值化图像进行膨胀处理,例如:通过膨胀处理可以将“o”的外边缘和“o”内部的像素点的像素值更新为1。同样的,通过膨胀处理可以将“r”的外边缘的像素点的像
素值更新为1。
其中,本申请中所述区域的外边缘可以是与该区域的距离小于预设距离的像素点构成的区域。本申请对如何确定区域的外边缘不做限制。
可选地,本申请还可以对膨胀处理后的图像进行平滑处理。本申请对如何进行平滑处理不做限制。
结合步骤S1023和步骤S1024进行说明:例如:图3A第一行所示的“PowerAW”和第二行所示的“ProgramsAndfeaturesAW”经过膨胀处理之后,它们各自的外边缘都是像素值为1的像素点。为了划分这两行,需要采用腐蚀处理,即将两行之间部分像素值为1的像素点更新为像素值为0的像素点。图6为本申请一实施例提供的界面的局部示意图,如图6所示,相对于图5,为了划分第一行字母“o”和第二行字母“r”,终端可以将“o”和“r”之间部分像素值为1的像素点更新为像素值为0的像素点。
进一步地,在同一行可以将***所有像素值为1的像素点围设成的区域称为第一区域。
可选地,步骤S1023之后,所述方法还包括:对所述至少一个第一区域进行平滑处理;本申请对平滑处理的具体方式不做限制,可以采用任一现有方法进行。
进一步地,在步骤S1024中,通常,应用控件的大小比较规范,因此可通过第一区域的区域大小与第一预设阈值和第二预设阈值的关系,确定第一区域是否为应用控件。其中,应用控件的大小包括以下至少一项:应用控件的面积、所述应用控件的长和所述应用控件的宽,相应的,第一区域的区域大小包括以下至少一项:第一区域的面积、第一区域的长和第一区域的宽等。本申请对此不做限制。
以所述应用控件的大小为应用控件的面积,第一区域的区域大小为第一区域的面积为例,比如:将所述至少一个第一区域中面积大于第一预设阈值且小于第二预设阈值的第一区域可以作为应用控件。相反,将所述至少一个第一区域中面积小于或者等于第一预设阈值;或者面积大于或者等于第二预设阈值的第一区域不作为应用控件。
需要说明的是,当应用控件的大小为它的面积时,第一预设阈值和第二预设阈值均是关于面积的预设阈值;同样的,当应用控件的大小为它的长时,第一预设阈值和第二预设阈值均是关于长的预设阈值。当应用控件的大小为它的宽时,第一预设阈值和第二预设阈值均是关于宽的预设阈值。当应用控件的大小包括应用控件的面积、所述应用控件的长和所述应用控件的宽至少两项时,则第一预设阈值和第二预设阈值均是关于所述至少两项的预设阈值,所述至少两项的预设阈值为一个二维向量。例如:当应用控件的大小包括应用控件的面积和所述应用控件的长时,对应的第一预设阈值和第二预设阈值均是二维向量,二维向量的第一个元素为关于面积的预设阈值,第二个元素为关于长的预设阈值。
可选地,步骤S1023之后,所述方法还包括:终端对所述至少一个第一区域进行膨胀处理,得到至少一个第二区域。其中,该膨胀处理过程可参照步骤S1022中的膨胀处理过程,本申请对此不再赘述。
相应的,在步骤S1024中:终端根据至少一个第二区域确定所述至少一个应用控件。其中,终端可以将所述至少一个第二区域中区域大小大于第一预设阈值且小于第二预设阈值的第二区域确定为应用控件。相反,将大小小于或者等于第一预设阈值;或者大小大于或者等于第二预设阈值的第二区域不作为应用控件。
如同上面所述,应用控件的大小比较规范,因此可通过第二区域的区域大小与第一预
设阈值和第二预设阈值的关系,确定第二区域是否为应用控件。其中,应用控件的大小包括以下至少一项:应用控件的面积、所述应用控件的长和所述应用控件的宽,相应的,第二区域的区域大小包括以下至少一项:第二区域的面积、第二区域的长和第二区域的宽等。本申请对此不做限制。
确定应用控件的另一种可选方式:终端对待测试界面进行二值化处理,得到二值化图像,终端确定像素值为1的各个像素点,并确定这些像素点之间的距离,将距离小于预设阈值的像素点划分为一类,同一类的像素点构成的区域作为应用控件。
综上,通过上述两种可选方式可以有效的确定应用控件。而无需采用随机生成应用界面上的点击坐标,从而提高测试效率。
可选地,步骤S102之后,所述方法还包括:
终端显示获取的至少一个应用控件的每个应用控件。
例如:终端可以通过高亮、划线、圈定、或者选中等方式显示获取到的应用控件,即通过这些方式指示哪些为获取到的应用控件。图7A为本申请一实施例提供的界面显示图,步骤S101和步骤S102之后,如图7A所示,被框选的区域均为图3A所示的获取到的待测试界面的应用控件。
同样的,图3B为本申请一实施例提供的另一界面显示图,图7B为本申请一实施例提供的另一界面显示图,步骤S101和步骤S102之后,如图7B所示,被框选的区域均为图3B所示的待测试界面的应用控件。
本申请中,终端可以通过高亮、划线、圈定、或者选中等方式显示获取到的应用控件,使得测试人员可以直观地看到确定的应用控件,基于此,使得测试人员能够尽快确定测试是否准确,从而提高测试效率。
针对步骤S103进行详细说明,一种可选方式:图8为本申请一实施例提供的确定应用控件对应的伪输入事件的方法流程图,如图8所示,该方法包括如下步骤:
步骤S1031:终端确定至少一个应用控件分别对应的特征信息;
步骤S1032:终端根据至少一个应用控件分别对应的特征信息确定至少一个应用控件各自对应的伪输入事件。
可选地,应用控件对应的特征信息包括以下至少一项:应用控件的大小、应用控件在应用界面中的位置信息和应用控件相对于水平方向或者竖直方向的偏转角度。
其中,应用控件的大小包括以下至少一项:应用控件的面积、所述应用控件的长和所述应用控件的宽。
例如:终端根据应用控件1的长和宽确定该应用控件应该是一个宽大于预设阈值的长方形,则确定该应用控件1对应的伪输入事件为滑动操作。
例如:终端根据应用控件2的面积确定该应用控件是一个面积小于预设阈值的圆形,则确定该应用控件2对应的伪输入事件为点击操作。
例如:终端根据应用控件2的偏转角度、长和宽确定该应用控件是一个宽度大于预设阈值,且相对于水平方向偏转角度为45度的长方形,则确定该应用控件2对应的伪输入事件为滑动操作,且该滑动操作的滑动方向与水平方向角度为45度。
可选地,终端可显示至少一个应用控件与伪输入事件的对应关系,具体见表1:
表1
应用控件 | 伪随机事件 |
应用控件1 | 滑动操作 |
应用控件2 | 点击操作 |
…… | …… |
应用控件N | 双击操作 |
另一种可选方式:终端确定至少一个伪输入事件,随机生成至少一个应用控件与至少一个伪输入事件的对应关系,可选地,该对应关系可周期性的发生变化。
例如:终端确定了4个应用控件以及4个伪输入事件,在第一个时间段,应用控件1对应伪输入事件1,应用控件2对应伪输入事件2,应用控件3对应伪输入事件3,应用控件4对应伪输入事件4;在第二个时间段,应用控件1对应伪输入事件4,应用控件2对应伪输入事件3,应用控件3对应伪输入事件2,应用控件4对应伪输入事件1。
针对步骤S104进行详细说明,图9为本申请一实施例提供的执行伪输入事件的方法流程图,如图9所示,该方法包括:
步骤S1041:针对至少一个应用控件中的每个应用控件,终端执行应用控件对应的伪输入事件;
步骤S1042:终端在已执行伪输入事件的应用控件处,显示标识,该标识用于指示所述应用控件对应的伪输入事件已被执行。
具体地,基于上述方法可以确定每个应用控件对应的伪输入事件。基于此,可以将每个应用控件以及和其对应的伪输入事件看作一个整体,可以随机地或者按照一定的顺序执行每个应用控件对应的伪输入事件,为了防止对同一应用控件的重复操作,可以对已经操作过的应用控件进行标识,其中,该标识可以是应用控件右上角的数字“1”,或者是应用控件右上角的星形图像等,还可以是以与应用控件不同的显示方式显示已执行伪输入事件的应用控件,例如,未执行伪输入事件的应用控件为高亮,已执行的就省去高亮,表明该事件已执行完毕,本申请对该标识不做限制,只要能够区分已执行伪输入事件以及待执行伪输入事件的应用控件即可。
例如:首先确定至少一个应用控件中的第i个应用控件对应的伪输入事件,然后执行该第i个应用控件对应的伪输入事件,当终端执行完第i个应用控件对应的伪输入事件之后,终端显示第i个应用控件的标识;接着确定至少一个应用控件中的第i+1个应用控件对应的伪输入事件,然后执行该第i+1个应用控件对应的伪输入事件,当终端执行完第i+1个应用控件对应的伪输入事件之后,终端显示第i+1个应用控件的标识,以此类推,直到执行完所有的应用控件对应的伪输入事件,则结束。其中,i为大于或者等于1的正整数。
需要说明的是,所述第i个应用控件以及第i+1个应用控件中仅表示先确定第i应用控件对应的伪输入事件,后确定第i+1个应用控件对应的伪输入事件,而第i个应用控件以及第i+1个应用控件之间本身没有先后顺序限制。在本申请中,通过该方法可以批量确定至少一个应用控件对应的伪输入事件,以执行各个应用控件对应的伪输入事件。从而提高测试效率。
可选地,在步骤S104中:终端在执行伪输入事件的同时,终端的光标或者鼠标点随着伪输入事件的执行一起移动,其中,光标位置或者鼠标点位置表示伪输入事件的位置。
例如:图10A为本申请一实施例提供的界面显示图,如图10A所示,光标当前指向第一行所示的“PowerAW”,表示当前正在对“PowerAW”执行伪输入事件。图10B为本申请一实施例提供的界面显示图,如图10B所示,光标当前指向“VMAL”,表示当前正在对“VMAL”执行伪输入事件。
在本申请中,由于终端的光标或者鼠标点随着伪输入事件的执行一起移动,使得测试人员可以直观地看到正在执行伪输入事件的应用控件,基于此,使得测试人员能够尽快确定测试是否准确,从而提高测试效率。
综上,本申请提供一种Monkey测试方法,包括:终端显示待测试界面;终端对待测试界面进行图像处理,获取待测试界面的至少一个应用控件;终端确定至少一个应用控件对应的伪输入事件,并执行至少一个应用控件的伪输入事件。通过该方法可以获取待测试界面的至少一个应用控件,而无需采用随机生成应用界面上的点击坐标,从而提高测试效率。
图11为本申请一实施例提供的一种终端110的结构示意图,其中,该终端110可以是智能手机,平板电脑,PC、游戏控制台或者模拟器等。如图11所示,该终端110包括:
显示模块111,用于显示待测试界面。
处理模块112,用于对待测试界面进行图像处理,获取待测试界面的至少一个应用控件。
确定模块113,用于确定至少一个应用控件对应的伪输入事件。
执行模块114,用于执行伪输入事件。
可选地,处理模块112包括:
二值化处理单元1121,用于对待测试界面进行二值化处理,得到二值化图像。
膨胀处理单元1122,用于对二值化图像进行膨胀处理,得到膨胀处理后的图像。
腐蚀处理单元1123,用于对膨胀处理后的图像进行腐蚀处理,得到至少一个第一区域。
确定单元1124,用于根据至少一个第一区域确定至少一个应用控件。
可选地,膨胀处理单元1122还用于对至少一个第一区域进行膨胀处理,得到至少一个第二区域;相应的,确定单元1124具体用于根据至少一个第二区域确定至少一个应用控件。
可选地,确定单元1124具体用于:将区域大小大于第一预设阈值且小于第二预设阈值的第二区域确定为应用控件。
可选地,显示模块111,还用于显示获取的至少一个应用控件的每个应用控件。
可选地,确定模块113具体用于:确定至少一个应用控件分别对应的特征信息;根据至少一个应用控件分别对应的特征信息确定至少一个应用控件各自对应的伪输入事件。
可选地,应用控件对应的特征信息包括以下至少一项:应用控件的大小、应用控件在应用界面中的位置信息和应用控件相对于水平方向或者竖直方向的偏转角度。
可选地,执行模块114具体用于:针对至少一个应用控件中的每个应用控件,执行应用控件对应的伪输入事件;相应的,显示模块111,还用于在已执行伪输入事件的应用控件处,显示标识,该标识用于指示应用控件对应的伪输入事件已被执行。
本申请提供一种终端,该终端可用于执行上述Monkey测试方法,其实现原理和技术效果与上述Monkey测试方法的原理和技术效果类似,本申请对此不再赘述。
图12为本申请一实施例提供的一种终端120的结构示意图,其中,该终端120可以是智能手机,平板电脑,PC、游戏控制台或者模拟器等。
如图12所示,该终端120包括:处理器121和用于存储所述处理器121的可执行指令的存储器122;所述处理器121通过执行所述指令以实现如上述的Monkey测试方法。
具体地,处理器121用于:显示待测试界面;对待测试界面进行图像处理,获取待测试界面的至少一个应用控件;确定至少一个应用控件对应的伪输入事件;执行伪输入事件。
可选地,处理器121具体用于:对待测试界面进行二值化处理,得到二值化图像;对二值化图像进行膨胀处理,得到膨胀处理后的图像;对膨胀处理后的图像进行腐蚀处理,得到至少一个第一区域;根据至少一个第一区域确定至少一个应用控件。
可选地,处理器121还用于对至少一个第一区域进行膨胀处理,得到至少一个第二区域;相应的,处理器121具体用于:根据至少一个第二区域确定至少一个应用控件。
可选地,处理器121具体用于:将区域大小大于第一预设阈值且小于第二预设阈值的第二区域确定为应用控件。
可选地,处理器121还用于显示获取的至少一个应用控件的每个应用控件。
可选地,处理器121具体用于:确定至少一个应用控件分别对应的特征信息;根据至少一个应用控件分别对应的特征信息确定至少一个应用控件各自对应的伪输入事件。
可选地,应用控件对应的特征信息包括以下至少一项:应用控件的大小、应用控件在应用界面中的位置信息和应用控件相对于水平方向或者竖直方向的偏转角度。
可选地,处理器121具体用于:针对至少一个应用控件中的每个应用控件,执行应用控件对应的伪输入事件;在已执行伪输入事件的所述应用控件处,显示标识,该标识用于指示所述应用控件对应的伪输入事件已被执行。
本申请提供一种终端,该终端可用于执行上述Monkey测试方法,其实现原理和技术效果与上述Monkey测试方法的原理和技术效果类似,本申请对此不再赘述。在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。所述集成的单元如果以软件功能单元的形式实现并作为独立的计算机程序产品销售或使用时,可以存储在一个计算机可读取存储介质中。
本申请还提供一种计算机程序产品,该计算机程序产品包含指令,当计算机程序产品被计算机执行时,指令使得计算机实现如上述终端所执行的功能。
本申请的技术方案在使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括至少一个指令。在计算机上加载和执行所述指令时,全部或部分地产生按照本申请所述的流程或功能。所述计算机可以是通过计算机、专用计算机、计算机网络、或者其他可编程装置。所述指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机可以从一个网站站点、计算机、服务器或数据中心通过同轴电缆、光纤、数字用户线(Digital subscriber line,DSL)等有线方式,或红外、无线、微波等无线方式向另一个网站站点、计算机、服务器或数据中心进行传输。
本申请还提供一种计算机存储介质,该计算机存储介质用于储存上述终端所用的计算机软件指令。以使所述终端通过执行该指令实现上述Monkey测试方法。
所述计算机可读介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是软盘、硬盘、磁带等磁性介质,或者固态硬盘(Solid State Disk,SSD)等半导体介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。
Claims (19)
- 一种Monkey测试方法,其特征在于,包括:终端显示待测试界面;所述终端对所述待测试界面进行图像处理,获取所述待测试界面的至少一个应用控件;所述终端确定所述至少一个应用控件对应的伪输入事件;所述终端执行所述伪输入事件。
- 根据权利要求1所述的方法,其特征在于,所述终端对所述待测试界面进行图像处理,获取所述待测试界面的至少一个应用控件,包括:所述终端对所述待测试界面进行二值化处理,得到二值化图像;所述终端对所述二值化图像进行膨胀处理,得到膨胀处理后的图像;所述终端对所述膨胀处理后的图像进行腐蚀处理,得到至少一个第一区域;所述终端根据所述至少一个第一区域确定所述至少一个应用控件。
- 根据权利要求2所述的方法,其特征在于,所述终端对所述膨胀处理后的图像进行腐蚀处理,得到至少一个第一区域之后,还包括:所述终端对所述至少一个第一区域进行膨胀处理,得到至少一个第二区域;相应的,所述终端根据所述至少一个第一区域确定所述至少一个应用控件,包括:所述终端根据所述至少一个第二区域确定所述至少一个应用控件。
- 根据权利要求3所述的方法,其特征在于,所述终端根据所述至少一个第二区域确定所述至少一个应用控件,包括:所述终端将区域大小大于第一预设阈值且小于第二预设阈值的第二区域确定为所述应用控件。
- 根据权利要求1-4任一项所述的方法,其特征在于,所述终端对所述待测试界面进行图像处理,获取所述待测试界面的至少一个应用控件之后,还包括:所述终端显示获取的所述至少一个应用控件的每个应用控件。
- 根据权利要求1-5任一项所述的方法,其特征在于,所述终端确定所述至少一个应用控件对应的伪输入事件,包括:所述终端确定所述至少一个应用控件分别对应的特征信息;所述终端根据所述至少一个应用控件分别对应的特征信息确定所述至少一个应用控件各自对应的伪输入事件。
- 根据权利要求6所述的方法,其特征在于,所述应用控件对应的特征信息包括以下至少一项:所述应用控件的大小、所述应用控件在所述应用界面中的位置信息和所述应用控件相对于水平方向或者竖直方向的偏转角度。
- 根据权利要求1-7任一项所述的方法,其特征在于,所述终端执行所述伪输入事件,包括:针对所述至少一个应用控件中的每个应用控件,所述终端执行所述应用控件对应的伪输入事件;所述终端在所述已执行伪输入事件的所述应用控件处,显示标识,所述标识用于指示所述应用控件对应的伪输入事件已被执行。
- 一种终端,其特征在于,包括:显示模块,用于显示待测试界面;处理模块,用于对所述待测试界面进行图像处理,获取所述待测试界面的至少一个应用控件;确定模块,用于确定所述至少一个应用控件对应的伪输入事件;执行模块,用于执行所述伪输入事件。
- 根据权利要求9所述的终端,其特征在于,所述处理模块包括:二值化处理单元,用于对所述待测试界面进行二值化处理,得到二值化图像;膨胀处理单元,用于对所述二值化图像进行膨胀处理,得到膨胀处理后的图像;腐蚀处理单元,用于对所述膨胀处理后的图像进行腐蚀处理,得到至少一个第一区域;确定单元,用于根据所述至少一个第一区域确定所述至少一个应用控件。
- 根据权利要求10所述的终端,其特征在于,所述膨胀处理单元还用于:对所述至少一个第一区域进行膨胀处理,得到至少一个第二区域;相应的,所述确定单元具体用于:根据所述至少一个第二区域确定所述至少一个应用控件。
- 根据权利要求11所述的终端,其特征在于,所述确定单元具体用于:将区域大小大于第一预设阈值且小于第二预设阈值的第二区域确定为所述应用控件。
- 根据权利要求9-12任一项所述的终端,其特征在于,所述显示模块,还用于显示获取的所述至少一个应用控件的每个应用控件。
- 根据权利要求9-13任一项所述的终端,其特征在于,所述确定模块具体用于:确定所述至少一个应用控件分别对应的特征信息;根据所述至少一个应用控件分别对应的特征信息确定所述至少一个应用控件各自对应的伪输入事件。
- 根据权利要求14所述的终端,其特征在于,所述应用控件对应的特征信息包括以下至少一项:所述应用控件的大小、所述应用控件在所述应用界面中的位置信息和所述应用控件相对于水平方向或者竖直方向的偏转角度。
- 根据权利要求9-15任一项所述的终端,其特征在于,所述执行模块具体用于针对所述至少一个应用控件中的每个应用控件,执行所述应用控件对应的伪输入事件;相应的,所述显示模块,还用于在所述已执行伪输入事件的所述应用控件处,显示标识,所述标识用于指示所述应用控件对应的伪输入事件已被执行。
- 一种终端设备,其特征在于,包括:一个或多个处理器和用于存储所述处理器的可执行指令的存储器;所述处理器通过执行所述指令以实现如权利要求1-8任一项所述的方法。
- 一种计算机程序产品,其特征在于,当所述计算机程序产品在终端上运行时,使得所述终端执行如权利要求1-8任一项所述的方法。
- 一种计算机存储介质,包括指令,其特征在于,当所述指令在终端上运行时,使得所述终端执行如权利要求1-8任一项所述的方法。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201780093230.9A CN110914810B (zh) | 2017-11-10 | 2017-11-10 | Monkey测试方法及终端 |
PCT/CN2017/110444 WO2019090691A1 (zh) | 2017-11-10 | 2017-11-10 | Monkey测试方法及终端 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2017/110444 WO2019090691A1 (zh) | 2017-11-10 | 2017-11-10 | Monkey测试方法及终端 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2019090691A1 true WO2019090691A1 (zh) | 2019-05-16 |
Family
ID=66437485
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/110444 WO2019090691A1 (zh) | 2017-11-10 | 2017-11-10 | Monkey测试方法及终端 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN110914810B (zh) |
WO (1) | WO2019090691A1 (zh) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111078579A (zh) * | 2019-12-31 | 2020-04-28 | 河北省科学院应用数学研究所 | 一种Monkey测试方法、装置及终端设备 |
CN111581091A (zh) * | 2020-04-30 | 2020-08-25 | 北京字节跳动网络技术有限公司 | 页面测试方法、装置、可读介质及电子设备 |
CN113722231A (zh) * | 2021-09-09 | 2021-11-30 | 同盾科技有限公司 | 用户操作的模拟方法、装置、电子设备及存储介质 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104063324A (zh) * | 2014-07-10 | 2014-09-24 | 上海斐讯数据通信技术有限公司 | 一种Monkey测试方法及*** |
CN105335976A (zh) * | 2015-10-23 | 2016-02-17 | 广州视睿电子科技有限公司 | 一种图像处理方法和装置 |
CN105607993A (zh) * | 2015-09-30 | 2016-05-25 | 北京奇虎科技有限公司 | 一种对应用的用户界面ui进行测试的方法和装置 |
CN106383780A (zh) * | 2016-09-05 | 2017-02-08 | 努比亚技术有限公司 | 一种Monkey测试方法及装置 |
CN106815134A (zh) * | 2015-11-27 | 2017-06-09 | 北京奇虎科技有限公司 | 一种app测试方法和装置 |
CN107193733A (zh) * | 2017-05-12 | 2017-09-22 | 微梦创科网络科技(中国)有限公司 | 模拟Monkey测试的方法、装置和*** |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9946637B2 (en) * | 2014-06-20 | 2018-04-17 | Vmware, Inc. | Automatic updating of graphical user interface element locators based on dimension comparison |
CN105740152A (zh) * | 2016-02-04 | 2016-07-06 | 浪潮电子信息产业股份有限公司 | 一种多节点批量部署***压力测试的方法 |
CN105868102B (zh) * | 2016-03-22 | 2018-06-26 | 中国科学院软件研究所 | 一种基于计算机视觉的移动端应用测试***及方法 |
-
2017
- 2017-11-10 CN CN201780093230.9A patent/CN110914810B/zh active Active
- 2017-11-10 WO PCT/CN2017/110444 patent/WO2019090691A1/zh active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104063324A (zh) * | 2014-07-10 | 2014-09-24 | 上海斐讯数据通信技术有限公司 | 一种Monkey测试方法及*** |
CN105607993A (zh) * | 2015-09-30 | 2016-05-25 | 北京奇虎科技有限公司 | 一种对应用的用户界面ui进行测试的方法和装置 |
CN105335976A (zh) * | 2015-10-23 | 2016-02-17 | 广州视睿电子科技有限公司 | 一种图像处理方法和装置 |
CN106815134A (zh) * | 2015-11-27 | 2017-06-09 | 北京奇虎科技有限公司 | 一种app测试方法和装置 |
CN106383780A (zh) * | 2016-09-05 | 2017-02-08 | 努比亚技术有限公司 | 一种Monkey测试方法及装置 |
CN107193733A (zh) * | 2017-05-12 | 2017-09-22 | 微梦创科网络科技(中国)有限公司 | 模拟Monkey测试的方法、装置和*** |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111078579A (zh) * | 2019-12-31 | 2020-04-28 | 河北省科学院应用数学研究所 | 一种Monkey测试方法、装置及终端设备 |
CN111581091A (zh) * | 2020-04-30 | 2020-08-25 | 北京字节跳动网络技术有限公司 | 页面测试方法、装置、可读介质及电子设备 |
CN111581091B (zh) * | 2020-04-30 | 2023-03-21 | 北京字节跳动网络技术有限公司 | 页面测试方法、装置、可读介质及电子设备 |
CN113722231A (zh) * | 2021-09-09 | 2021-11-30 | 同盾科技有限公司 | 用户操作的模拟方法、装置、电子设备及存储介质 |
CN113722231B (zh) * | 2021-09-09 | 2024-04-26 | 同盾科技有限公司 | 用户操作的模拟方法、装置、电子设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN110914810B (zh) | 2022-02-01 |
CN110914810A (zh) | 2020-03-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8549478B2 (en) | Graphical user interface input element identification | |
US9519401B2 (en) | Providing context menu based on predicted commands | |
JP2019075172A (ja) | 電子画像におけるコンテンツの識別 | |
JP6324388B2 (ja) | コンピューティング・デバイスについてのセキュアな識別およびセキュアな識別方法 | |
US20160070633A1 (en) | Memory leak analysis by usage trends correlation | |
US10810113B2 (en) | Method and apparatus for creating reference images for an automated test of software with a graphical user interface | |
JP6888019B2 (ja) | メモリアクセスコマンドの転送記述子 | |
WO2019019628A1 (zh) | 移动应用的测试方法、装置、测试设备及介质 | |
CN107025174A (zh) | 用于设备的用户界面异常测试的方法、装置和可读储介质 | |
CN109753641B (zh) | 一种更改对象位置的方法、装置、电子设备及存储介质 | |
WO2019090691A1 (zh) | Monkey测试方法及终端 | |
WO2019134578A1 (zh) | 设备兼容性的测试方法、装置、电子设备及介质 | |
JP2015531918A (ja) | ヒットテスト方法および装置 | |
CN112947969A (zh) | 一种页面离屏渲染方法、装置、设备和可读介质 | |
US20180336122A1 (en) | Generating application flow entities | |
CN113657518B (zh) | 训练方法、目标图像检测方法、装置、电子设备以及介质 | |
JP2022529201A (ja) | 意味論的拡張人工現実体験 | |
WO2017067459A1 (zh) | 一种桌面数据加载方法及装置 | |
CN109753217B (zh) | 动态键盘操作方法、装置、存储介质及电子设备 | |
US9128613B2 (en) | Positioning clickable hotspots on a touchscreen display | |
US8856634B2 (en) | Compensating for gaps in workload monitoring data | |
US20200193298A1 (en) | Accurately identifying members of training data in variational autoencoders by reconstruction error | |
EP4325396A1 (en) | Machine learning model training with privacy and explainability | |
US10304224B2 (en) | Dynamic graphic entity determination | |
CN114513736B (zh) | 一种耳机的声学测试方法、设备、终端及存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17931342 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 17931342 Country of ref document: EP Kind code of ref document: A1 |