WO2023151622A1 - 页面测试方法、装置、设备及存储介质 - Google Patents

页面测试方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2023151622A1
WO2023151622A1 PCT/CN2023/075213 CN2023075213W WO2023151622A1 WO 2023151622 A1 WO2023151622 A1 WO 2023151622A1 CN 2023075213 W CN2023075213 W CN 2023075213W WO 2023151622 A1 WO2023151622 A1 WO 2023151622A1
Authority
WO
WIPO (PCT)
Prior art keywords
page
image
tested
element area
static element
Prior art date
Application number
PCT/CN2023/075213
Other languages
English (en)
French (fr)
Inventor
郭玲玲
Original Assignee
北京罗克维尔斯科技有限公司
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 北京罗克维尔斯科技有限公司 filed Critical 北京罗克维尔斯科技有限公司
Publication of WO2023151622A1 publication Critical patent/WO2023151622A1/zh

Links

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
    • 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/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present disclosure relates to the technical field of page testing, and in particular to a page testing method, device, equipment and storage medium.
  • the present disclosure provides a page testing method, device, equipment and storage medium.
  • the present disclosure provides a page testing method, which includes:
  • the page test result of the page image to be tested is determined.
  • the present disclosure provides a page testing device, the device comprising:
  • An image acquisition module configured to acquire the image of the page to be tested and the image of the reference page
  • a structural similarity calculation module configured to calculate the structural similarity between the page image to be tested and the reference page image based on the first static element area of the page image to be tested and the second static element area of the reference page image;
  • the page test result generation module is used to generate the page test result of the page image to be tested according to the structural similarity.
  • the embodiment of the present disclosure also provides a page testing device, including:
  • the processor is configured to read executable instructions from the memory, and execute the executable instructions to implement the page testing method of the first aspect above.
  • an embodiment of the present disclosure further provides a computer-readable storage medium, the storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the page testing method in the first aspect above.
  • an embodiment of the present disclosure further provides a computer program product, including a computer program, and when the computer program is executed by a processor, implements the page testing method in the first aspect above.
  • FIG. 1 is a schematic flowchart of a page testing method provided by an embodiment of the present disclosure
  • FIG. 2 is a schematic flowchart of another page testing method provided by an embodiment of the present disclosure
  • FIG. 3 is a logical schematic diagram of calculating structural similarity by an SSIM method provided by an embodiment of the present disclosure
  • FIG. 4 is a logical schematic diagram of a page testing method provided by an embodiment of the present disclosure.
  • FIG. 5 is a schematic structural diagram of a page testing device provided by an embodiment of the present disclosure.
  • FIG. 6 is a schematic structural diagram of a page testing device provided by an embodiment of the present disclosure.
  • WebDriver In the current web application page testing method, WebDriver is generally used to obtain page elements of the Web application and determine whether the page elements exist. However, WebDriver cannot verify whether the page elements meet user expectations. In order to solve this problem, it is possible to manually test whether the pages of the web application are correct. Specifically, manual testing can be carried out in software stages such as the testing stage, grayscale release stage, and full release stage. However, manual testing is inefficient and depends on the experience of testers.
  • the embodiments of the present disclosure provide a page testing method, device, device, and storage medium capable of automatically testing pages.
  • Fig. 1 shows a schematic flowchart of a page testing method provided by an embodiment of the present disclosure.
  • the page testing method shown in FIG. 1 may be executed by an electronic device or a server.
  • the electronic equipment may include, but not limited to, devices such as smart phones, notebook computers, personal digital assistants (PDA), tablet computers (PAD), portable multimedia players (PMP), vehicle terminals (such as vehicle navigation terminals), wearable devices, etc.
  • PDA personal digital assistants
  • PAD tablet computers
  • PMP portable multimedia players
  • vehicle terminals such as vehicle navigation terminals
  • wearable devices etc.
  • Mobile terminals, and stationary terminals such as digital TVs, desktop computers, smart home devices, etc.
  • the server can be a server cluster or a cloud server.
  • the page testing method may include the following steps S110 , S120 and S130 .
  • the benchmark page image of this test can be recorded by the recording tool, and when the web application needs to be tested for the page, the page test device can be obtained by the recording tool, the playback tool and the screenshot tool The image of the page under test for this test.
  • the image of the page to be tested may be an image in the web application that needs to be tested.
  • the benchmark page image may be a reference image for performing page testing.
  • the recording tool can record the page elements of the Web application, obtain the reference page image and the image of the page to be tested, and store the recorded reference page image and the image of the page to be tested in a specified file.
  • the transmission time of the reference page image can be monitored in real time, and whether network delay occurs is judged according to the transmission time.
  • an audit prompt message for the reference page image can be generated to remind the tester to review the reference page image, thereby obtaining a reference page image that has passed the review.
  • the playback tool can read the coordinates of the page elements of the page image to be tested from the specified file.
  • the screenshot tool may intercept the image of the page to be tested according to the coordinates of the page elements of the image of the page to be tested.
  • the page testing device may acquire the first static element area of the page image to be tested, and acquire the second static element area of the reference page image, according to the static elements in the first static element area and the second static element area element, and calculate the structural similarity between the image of the page to be tested and the image of the reference page.
  • both the first static element area and the second static element area may be areas composed of static elements.
  • the structural similarity may be the spatial similarity between the image of the page to be tested and the image of the reference page.
  • the page testing device after the page testing device obtains the image of the page to be tested and the image of the reference page, it can obtain the first static element area and the second static element area marked manually, or automatically determine the first static element area and the second static element area. Two static element areas; then, according to the static elements in the first static element area and the static elements in the second static element area, calculate the spatial similarity between the image of the page to be tested and the reference page image as the structural similarity.
  • S120 may specifically include the following steps:
  • the structure similarity is calculated in parallel based on the first static element area and the second static element area by using multiple threads opened in advance.
  • the page testing device can determine the number of page images to be tested, compare the number of page images to be tested with a preset number, and if the number of page images to be tested is greater than the preset number If the quantity is large, it means that the number of page images to be tested is large, and multiple threads opened in advance can be used, and based on the first The static element area and the second static element area calculate the structural similarity in parallel, otherwise, a single thread can be used to calculate the structural similarity.
  • the preset number may be the number of images used for judging whether to use multi-threaded parallel calculation of the structural similarity.
  • the page testing device may determine whether the page image to be tested passes the test according to the structural similarity, and obtain the page test result of the page image to be tested.
  • S130 may specifically include the following steps S1301 and S1302.
  • the page testing device can obtain a preset similarity threshold, compare the calculated structural similarity with the preset similarity threshold, and if the structural similarity is greater than or equal to the preset similarity threshold, then It is determined that the image of the page to be tested passes the test, and a test pass report is generated; otherwise, it is determined that the image of the page to be tested fails the test, and a test failure report is generated.
  • the similarity threshold may be a preset similarity for judging whether to pass the page test according to needs.
  • abnormal information can be fed back to the tester, so that the tester can modify the code of the page according to the abnormal information, and reacquire the image of the page to be tested, so that the page image will not be affected without affecting the function of the page. In case the page to be tested is retested.
  • test failure report includes error type and error reason
  • the page testing method may further include the following steps.
  • the page testing device can predetermine a plurality of error types and the error cause corresponding to each error type; after the page testing device generates a test failure report, it can determine the error type and the error reason, and show the tester The type of error and the cause of the error allow the tester to modify the code of the page according to the type of error displayed and the cause of the error. Therefore, the page testing method provides an effective test feedback mechanism, which is beneficial to improving the overall efficiency of the page testing process.
  • the image of the page to be tested and the reference page can be calculated based on the first static element area of the page image to be tested and the second static element area of the reference page image
  • the structural similarity of the image is further used to generate a page test result of the image of the page to be tested according to the structural similarity.
  • Fig. 2 shows a schematic flowchart of another page testing method provided by an embodiment of the present disclosure.
  • the page testing method may specifically include the following steps S210 , S220 , S230 and S240 .
  • S210 is similar to S110, and details are not described here.
  • S220 may specifically include the following step S2201.
  • the page testing device may extract the page elements to be tested whose feature values have not changed within the first preset time period, and select the elements to be tested that have not changed within the first preset time period
  • the page elements constitute the first static element area; and, the reference page elements whose characteristic values have not changed within the first preset time length can be extracted, and the reference page elements that have not changed within the first preset time length can be used to form the second static element area.
  • the first preset duration may be a time period set according to requirements for detecting static elements in the image of the page to be tested.
  • the image of the page to be tested may include at least one of static elements and dynamic elements.
  • the static element may be a pixel of a page image whose feature value never changes.
  • a dynamic element may be a pixel of a page image whose characteristic value changes continuously or periodically.
  • the feature value may be any one of brightness value, pixel value, gray value, and contrast, which is not limited here.
  • the first static element area can be formed by the elements of the page to be tested whose characteristic value does not change within the first preset time period, and the feature value does not change within the first preset time period
  • the base page element constitutes the second static element area. Therefore, the static element area can be automatically extracted from the image, and the method for determining the static element area is simple and easy to implement, and has good promotion and application value.
  • S220 may specifically include the following steps S2202, S2203 and S2204.
  • the page testing device may predetermine a template page image, and the template page image only includes static elements.
  • the page testing device can compare the page element to be tested and the reference page element with the template page element of the template page image respectively, and obtain the first comparison feature and The second comparison feature; then, the page testing device can extract the page element to be tested corresponding to the first comparison feature whose feature value has not changed within the second preset time length, and use the first comparison feature that has not changed within the second preset time length
  • the to-be-tested page elements corresponding to the features constitute the first static element area; and, the reference page elements corresponding to the second comparison features whose feature values have not changed within the second preset time length can be extracted, and the The reference page element corresponding to the changed first contrast feature constitutes the second static element area.
  • the template page image may be a mask image including only static elements.
  • the second preset duration may be a time period set according to requirements for detecting static elements in the image of the page to be tested.
  • the first preset duration and the second preset duration may or may not be equal.
  • both the first contrast feature and the second contrast feature may be any one of brightness contrast features, pixel contrast features, grayscale contrast features, and contrast contrast features, which are not limited here. It should be noted that only when the first comparison feature and the second comparison feature are the same comparison feature can they be compared and the static element area determined.
  • the first static element area can be formed by the page elements to be tested corresponding to the first comparison feature whose characteristic value has not changed within the second preset time length, and the first static element area can be formed by the first preset time length
  • the reference page elements corresponding to the second comparison feature whose internal feature value has not changed constitute the second static element area. Therefore, the static element area can be automatically extracted from the image, and the method for determining the static element area is accurate, and can accurately determine the static element area of the page image.
  • S2201 can also be executed first, and then the extracted first static element area and the second static element area can be corrected through S2202-S2204; or, S2202-S2204 can also be executed first, Then through S2201, the extracted first static element area and the second static element area are corrected.
  • S2201 for the specific implementation manners of these two manners, reference may be made to the foregoing description, and details are not repeated here.
  • S230-S240 are similar to S120-S130, and will not be repeated here.
  • the Structural Similarity (SSIM) method can be used to calculate the structural similarity.
  • the image of the page to be tested and the benchmark can be calculated according to the brightness characteristics, contrast characteristics and structural characteristics of the static element area. Structural similarity of page images.
  • S120 may specifically include the following steps S1201, S1202, S1203, and S1204.
  • the page testing device can respectively perform brightness measurement on the first static element area and the second static element area to obtain the first brightness feature and the second brightness feature, and according to the first The brightness feature is compared with the second brightness feature to obtain a brightness average value.
  • the page testing device may respectively perform contrast measurement on the first static element area and the second static element area to obtain the first contrast feature and the second contrast feature, and according to the first contrast feature Perform a contrast comparison with the second contrast feature to obtain a contrast standard deviation.
  • the page testing device may respectively perform structural measurement on the first static element area and the second static element area to obtain the first structural feature and the second structural feature, and according to the first The structural features and the second structural features are compared to obtain the structural covariance.
  • the page testing device can perform similarity measurement according to the average brightness, standard deviation of contrast, and structural covariance. Then, according to the weights, the weighted summation of the average brightness, contrast standard deviation and structural covariance is carried out to obtain the structural similarity.
  • FIG. 3 shows a schematic diagram of calculating the structural similarity by an SSIM method provided by an embodiment of the present disclosure.
  • image x and image y are obtained, wherein image x is the image of the page to be tested, and image y is the image of the reference page; then, the first static element area of image x and the second static element area of image y The brightness of the element area is measured to obtain the first brightness feature and the second brightness feature.
  • the contrast measurement is performed on the first static element area of image x and the second static element area of image y to obtain the first contrast feature and the second contrast feature, and perform structural measurement on the first static element area of image x and the second static element area of image y to obtain the first structural feature and the second structural feature; then, according to the first brightness feature and the second brightness feature, perform Contrast the brightness, obtain the average value of the brightness, compare the contrast according to the first contrast feature and the second contrast feature, and obtain the standard deviation of the contrast, and perform a structural comparison according to the first structural feature and the second structural feature to obtain the structural covariance; finally , according to the average brightness, contrast standard deviation and structural covariance to measure the similarity.
  • the weight corresponding to each feature can be obtained, and the weighted sum of the average brightness, contrast standard deviation and structural covariance can be obtained to obtain the structural similarity .
  • the SSIM method can be used to determine the brightness feature, contrast feature and structural feature of the static element area, and calculate the structural similarity according to the brightness feature, contrast feature and structural feature of the static element area. Therefore, in this way, the structural similarity between the image of the page to be tested and the image of the reference page can be accurately calculated, thereby improving the accuracy of the page test.
  • Fig. 4 shows a schematic diagram of a page testing method provided by an embodiment of the present disclosure.
  • the page testing method may include the following steps S410 , S420 , S430 , S440 , S450 , S460 , S470 and S480 .
  • S410 is similar to the manner of acquiring the reference page image in S110 , and will not be repeated here.
  • the review result of the reference page image can be determined through manual review or automatic review, and judge whether the reference page image has passed the review according to the review result, and if it passes, obtain the page to be tested image, otherwise, refetch the base page image.
  • S430 is similar to the method of acquiring the image of the page to be tested in S110 , and details are not repeated here.
  • the page testing device may calculate the structural similarity between the image to be tested and the reference page image based on the first static element area of the image to be tested and the second static element area of the reference page image.
  • the structural similarity may be made to the descriptions of the foregoing embodiments, and details are not repeated here.
  • Fig. 5 shows a schematic structural diagram of a page testing device provided by an embodiment of the present disclosure.
  • the page testing apparatus shown in FIG. 5 may be executed by an electronic device or a server.
  • the electronic equipment may include, but not limited to, devices such as smart phones, notebook computers, personal digital assistants (PDA), tablet computers (PAD), portable multimedia players (PMP), vehicle terminals (such as vehicle navigation terminals), wearable devices, etc.
  • PDA personal digital assistants
  • PAD tablet computers
  • PMP portable multimedia players
  • vehicle terminals such as vehicle navigation terminals
  • wearable devices etc.
  • Mobile terminals, and stationary terminals such as digital TVs, desktop computers, smart home devices, etc.
  • the server can be a server cluster or a cloud server.
  • the page testing device 500 may include: an image acquisition module 510 , a structure similarity calculation module 520 and a page test result generation module 530 .
  • the image acquisition module 510 can be used to acquire the image of the page to be tested and the image of the reference page;
  • the structural similarity calculation module 520 can be used to calculate the structural similarity between the image of the page to be tested and the image of the reference page based on the first static element area of the page image to be tested and the second static element area of the reference page image;
  • the page test result generating module 530 may be configured to generate a page test result of the page image to be tested according to the structural similarity.
  • the image of the page to be tested and the reference page can be calculated based on the first static element area of the page image to be tested and the second static element area of the reference page image
  • the structural similarity of the image is further used to generate a page test result of the image of the page to be tested according to the structural similarity.
  • the device may further include a static element area determination module.
  • the static element area determination module can identify the first static element area of the page image to be tested and the second static element area of the reference page image based on the page elements to be tested of the page image to be tested and the reference page elements of the reference page image.
  • the static element area determination module may be specifically configured to form the first static element area according to the detection of the page elements to be tested that have not The reference page elements that have not changed within a preset period of time constitute the second static element area.
  • the static element area determination module may include a template page image acquisition unit, a page element comparison unit, and a static element area determination unit.
  • the template page image acquisition unit can be used to acquire a predetermined template page image, and the template page image is a page image composed of static elements;
  • the page element comparison unit can be used to compare the template page element of the template page image with the page element to be tested to obtain the first comparison feature, and compare the template page element of the template page image with the reference page element to obtain the second comparison feature;
  • the static element area determination unit may be configured to form a first static element area based on the detection of the page element to be tested corresponding to the first contrast feature that has not changed within the second preset time length, and, based on the detection of the second preset time length
  • the reference page elements corresponding to the second comparison features that have not changed in the reference page constitute the second static element area.
  • the structural similarity calculation module 520 can be specifically configured to calculate the image of the page to be tested and the reference page according to the brightness features, contrast features, and structural features of the first static element area and the second static element area, respectively. Structural similarity of images.
  • the structural similarity calculation module 520 may be specifically configured to calculate the image of the page to be tested and the reference page according to the first brightness feature of the first static element area and the second brightness feature of the second static element area the brightness average of the image;
  • the first contrast feature of the first static element area and the second contrast feature of the second static element area calculate the contrast standard deviation between the image of the page to be tested and the image of the reference page;
  • Structural similarity is obtained by weighted summation of brightness mean, contrast standard deviation, and structural covariance.
  • the structural similarity calculation module 520 can be specifically configured to, when the number of page images to be tested is greater than a preset number, use multiple threads opened in advance, based on the first static element area and the second In two static element regions, the structural similarity is calculated in parallel.
  • the page test result generation module 530 may include a comparison unit and a report generation unit.
  • a comparison unit which can be used to compare the structural similarity with a preset similarity threshold
  • a report generating unit which can be used to generate a test if the structural similarity is greater than or equal to a preset similarity threshold pass report, otherwise, generate a test fail report.
  • the test failure report includes error type and error reason
  • the page testing device may also include a display module.
  • the display module can be used to display the error type and error reason.
  • the page testing device 500 shown in FIG. 5 can execute each step in the method embodiment shown in FIG. 1 and FIG. 4 , and realize each process and effects, which will not be described here.
  • FIG. 6 shows a schematic diagram of a hardware circuit structure of a page testing device provided by an embodiment of the present disclosure.
  • the page testing device 600 may include a controller 601 and a memory 602 storing computer program instructions.
  • the above-mentioned controller 601 may include a central processing unit (CPU), or an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
  • CPU central processing unit
  • ASIC Application Specific Integrated Circuit
  • Memory 602 may include mass storage for information or instructions.
  • memory 602 may include a hard disk drive (Hard Disk Drive, HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a Universal Serial Bus (Universal Serial Bus, USB) drive or two or more A combination of the above.
  • Storage 602 may include removable or non-removable (or fixed) media, where appropriate.
  • Memory 602 may be internal or external to the integrated gateway device, where appropriate.
  • memory 602 is a non-volatile solid-state memory.
  • the memory 602 includes a read-only memory (Read-Only Memory, ROM).
  • the ROM can be a mask programmed ROM, a programmable ROM (Programmable ROM, PROM), an erasable PROM (Electrical Programmable ROM, EPROM), an electrically erasable PROM (Electrically Erasable Programmable ROM, EEPROM) ), electrically rewritable ROM (Electrically Alterable ROM, EAROM) or flash memory, or a combination of two or more of these.
  • the controller 601 reads and executes the computer program instructions stored in the memory 602 to execute the steps of the page testing method provided by the embodiments of the present disclosure.
  • the page testing device 600 may further include a transceiver 603 and a bus 604 .
  • the controller 601 , the memory 602 and the transceiver 603 are connected through a bus 604 and complete mutual communication.
  • Bus 604 includes hardware, software, or both.
  • the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Super Transmission (Hyper Transport, HT) interconnection, Industrial Standard Architecture (Industrial Standard Architecture, ISA) bus, Infiniband Interconnection, Low Pin Count (Low Pin Count, LPC) bus, memory bus, Micro Channel Architecture (Micro Channel Architecture) , MCA) bus, Peripheral Component Interconnect (PCI) bus, PCI-Express (PCI-X) bus, Serial Advanced Technology Attachment (Serial Advanced Technology Attachment, SATA) bus, Video Electronics Standards Association local (Video Electronics Standards Association Local Bus, VLB) bus or other suitable bus or a combination of two or more of these.
  • Bus 604 may comprise one or more buses, where appropriate. Although the embodiments of this application describe and illustrate a particular bus, this application contemplates any suitable bus or interconnect even.
  • the following are the embodiments of the computer-readable storage medium provided by the embodiments of the present disclosure.
  • the computer-readable storage medium and the page testing methods of the above-mentioned embodiments belong to the same inventive concept, and are not detailed in the embodiments of the computer-readable storage medium.
  • This embodiment provides a storage medium containing computer-executable instructions, and the computer-executable instructions are used to execute a page testing method when executed by a computer processor.
  • the method includes:
  • the page test result of the page image to be tested is determined.
  • the computer-executable instructions are not limited to the operations of the above method, and may also perform related operations in the page testing method provided by any embodiment of the present disclosure. .
  • This embodiment provides a computer program product, including a computer program, and when the computer program is executed by a processor, the above page testing method is implemented.
  • the present disclosure can be implemented by means of software and necessary general-purpose hardware, and of course can also be implemented by hardware, but in many cases the former is a better implementation mode .
  • the technical solution of the present disclosure can be embodied in the form of a software product in essence or the part that contributes to the prior art, and the computer software product can be stored in a computer-readable storage medium, such as a floppy disk of a computer , read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), flash memory (FLASH), hard disk or CD, etc., including several instructions to make a computer cloud platform (which can be a personal A computer, a server, or a network cloud platform, etc.) executes the page testing methods provided by various embodiments of the present disclosure.
  • a computer cloud platform which can be a personal A computer, a server, or a network cloud platform, etc.
  • a page testing method, device, device, and storage medium can, after acquiring the image of the page to be tested and the image of the reference page, be able to The element area calculates the structural similarity between the image of the page to be tested and the image of the reference page, and further generates a page test result of the image of the page to be tested according to the structural similarity.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Debugging And Monitoring (AREA)
  • Image Analysis (AREA)

Abstract

本公开提供了一种页面测试方法,包括:获取待测试页面图像和基准页面图像;基于待测试页面图像的第一静态元素区域与基准页面图像的第二静态元素区域,计算待测试页面图像和基准页面图像的结构相似度;根据结构相似度,确定待测试页面图像的页面测试结果。

Description

页面测试方法、装置、设备及存储介质
相关申请的交叉引用
本申请基于申请号为202210121531.0、申请日为2022年2月9日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本公开涉及页面测试技术领域,尤其涉及一种页面测试方法、装置、设备及存储介质。
背景技术
随着Web应用的功能越来越复杂,Web应用的页面测试越来越得到重视。但是,目前的Web应用的页面测试方法,只能通过人工方式测试Web应用的页面是否正确,这种测试方式效率很低,若测试者经验不足,不能保证页面测试的准确性。因此,提出一种自动化的页面测试方法是目前亟需解决的技术问题。
发明内容
为了解决上述技术问题,本公开提供了一种页面测试方法、装置、设备及存储介质。
在第一方面,本公开提供了一种页面测试方法,该方法包括:
获取待测试页面图像和基准页面图像;
基于待测试页面图像的第一静态元素区域与基准页面图像的第二静态元素区域,计算待测试页面图像和基准页面图像的结构相似度;
根据结构相似度,确定待测试页面图像的页面测试结果。
在第二方面,本公开提供了一种页面测试装置,该装置包括:
图像获取模块,用于获取待测试页面图像和基准页面图像;
结构相似度计算模块,用于基于待测试页面图像的第一静态元素区域与基准页面图像的第二静态元素区域,计算待测试页面图像和基准页面图像的结构相似度;
页面测试结果生成模块,用于根据结构相似度,生成待测试页面图像的页面测试结果。
在第三方面,本公开实施例还提供了一种页面测试设备,包括:
处理器;
存储器,用于存储可执行指令;
其中,处理器用于从存储器中读取可执行指令,并执行可执行指令以实现上述第一方面的页面测试方法。
在第四方面,本公开实施例还提供了一种计算机可读存储介质,存储介质存储有计算机程序,当计算机程序被处理器执行时,使得处理器实现上述第一方面的页面测试方法。
在第五方面,本公开实施例还提供了一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现上述第一方面的页面测试方法。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本公开实施例提供的一种页面测试方法的流程示意图;
图2为本公开实施例提供的另一种页面测试方法的流程示意图;
图3为本公开实施例提供的一种SSIM方法计算结构相似度的逻辑示意图;
图4为本公开实施例提供的一种页面测试方法的逻辑示意图;
图5为本公开实施例提供的一种页面测试装置的结构示意图;
图6为本公开实施例提供的一种页面测试设备的结构示意图。
具体实施方式
为了能够更清楚地理解本公开的上述目的、特征和优点,下面将对本公开的方案进行进一步描述。需要说明的是,在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合。
在下面的描述中阐述了很多具体细节以便于充分理解本公开,但本公开还可以采用其他不同于在此描述的方式来实施;显然,说明书中的实施例只是本公开的一部分实施例,而不是全部的实施例。
目前的Web应用的页面测试方法,一般利用WebDriver去获取Web应用的页面元素,并判断页面元素是否存在,但是,WebDriver无法验证页面元素是否满足用户的预期。为了解决该问题,可以通过人工方式来测试Web应用的页面是否正确,具体可以在测试阶段、灰度发布阶段以及全量发布阶段等软件阶段进行人工测试。但是,基于人工测试方式效率很低,且依赖测试者经验。
为了解决上述问题,本公开实施例提供了一种能够对页面进行自动化测试的页面测试方法、装置、设备及存储介质。
下面首先结合图1至图4对本公开实施例提供的页面测试方法进行说明。
图1示出了本公开实施例提供的一种页面测试方法的流程示意图。
在本公开一些实施例中,图1所示的页面测试方法可以由电子设备或服务器执行。该电子设备可以包括但不限于诸如智能手机、笔记本电脑、个人数字助理(PDA)、平板电脑(PAD)、便携式多媒体播放器(PMP)、车载终端(例如车载导航终端)、可穿戴设备等的移动终端,以及诸如数字TV、台式计算机、智能家居设备等的固定终端。服务器可以是服务器集群也可以是云服务器。
如图1所示,该页面测试方法可以包括如下步骤S110、S120和S130。
S110、获取待测试页面图像和基准页面图像。
在本公开实施例中,在进行页面测试之前,可以通过录制工具录制本次测试的基准页面图像,当需要对Web应用进行页面测试时,页面测试设备可以通过录制工具、回放工具以及截图工具获取本次测试的待测试页面图像。
在本公开实施例中,待测试页面图像可以是Web应用中需要进行页面测试的图像。
在本公开实施例中,基准页面图像可以是进行页面测试的参考图像。
在本公开实施例中,录制工具可以记录Web应用的页面元素,得到基准页面图像和待测试页面图像,并将录制得到的基准页面图像和待测试页面图像存储在指定文件中。
需要说明的是,在获取基准页面图像时,可以实时监测基准页面图像的传输时间,根据传输时间判断是否发生网络延迟,若发生网络延迟,在网络恢复之后继续发送未传输完的页面元素,直至得到完整的基准页面图像;进一步的,在得到基准页面图像之后,可以生成针对基准页面图像的审核提示信息,提醒测试者审核基准页面图像,由此,可以得到通过审核的基准页面图像。
在本公开实施例中,回放工具可以从指定文件中读取待测试页面图像的页面元素的坐标。
在本公开实施例中,截图工具可以根据待测试页面图像的页面元素的坐标,截取待测试页面图像。
S120、基于待测试页面图像的第一静态元素区域与基准页面图像的第二静态元素区域,计算待测试页面图像和基准页面图像的结构相似度。
在本公开实施例中,页面测试设备可以获取待测试页面图像的第一静态元素区域,以及获取基准页面图像的第二静态元素区域,根据第一静态元素区域和第二静态元素区域中的静态元素,计算待测试页面图像和基准页面图像的结构相似度。
在本公开实施例中,第一静态元素区域和第二静态元素区域均可以是由静态元素构成的区域。
在本公开实施例中,结构相似度可以是待测试页面图像和基准页面图像在空间上的相似度。
在一些实施例中,在页面测试设备获取到待测试页面图像和基准页面图像之后,可以获取人工标注的第一静态元素区域和第二静态元素区域,或者,自动确定第一静态元素区域和第二静态元素区域;接着,根据第一静态元素区域的静态元素和第二静态元素区域中静态元素,计算待测试页面图像和基准页面图像在空间上的相似度,作为结构相似度。
在本公开实施例中,当需要测试大量的页面图像时,可以利用多个线程并行计算待测试页面图像的结构相似度。基于此,在一些实施例中,S120具体可以包括如下步骤:
在待测试页面图像的数量大于预设数量的情况下,利用预先开启的多个线程,基于第一静态元素区域与第二静态元素区域,并行计算结构相似度。
在一些实施例中,在进行页面测试的过程中,页面测试设备可以确定待测试页面图像的数量,将待测试页面图像的数量与预设数量进行比较,如果待测试页面图像的数量大于预设数量,则说明需要测试的页面图像的数量很大,可以利用预先开启的多个线程,并基于第一 静态元素区域与第二静态元素区域,并行计算结构相似度,否则,可以利用单个线程计算结构相似度。
其中,预设数量可以是用于判断是否利用多线程并行计算结构相似度的图像数量。
由此,在对大量的页面图像进行测试时,可以利用多个线程并行计算待测试页面图像的结构相似度,提高了页面测试的效率。
S130、根据结构相似度,确定待测试页面图像的页面测试结果。
在本公开实施例中,页面测试设备可以根据结构相似度的大小,确定待测试页面图像是否通过测试,得到待测试页面图像的页面测试结果。
在本公开实施例中,在一些实施例中,S130具体可以包括如下步骤S1301和S1302。
S1301、将结构相似度与预先设置的相似度阈值进行比较。
S1302、若结构相似度大于或等于预先设置的相似度阈值,则生成测试通过报告,否则,生成测试未通过报告。
在一些实施例中,页面测试设备可以获取预先设置的相似度阈值,将计算得到的结构相似度与预先设置的相似度阈值进行比较,若结构相似度大于或等于预先设置的相似度阈值,则确定待测试页面图像通过测试,并生成测试通过报告,否则,确定待测试页面图像未通过测试,并生成测试未通过报告。
其中,相似度阈值可以是根据需要预先设置的用于判断是否通过页面测试的相似度。
需要说明的是,若待测试页面图像未通过测试,则可以向测试者反馈异常信息,使得测试者根据异常信息进行页面代码的修改,并重新获取待测试页面图像,使得在不影响页面功能的情况下对待测试页面进行重新测试。
进一步的,测试未通过报告包括错误类型和错误原因;
相应的,在S1302之后,该页面测试方法还可以包括如下步骤。
显示错误类型和错误原因。
在一些实施例中,页面测试设备可以预先确定多个错误类型和每个错误类型对应的错误原因;在页面测试设备生成测试未通过报告之后,可以确定错误类型和错误原因,并向测试者展示错误类型和错误原因,使得测试者根据展示错误类型和错误原因针对性的修改页面代码。因此,该页面测试方法提供了一种有效的测试反馈机制,有利于提高页面测试过程的整体效率。
在本公开实施例中,在获取待测试页面图像和基准页面图像之后,能够基于待测试页面图像的第一静态元素区域与基准页面图像的第二静态元素区域,计算待测试页面图像和基准页面图像的结构相似度,进一步根据结构相似度,生成待测试页面图像的页面测试结果。由此,可以根据待测试页面图像与基准页面图像之间的结构相似度,评估待测试页面图像是否通过测试,实现了对页面进行自动化测试,提高了测试效率,且不依赖测试者经验,保证了页面测试的准确性;并且,页面图像中的静态元素稳定,根据静态元素来评估页面测试结果,进一步提高了待测试页面图像的测试结果的准确性。
在本公开另一种实施方式中在计算结构相似度之前,可以采用不同的方式识别第一静态 元素区域和第二静态元素区域。
图2示出了本公开实施例提供的另一种页面测试方法的流程示意图。
如图2所示,该页面测试方法具体可以包括如下步骤S210、S220、S230和S240。
S210、获取待测试页面图像和基准页面图像。
其中,S210与S110相似,在此不做赘述。
S220、基于待测试页面图像的待测试页面元素和基准页面图像的基准页面元素,识别待测试页面图像的第一静态元素区域以及基准页面图像的第二静态元素区域。
在一些实施例中,S220具体可以包括如下步骤S2201。
S2201、根据检测到第一预设时长内未发生变化的待测试页面元素,构成第一静态元素区域,以及,根据检测到第一预设时长内未发生变化的基准页面元素,构成第二静态元素区域。
在一些实施例中,当需要提取静态元素区域时,页面测试设备可以提取第一预设时长内特征值未发生变化的待测试页面元素,并由第一预设时长内未发生变化的待测试页面元素,构成第一静态元素区域;并且,可以提取第一预设时长内特征值未发生变化的基准页面元素,并由第一预设时长内未发生变化的基准页面元素,构成第二静态元素区域。
其中,第一预设时长可以是根据需要设置的用于检测待测试页面图像中的静态元素的时间段。
需要说明的是,待测试页面图像可以包括静态元素和动态元素中的至少一种。其中,静态元素可以是特征值始终不发生变化页面图像的像素。动态元素可以是特征值持续变化或者周期变化的页面图像的像素。
在一些实施例中,特征值可以是亮度值、像素值、灰度值、对比度中的任意一种,在此不做限制。
由此,在本公开实施例中,可以由第一预设时长内特征值未发生变化的待测试页面元素,构成第一静态元素区域,以及,由第一预设时长内特征值未发生变化的基准页面元素,构成第二静态元素区域。因此,可以从图像中自动提取静态元素区域,并且,这种静态元素区域的确定方法简单易于实现,有很好的推广应用价值。
在另一些实施例中,S220具体可以包括如下步骤S2202、S2203和S2204。
S2202、获取预先确定的模板页面图像,模板页面图像是由静态元素构成的页面图像;
S2203、将模板页面图像的模板页面元素与待测试页面元素进行对比,得到第一对比特征,以及将模板页面图像的模板页面元素与基准页面元素进行对比,得到第二对比特征;
S2204、基于检测到第二预设时长内未发生变化的第一对比特征对应的待测试页面元素,构成第一静态元素区域,以及,基于检测到第二预设时长内未发生变化的第二对比特征对应的基准页面元素,构成第二静态元素区域。
在一些实施例中,在计算结构相似度之前,页面测试设备可以预先确定模板页面图像,模板页面图像只包括静态元素。当需要提取静态元素区域时,页面测试设备可以将待测试页面元素和基准页面元素分别与模板页面图像的模板页面元素进行对比,得到第一对比特征和 第二对比特征;接着,页面测试设备可以提取第二预设时长内特征值未发生变化的第一对比特征对应的待测试页面元素,并由第二预设时长内未发生变化的第一对比特征对应的待测试页面元素,构成第一静态元素区域;并且,可以提取第二预设时长内特征值未发生变化的第二对比特征对应的基准页面元素,并由第二预设时长内未发生变化的第一对比特征对应的基准页面元素,构成第二静态元素区域。
其中,模板页面图像可以一种只包括静态元素的蒙版图像。
其中,第二预设时长可以是根据需要设置的用于检测待测试页面图像中的静态元素的时间段。在一些实施例中,第一预设时长与第二预设时长可以相等也可以不相等。
在一些实施例中,第一对比特征和第二对比特征都可以为亮度对比特征、像素对比特征、灰度对比特征、对比度对比特征中的任意一种特征,在此不做限制。需要说明的是,第一对比特征和第二对比特征为相同的对比特征时,才可以进行比较,且确定静态元素区域。
由此,在本公开实施例中,可以由第二预设时长内特征值未发生变化的第一对比特征对应的待测试页面元素,构成第一静态元素区域,以及,由第一预设时长内特征值未发生变化的第二对比特征对应的基准页面元素,构成第二静态元素区域。因此,可以从图像中自动提取静态元素区域,并且,这种静态元素区域的确定方法准确,能够准确的确定页面图像的静态元素区域。
需要说明的是,在实际应用过程中,也可以先执行S2201,再通过S2202~S2204对提取到的第一静态元素区域和第二静态元素区域进行修正;或者,也可以先执行S2202~S2204,再通过S2201对提取到的第一静态元素区域和第二静态元素区域进行修正。其中,这两种方式的具体实现方式可以参考上述描述,在此不做赘述。
综上,在本公开实施例中,可以采用不同的方式识别第一静态元素区域和第二静态元素区域,提高了确定静态元素区域的灵活性,能够适应多种应用场景。
S230、基于待测试页面图像的第一静态元素区域与基准页面图像的第二静态元素区域,计算待测试页面图像和基准页面图像的结构相似度。
S240、根据结构相似度,确定待测试页面图像的页面测试结果。
其中,S230~S240与S120~S130相似,在此不做赘述。
在本公开又一种实施方式中,可以采用结构相似性(Structural Similarity,SSIM)方法计算结构相似度,具体可以根据静态元素区域的亮度特征、对比度特征以及结构特征,计算待测试页面图像和基准页面图像的结构相似度。
在本公开实施例中,在一些实施例中,S120具体可以包括如下步骤S1201、S1202、S1203和S1204。
S1201、根据第一静态元素区域的第一亮度特征和第二静态元素区域的第二亮度特征,计算待测试页面图像和基准页面图像的亮度平均值。
在一些实施例中,当需要计算结构相似度时,页面测试设备可以分别对第一静态元素区域和第二静态元素区域进行亮度测量,得到第一亮度特征和第二亮度特征,并根据第一亮度特征和第二亮度特征,进行亮度对比,得到亮度平均值。
S1202、根据第一静态元素区域的第一对比度特征和第二静态元素区域的第二对比度特征,计算待测试页面图像和基准页面图像的对比度标准差。
在一些实施例中,在执行S1201的同时,页面测试设备可以分别对第一静态元素区域和第二静态元素区域进行对比度测量,得到第一对比度特征和第二对比度特征,并根据第一对比度特征和第二对比度特征,进行对比度对比,得到对比度标准差。
S1203、根据第一静态元素区域的第一结构特征和第二静态元素区域的第二结构特征,计算待测试页面图像和基准页面图像的结构协方差。
在一些实施例中,在执行S1201和S1202的同时,页面测试设备可以分别对第一静态元素区域和第二静态元素区域进行结构测量,得到第一结构特征和第二结构特征,并根据第一结构特征和第二结构特征,进行结构对比,得到结构协方差。
S1204、对亮度平均值、对比度标准差和结构协方差进行加权求和,得到结构相似度。
在一些实施例中,在得到亮度平均值、对比度标准差和结构协方差之后,页面测试设备可以根据亮度平均值、对比度标准差和结构协方差进行相似度测量,具体可以获取每个特征分别对应的权重,然后,根据权重,对亮度平均值、对比度标准差和结构协方差进行加权求和,得到结构相似度。
为了在一些实施例中解释结构相似度的计算过程,图3示出了本公开实施例提供的一种SSIM方法计算结构相似度的逻辑示意图。
如图3所示,首先,获取图像x和图像y,其中,图像x为待测试页面图像,图像y为基准页面图像;然后,对图像x的第一静态元素区域和图像y的第二静态元素区域进行亮度测量,得到第一亮度特征和第二亮度特征,同时,对图像x的第一静态元素区域和图像y的第二静态元素区域进行对比度测量,得到第一对比度特征和第二对比度特征,以及对图像x的第一静态元素区域和图像y的第二静态元素区域进行结构测量,得到第一结构特征和第二结构特征;接着,根据第一亮度特征和第二亮度特征,进行亮度对比,得到亮度平均值、根据第一对比度特征和第二对比度特征,进行对比度对比,得到对比度标准差,以及根据第一结构特征和第二结构特征,进行结构对比,得到结构协方差;最后,根据亮度平均值、对比度标准差和结构协方差进行相似度测量,具体可以获取每个特征分别对应的权重,对亮度平均值、对比度标准差和结构协方差进行加权求和,得到结构相似度。
由此,在本公开实施例中,可以采用SSIM方法确定静态元素区域的亮度特征、对比度特征以及结构特征,以及根据静态元素区域的亮度特征、对比度特征以及结构特征,计算结构相似度。由此,通过这种方式,可以准确的计算待测试页面图像和基准页面图像的结构相似度,提高了页面测试的准确性。
在本公开再一种实施方式中,提供了一种页面测试方法的逻辑示意图。
图4示出了本公开实施例提供的一种页面测试方法的逻辑示意图。
如图4所示,该页面测试方法可以包括如下步骤S410、S420、S430、S440、S450、S460、S470和S480。
S410、获取基准页面图像。
其中,S410与S110中的获取基准页面图像的方式相似,在此不做赘述。
S420、判断基准页面图像是否审核通过,若是,则执行S430,否则,返回执行S410。
在一些实施例中,在获取基准页面图像之后,可以通过人工审核或者自动审核的方式,确定基准页面图像的审核结果,根据审核结果判断基准页面图像是否审核通过,如果通过,则获取待测试页面图像,否则,重新获取基准页面图像。
S430、获取待测试页面图像。
其中,S430与S110中的获取待测试页面图像的方式相似,在此不做赘述。
S440、将待测试页面图像与基准页面图像进行对比,计算待测试页面图像和基准页面图像的结构相似度。
在一些实施例中,页面测试设备可以基于待测试页面图像的第一静态元素区域与基准页面图像的第二静态元素区域,计算待测试页面图像和基准页面图像的结构相似度。其中,结构相似度的具体计算方式可以参见前述实施例的描述,在此不做赘述。
S450、判断结构相似度是否大于预先设置的相似度阈值,若是,则执行S460,否则,执行S470。
S460、确定待测试页面通过测试,生成测试通过报告。
S470、确定待测试页面未通过测试,生成测试未通过报告。
S480、保存测试通过报告和测试未通过报告。
其中,S450~S480具体实现方法可以参照前述实施例的描述,在此不做赘述。
图5示出了本公开实施例提供的一种页面测试装置的结构示意图。
在本公开一些实施例中,图5所示的页面测试装置可以由电子设备或服务器执行。该电子设备可以包括但不限于诸如智能手机、笔记本电脑、个人数字助理(PDA)、平板电脑(PAD)、便携式多媒体播放器(PMP)、车载终端(例如车载导航终端)、可穿戴设备等的移动终端,以及诸如数字TV、台式计算机、智能家居设备等的固定终端。服务器可以是服务器集群也可以是云服务器。
如图5所示,该页面测试装置500可以包括:图像获取模块510、结构相似度计算模块520和页面测试结果生成模块530。
图像获取模块510,可以用于获取待测试页面图像和基准页面图像;
结构相似度计算模块520,可以用于基于待测试页面图像的第一静态元素区域与基准页面图像的第二静态元素区域,计算待测试页面图像和基准页面图像的结构相似度;
页面测试结果生成模块530,可以用于根据结构相似度,生成待测试页面图像的页面测试结果。
在本公开实施例中,在获取待测试页面图像和基准页面图像之后,能够基于待测试页面图像的第一静态元素区域与基准页面图像的第二静态元素区域,计算待测试页面图像和基准页面图像的结构相似度,进一步根据结构相似度,生成待测试页面图像的页面测试结果。由此,可以根据待测试页面图像与基准页面图像之间的结构相似度,评估待测试页面图像是否通过测试,实现了对页面进行自动化测试,提高了测试效率,且不依赖测试者经验,保证了 页面测试的准确性;并且,页面图像中的静态元素稳定,根据静态元素来评估页面测试结果,进一步提高了待测试页面图像的测试结果的准确性。
在本公开一些实施例中,该装置还可以包括静态元素区域确定模块。
静态元素区域确定模块,可以基于待测试页面图像的待测试页面元素和基准页面图像的基准页面元素,识别待测试页面图像的第一静态元素区域以及基准页面图像的第二静态元素区域。
在本公开一些实施例中,静态元素区域确定模块具体可以用于,根据检测到第一预设时长内未发生变化的待测试页面元素,构成第一静态元素区域,以及,根据检测到第一预设时长内未发生变化的基准页面元素,构成第二静态元素区域。
在本公开一些实施例中,静态元素区域确定模块可以包括模板页面图像获取单元、页面元素对比单元和静态元素区域确定单元。
模板页面图像获取单元,可以用于获取预先确定的模板页面图像,模板页面图像是由静态元素构成的页面图像;
页面元素对比单元,可以用于将模板页面图像的模板页面元素与待测试页面元素进行对比,得到第一对比特征,以及将模板页面图像的模板页面元素与基准页面元素进行对比,得到第二对比特征;
静态元素区域确定单元,可以用于基于检测到第二预设时长内未发生变化的第一对比特征对应的待测试页面元素,构成第一静态元素区域,以及,基于检测到第二预设时长内未发生变化的第二对比特征对应的基准页面元素,构成第二静态元素区域。
在本公开一些实施例中,结构相似度计算模块520具体可以用于,分别根据第一静态元素区域和第二静态元素区域的亮度特征、对比度特征以及结构特征,计算待测试页面图像和基准页面图像的结构相似度。
在本公开一些实施例中,结构相似度计算模块520具体可以用于,根据第一静态元素区域的第一亮度特征和第二静态元素区域的第二亮度特征,计算待测试页面图像和基准页面图像的亮度平均值;
根据第一静态元素区域的第一对比度特征和第二静态元素区域的第二对比度特征,计算待测试页面图像和基准页面图像的对比度标准差;
根据第一静态元素区域的第一结构特征和第二静态元素区域的第二结构特征,计算待测试页面图像和基准页面图像的结构协方差;
对亮度平均值、对比度标准差和结构协方差进行加权求和,得到结构相似度。
在本公开一些实施例中,结构相似度计算模块520具体可以用于,在待测试页面图像的数量大于预设数量的情况下,利用预先开启的多个线程,基于第一静态元素区域与第二静态元素区域,并行计算结构相似度。
在本公开一些实施例中,页面测试结果生成模块530可以包括比较单元和报告生成单元。
比较单元,可以用于将结构相似度与预先设置的相似度阈值进行比较;
报告生成单元,可以用于若结构相似度大于或等于预先设置的相似度阈值,则生成测试 通过报告,否则,生成测试未通过报告。
在本公开一些实施例中,测试未通过报告包括错误类型和错误原因;
相应的,该页面测试装置还可以包括显示模块。
显示模块,可以用于显示错误类型和错误原因。
需要说明的是,图5所示的页面测试装置500可以执行图1和图4所示的方法实施例中的各个步骤,并且实现图1和图4所示的方法实施例中的各个过程和效果,在此不做赘述。
图6示出了本公开实施例提供的一种页面测试设备的硬件电路结构示意图。
如图6所示,该页面测试设备600可以包括控制器601以及存储有计算机程序指令的存储器602。
在一些实施例中,上述控制器601可以包括中央处理器(CPU),或者特定集成电路(Application Specific Integrated Circuit,ASIC),或者可以被配置成实施本申请实施例的一个或多个集成电路。
存储器602可以包括用于信息或指令的大容量存储器。举例来说而非限制,存储器602可以包括硬盘驱动器(Hard Disk Drive,HDD)、软盘驱动器、闪存、光盘、磁光盘、磁带或通用串行总线(Universal Serial Bus,USB)驱动器或者两个及其以上这些的组合。在合适的情况下,存储器602可包括可移除或不可移除(或固定)的介质。在合适的情况下,存储器602可在综合网关设备的内部或外部。在特定实施例中,存储器602是非易失性固态存储器。在特定实施例中,存储器602包括只读存储器(Read-Only Memory,ROM)。在合适的情况下,该ROM可以是掩模编程的ROM、可编程ROM(Programmable ROM,PROM)、可擦除PROM(Electrical Programmable ROM,EPROM)、电可擦除PROM(Electrically Erasable Programmable ROM,EEPROM)、电可改写ROM(Electrically Alterable ROM,EAROM)或闪存,或者两个或及其以上这些的组合。
控制器601通过读取并执行存储器602中存储的计算机程序指令,以执行本公开实施例所提供的页面测试方法的步骤。
在一个示例中,该页面测试设备600还可包括收发器603和总线604。其中,如图6所示,控制器601、存储器602和收发器603通过总线604连接并完成相互间的通信。
总线604包括硬件、软件或两者。举例来说而非限制,总线可包括加速图形端口(Accelerated Graphics Port,AGP)或其他图形总线、增强工业标准架构(Extended Industry Standard Architecture,EISA)总线、前端总线(Front Side BUS,FSB)、超传输(Hyper Transport,HT)互连、工业标准架构(Industrial Standard Architecture,ISA)总线、无限带宽互连、低引脚数(Low Pin Count,LPC)总线、存储器总线、微信道架构(Micro Channel Architecture,MCA)总线、外围控件互连(Peripheral Component Interconnect,PCI)总线、PCI-Express(PCI-X)总线、串行高级技术附件(Serial Advanced Technology Attachment,SATA)总线、视频电子标准协会局部(Video Electronics Standards Association Local Bus,VLB)总线或其他合适的总线或者两个或更多个以上这些的组合。在合适的情况下,总线604可包括一个或多个总线。尽管本申请实施例描述和示出了特定的总线,但本申请考虑任何合适的总线或互 连。
以下是本公开实施例提供的计算机可读存储介质的实施例,该计算机可读存储介质与上述各实施例的页面测试方法属于同一个发明构思,在计算机可读存储介质的实施例中未详尽描述的细节内容,可以参考上述车道保持方法的实施例。
本实施例提供一种包含计算机可执行指令的存储介质,计算机可执行指令在由计算机处理器执行时用于执行一种页面测试方法,该方法包括:
获取待测试页面图像和基准页面图像;
基于待测试页面图像的第一静态元素区域与基准页面图像的第二静态元素区域,计算待测试页面图像和基准页面图像的结构相似度;
根据结构相似度,确定待测试页面图像的页面测试结果。
当然,本公开实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上的方法操作,还可以执行本公开任意实施例所提供的页面测试方法中的相关操作。
本实施例提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现上述页面测试方法。
通过以上关于实施方式的描述,所属领域的技术人员可以清楚地了解到,本公开可借助软件及必需的通用硬件来实现,当然也可以通过硬件实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如计算机的软盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、闪存(FLASH)、硬盘或光盘等,包括若干指令用以使得一台计算机云平台(可以是个人计算机,服务器,或者网络云平台等)执行本公开各个实施例所提供的页面测试方法。
本公开实施例提供的技术方案与现有技术相比具有如下优点:
本公开实施例的一种页面测试方法、装置、设备及存储介质,在获取待测试页面图像和基准页面图像之后,能够基于待测试页面图像的第一静态元素区域与基准页面图像的第二静态元素区域,计算待测试页面图像和基准页面图像的结构相似度,进一步根据结构相似度,生成待测试页面图像的页面测试结果。由此,可以根据待测试页面图像与基准页面图像之间的结构相似度,评估待测试页面图像是否通过测试,实现了对页面进行自动化测试,提高了测试效率,且不依赖测试者经验,保证了页面测试的准确性;并且,页面图像中的静态元素稳定,根据静态元素来评估页面测试结果,进一步提高了待测试页面图像的测试结果的准确性。
注意,上述仅为本公开的较佳实施例及所运用技术原理。本领域技术人员会理解,本公开不限于这里的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本公开的保护范围。因此,虽然通过以上实施例对本公开进行了较为详细的说明,但是本公开不仅仅限于以上实施例,在不脱离本公开构思的情况下,还可以包括更多其他等效实施例,而本公开的范围由所附的权利要求范围决定。

Claims (13)

  1. 一种页面测试方法,包括:
    获取待测试页面图像和基准页面图像;
    基于所述待测试页面图像的第一静态元素区域与所述基准页面图像的第二静态元素区域,计算所述待测试页面图像和所述基准页面图像的结构相似度;
    根据所述结构相似度,确定所述待测试页面图像的页面测试结果。
  2. 根据权利要求1所述的方法,其中,在所述基于所述待测试页面图像的第一静态元素区域与所述基准页面图像的第二静态元素区域,计算所述待测试页面图像和所述基准页面图像的结构相似度之前,所述方法还包括:
    基于所述待测试页面图像的待测试页面元素和所述基准页面图像的基准页面元素,识别所述待测试页面图像的第一静态元素区域以及所述基准页面图像的第二静态元素区域。
  3. 根据权利要求2所述的方法,其中,所述基于所述待测试页面图像的待测试页面元素和所述基准页面图像的基准页面元素,识别所述待测试页面图像的第一静态元素区域以及所述基准页面图像的第二静态元素区域,包括:
    根据检测到第一预设时长内未发生变化的待测试页面元素,构成所述第一静态元素区域,以及,根据检测到所述第一预设时长内未发生变化的基准页面元素,构成所述第二静态元素区域。
  4. 根据权利要求2所述的方法,其中,所述基于所述待测试页面图像的待测试页面元素和所述基准页面图像的基准页面元素,识别所述待测试页面图像的第一静态元素区域以及所述基准页面图像的第二静态元素区域,包括:
    获取预先确定的模板页面图像,所述模板页面图像是由静态元素构成的页面图像;
    将所述模板页面图像的模板页面元素与所述待测试页面元素进行对比,得到第一对比特征,以及将所述模板页面图像的模板页面元素与所述基准页面元素进行对比,得到第二对比特征;
    基于检测到第二预设时长内未发生变化的第一对比特征对应的待测试页面元素,构成所述第一静态元素区域,以及,基于检测到所述第二预设时长内未发生变化的第二对比特征对应的基准页面元素,构成所述第二静态元素区域。
  5. 根据权利要求1所述的方法,其中,所述基于所述待测试页面图像的第一静态元素区域与所述基准页面图像的第二静态元素区域,确定所述待测试页面图像和所述基准页面图像的结构相似度,包括:
    分别根据所述第一静态元素区域和所述第二静态元素区域的亮度特征、对比度特征以及结构特征,计算所述待测试页面图像和所述基准页面图像的结构相似度。
  6. 根据权利要求5所述的方法,其中,所述分别根据所述第一静态元素区域和所述第二静态元素区域的亮度特征、对比度特征以及结构特征,计算所述待测试页面图像和所述基准页面图像的结构相似度,包括:
    根据所述第一静态元素区域的第一亮度特征和所述第二静态元素区域的第二亮度特征, 计算所述待测试页面图像和所述基准页面图像的亮度平均值;
    根据所述第一静态元素区域的第一对比度特征和所述第二静态元素区域的第二对比度特征,计算所述待测试页面图像和所述基准页面图像的对比度标准差;
    根据所述第一静态元素区域的第一结构特征和所述第二静态元素区域的第二结构特征,计算所述待测试页面图像和所述基准页面图像的结构协方差;
    对所述亮度平均值、所述对比度标准差和所述结构协方差进行加权求和,得到所述结构相似度。
  7. 根据权利要求1所述的方法,其中,所述基于所述待测试页面图像的第一静态元素区域与所述基准页面图像的第二静态元素区域,计算所述待测试页面图像和所述基准页面图像的结构相似度,包括:
    在所述待测试页面图像的数量大于预设数量的情况下,利用预先开启的多个线程,基于所述第一静态元素区域与所述第二静态元素区域,并行计算所述结构相似度。
  8. 根据权利要求1所述的方法,其中,所述根据所述结构相似度,生成所述待测试页面图像的页面测试结果,包括:
    将所述结构相似度与预先设置的相似度阈值进行比较;
    若所述结构相似度大于或等于所述预先设置的相似度阈值,则生成测试通过报告,否则,生成测试未通过报告。
  9. 根据权利要求8所述的方法,其中,所述测试未通过报告包括错误类型和错误原因;
    其中,在所述生成测试未通过报告之后,所述方法还包括:
    显示所述错误类型和所述错误原因。
  10. 一种页面测试装置,包括:
    图像获取模块,用于获取待测试页面图像和基准页面图像;
    结构相似度计算模块,用于基于所述待测试页面图像的第一静态元素区域与所述基准页面图像的第二静态元素区域,计算所述待测试页面图像和所述基准页面图像的结构相似度;
    页面测试结果生成模块,用于根据所述结构相似度,生成所述待测试页面图像的页面测试结果。
  11. 一种页面测试设备,包括:
    处理器;
    存储器,用于存储可执行指令;
    其中,所述处理器用于从所述存储器中读取所述可执行指令,并执行所述可执行指令以实现上述权利要求1至9中任一项所述的页面测试方法。
  12. 一种计算机可读存储介质,其上存储有计算机程序,其中,所述存储介质存储有计算机程序,当所述计算机程序被处理器执行时,使得处理器实现上述权利要求1至9中任一项所述的页面测试方法。
  13. 一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如权利要求1至9中任一项所述的页面测试方法。
PCT/CN2023/075213 2022-02-09 2023-02-09 页面测试方法、装置、设备及存储介质 WO2023151622A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210121531.0 2022-02-09
CN202210121531.0A CN116627790A (zh) 2022-02-09 2022-02-09 页面测试方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2023151622A1 true WO2023151622A1 (zh) 2023-08-17

Family

ID=87563686

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/075213 WO2023151622A1 (zh) 2022-02-09 2023-02-09 页面测试方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN116627790A (zh)
WO (1) WO2023151622A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779245A (zh) * 2011-05-12 2012-11-14 李朝荣 基于图像处理技术的网页异常检测方法
CN112529091A (zh) * 2020-12-18 2021-03-19 广州视源电子科技股份有限公司 课件相似度检测方法、装置及存储介质
US11182273B1 (en) * 2018-08-24 2021-11-23 Intuit, Inc. Application testing using automatically generated test cases
CN113946510A (zh) * 2021-10-14 2022-01-18 中国平安财产保险股份有限公司 Web页面测试方法、装置、设备及计算机存储介质
CN113961864A (zh) * 2021-11-04 2022-01-21 京东科技信息技术有限公司 系统巡检方法、装置、存储介质及电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779245A (zh) * 2011-05-12 2012-11-14 李朝荣 基于图像处理技术的网页异常检测方法
US11182273B1 (en) * 2018-08-24 2021-11-23 Intuit, Inc. Application testing using automatically generated test cases
CN112529091A (zh) * 2020-12-18 2021-03-19 广州视源电子科技股份有限公司 课件相似度检测方法、装置及存储介质
CN113946510A (zh) * 2021-10-14 2022-01-18 中国平安财产保险股份有限公司 Web页面测试方法、装置、设备及计算机存储介质
CN113961864A (zh) * 2021-11-04 2022-01-21 京东科技信息技术有限公司 系统巡检方法、装置、存储介质及电子设备

Also Published As

Publication number Publication date
CN116627790A (zh) 2023-08-22

Similar Documents

Publication Publication Date Title
CN107193750B (zh) 一种脚本录制方法和装置
CN110764993A (zh) 自动化测试方法及终端设备
US10552302B2 (en) System and method for analyzing risks present in a software program code
CN103577658A (zh) 智能终端硬件的评估方法及评估系统
CN114116496A (zh) 自动化测试方法、装置、设备及介质
WO2020237508A1 (zh) 一种断言验证代码绑定方法及装置
CN115686961A (zh) 处理器测试方法、装置及电子设备
CN107145447B (zh) 检测内存泄漏的方法、装置及电子设备
CN113886373A (zh) 一种数据处理方法、装置及电子设备
WO2023151622A1 (zh) 页面测试方法、装置、设备及存储介质
CN111694735A (zh) 一种页面性能测试方法、装置、电子设备及存储介质
CN110765005A (zh) 软件可靠性评估方法和装置
CN108763092B (zh) 一种基于交叉验证的代码缺陷检测方法及装置
US20080195906A1 (en) Test pattern generation apparatus and test pattern generation method
CN115033434A (zh) 一种内核性能理论值计算方法、装置及存储介质
CN115269389A (zh) 一种项目质量确定方法、装置、电子设备及存储介质
CN109388564B (zh) 一种测试方法、装置及电子设备
CN111143220B (zh) 一种软件测试的训练系统及方法
CN114648656A (zh) 图像识别方法、装置、终端设备及可读存储介质
CN113312261A (zh) 测试用例筛选方法、设备、存储介质及装置
CN108235324B (zh) 一种短信模板的测试方法及服务器
CN110597703A (zh) 一种回归测试方法及装置
CN112486808B (zh) 一种系统测试方法、装置、电子设备及存储介质
CN112612882B (zh) 检阅报告生成方法、装置、设备和存储介质
CN116594862B (zh) Dbms的测试方法、装置、电子设备及可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23752402

Country of ref document: EP

Kind code of ref document: A1