APP automatic testing method and device for automatically generating target image

Generate test scripts through real-time recording and gesture tracking technology to automatically generate target images in APP automated testing. This solves the problem in the existing technology that testers need to have a programming foundation and cannot automatically generate target images, and improves testing efficiency and accuracy.

CN118567983APending Publication Date: 2024-08-30FUJIAN FUNO MOBILE COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410696314.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing APP automated testing methods require testers to have a programming foundation, are difficult to promote on a large scale, and cannot automatically generate specific target images in test scripts, affecting testing efficiency.

Method used

By recording the tester's test process in real time, gesture tracking technology is used to generate gesture interaction records, and the initial test script is automatically generated. The video screen and location information of the target image are screened from the screen recording file, and inserted into the test script to achieve automatic detection of the target image. Interception and insertion.

Benefits of technology

There is no need to manually write test scripts, which improves the efficiency and accuracy of test script generation, automatically generates target images in test scripts, optimizes APP automated testing methods, and improves testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567983A
    Figure CN118567983A
Patent Text Reader

Abstract

The invention relates to an APP automatic testing method and device capable of automatically generating a target image, and the method comprises the steps: obtaining a screen recording file through recording a testing process when a tester carries out the manual testing on a to-be-tested APP in real time, automatically monitoring the gesture interaction operation in the testing process through a gesture tracking technology, and carrying out the automatic testing of the to-be-tested APP. Generating a gesture interaction record so as to generate a corresponding initial test script, screening out a first gesture from the gesture interaction record, and obtaining to-be-intercepted information of the target image according to a position coordinate of the first gesture on the to-be-tested APP, gesture duration and a gesture pressure peak value; and intercepting a target image from a picture file of a first video picture corresponding to the first gesture in the screen recording file, and inserting the target image into the initial test script to obtain a final test script for automatic test. Therefore, the specific target image is automatically generated in the test script, the target image does not need to be manually intercepted and inserted, and the APP automatic test method is optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an APP automated testing method and device for automatically generating a target image. Background Art

[0002] The traditional APP automated testing method is that the tester first writes a test script to test the APP, and then automatically executes the test script through an automated testing tool to achieve automated testing of the APP. Since the test script not only needs to include test steps, but also needs to include steps for performing various gesture interaction actions and detecting whether a specific target image appears on the page, manually writing test scripts requires testers to have a certain programming foundation, has a high technical threshold, and is not easy to promote on a large scale.

[0003] Application number: CN201710071076.7, patent name: APP testing method, APP test script generating device and APP test script executing device. Although a method is disclosed for generating a test script according to the operation sequence by obtaining the corresponding coordinate information of each test action on the test device when testing the APP to be tested, so that the generation of the APP test script can be completed by ordinary testers who do not have the ability to edit script software, when faced with the detection of whether a specific target image appears on the page, it is necessary to rely on the tester to manually capture and insert the specific target image in the test script, that is, it is impossible to automatically generate a specific target image in the test script. Therefore, the existing APP automated testing method still needs to be optimized. Summary of the invention

[0004] The technical problem to be solved by the present invention is: the present invention provides an APP automated testing method and device for automatically generating a target image, which can automatically generate a specific target image in a test script, optimize the APP automated testing method, and improve the efficiency of the APP automated testing.

[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0006] In a first aspect, the present invention provides an APP automated testing method for automatically generating a target image, comprising:

[0007] Real-time recording of the test process when the tester performs manual testing on the APP to be tested, and obtaining the corresponding screen recording file;

[0008] Automatically monitor the gesture interaction operations during the test process by using gesture tracking technology, generate corresponding gesture interaction records, and automatically generate corresponding initial test scripts according to the gesture interaction records;

[0009] Filtering out a first gesture from the gesture interaction record, filtering out a first video screen corresponding to the first gesture from the screen recording file, converting the first video screen into a corresponding picture file, wherein the first gesture is a test action of a target image;

[0010] Obtaining the position coordinates, gesture duration and gesture pressure peak of the first gesture on the APP to be tested from the gesture interaction record, obtaining the information to be intercepted of the target image according to the position coordinates, the gesture duration and the gesture pressure peak, intercepting the corresponding target image from the picture file according to the information to be intercepted, and inserting the target image into the initial test script accordingly to obtain the final test script;

[0011] Perform automated testing on the APP to be tested according to the final test script.

[0012] The beneficial effects of the present invention are: implementing recording of the test process when the test person performs manual testing on the APP to be tested, obtaining the corresponding screen recording file, and automatically monitoring the gesture interaction operations during the test process through gesture tracking technology to generate a corresponding gesture interaction record, thereby automatically generating a corresponding initial test script according to the gesture interaction record, without the need for manual writing of the test script, improving the efficiency of test script generation and facilitating promotion, and filtering out the corresponding first video screen from the screen recording file according to the test action of the target image in the gesture machine interaction record, and then obtaining the corresponding information to be intercepted according to the position coordinates, gesture duration and gesture pressure peak of the test action of the target image on the APP to be tested, taking the gesture duration and gesture pressure peak into account to ensure the integrity and accuracy of the information to be intercepted, so as to improve the accuracy of the intercepted target image, and inserting the target image into the initial test script, so as to realize the automatic generation of a specific target image in the test script, without the need for manual interception and insertion of the target image, realizing the optimization of the APP automated testing method, and improving the efficiency of the APP automated testing.

[0013] Optionally, the automatically monitoring the gesture interaction operation during the test process by using gesture tracking technology to generate a corresponding gesture interaction record, and automatically generating a corresponding initial test script according to the gesture interaction record includes:

[0014] Obtaining the gesture type, occurrence time, and occurrence coordinates of each gesture interaction operation, and when a preset end gesture is monitored, obtaining the end time of the preset end gesture, and generating a corresponding gesture interaction record according to the gesture type, the occurrence time, the occurrence coordinates, and the end time;

[0015] A corresponding initial test script is automatically generated according to the gesture interaction record.

[0016] According to the above description, the gesture interaction record is generated according to the gesture type, occurrence time, occurrence coordinates and end time of each gesture interaction operation, which ensures the integrity of the gesture interaction record and further ensures the accuracy of the generated initial test script.

[0017] Optionally, automatically generating a corresponding initial test script according to the gesture interaction record includes:

[0018] Calling a corresponding action function according to the gesture type in the gesture interaction record, and automatically generating a corresponding initial test script according to the action function;

[0019] The calling of a corresponding action function according to the gesture type in the gesture interaction record comprises:

[0020] The delay time of each two adjacent gesture interaction records is calculated by the delay formula. When the delay time exceeds the delay threshold, the sleep function of the poco framework is called in the corresponding two adjacent gesture interaction records, and the delay time is used as the sleep time of the sleep function. The delay formula is:

[0021] YT=HT-QT

[0022] Wherein, YT represents the delay time, HT represents the occurrence time of the latter of two adjacent gesture interaction records, and QT represents the end time of the former of two adjacent gesture interaction records;

[0023] When the gesture type is a click type, the click function of the poco framework is called; when the gesture type is a slide type, the slide function of the poco framework is called; when the gesture type is a return type, the return function of the poco framework is called; when the gesture type is a long press gesture, the wait function of the poco framework is called.

[0024] According to the above description, different gesture types correspond to different action functions, that is, by associating gesture types with action functions, the initial test script corresponding to the gesture type can be automatically generated according to the action function, thereby ensuring the rationality of the generated initial test script.

[0025] Optionally, the filtering out the first gesture from the gesture interaction record, and filtering out the video picture corresponding to the first gesture from the screen recording file includes:

[0026] Filtering out a second gesture from the gesture interaction record, and obtaining a start time of the first second gesture;

[0027] Crop a screen recording video picture of a preset top height from the screen recording file, and decode the screen recording video picture frame by frame to obtain all frames;

[0028] Filtering out a first frame from all the frames, calculating the similarity between each frame and the first frame in turn, and obtaining a first timestamp of a frame corresponding to a first similarity lower than a first threshold;

[0029] Correcting the first timestamp according to the start time, unifying the time lines of the gesture interaction record and the screen recording file, and obtaining the screen recording file after the unified time line;

[0030] The first video frame corresponding to the first gesture is filtered out from the screen recording files after the unified timeline.

[0031] According to the above description, before filtering out the video image corresponding to the first gesture from the screen recording file, the timeline of the screen recording file will be corrected first, that is, the timelines of the gesture interaction record and the screen recording file will be unified. The unification of the timeline is to correct the first frame image corresponding to the first similarity lower than the first threshold in the screen recording file according to the start time of the second gesture in the gesture interaction record, that is, the first timestamp of the first frame image change, to ensure the unification of the timelines of the screen recording file and the gesture interaction record, thereby ensuring the accuracy of filtering out the first video image corresponding to the first gesture from the screen recording file after the unified timeline.

[0032] Optionally, filtering out the first video frame corresponding to the first gesture from the screen recording file after the unified timeline includes:

[0033] Obtain the first action occurrence time point of the first gesture in the screen recording file before the unified timeline and the second action occurrence time point of the first second gesture;

[0034] The first action occurrence time point, the second action occurrence time point and the start time are input into the first gesture timestamp calculation formula for calculation to obtain the first gesture timestamp, wherein the first gesture timestamp calculation formula is:

[0035] Vn=V0+(Tn-T0)

[0036] Wherein, Vn represents the first gesture timestamp of the nth first gesture, V0 represents the start time, Tn represents the time point at which the first action of the nth first gesture occurs in the screen recording file before the unified timeline, and T0 represents the time point at which the second action of the first second gesture occurs in the screen recording file before the unified timeline;

[0037] A first video frame corresponding to the first gesture is filtered out from the screen recording file after the unified timeline according to the first gesture timestamp.

[0038] According to the above description, the first gesture timestamp is calculated by combining the occurrence time points of the first gesture and the second gesture in the screen recording file before the unified timeline and the start time of the second gesture in the gesture interaction record, so as to filter out the corresponding first video picture according to the first gesture timestamp, thereby ensuring the rationality and accuracy of the filtered first video picture.

[0039] Optionally, the interception information includes coordinates of a center point to be intercepted, a width to be intercepted, and a height to be intercepted, and the information to be intercepted of the target image obtained according to the position coordinates, the gesture duration, and the gesture pressure peak value includes:

[0040] Using the position coordinates as the coordinates of the center point to be intercepted of the target image;

[0041] The gesture duration is input into the calculation formula of the width to be intercepted to calculate the width to be intercepted, and the width to be intercepted of the target image is obtained. The calculation formula of the width to be intercepted is:

[0042] w=W*T / 5

[0043] w represents the width of the target image to be captured, W represents the width of the device screen where the APP to be tested is located, and T represents the duration of the gesture;

[0044] The gesture pressure peak is input into the calculation formula of the height to be intercepted to calculate the height to be intercepted, and the height to be intercepted of the target image is obtained. The calculation formula of the height to be intercepted is:

[0045] h=H*P / 10

[0046] h represents the height of the target image to be captured, H represents the height of the device screen where the APP to be tested is located, and P represents the peak value of the gesture pressure.

[0047] According to the above description, the information to be intercepted of the target image includes the coordinates of the center point to be intercepted, the width to be intercepted and the height to be intercepted, that is, the information to be intercepted includes both the position coordinates and the width and height. The comprehensiveness of the information to be intercepted improves the accuracy of the target image intercepted therefrom, and the width to be intercepted is calculated based on the duration of the gesture, and the height to be intercepted is calculated based on the peak pressure of the gesture, thereby ensuring the rationality and accuracy of the calculated width and height to be intercepted.

[0048] Optionally, there is a first constraint condition in the calculation formula for the width to be intercepted, and the first constraint condition is: W*1 / 5≤w≤W*2 / 5; there is a second constraint condition in the calculation formula for the height to be intercepted, and the second constraint condition is: H / 10≤h≤H / 5.

[0049] According to the above description, there are corresponding constraints in the calculation formula of the width to be intercepted and the calculation formula of the height to be intercepted, so as to avoid the obtained width to be intercepted being too wide or too narrow, and avoid the obtained height to be intercepted being too high or too low.

[0050] Optionally, the preset ending gesture is a lifting gesture.

[0051] Optionally, the second gesture is a pull-down gesture.

[0052] In a second aspect, the present invention provides an APP automated testing device for automatically generating a target image, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, an APP automated testing method for automatically generating a target image as described in the first aspect is implemented.

[0053] Among them, the technical effect corresponding to the APP automated testing device for automatically generating a target image provided by the second aspect refers to the relevant description of the APP automated testing method for automatically generating a target image provided by the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 A flowchart of an APP automated testing method for automatically generating a target image provided in this embodiment;

[0055] Figure 2 A schematic diagram of the overall process of an APP automated testing method for automatically generating a target image provided by this embodiment;

[0056] Figure 3 A schematic diagram of the structure of an APP automated testing device for automatically generating a target image provided in this embodiment.

[0057] [Description of Reference Numerals]

[0058] 1. An APP automated testing device that automatically generates a target image;

[0059] 2. Processor;

[0060] 3. Memory. DETAILED DESCRIPTION

[0061] In order to better understand the above technical solution, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a clearer and more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.

[0062] Embodiment 1

[0063] Please refer to Figure 1 to Figure 2 The present invention provides an APP automated testing method for automatically generating a target image, comprising the steps of:

[0064] S1. Record the test process of the tester performing manual testing on the APP to be tested in real time to obtain the corresponding screen recording file;

[0065] In this embodiment, if Figure 2 As shown, the test process when the tester performs manual testing on the APP to be tested is recorded in real time through the existing screen recording technology. For example, when the tester performs manual testing on the APP to be tested on a mobile phone device, real-time recording can be performed through the mobile phone's built-in screen recording function. When the tester performs manual testing on the APP to be tested on a tablet, computer and other devices, real-time recording can be performed through the existing screen recording software to obtain a screen recording file corresponding to the test process.

[0066] S2. Automatically monitor the gesture interaction operations during the test process by using gesture tracking technology, generate corresponding gesture interaction records, and automatically generate corresponding initial test scripts according to the gesture interaction records;

[0067] In this embodiment, if Figure 2 As shown, gesture tracking technology can automatically monitor gesture interaction operations during the test process and generate corresponding gesture interaction records, where gesture interaction operations include but are not limited to: clicking, sliding, returning, lifting, pulling down and long pressing, etc., thereby automatically generating corresponding initial test scripts based on the gesture interaction records.

[0068] At this time, step S2 includes:

[0069] S21, obtaining the gesture type, occurrence time, and occurrence coordinates of each gesture interaction operation, and when a preset end gesture is monitored, obtaining the end time of the preset end gesture, and generating a corresponding gesture interaction record according to the gesture type, the occurrence time, the occurrence coordinates, and the end time;

[0070] The preset ending gesture is a lifting gesture.

[0071] In this embodiment, if Figure 2As shown, when the gesture interaction operations in the test process are automatically monitored by gesture tracking technology, the gesture type, occurrence time and occurrence coordinates of each gesture interaction operation can be automatically recorded, and when a lifting gesture is monitored, the lifting gesture is used as the end gesture of the current gesture interaction operation, so as to obtain the end time of the end gesture, and the gesture type, occurrence time, occurrence coordinates and end time are comprehensively used to generate a gesture interaction record of the corresponding gesture interaction operation. In this embodiment, the lifting gesture is used as the preset end gesture, and the preset end gesture can be modified and adjusted according to actual needs in real life.

[0072] S22. Automatically generate a corresponding initial test script according to the gesture interaction record.

[0073] At this time, step S22 includes:

[0074] S221, calling a corresponding action function according to the gesture type in the gesture interaction record, and automatically generating a corresponding initial test script according to the action function;

[0075] In this embodiment, if Figure 2 As shown, each gesture type has a corresponding action function. By associating the gesture type with the action function, the corresponding action function is called according to the gesture type, and a test case is constructed according to the obtained action function to generate the corresponding initial test script.

[0076] At this time, calling the corresponding action function according to the gesture type in the gesture interaction record in step S221 includes:

[0077] S2211. Calculate the delay time of each two adjacent gesture interaction records by using a delay formula. When the delay time exceeds the delay threshold, call the sleep function of the poco framework in the corresponding two adjacent gesture interaction records, and use the delay time as the sleep time of the sleep function. The delay formula is:

[0078] YT=HT-QT

[0079] Wherein, YT represents the delay time, HT represents the occurrence time of the latter of two adjacent gesture interaction records, and QT represents the end time of the former of two adjacent gesture interaction records;

[0080] S2212. When the gesture type is a click type, the click function of the poco framework is called; when the gesture type is a slide type, the slide function of the poco framework is called; when the gesture type is a return type, the return function of the poco framework is called; when the gesture type is a long press gesture, the wait function of the poco framework is called.

[0081] In this embodiment, if Figure 2 As shown, the delay time of two adjacent gesture interaction records, that is, the interval time of two adjacent gesture interaction records is achieved by calling the sleep function of the poco framework, and using the delay time as the sleep time of the sleep function, so as to realize the delay of two adjacent gesture interaction records. Different gesture types call different action functions of different poco frameworks. For example, when the gesture type is a click type, the click function is called, when the gesture type is a slide type, the slide function is called, and when the gesture type is a long press gesture, the wait function is called. The specific gesture type can be obtained by gesture tracking technology, and the judgment condition can be further set. For example, when the gesture type is a press, the judgment is made according to the time interval between the occurrence time of the press and the end time of the preset end gesture, and the occurrence coordinates of the press and the occurrence coordinates of the preset end gesture. When the time interval is less than the interval threshold and the occurrence coordinates of the two are the same, it is judged as a click type, when the time interval is greater than or equal to the interval threshold and the occurrence coordinates of the two are the same, it is judged as a long press type, and when the occurrence coordinates of the two change, it is judged as a slide type, wherein the interval threshold is 0.5 seconds, and the specific interval threshold can be adjusted according to actual conditions.

[0082] S3, filtering out a first gesture from the gesture interaction record, filtering out a first video screen corresponding to the first gesture from the screen recording file, converting the first video screen into a corresponding image file, wherein the first gesture is a test action of a target image;

[0083] In this embodiment, if Figure 2 As shown, a first gesture is filtered out from the gesture interaction record, and the first gesture is a test action of the target image. Specifically, the first gesture is a long press gesture, that is, the long press gesture is used as the test action of the target image, and a first video frame corresponding to the first gesture, that is, the long press gesture, is filtered out from the screen recording file, and the first video frame is converted into a corresponding picture file.

[0084] At this time, the step S3 of selecting the first gesture from the gesture interaction record and selecting the video screen corresponding to the first gesture from the screen recording file includes:

[0085] S31, selecting a second gesture from the gesture interaction record, and obtaining a start time of the first second gesture;

[0086] The second gesture is a pull-down gesture.

[0087] In this embodiment, if Figure 2 As shown, a second gesture is filtered out from the gesture interaction record. The second gesture is a pull-down gesture. The pull-down gesture in this embodiment refers to a gesture interaction operation that pulls the home page of the APP to be tested down a certain distance but does not trigger a refresh operation. The start time of the pull-down gesture is obtained.

[0088] S32, cutting out a screen recording video picture of a preset top height from the screen recording file, and decoding the screen recording video picture frame by frame to obtain all frames;

[0089] In this embodiment, if Figure 2 As shown, a screen recording video picture with a preset top height is cropped from the screen recording file, and the preset top height is 8 pixels, that is, a screen recording video picture with a top height of 8 pixels is cropped from the screen recording file. This preset top height is set according to the specific APP to be tested and can be adjusted according to actual conditions. The obtained screen recording video picture is decoded frame by frame using FFmpeg's video decoding technology to obtain all frames.

[0090] S33, selecting a first frame from all the frames, calculating the similarity between each frame and the first frame in turn, and obtaining a first timestamp of a frame corresponding to a first similarity lower than a first threshold;

[0091] In this embodiment, if Figure 2 As shown, the similarity between each frame and the first frame is calculated in turn through the image processing module PIL of OpenCV. Since the higher the similarity, the lower the probability that the pixels of the two frames change, and the lower the similarity, the higher the probability that the pixels of the two frames change. Therefore, the first timestamp of the frame corresponding to the first similarity lower than the first threshold is obtained, that is, it is considered that the pixels of the frame at this time have changed. The first threshold here is 0.9, that is, the first timestamp of the frame corresponding to the first frame whose similarity with the first frame is lower than 0.9 is obtained. The specific first threshold can be adjusted according to actual conditions.

[0092] S34, correcting the first timestamp according to the start time, unifying the time lines of the gesture interaction record and the screen recording file, and obtaining the screen recording file after the unified time line;

[0093] S35. Filter out a first video frame corresponding to the first gesture from the screen recording file after the unified timeline.

[0094] In this embodiment, if Figure 2 As shown, the first timestamp is corrected according to the start time, that is, the first timestamp in the screen recording file is compared with the start time in the gesture interaction record, so as to unify the time line of the gesture interaction record and the screen recording file, and filter out the first video frame corresponding to the first gesture from the screen recording file after the unified time line.

[0095] At this time, step S35 includes:

[0096] S351, obtaining a first action occurrence time point of a first gesture in a screen recording file before a unified timeline and a second action occurrence time point of a first second gesture;

[0097] S352: Input the first action occurrence time point, the second action occurrence time point and the start time into a first gesture timestamp calculation formula to obtain a first gesture timestamp, wherein the first gesture timestamp calculation formula is:

[0098] Vn=V0+(Tn-T0)

[0099] Wherein, Vn represents the first gesture timestamp of the nth first gesture, V0 represents the start time, Tn represents the time point at which the first action of the nth first gesture occurs in the screen recording file before the unified timeline, and T0 represents the time point at which the second action of the first second gesture occurs in the screen recording file before the unified timeline;

[0100] S353: Filter out a first video frame corresponding to the first gesture from the screen recording file after the unified timeline according to the first gesture timestamp.

[0101] In this embodiment, if Figure 2 As shown, the first action occurrence time point and the second action occurrence time point and the start time corresponding to the first gesture and the first second gesture in the screen recording file before the unified timeline are input into the first gesture timestamp calculation formula to calculate the first gesture timestamp, so as to filter out the first video frame corresponding to the first gesture from the screen recording file after the unified timeline according to the first gesture timestamp.

[0102] S4, obtaining the position coordinates, gesture duration and gesture pressure peak of the first gesture on the APP to be tested from the gesture interaction record, obtaining the information to be intercepted of the target image according to the position coordinates, the gesture duration and the gesture pressure peak, intercepting the corresponding target image from the picture file according to the information to be intercepted, and inserting the target image into the initial test script accordingly to obtain the final test script;

[0103] In this embodiment, if Figure 2 As shown, the information to be intercepted of the target image is obtained based on the position coordinates of the first gesture on the APP to be tested, the gesture duration and the gesture pressure peak value obtained from the gesture interaction record, and then the corresponding target image is intercepted from the picture file according to the information to be intercepted, and it is inserted into the initial test script accordingly to obtain the initial test script after the target image is inserted, that is, the final test script.

[0104] At this time, the interception information in step S4 includes the coordinates of the center point to be intercepted, the width to be intercepted, and the height to be intercepted, and the information to be intercepted of the target image obtained according to the position coordinates, the gesture duration, and the gesture pressure peak value includes:

[0105] S41, using the position coordinates as the coordinates of the center point to be intercepted of the target image;

[0106] S42, inputting the gesture duration into a calculation formula for the width to be intercepted to calculate the width to be intercepted, and obtaining the width to be intercepted of the target image, wherein the calculation formula for the width to be intercepted is:

[0107] w=W*T / 5

[0108] w represents the width of the target image to be captured, W represents the width of the device screen where the APP to be tested is located, and T represents the duration of the gesture;

[0109] In this embodiment, if Figure 2 As shown, the width to be intercepted of the target image is calculated according to the gesture duration, the gesture duration is input into the calculation formula of the width to be intercepted, and the calculation is performed in combination with the width of the device screen where the APP to be tested is located. In the calculation formula of the width to be intercepted, the upper and lower limits of the width to be intercepted are constrained, and the constraint condition is: W*1 / 5≤w≤W*2 / 5, that is, the lower limit of the width to be intercepted is one-fifth of the width of the device screen where the APP to be tested is located, and the upper limit of the width to be intercepted is two-fifths of the width of the device screen where the APP to be tested is located, so as to avoid the width to be intercepted being too wide or too narrow.

[0110] S43, inputting the gesture pressure peak into a calculation formula for the height to be intercepted to calculate the height to be intercepted, and obtaining the height to be intercepted of the target image, wherein the calculation formula for the height to be intercepted is:

[0111] h=H*P / 10

[0112] h represents the height of the target image to be captured, H represents the height of the device screen where the APP to be tested is located, and P represents the peak value of the gesture pressure.

[0113] In this embodiment, if Figure 2 As shown, the height to be intercepted of the target image is calculated according to the gesture pressure peak value, the gesture pressure peak value is input into the calculation formula of the height to be intercepted, and the calculation is performed in combination with the height of the device screen where the APP to be tested is located. In the calculation formula of the height to be intercepted, the upper and lower limits of the height to be intercepted are constrained, and the constraint conditions are: H / 10≤h≤H / 5, that is, the lower limit of the height to be intercepted is one tenth of the height of the device screen where the APP to be tested is located, and the upper limit of the height to be intercepted is one fifth of the height of the device screen where the APP to be tested is located, so as to avoid the height to be intercepted being too high or too low.

[0114] S5. Perform automated testing on the APP to be tested according to the final test script.

[0115] In this embodiment, if Figure 2 As shown, the APP to be tested is automatically tested according to the final test script, and a corresponding test report is generated according to the automated test results.

[0116] Embodiment 2

[0117] Please refer to Figure 3 An APP automated testing device 1 for automatically generating a target image includes a memory 3, a processor 2, and a computer program stored in the memory 3 and executable on the processor 2. When the processor 2 executes the computer program, the steps in Example 1 are implemented.

[0118] Since the system / device described in the above embodiments of the present invention is a system / device used to implement the method of the above embodiments of the present invention, a person skilled in the art can understand the specific structure and deformation of the system / device based on the method described in the above embodiments of the present invention, and thus will not be described in detail here. All systems / devices used in the method of the above embodiments of the present invention belong to the scope of protection of the present invention.

[0119] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0120] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions.

[0121] It should be noted that in the claims, any reference numerals placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In the claims enumerating several means, several of these means may be embodied by the same hardware. The use of the words first, second, third, etc., is for convenience of expression only and does not indicate any order. These words may be understood as part of the component name.

[0122] In addition, it should be noted that, in the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.

[0123] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments after knowing the basic creative concept. Therefore, the claims should be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.

[0124] Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention should also include these modifications and variations.

Claims

1. An APP automated testing method for automatically generating target images, It is characterized in that include: Real-time recording of the test process when the tester performs manual testing on the APP to be tested, and obtaining the corresponding screen recording file; Automatically monitor the gesture interaction operations during the test process by using gesture tracking technology, generate corresponding gesture interaction records, and automatically generate corresponding initial test scripts according to the gesture interaction records; Filtering out a first gesture from the gesture interaction record, filtering out a first video screen corresponding to the first gesture from the screen recording file, converting the first video screen into a corresponding picture file, wherein the first gesture is a test action of a target image; Obtaining the position coordinates, gesture duration and gesture pressure peak of the first gesture on the APP to be tested from the gesture interaction record, obtaining the information to be intercepted of the target image according to the position coordinates, the gesture duration and the gesture pressure peak, intercepting the corresponding target image from the picture file according to the information to be intercepted, and inserting the target image into the initial test script accordingly to obtain the final test script; Perform automated testing on the APP to be tested according to the final test script.

2. An APP automated testing method for automatically generating a target image as claimed in claim 1, It is characterized in that The method of automatically monitoring the gesture interaction operation during the test process by using gesture tracking technology, generating corresponding gesture interaction records, and automatically generating corresponding initial test scripts according to the gesture interaction records includes: Obtaining the gesture type, occurrence time, and occurrence coordinates of each gesture interaction operation, and when a preset end gesture is monitored, obtaining the end time of the preset end gesture, and generating a corresponding gesture interaction record according to the gesture type, the occurrence time, the occurrence coordinates, and the end time; A corresponding initial test script is automatically generated according to the gesture interaction record.

3. An APP automated testing method for automatically generating a target image as claimed in claim 2, It is characterized in that The automatically generating a corresponding initial test script according to the gesture interaction record comprises: Calling a corresponding action function according to the gesture type in the gesture interaction record, and automatically generating a corresponding initial test script according to the action function; The calling of a corresponding action function according to the gesture type in the gesture interaction record comprises: The delay time of each two adjacent gesture interaction records is calculated by the delay formula. When the delay time exceeds the delay threshold, the sleep function of the poco framework is called in the corresponding two adjacent gesture interaction records, and the delay time is used as the sleep time of the sleep function. The delay formula is: YT=HT-QT Wherein, YT represents the delay time, HT represents the occurrence time of the latter of two adjacent gesture interaction records, and QT represents the end time of the former of two adjacent gesture interaction records; When the gesture type is a click type, the click function of the poco framework is called; when the gesture type is a slide type, the slide function of the poco framework is called; when the gesture type is a return type, the return function of the poco framework is called; when the gesture type is a long press gesture, the wait function of the poco framework is called.

4. The APP automated testing method for automatically generating a target image according to claim 1, It is characterized in that The step of selecting the first gesture from the gesture interaction record and selecting the video image corresponding to the first gesture from the screen recording file includes: Filtering out a second gesture from the gesture interaction record, and obtaining a start time of the first second gesture; Crop a screen recording video picture of a preset top height from the screen recording file, and decode the screen recording video picture frame by frame to obtain all frames; Filtering out a first frame from all the frames, calculating the similarity between each frame and the first frame in turn, and obtaining a first timestamp of a frame corresponding to a first similarity lower than a first threshold; Correcting the first timestamp according to the start time, unifying the time lines of the gesture interaction record and the screen recording file, and obtaining the screen recording file after the unified time line; The first video frame corresponding to the first gesture is filtered out from the screen recording files after the unified timeline.

5. An APP automated testing method for automatically generating a target image as claimed in claim 4, It is characterized in that The step of filtering out the first video frame corresponding to the first gesture from the screen recording file after the unified timeline includes: Obtain the first action occurrence time point of the first gesture in the screen recording file before the unified timeline and the second action occurrence time point of the first second gesture; The first action occurrence time point, the second action occurrence time point and the start time are input into the first gesture timestamp calculation formula for calculation to obtain the first gesture timestamp, wherein the first gesture timestamp calculation formula is: Vn=V0+(Tn-T0) Wherein, Vn represents the first gesture timestamp of the nth first gesture, V0 represents the start time, Tn represents the time point at which the first action of the nth first gesture occurs in the screen recording file before the unified timeline, and T0 represents the time point at which the second action of the first second gesture occurs in the screen recording file before the unified timeline; A first video frame corresponding to the first gesture is filtered out from the screen recording file after the unified timeline according to the first gesture timestamp.

6. The APP automated testing method for automatically generating a target image according to claim 1, It is characterized in that The interception information includes the coordinates of the center point to be intercepted, the width to be intercepted, and the height to be intercepted. The information to be intercepted of the target image obtained according to the position coordinates, the gesture duration, and the gesture pressure peak value includes: Using the position coordinates as the coordinates of the center point to be intercepted of the target image; The gesture duration is input into the calculation formula of the width to be intercepted to calculate the width to be intercepted, and the width to be intercepted of the target image is obtained. The calculation formula of the width to be intercepted is: w=W*T / 5 w represents the width of the target image to be captured, W represents the width of the device screen where the APP to be tested is located, and T represents the duration of the gesture; The gesture pressure peak is input into the calculation formula of the height to be intercepted to calculate the height to be intercepted, and the height to be intercepted of the target image is obtained. The calculation formula of the height to be intercepted is: h=H*P / 10 h represents the height of the target image to be captured, H represents the height of the device screen where the APP to be tested is located, and P represents the peak value of the gesture pressure.

7. An APP automated testing method for automatically generating a target image as claimed in claim 6, It is characterized in that There is a first constraint condition in the calculation formula for the width to be intercepted, and the first constraint condition is: W*1 / 5≤w≤W*2 / 5. There is a second constraint condition in the calculation formula for the height to be intercepted, and the second constraint condition is: H / 10≤h≤H / 5.

8. An APP automated testing method for automatically generating a target image as claimed in claim 2, It is characterized in that The preset ending gesture is a lifting gesture.

9. The APP automated testing method for automatically generating a target image according to claim 4, It is characterized in that The second gesture is a pull-down gesture.

10. An APP automated testing device for automatically generating a target image, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the method according to any one of claims 1 to 9 is implemented.