CN111538658A - Automatic testing method for interface loading duration - Google Patents

Automatic testing method for interface loading duration Download PDF

Info

Publication number
CN111538658A
CN111538658A CN202010309951.2A CN202010309951A CN111538658A CN 111538658 A CN111538658 A CN 111538658A CN 202010309951 A CN202010309951 A CN 202010309951A CN 111538658 A CN111538658 A CN 111538658A
Authority
CN
China
Prior art keywords
image
pixel points
interface
sum
screen capture
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010309951.2A
Other languages
Chinese (zh)
Inventor
张谷亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Aspire Digital Technologies Shenzhen Co Ltd
Original Assignee
Aspire Digital Technologies Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Aspire Digital Technologies Shenzhen Co Ltd filed Critical Aspire Digital Technologies Shenzhen Co Ltd
Priority to CN202010309951.2A priority Critical patent/CN111538658A/en
Publication of CN111538658A publication Critical patent/CN111538658A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

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)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses an automatic testing method of interface loading duration, which comprises the steps of obtaining a screenshot image before interface loading to serve as a first image, obtaining the screenshot image after interface loading according to a preset time interval, marking as a second image, comparing the second image with pixel points of the first image, and calculating to obtain the sum of different pixel points; if the sum of different pixel points is larger than a preset value, circularly acquiring a screen capture image after the interface is loaded according to a preset time interval, and recording the screen capture image as an Nth image; and comparing the pixel points of the Nth image with the N-1 th image, and if the sum of different pixel points is less than a preset value, acquiring the time difference between the first image and the screen capture of the Nth image or acquiring the time difference between the first image and the screen capture of the N-1 th image as the interface loading time. According to the method, the automatic test script of the UIAutomator frame is used for simulating manual operation on the interface, image information before and after screen capture of the interface is compared, and the interface loading duration is obtained through more accurate test.

Description

Automatic testing method for interface loading duration
Technical Field
The invention relates to the field of automatic testing, in particular to an automatic testing method for interface loading duration.
Background
At present, in the process of testing the loading duration of the APP, the loading duration is mainly tested in a manual estimation mode. Therefore, in the test stage and the dial test stage after the APP is on line, the error caused by the subjective factor must be accepted, and the obtained result cannot truly reflect the actual APP loading duration.
For example, in some map APP road condition loading duration tests, firstly, a tester clicks a 'road condition' button, and starts recording the current time at the same time, which can only be accurate to seconds; when the loading is judged to be finished by naked eyes, the current time is recorded and can only be accurate to seconds; and simultaneously calculating the loading duration of the current test activity. In addition, for the proportion condition of different road conditions needing to be counted in the test process, the proportion condition is also roughly estimated according to the APP display condition. Finally, the tester inputs the current test time, the current position, the current equipment type, the occupation ratios of different road conditions and the like into the system, if different terminal types need to be covered, different test places need to be covered or different network types need to be covered, the test content increases exponentially, the process needs to consume great manpower and material resources to complete, and an accurate test effect cannot be achieved.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art. Therefore, the embodiment of the invention provides an automatic test method of interface loading duration, image information before and after interface screen capturing is compared, the loading duration is calculated according to a comparison result, and the interface loading duration can be obtained through more accurate test.
In a first aspect, an embodiment of the present invention provides an automated testing method for interface loading duration, including the steps of:
acquiring a screen cut image before interface loading to serve as a first image;
taking the screen capture time of the first image as a reference time point, acquiring the screen capture image loaded on the interface according to a preset time interval, marking as a second image, comparing pixel points of the second image and the first image, and calculating to obtain the sum of different pixel points;
if the sum of different pixel points is larger than a preset value, circularly acquiring a screen capture image after the interface is loaded according to a preset time interval, recording the screen capture image as an Nth image, and recording a screen capture image of a previous time point of the Nth image as an N-1 th image;
comparing pixel points of the Nth image with the N-1 th image, and if the sum of different pixel points is smaller than a preset value, acquiring the time difference between screen capturing of the first image and the Nth image as interface loading time;
or acquiring the time difference between the first image and the screen capture of the (N-1) th image as the interface loading duration.
The automatic test method for the interface loading duration of the embodiment of the invention at least has the following beneficial effects: through the automatic test script, the simulation manual work is operated to the interface to image information is compared before and after the interface screen capturing, and more accurate test obtains the interface loading duration.
According to another embodiment of the present invention, an automated testing method for interface loading duration is applicable to testing the loading duration of a road condition display interface, and includes:
acquiring a screen capture image and RGB values of corresponding pixel points;
and realizing pixel point comparison based on comparison of RGB values of the pixel points.
According to the automatic test method for interface loading duration of the other embodiments of the present invention, different RGB values are used to represent different road conditions, and the sums of pixel points of different road conditions are calculated according to the RGB values;
acquiring the sum of different pixel points of the first image and the Nth image and recording the sum as T;
and setting different road condition occupation ratios according to the ratio of the sum of the pixel points of different road conditions to T.
According to the automatic test method for interface loading duration of other embodiments of the present invention, the road condition may be set as: the method comprises the steps of calculating the smooth occupation ratio, the slow occupation ratio, the congestion occupation ratio and/or the very congested occupation ratio. The accurate road condition occupation ratios of different roads can be tested through the statistical calculation after the interface loading.
In a second aspect, an embodiment of the present invention provides an apparatus for automatically testing interface loading duration, including: the interface acquisition module is used for acquiring a screen shot image of the interface;
the interface loading duration acquisition module comprises a comparison unit and a calculation unit:
the interface acquisition module acquires a screenshot image before interface loading as a first image, acquires the screenshot image after the interface loading according to a preset time interval by taking the screenshot time of the first image as a reference time point, and records the screenshot image as a second image;
the comparison unit is used for comparing pixel points of the second image with pixel points of the first image and calculating to obtain the sum of different pixel points;
if the sum of different pixel points is larger than a preset value, the interface acquisition module circularly acquires a screen capture image loaded by an interface according to a preset time interval, and records the screen capture image as an Nth image, and records the screen capture image at the previous time point of the Nth image as an N-1 th image;
comparing pixel points of the Nth image with the N-1 th image, and if the sum of different pixel points is smaller than a preset value, acquiring the time difference between screen capturing of the first image and the Nth image as interface loading time by a computing unit;
and the calculating unit is used for acquiring the time difference between the first image and the screen capture of the (N-1) th image as the interface loading time length.
The automatic testing device for the interface loading duration of the embodiment of the invention at least has the following beneficial effects: .
According to another embodiment of the present invention, an automatic testing apparatus for interface loading duration is adapted to test loading duration of a road condition display interface, and includes:
the interface acquisition module is also used for simultaneously acquiring RGB values of pixel points corresponding to the screenshot image, and expressing different road conditions by using different RGB values;
the comparison unit also comprises a pixel point comparison unit for realizing pixel point comparison based on the comparison of the RGB values of the pixel points;
the calculating unit also comprises calculating the proportions of different road conditions and calculating the sum of pixel points of different road conditions according to the RGB values;
acquiring the sum of different pixel points of the first image and the Nth image and recording the sum as T;
and setting different road condition occupation ratios according to the ratio of the sum of the pixel points of different road conditions to T.
In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions for causing a computer to execute the method according to the first aspect.
Drawings
FIG. 1 is a flowchart illustrating an embodiment of a method for testing interface loading duration according to the present invention;
FIG. 2 is a flowchart illustrating a method for testing loading duration of an interface according to another embodiment of the present invention;
FIG. 3 is a flowchart illustrating an automated testing method for interface loading duration according to another embodiment of the present disclosure;
FIG. 4 is a schematic structural diagram of an embodiment of an apparatus for automatically testing interface loading duration according to the present invention;
fig. 5 is a schematic structural diagram of another embodiment of an automatic testing apparatus for interface loading duration according to an embodiment of the present invention.
Detailed Description
The concept and technical effects of the present invention will be clearly and completely described below in conjunction with the embodiments to fully understand the objects, features and effects of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments, and those skilled in the art can obtain other embodiments without inventive effort based on the embodiments of the present invention, and all embodiments are within the protection scope of the present invention.
In the description of the embodiments of the present invention, if "a number" is referred to, it means one or more, if "a plurality" is referred to, it means two or more, if "greater than", "less than" or "more than" is referred to, it is understood that the number is not included, and if "greater than", "lower" or "inner" is referred to, it is understood that the number is included. If reference is made to "first" or "second", this should be understood to distinguish between features and not to indicate or imply relative importance or to implicitly indicate the number of indicated features or to implicitly indicate the precedence of the indicated features.
The basic idea of the embodiment of the invention is to realize the method by utilizing the color difference of the interface screenshots before and after the interface loading time delay, and simultaneously, the time length for completing the interface loading can be accurately calculated by means of an automatic testing tool and a screenshot comparison technology.
Referring to fig. 1, a flowchart of a specific embodiment of a method for testing interface loading duration in an embodiment of the present invention is shown. The method comprises the following steps:
s, 101, acquiring a screen cut image before interface loading to serve as a first image;
and S, 102, starting loading the interface. Automatically clicking a loading starting interface by a program;
s, 103, acquiring a screen capture image after interface loading, recording the screen capture image as a second image, specifically, acquiring the screen capture image after interface loading according to a preset time interval by taking the screen capture time of the first image as a reference time point, and recording the screen capture image as the second image;
s, 104, comparing the first image with the second image, and calculating to obtain the sum of different pixel points;
if the sum of the different pixels is greater than the preset value, in some embodiments, the preset value is set according to experience of manual testing, and specifically, the preset value may be set to 100 pixels.
S, 105, acquiring a screen capture image loaded by an interface according to a preset time interval, recording the screen capture image as an Nth image, and recording a screen capture image of a previous time point of the Nth image as an N-1 th image;
s, 106, comparing the pixel points of the Nth image and the N-1 th image;
if the sum of different pixel points is larger than a preset value, circularly acquiring a screen capture image;
s, 107, if the sum of different pixel points is smaller than a preset value, calculating to obtain interface loading duration, and obtaining the time difference between the first image and the Nth image screen capture as the interface loading duration;
or acquiring the time difference between the first image and the screen capture of the (N-1) th image as the interface loading time, wherein in some specific embodiments, the variation pixel point of the screen capture of the (N-1) th image is almost the same as that of the (N-1) th image, so the algorithm calculates the interface loading time according to the time point of the screen capture of the (N-1) th image.
As mentioned in the background art, in practice, it is time-consuming and labor-consuming to manually determine whether the interface is loaded.
In this embodiment, an image before interface loading is intercepted and used as a basis for comparison, for example, if an interface of software is in a waiting state, the content of the corresponding image is not changed. Then, a predetermined time point, for example, time a, is set, and the loading of the interface is started at time a, so that the image displayed by the interface changes until the content of the image is unchanged within a period of time after time a. The present embodiment determines whether loading is completed according to the trend of image change. Specifically, a first image is obtained by screenshot at a moment before the moment A, such as the moment A-; and then intercepting the interface image according to a preset time interval, recording the interface image as a second image, and intercepting a plurality of images behind the second image. And then judging whether the loading is finished according to the difference between the plurality of images at the moment A and the first image.
When the sum of different pixel points of the second image and the first image is larger than a preset value, the interface image is intercepted in a circulating mode and recorded as an Nth image, the images in two adjacent time intervals are compared in a circulating mode until the sum of different pixel points of the two images is smaller than the preset value, loading is completed, and the time difference between the acquired image and the first image is interface loading time.
Referring to fig. 2, a flowchart of another specific embodiment of the interface loading duration testing method in the embodiment of the present invention is shown. The embodiment of the invention is particularly applied to testing the page loading time of the mobile terminal, firstly, an UIAutomator automatic test tool is installed at a PC end, a test environment is set up, and a test script is compiled according to JAVA language specification; and finally, after the operation is successful, the terminal equipment connected to the PC side through a USB line can automatically install and start the map APP and click a corresponding button according to script control.
In some embodiments, screenshot of the application interface through the minicap includes:
the following commands are run on the PC side:
adb shell LD_LIBRARY_PATH=/data/local/tmp/data/local/tmp/minicap-P%s@%s/0
in some embodiments,% s @% s/0 may be 1920x1080@1920x1080/0, the current screen resolution is 1920x1080, and the post-cropped image resolution is 1920x1080 (it may be set that the post-cropping compression resolution, e.g., 960 x 540, is used).
After the operation, a Socket channel established by a PC side and a terminal transmits a currently intercepted screen image, the screen interception interval time is set in minicap, the resolution of the terminal is 1920x1080 standard at present, the comparison algorithm of the embodiment of the invention can complete calculation within 10ms after each interface screenshot under an x86 architecture 64bit CPU is estimated, and a program intercepts the screen image according to the set interval time and sends the screen image to the PC side for image comparison.
The method comprises the following steps:
201PC is connected with terminal equipment through a USB line;
202, starting an automatic test script to complete APP installation and starting;
203, acquiring a screen cut image before interface loading to serve as a first image; in some specific embodiments, the screen capture tool can capture a screen by using a third-party tool minicap, wherein the minicap runs at an Android device end and is responsible for real-time acquisition of a device screen video and sending the device screen video through a Socket interface. The principle of the minicap acquisition screen is as follows: the method comprises the steps of capturing a screen at a preset time interval through a screen capturing interface of the NDK and sending the screen to a PC (personal computer) end in real time through a Socket interface;
the interface 204 starts to load, and the program automatically clicks the interface to start loading;
205, acquiring a screen capture image after the interface loading, and recording the screen capture image as a second image, specifically, acquiring the screen capture image after the interface loading according to a preset time interval by taking the screen capture time of the first image as a reference time point, and recording the screen capture image as the second image;
206 comparing the first image with the second image, and calculating to obtain the sum of different pixel points;
if the sum of the different pixel points is greater than the preset value, in some embodiments, the preset value is set according to experience of manual testing, and specifically, the preset value may be set to 100.
207, acquiring a screen capture image after the interface loading according to a preset time interval, recording the screen capture image as an Nth image, and recording a screen capture image of a previous time point of the Nth image as an N-1 th image;
208, comparing the pixel points of the Nth image and the N-1 th image;
if the sum of different pixel points is larger than a preset value, circularly acquiring a screen capture image;
209 if the sum of the different pixel points is less than the preset value, calculating to obtain the interface loading duration, including: acquiring the time difference between the first image and the screen capture of the Nth image as the interface loading duration;
or acquiring the time difference between the first image and the screen capture of the (N-1) th image as the interface loading time, wherein in some specific embodiments, the variation pixel point of the screen capture of the (N-1) th image is almost the same as that of the (N-1) th image, so the algorithm calculates the interface loading time according to the time point of the screen capture of the (N-1) th image.
In some embodiments, when the terminal APP is a map APP, the test of the loading duration of the map APP road condition is completed by manually nipping the table at present, the accuracy can only reach seconds, errors can be caused by artificial subjective factors, the obtained result cannot truly reflect the actual road condition loading duration, and then different road condition occupancy cannot be counted, such as smooth, slow, congested and very congested occupancy conditions, real-time data of the road condition occupancy cannot be better obtained.
In some embodiments, different RGB values are used for different road conditions in the map APP, and the pixel values sPixels are used for smooth representation. In some embodiments, each pixel in the 24-bit BMP image is represented by three bytes, which respectively represents the intensity of Red, Green, and Blue, and different colors are used for representing different road conditions in the map APP. The smooth traffic classification is (0,250,0), the slow traffic classification is (245,200,50), the congestion traffic classification is (250,80,80), and the congestion traffic classification is (155,35,35), which can be dynamically adjusted in actual tests and needs to be parameterized and saved.
Referring to fig. 3, a flowchart illustrating another specific embodiment of the method for automatically testing interface loading duration according to the embodiment of the present invention is shown. In some specific examples, the embodiment of the present invention is applicable to testing the loading duration of a road condition display interface, different RGB values are used to represent different road conditions, a test environment and a test script are first prepared, and the start-up is completed, including:
301PC is connected with terminal equipment through a USB line;
302 starting an automated test script to complete APP installation and start, in some embodiments, including: and automatically installing the map APP and automatically starting through the UIAutomator.
In some specific embodiments, a PC device installed with Linux (recommended Ubuntu) is used to connect a terminal device to a USB port through a USB cable, where Android terminal device needs to open USB debugging of developer options in a mobile phone setting, first obtain the number of a currently connected device by executing adb devices, and then execute adbinstall-r map.apk (map.apk is a map APP installation package) under a Shell command line;
and opening an Android Studio editor to compile a test script, importing two dependency packages, namely Android. Inheriting a current starting script from a UiAutomatoTestCase basic class, testing the terminal equipment and the Android version which are automatically adapted and connected by a UiAutomator framework, and adding getUiDevice (). executing SellCommand (am start-n map/first activity) in a starting method class; thereby completing the corresponding APP start-up work.
303, acquiring a screen cut image before interface loading to serve as a first image; meanwhile, acquiring the screen capture image and the RGB value of the corresponding pixel point;
in some specific embodiments, the screen capture tool can capture a screen by using a third-party tool minicap, wherein the minicap runs at an Android device end and is responsible for real-time acquisition of a device screen video and sending the device screen video through a Socket interface. The principle of the minicap acquisition screen is as follows: the method comprises the steps of capturing a screen at a preset time interval through a screen capturing interface of the NDK and sending the screen to a PC (personal computer) end in real time through a Socket interface;
starting loading by the interface 304, and automatically clicking the loading starting interface by the program;
in some implementations, obtaining interface initial screen information and recording includes:
after the starting step is completed, automatically displaying map information of a current position by an APP, defaulting to unopened road condition information, then obtaining a screenshot of a current screen through adb shell LD _ LIBRARY _ PATH (where-s parameter is only one picture intercepted), then recording Pixel points of the screenshot in a circulating mode, and storing the recorded information in a memory array for storage, wherein the process is realized by writing a JAVA method, namely int [ ] [ ] getPrixelArray (InputStream), wherein is a file stream of the current screenshot, such as Pixel [ x, y ], wherein x is a horizontal axis and y is a vertical axis. And the current timestamp is recorded as T0 by system currenttimemillis (), which can be accurate to the millisecond level.
② click the map APP 'road conditions' button
And after the initial screen information is recorded, acquiring and clicking a 'road condition' button control through the control searching capability of the UiAutomator.
# road conditions first defined button text information
String button text is "road condition";
# sets the road condition control to be looked up as uiObject, and looks up the control
UiObject uiObject=null;
uiObject=mDevice.findObject(new
UiSelector().textStartsWith(buttonText));
If found, click
if(uiObject!=null){
uiObject2.click();
}
The text description of the road condition can be defined in the configuration file, and the APP for different map types can be flexibly set by modifying the configuration file.
305, acquiring a screen capture image after the interface loading, and recording the screen capture image as a second image, specifically acquiring the screen capture image after the interface loading according to a preset time interval by taking the screen capture time of the first image as a reference time point, and recording the screen capture image as the second image;
306 comparing the first image with the second image, and comparing based on the RGB values of the pixel points to realize pixel point comparison, and calculating to obtain the sum of different pixel points;
in some embodiments, the obtaining and comparing the current screen information of the map class includes:
and after the clicking action is finished, the map starts to load road condition information. The script triggers a continuous screenshot action: the method comprises the steps that adb shelld _ LIBRARY _ PATH ═ data/local/tmp/data/local/tmp/minor-P resolution @ resolution/0, after screenshot is obtained, getPixelArray () is used for obtaining pixel point information of the current screenshot, then comparison is carried out with initial screenshot information, in order to improve comparison speed, the JAVA multithreading technology is used for carrying out comparison, an independent JAVA method intcomposel () is used for completing comparison, the obtained comparison value is marked as C1, and the current timestamp is T1; then, the next cycle is carried out for comparison, and the comparison value is C2, and the current timestamp is T2; and when the time is T2-T1<100, the cycle is ended, and the road condition loading time length is calculated to be T1-T0.
If the sum of the different pixel points is greater than the preset value, in some embodiments, the preset value is set according to experience of manual testing, and specifically, the preset value may be set to 100.
307, acquiring a screen capture image after the interface loading according to a preset time interval, recording the screen capture image as an Nth image, and recording a screen capture image of a previous time point of the Nth image as an N-1 th image;
308, comparing the pixel points of the Nth image with the pixel points of the N-1 th image, calculating to obtain the sum of different pixel points, and calculating the sum of the pixel points of different road conditions according to the RGB values respectively, namely performing classification statistics on the pixel points of different road conditions according to different RGB values;
in some embodiments, when the difference between the pixel points changes slightly, it is determined that the road condition loading is completed, so as to obtain a screenshot corresponding to the T1 timestamp.
Comparing T1 screenshot with initial screenshot
Int comparePixelCount(InputStream lastIs)
# obtaining the number of pixels of different road conditions in T1 screenshot
Int getScreenTrafficCount(InputStream lastIs,int RGB)
Counting the obtained pixel points of different road conditions and the total changed pixel points to obtain the proportion conditions of different road conditions, finally storing all statistical information into a test result file, and using a test step getUidevice (). executing an application library (APP) packet name of an am force-stop map; and exiting the application.
If the sum of different pixel points is larger than a preset value, circularly acquiring a screen capture image;
309 if the sum of the different pixel points is less than the preset value, calculating to obtain the interface loading duration and the occupation ratio of different road conditions, including: acquiring the time difference between the first image and the screen capture of the Nth image as the interface loading time, acquiring the sum of different pixel points of the first image and the Nth image and recording the sum as T, setting different road condition ratios according to the sum of the pixel points of different road conditions and the ratio of T, wherein the road condition can be set as: the method comprises the steps of calculating a smooth occupation ratio, a slow occupation ratio, a congestion occupation ratio and/or a very congested occupation ratio, wherein the smooth occupation ratio, the slow occupation ratio, the congestion occupation ratio and the very congested occupation ratio are/is obtained;
or acquiring the time difference between the first image and the screen capture of the (N-1) th image as the interface loading time, wherein in some specific embodiments, the variation pixel point of the screen capture of the (N-1) th image is almost the same as that of the (N-1) th image, so the algorithm calculates the interface loading time according to the time point of the screen capture of the (N-1) th image.
Referring to fig. 4, a structural intent of an embodiment of an automatic testing apparatus for interface loading duration according to an embodiment of the present invention is shown. The method specifically comprises the following steps:
the automatic testing device 400 for interface loading duration includes:
an interface obtaining module 410, configured to obtain a screen capture image of an interface;
the interface loading duration obtaining module 420 includes a comparing unit 421 and a calculating unit 422:
the interface obtaining module 410 obtains a screenshot image before interface loading as a first image, obtains the screenshot image after interface loading according to a preset time interval by taking the screenshot time of the first image as a reference time point, and records the screenshot image as a second image, the comparison 421 module is used for comparing pixel points of the second image and the first image, the calculating unit 422 calculates to obtain the sum of different pixel points, if the sum of the different pixel points is greater than a preset value, the interface obtaining module 410 circularly obtains the screenshot image after interface loading according to the preset time interval, and records the screenshot image as an nth image, and records the screenshot image at the previous time point of the nth image as an nth-1 image; comparing pixel points of the nth image and the nth-1 image, and if the sum of the different pixel points is smaller than a preset value, the calculating unit 422 is configured to obtain a time difference between screen capturing of the first image and the nth image as an interface loading duration;
the calculating unit 422, or obtains the time difference between the first image and the screen capturing of the N-1 th image as the interface loading duration.
Referring to fig. 5, a schematic structural diagram of another specific embodiment of the automatic testing apparatus for interface loading duration in the embodiment of the present invention is shown. The method comprises the following steps:
the interface obtaining module 510 is configured to obtain a screen capture image of an interface and obtain RGB values of pixel points corresponding to the screen capture image, where different RGB values represent different road conditions;
the interface obtaining module 510 obtains a screenshot image before interface loading as a first image, and obtains the screenshot image after interface loading according to a preset time interval by taking the screenshot time of the first image as a reference time point, and records the screenshot image as a second image, the comparison 521 module is used for comparing pixel points of the second image and the first image, the calculation unit 522 calculates to obtain the sum of different pixel points, if the sum of the different pixel points is greater than a preset value, the interface obtaining module 510 circularly obtains the screenshot image after interface loading according to the preset time interval, and records the screenshot image as an nth image, and records the screenshot image at the previous time point of the nth image as an nth-1 image; comparing pixel points of the nth image and the nth-1 image, and if the sum of the different pixel points is smaller than a preset value, the calculating unit 522 is configured to obtain a time difference between screen capturing of the first image and the nth image as an interface loading duration;
the interface loading duration obtaining module 520 includes a comparing unit 521 and a calculating unit 522:
the comparison unit 521 further includes a pixel point comparison unit for comparing the RGB values of the pixel points;
the calculating unit 522 further calculates the ratio of different road conditions, and respectively calculates the total number of pixel points of different road conditions according to the RGB values;
acquiring the sum of different pixel points of the first image and the Nth image and recording the sum as T;
and setting different road condition occupation ratios according to the ratio of the sum of the pixel points of the different road conditions to T.
One embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions for causing a computer to perform the method as described above.
The above-described embodiments of the apparatus are merely illustrative, wherein the units illustrated as separate components may or may not be physically separate, i.e. may be located in one place, or may also be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
One of ordinary skill in the art will appreciate that all or some of the steps, systems, and methods disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as is well known to those of ordinary skill in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by a computer. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to those skilled in the art.
The embodiments of the present invention have been described in detail with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the gist of the present invention. Furthermore, the embodiments of the present invention and the features of the embodiments may be combined with each other without conflict.

Claims (7)

1. The automatic test method of the interface loading duration is characterized by comprising the following steps:
acquiring a screen cut image before interface loading to serve as a first image;
taking the screen capture time of the first image as a reference time point, acquiring a screen capture image after interface loading according to a preset time interval, marking as a second image, comparing pixel points of the second image and the first image, and calculating to obtain the sum of different pixel points;
if the sum of the different pixel points is larger than a preset value, circularly acquiring a screen capture image after the interface is loaded according to the preset time interval, recording the screen capture image as an Nth image, and recording a screen capture image at the previous time point of the Nth image as an N-1 th image;
comparing pixel points of the Nth image with the N-1 th image, and if the sum of different pixel points is smaller than a preset value, acquiring the time difference between screen capturing of the first image and the Nth image as interface loading time;
or acquiring the time difference between the first image and the screen capture of the (N-1) th image as the interface loading duration.
2. The method for automatically testing the interface loading duration according to claim 1, wherein the method for testing the interface loading duration is suitable for testing the road condition display interface loading duration and comprises the following steps:
acquiring a screen capture image and RGB values of corresponding pixel points;
and realizing pixel point comparison based on comparison of RGB values of the pixel points.
3. The method for automatically testing interface loading duration according to claim 2, wherein different RGB values are used to represent different road conditions, and the sum of pixel points of different road conditions is calculated according to the RGB values;
acquiring the sum of different pixel points of the first image and the Nth image and recording the sum as T;
setting different road condition occupation ratios according to the ratio of the sum of the pixel points of the different road conditions to T;
and setting different road condition occupation ratios according to the ratio of the sum of the pixel points of different road conditions to T.
4. The method for automatically testing the interface loading duration according to claim 3, wherein the road condition is set as: smooth, slow, congested and very congested;
calculating to obtain the proportion of the corresponding road condition: a smooth occupancy, a slow occupancy, a congestion occupancy, and/or a very congested occupancy.
5. Automatic testing arrangement of interface load duration, its characterized in that includes:
the interface loading duration acquisition module comprises a comparison unit and a calculation unit:
the interface acquisition module acquires a screenshot image before interface loading as a first image, acquires the screenshot image after the interface loading according to a preset time interval by taking the screenshot time of the first image as a reference time point, and records the screenshot image as a second image;
the comparison unit is used for comparing the pixel points of the second image with the pixel points of the first image, calculating to obtain the sum of different pixel points, if the sum of different pixel points is larger than a preset value, the interface acquisition module circularly acquires a screen capture image loaded by an interface according to the preset time interval, and records the screen capture image as an Nth image, and records the screen capture image at the previous time point of the Nth image as an N-1 th image; comparing the pixel points of the Nth image with the pixel points of the N-1 th image, and if the sum of the different pixel points is smaller than a preset value;
the calculating unit is used for acquiring the time difference between the first image and the Nth image screen capture as the interface loading duration;
and the computing unit is used for acquiring the time difference between the first image and the screen capture of the (N-1) th image as the interface loading duration.
6. The device for automatically testing the loading duration of the interface according to claim 5, wherein the device is suitable for testing the loading duration of the road condition display interface and comprises:
the interface acquisition module is also used for simultaneously acquiring RGB values of pixel points corresponding to the screenshot image, and expressing different road conditions by using different RGB values;
the comparison unit also comprises a pixel point comparison unit for realizing pixel point comparison based on the comparison of the RGB values of the pixel points;
the calculating unit also comprises calculating the proportions of different road conditions and calculating the sum of pixel points of different road conditions according to the RGB values;
acquiring the sum of different pixel points of the first image and the Nth image and recording the sum as T;
and setting different road condition occupation ratios according to the ratio of the sum of the pixel points of the different road conditions to T.
7. A computer-readable storage medium having stored thereon computer-executable instructions for causing a computer to perform the method of any one of claims 1 to 4.
CN202010309951.2A 2020-04-20 2020-04-20 Automatic testing method for interface loading duration Pending CN111538658A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010309951.2A CN111538658A (en) 2020-04-20 2020-04-20 Automatic testing method for interface loading duration

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010309951.2A CN111538658A (en) 2020-04-20 2020-04-20 Automatic testing method for interface loading duration

Publications (1)

Publication Number Publication Date
CN111538658A true CN111538658A (en) 2020-08-14

Family

ID=71973027

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010309951.2A Pending CN111538658A (en) 2020-04-20 2020-04-20 Automatic testing method for interface loading duration

Country Status (1)

Country Link
CN (1) CN111538658A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114827754A (en) * 2022-02-23 2022-07-29 阿里巴巴(中国)有限公司 Method and device for detecting video first frame time

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016078479A1 (en) * 2014-11-17 2016-05-26 广州市动景计算机科技有限公司 Method and device for monitoring web page changes
CN107301231A (en) * 2017-06-26 2017-10-27 腾讯科技(深圳)有限公司 The page opens time-consuming method of testing and test system
CN107704385A (en) * 2017-09-15 2018-02-16 天津大学 Cell phone map road conditions loading time delay automatic test approach based on Appium
CN108109168A (en) * 2018-02-09 2018-06-01 世纪龙信息网络有限责任公司 Region area measuring method, device, computer equipment and storage medium
CN108154497A (en) * 2017-12-05 2018-06-12 北京掌行通信息技术有限公司 A kind of automated detection method and system for illustrating road conditions
CN109425360A (en) * 2017-08-24 2019-03-05 阿里巴巴集团控股有限公司 Applied to road conditions display methods, device and the display equipment in map
CN110825456A (en) * 2019-11-01 2020-02-21 北京博睿宏远数据科技股份有限公司 Loading time calculation method and device, computer equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016078479A1 (en) * 2014-11-17 2016-05-26 广州市动景计算机科技有限公司 Method and device for monitoring web page changes
CN107301231A (en) * 2017-06-26 2017-10-27 腾讯科技(深圳)有限公司 The page opens time-consuming method of testing and test system
CN109425360A (en) * 2017-08-24 2019-03-05 阿里巴巴集团控股有限公司 Applied to road conditions display methods, device and the display equipment in map
CN107704385A (en) * 2017-09-15 2018-02-16 天津大学 Cell phone map road conditions loading time delay automatic test approach based on Appium
CN108154497A (en) * 2017-12-05 2018-06-12 北京掌行通信息技术有限公司 A kind of automated detection method and system for illustrating road conditions
CN108109168A (en) * 2018-02-09 2018-06-01 世纪龙信息网络有限责任公司 Region area measuring method, device, computer equipment and storage medium
CN110825456A (en) * 2019-11-01 2020-02-21 北京博睿宏远数据科技股份有限公司 Loading time calculation method and device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114827754A (en) * 2022-02-23 2022-07-29 阿里巴巴(中国)有限公司 Method and device for detecting video first frame time
CN114827754B (en) * 2022-02-23 2023-09-12 阿里巴巴(中国)有限公司 Video first frame time detection method and device

Similar Documents

Publication Publication Date Title
CN109165162B (en) Test method and related equipment for vehicle-mounted system
CN111159049B (en) Automatic interface testing method and system
CN109885480B (en) Automatic interface compatibility testing method and device based on debugging bridge
CN111651366A (en) SDK test method, device, equipment and storage medium
CN111124919A (en) User interface testing method, device, equipment and storage medium
CN106294179A (en) Analog detection method in process of application development and server
CN106776338B (en) Test method, test device and server
CN109739762A (en) A kind of performance test methods and device of application program
CN106888060B (en) Anti-interference test method and system for wireless communication module
CN111831573A (en) Method, device, computer system and medium for determining code branch coverage condition
CN109801342B (en) Method and device for dynamically identifying mapping fit degree in running process on mobile equipment
CN111813686A (en) Game testing method and device, testing terminal and storage medium
CN106059860A (en) Method and device for testing network cards
WO2021227690A1 (en) Automatic testing system and method for robot, and build server and storage medium
CN111538658A (en) Automatic testing method for interface loading duration
CN109656791B (en) gPC performance test method and device based on Jmeter
CN114238134A (en) Test result display method, device, equipment and storage medium
CN111050333A (en) Base station automatic test method and system
CN112787894A (en) Wireless device test system, method, apparatus, medium, and device
CN112837640A (en) Screen dynamic picture testing method, system, electronic equipment and storage medium
CN111610965A (en) Standard SDK (software development kit) making method and device of access control platform
CN110267030A (en) TV program search automatic test approach, system and storage medium
CN115373989A (en) Automatic test system and method for vehicle, vehicle and storage medium
CN115455564A (en) Virtual automobile automatic simulation method and device based on assembly line
CN115237441A (en) Upgrade test method, device and medium based on cloud platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination