CN113704111A - Page automatic testing method, device, equipment and storage medium - Google Patents

Page automatic testing method, device, equipment and storage medium Download PDF

Info

Publication number
CN113704111A
CN113704111A CN202111003903.1A CN202111003903A CN113704111A CN 113704111 A CN113704111 A CN 113704111A CN 202111003903 A CN202111003903 A CN 202111003903A CN 113704111 A CN113704111 A CN 113704111A
Authority
CN
China
Prior art keywords
verification code
page
picture
test
image
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
CN202111003903.1A
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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202111003903.1A priority Critical patent/CN113704111A/en
Publication of CN113704111A publication Critical patent/CN113704111A/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/3684Test management for test design, e.g. generating new test cases
    • 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/3692Test management for test results analysis

Abstract

The invention relates to the field of artificial intelligence and discloses a page automatic testing method, a device, equipment and a storage medium. The method comprises the following steps: if the verification code is detected in the process of page automatic testing, intercepting a page picture containing the verification code; positioning the position of the verification code in the page picture to obtain position information corresponding to the verification code; intercepting the area where the verification code is located from the page picture through the position information to obtain a corresponding verification code picture; performing image processing on the verification code picture to obtain corresponding target verification code information; loading the target verification code information into a verification code input box for testing to obtain a corresponding test page picture; and comparing the pixels of the test page picture with preset reference page pictures to obtain a corresponding page automatic test result. The invention also relates to a block chain technology, and the page pictures can be stored in the block chain.

Description

Page automatic testing method, device, equipment and storage medium
Technical Field
The invention relates to the field of artificial intelligence, in particular to a page automatic testing method, a device, equipment and a storage medium.
Background
At present, many application software add verification code function on login page to prevent malicious script from trying to login application continuously, verification code is essentially a small randomly generated picture, during software production and development, we need to test software, in order to improve test efficiency, often need to introduce automation technology to improve efficiency of automation test,
However, in the process of software automated testing or UI automated testing, when a place needing to input a verification code is encountered, the code is often developed and annotated to skip the step, the verification code cannot be automatically obtained, the verification code cannot be automatically and correctly input, the process automation cannot be really achieved, and in the process of UI testing, data problems or problems that a UI page is incorrect due to relevant changes, manual verification is needed, and automatic verification cannot be achieved.
Disclosure of Invention
The invention mainly aims to solve the technical problem of low efficiency of page automatic testing.
The invention provides a page automatic testing method in a first aspect, which comprises the following steps: if the verification code is detected in the process of page automatic testing, intercepting a page picture containing the verification code; positioning the position of the verification code in the page picture to obtain position information corresponding to the verification code; intercepting the area where the verification code is located from the page picture through the position information to obtain a corresponding verification code picture; performing image processing on the verification code picture to obtain corresponding target verification code information; loading the target verification code information into a verification code input box for testing to obtain a corresponding test page picture; and comparing the pixels of the test page picture with preset reference page pictures to obtain a corresponding page automatic test result.
Optionally, in a first implementation manner of the first aspect of the present invention, the positioning the location of the verification code in the page picture to obtain location information corresponding to the verification code includes: carrying out format conversion on the content information of the page picture to obtain a target document; traversing the target document according to a plurality of preset identifying code element names, acquiring identifying code elements corresponding to the identifying codes, scanning the identifying code elements, and determining corresponding identifying code description information; and determining the position information corresponding to the verification code through the verification code description information.
Optionally, in a second implementation manner of the first aspect of the present invention, the performing image processing on the verification code picture to obtain corresponding target verification code information includes: ashing the verification code image to obtain a verification code gray image; carrying out optimal threshold calculation on the verification code gray level image to obtain a corresponding optimal threshold, and carrying out binarization processing on the verification code gray level image according to the optimal threshold to obtain a corresponding binarization picture; carrying out character segmentation on the binary image to obtain a plurality of single character images; identifying characters in each single character image according to a preset character identification mode to obtain candidate characters corresponding to each single character image; and combining the candidate characters corresponding to each single character image according to an initial sequence to obtain a corresponding character string, and taking the character string as the target verification code information.
Optionally, in a third implementation manner of the first aspect of the present invention, the performing ashing processing on the verification code image to obtain a verification code grayscale image includes: acquiring a plurality of coordinate values and tristimulus values corresponding to a plurality of pixels in the verification code picture; calculating a plurality of gray level transformation values corresponding to the plurality of pixels by adopting a gray level transformation formula according to the plurality of coordinate values and the three primary color values; and carrying out gray level transformation on the verification code picture based on the plurality of gray level transformation values to obtain a verification code gray level image.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the recognizing the character in each single character image according to a preset character recognition manner to obtain the candidate character corresponding to each single character image includes: performing feature analysis on each single character image according to the definition of a preset character feature template to obtain an intermediate character feature corresponding to each single character image; calculating the feature similarity of the intermediate character features corresponding to each single character image and the feature similarity corresponding to the candidate character features in the preset character library to obtain a feature similarity number set corresponding to each single character image; and respectively carrying out numerical analysis on the similarity number sets corresponding to each single character image, and determining a candidate character corresponding to the candidate character feature with the maximum feature similarity in the feature similarity number sets corresponding to each single character image as the candidate character corresponding to each single character image, wherein the character library comprises preset candidate characters and candidate character features corresponding to the preset candidate characters.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the performing a pixel comparison between the test page picture and a preset reference page picture to obtain a corresponding page automation test result includes: scanning the test interface picture to determine a corresponding test case identifier; acquiring a reference page picture corresponding to the test case identifier in a preset reference image library through the test case identifier; performing image pixel comparison on the test page picture and the reference page picture by adopting an image pixel comparison tool to obtain a comparison result; and determining a corresponding page automatic test result according to the comparison result, and outputting the page automatic test result.
Optionally, in a sixth implementation manner of the first aspect of the present invention, the performing, by using an image pixel comparison tool, image pixel comparison between the test page picture and the reference page picture, and obtaining a comparison result includes: carrying out pixel-based numerical processing on the test page picture to obtain a pixel value of each pixel; and comparing the pixel value of each pixel point of the test page picture with the pixel value of the corresponding pixel point in the reference page picture to obtain a comparison result.
The second aspect of the present invention provides an automatic page testing apparatus, including: the detection module is used for intercepting a page picture containing a verification code if the verification code is detected in the process of page automatic testing; the positioning module is used for positioning the position of the verification code in the page picture to obtain position information corresponding to the verification code; the intercepting module is used for intercepting the area where the verification code is located from the page picture through the position information to obtain a corresponding verification code picture; the processing module is used for carrying out image processing on the verification code picture to obtain corresponding target verification code information; the test module is used for loading the target verification code information into a verification code input box for testing to obtain a corresponding test page picture; and the comparison module is used for carrying out pixel comparison on the test page picture and a preset reference page picture to obtain a corresponding page automatic test result.
Optionally, in a first implementation manner of the second aspect of the present invention, the positioning module is specifically configured to: carrying out format conversion on the content information of the page picture to obtain a target document; traversing the target document according to a plurality of preset identifying code element names, acquiring identifying code elements corresponding to the identifying codes, scanning the identifying code elements, and determining corresponding identifying code description information; and determining the position information corresponding to the verification code through the verification code description information.
Optionally, in a second implementation manner of the second aspect of the present invention, the processing module further includes: the ashing unit is used for performing ashing treatment on the verification code image to obtain a verification code gray image; the calculation unit is used for performing optimal threshold calculation on the verification code gray level image to obtain a corresponding optimal threshold and performing binarization processing on the verification code gray level image according to the optimal threshold to obtain a corresponding binarization picture; the segmentation unit is used for carrying out character segmentation on the binary image to obtain a plurality of single character images; the recognition unit is used for recognizing the characters in each single character image according to a preset character recognition mode to obtain candidate characters corresponding to each single character image; and the combination unit is used for combining the candidate characters corresponding to each single character image according to an initial sequence to obtain a corresponding character string and taking the character string as the target verification code information.
Optionally, in a third implementation manner of the second aspect of the present invention, the ashing unit may be further specifically configured to: acquiring a plurality of coordinate values and tristimulus values corresponding to a plurality of pixels in the verification code picture; calculating a plurality of gray level transformation values corresponding to the plurality of pixels by adopting a gray level transformation formula according to the plurality of coordinate values and the three primary color values; and carrying out gray level transformation on the verification code picture based on the plurality of gray level transformation values to obtain a verification code gray level image.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the identification unit may be further specifically configured to: performing feature analysis on each single character image according to the definition of a preset character feature template to obtain an intermediate character feature corresponding to each single character image; calculating the feature similarity of the intermediate character features corresponding to each single character image and the feature similarity corresponding to the candidate character features in the preset character library to obtain a feature similarity number set corresponding to each single character image; and respectively carrying out numerical analysis on the similarity number sets corresponding to each single character image, and determining a candidate character corresponding to the candidate character feature with the maximum feature similarity in the feature similarity number sets corresponding to each single character image as the candidate character corresponding to each single character image, wherein the character library comprises preset candidate characters and candidate character features corresponding to the preset candidate characters.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the comparing module further includes: the scanning unit is used for scanning the test interface picture and determining a corresponding test case identifier; the acquisition unit acquires a reference page picture corresponding to the test case identifier from a preset reference image library through the test case identifier; the comparison unit is used for comparing the image pixels of the test page picture and the reference page picture by adopting an image pixel comparison tool to obtain a comparison result; and the output unit is used for determining a corresponding page automatic test result according to the comparison result and outputting the page automatic test result.
Optionally, in a sixth implementation manner of the second aspect of the present invention, the comparing unit is further specifically configured to: carrying out pixel-based numerical processing on the test page picture to obtain a pixel value of each pixel; and comparing the pixel value of each pixel point of the test page picture with the pixel value of the corresponding pixel point in the reference page picture to obtain a comparison result.
The third aspect of the present invention provides a page automation test device, including: a memory and at least one processor, the memory having instructions stored therein; the at least one processor calls the instructions in the memory to cause the page automation test equipment to execute the page automation test method.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the above-mentioned page automation test method.
In the technical scheme provided by the invention, if the verification code is detected in the process of page automatic test, a page picture containing the verification code is intercepted; positioning the position of the verification code in the page picture to obtain position information corresponding to the verification code; intercepting the area where the verification code is located from the page picture through the position information to obtain a corresponding verification code picture; performing image processing on the verification code picture to obtain corresponding target verification code information; loading the target verification code information into a verification code input box for testing to obtain a corresponding test page picture; and comparing the pixels of the test page picture with preset reference page pictures to obtain a corresponding page automatic test result. According to the embodiment of the invention, the automatic identification and input of the verification code in the automatic page testing process can be realized, and the automatic pixel comparison verification is carried out aiming at the test page picture, so that the automatic testing efficiency is improved.
Drawings
FIG. 1 is a schematic diagram of an embodiment of a method for automatically testing a page according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of another embodiment of a method for testing a page automation system according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an embodiment of a page automation test device in an embodiment of the present invention;
FIG. 4 is a schematic diagram of another embodiment of the apparatus for testing page automation in the embodiment of the present invention;
FIG. 5 is a diagram of an embodiment of a page automation test device in the embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a page automatic testing method, device, equipment and storage medium. The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result. The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
Referring to fig. 1, an embodiment of a method for testing a page automatically according to an embodiment of the present invention includes:
101. if the verification code is detected in the process of page automatic testing, intercepting a page picture containing the verification code;
it is understood that the execution subject of the present invention may be a page automation testing apparatus, and may also be a server, which is not limited herein. The embodiment of the present invention is described by taking a server as an execution subject.
Specifically, in the process of the page automatic test, if the condition that the verification code is input is detected by the server, the server performs screen capture operation on the picture containing the verification code, the server captures the page picture containing the verification code by using the screen capture function of the page automatic test tool, and stores the captured picture in a preset path, and what needs to be emphasized is that the page picture can also be stored in a node of a block chain for further ensuring the privacy and the security of the page picture.
102. Positioning the position of the verification code in the page picture to obtain position information corresponding to the verification code;
it should be noted that the position information refers to position coordinate information of the verification code in the page picture, the position coordinate information is determined based on a plane rectangular coordinate system established in the page picture, the plane rectangular coordinate system is a coordinate system established by taking a vertex of a lower left corner of the page as an origin, establishing a Y axis upwards along a left side edge of the page picture, establishing an X axis rightwards along a lower side edge of the page picture, and an included angle between the X axis and the Y axis is 90 degrees, and the server positions the position of the verification code in the page picture to further determine the position information of the verification code in the page picture.
103. Intercepting the area where the verification code is located from the page picture through the position information to obtain a corresponding verification code picture;
specifically, the server extracts the stored page picture from the preset path, intercepts the verification code picture from the page picture according to the position information of the verification code, and stores the verification code picture in the preset storage path.
104. Carrying out image processing on the verification code picture to obtain corresponding target verification code information;
it should be noted that the target identifying code information refers to character information on an identifying code picture, and the server performs image processing on the identifying code picture, so as to identify the identifying code information on the identifying code picture, and further obtain corresponding target identifying code information.
105. Loading the target verification code information into a verification code input box for testing to obtain a corresponding test page picture;
specifically, the server automatically inputs the identified verification code information into the verification code input box to complete automatic testing of the verification code, and when the verification code is automatically tested, the server automatically inputs the identified target verification code information into the verification code input box so as to complete automatic testing of the correct verification code, and then obtains a test page picture after verification of the verification code is completed and stores the picture in a screenshot manner.
106. And comparing the pixels of the test page picture with the preset reference page picture to obtain a corresponding page automatic test result.
It should be noted that the preset reference page picture refers to a page picture which passes verification and is obtained after a correct verification code is input in advance, the page picture is used as a reference page picture, and the server compares the test page picture with the reference page picture at a pixel level to obtain a corresponding page automatic test result.
In the embodiment of the invention, the server positions the verification code in the page picture to further determine the position information of the verification code in the page picture, then the server performs image processing on the verification code picture to identify the verification code information on the verification code picture, and then the server obtains the corresponding target verification code information and automatically inputs the identified target verification code information into a verification code input frame so as to complete the automatic test of the correct verification code, and finally the server obtains the test result by comparing the test page picture with the reference page picture at the pixel level. The invention can realize the automatic identification and input of the verification code in the automatic testing process of the page, and carry out automatic pixel comparison verification aiming at the tested page picture, thereby improving the automatic testing efficiency.
Referring to fig. 2, another embodiment of the method for testing page automation according to the embodiment of the present invention includes:
201. if the verification code is detected in the process of page automatic testing, intercepting a page picture containing the verification code;
specifically, in this embodiment, the specific implementation of step 201 is similar to that of step 101, and is not described herein again.
202. Positioning the position of the verification code in the page picture to obtain position information corresponding to the verification code;
specifically, the server performs format conversion on the content information of the page picture to obtain a target document; the server traverses the target document according to a plurality of preset identifying code element names, acquires identifying code elements corresponding to the identifying codes, scans the identifying code elements and determines corresponding identifying code description information; and the server determines the position information corresponding to the verification code through the verification code description information.
It should be noted that the target document is an Extensible Markup Language (XML) document, and identifying the verification code requires identifying the content of the page picture including the verification code first, so that the content of the page picture including the verification code needs to be converted into an XML document first, and the server acquires the description information of each element in the page picture currently including the verification code and generates the XML document according to the acquired description information of each element. For example, the elements may include a password, a confirmation password, a cell phone number, a passcode, and the like. The description information of each element is used for describing the attribute of the element, the attribute includes the name of the element, the position information of the element, whether the element is visible or not, and the like, the position information of the element specifically includes the position coordinate of the pixel point at the upper left corner of the element, the width, the height and the like of the element, and the position information of the element also includes the position coordinate of the pixel point at the upper left corner of the element, the position coordinate of the pixel point at the upper right corner, the position coordinate of the pixel point at the lower left corner, the position coordinate of the pixel point at the lower right corner and the like. The server traverses the XML document, searches the name of the identifying code element, and obtains the description information of the identifying code element in the XML document according to the searched name of the identifying code element. The server analyzes the description information of the verification code element through the structural definition of the preset attribute, and extracts the position information of the verification code element, for example, the position information may specifically include the position coordinates of the pixel point at the upper left corner of the verification code picture, and the width and height of the verification code picture.
203. Intercepting the area where the verification code is located from the page picture through the position information to obtain a corresponding verification code picture;
specifically, the specific implementation of step 203 is similar to that of step 103, and is not described herein again.
204. Carrying out image processing on the verification code picture to obtain corresponding target verification code information;
specifically, the server performs ashing processing on the verification code picture to obtain a gray level image of the verification code; the server calculates an optimal threshold value through the verification code gray level image to obtain a corresponding optimal threshold value, and performs binarization processing on the verification code gray level image according to the optimal threshold value to obtain a corresponding binarization picture; the server performs character segmentation on the binary image to obtain a plurality of single character images; the server identifies the characters in each single character image according to a preset character identification mode to obtain candidate characters corresponding to each single character image; and the server combines the candidate characters corresponding to each single character image according to the initial sequence to obtain a corresponding character string and takes the character string as target verification code information.
The server performs ashing processing on the verification code picture, removes color elements and other interference elements in the verification code picture, obtains a verification code gray level image convenient to identify, and calculates an optimal threshold value by adopting an Otsu algorithm based on image information of the verification code gray level image; respectively carrying out difference operation on the gray level conversion value of each pixel and the optimal threshold value, summarizing the pixels with positive operation values into a non-identifying code character pixel set, and summarizing the pixels with negative operation values into an identifying code character pixel set; setting each pixel in the non-identifying code character pixel set as white and setting each pixel in the identifying code character pixel set as black to obtain a binary image, scanning the binary image by the server to perform character segmentation to obtain a single character image, performing character identification on the single character image to obtain candidate characters, and finally forming the identified candidate characters into identifying code information.
Optionally, performing ashing processing on the verification code image to obtain a gray level image of the verification code may include: the method comprises the steps that a server obtains a plurality of coordinate values and three primary color values corresponding to a plurality of pixels in a verification code picture; the server calculates a plurality of gray scale conversion values corresponding to a plurality of pixels by adopting a gray scale conversion formula according to the coordinate values and the three primary color values; and the server performs gray level conversion on the verification code picture based on the plurality of gray level conversion values to obtain a verification code gray level image.
In the embodiment, the influence of color elements on the identification of the identification code can be eliminated by ashing the colorful identification code picture, so that the identification accuracy of the identification code is improved.
Specifically, the gray level conversion formula is as follows: f (i, j) ═ 0.25 × R (i, j) +0.55 × G (i, j) +0.20 × B (i, j), where R (i, j), G (i, j), and B (i, j) correspond to RGB tristimulus values indicated by the same coordinate pixel.
Optionally, recognizing the character in each single character image according to a preset character recognition mode, and obtaining the candidate character corresponding to each single character image may include: the server performs feature analysis on each single character image according to the definition of a preset character feature template to obtain an intermediate character feature corresponding to each single character image; the server calculates the feature similarity between the intermediate character features corresponding to each single character image and the candidate character features in the preset character library to obtain a feature similarity number set corresponding to each single character image; the server respectively performs numerical analysis on the similarity number sets corresponding to each single character image, and determines a candidate character corresponding to the candidate character feature with the maximum feature similarity in the feature similarity number sets corresponding to each single character image as a candidate character corresponding to each single character image, wherein the character library comprises preset candidate characters and candidate character features corresponding to the preset candidate characters.
The server performs feature recognition on the obtained single character image according to the character feature template to obtain intermediate character features corresponding to the single character image, for example, if the definition of the pixel value feature template uses the pixel value of each pixel point in the binarized image as a feature code, a pixel value character string obtained by combining the feature codes according to a preset combination mode is the pixel value feature template corresponding to the character in the binarized image, then performs feature analysis on each single character image according to the definition of the pixel value feature template to obtain the intermediate character features corresponding to the single character image, the preset character library in this embodiment includes common intermediate characters and the intermediate character features obtained by each intermediate character according to the preset character feature template, the middle characters include, but are not limited to: 0-9, A-Z and the like. The server compares the intermediate character features with the intermediate character features corresponding to each intermediate character in a preset character library according to the analyzed intermediate character features corresponding to each single character image, calculates the feature similarity between the intermediate character features and each intermediate character feature to obtain a feature similarity number set, selects the intermediate character corresponding to the intermediate character feature with the maximum feature similarity from all the feature similarities of the feature similarity number set, and identifies the intermediate character as the candidate character of the single character image.
205. Loading the target verification code information into a verification code input box for testing to obtain a corresponding test page picture;
specifically, in this embodiment, the specific implementation of step 205 is similar to that of step 105, and is not described herein again.
206. Scanning the test interface picture to determine a corresponding test case identifier;
it should be noted that the test case is used for testing a program path or for verifying whether a certain function meets a specific requirement of a user. The test case is used for specifying a test target and a test mode through a specification formed after development. In this embodiment, the specific test case refers to a test for implementing a UI interface, and when the server determines the test case, the server may determine a corresponding test case according to the identifier of the test case.
207. Acquiring a reference page picture corresponding to the test case identification in a preset reference image library through the test case identification;
it should be noted that the reference image library is a preset image library, and the reference image library includes at least one reference image, and the reference image is used for comparing the test page pictures. The reference image is preset to be acquired and stored in the reference image library. The reference image is stored in the reference image library, and the corresponding relationship between each reference image and the identifier of the test case is also stored, specifically, after the server determines the corresponding test case according to the identifier of the test case, the server obtains the matched reference image in the reference image library as the reference page picture through the identifier of the test case.
208. Adopting an image pixel comparison tool to perform image pixel comparison on the test page picture and the reference page picture to obtain a comparison result;
specifically, the server performs pixel-based numerical processing on a test page picture to obtain a pixel value of each pixel; and the server compares the pixel value of each pixel point of the test page picture with the pixel value of the corresponding pixel point in the reference page picture to obtain a comparison result.
After the server acquires the test page picture, determining pixel points on the test page picture, and performing digitization processing on each pixel point to determine a pixel value corresponding to each pixel point, where the pixel value may include pixel information such as a red, green, blue pixel value, transparency, and the like. The server can determine the pixel value of each pixel point of the test page picture and the pixel value of each pixel point by adopting the same mode while determining the pixel value of each pixel point of the test page picture, wherein the pixel points of the test page picture correspond to the pixel points of the reference page picture one to one. After determining the pixel value of each pixel point of the test page picture and the pixel value of each pixel point of the reference page picture, the server compares each pixel point on the test page picture with the corresponding pixel point on the reference page picture in sequence to obtain a comparison result corresponding to each pixel point. The comparison result is used for representing the similarity between each pixel point of the test page picture and the corresponding pixel point of the reference page picture. For example, the similarity may be expressed in a percentage form, and the similarity value range is 0 to 100%, and the percentage similarity may be determined according to the pixel value of the pixel point of the test page picture and the pixel value of the corresponding pixel point of the reference page picture.
209. And determining a corresponding page automatic test result according to the comparison result, and outputting the page automatic test result.
Specifically, the server performs image pixel comparison on the test page picture and the reference page picture to determine different pixel points in the test page picture and the reference page picture, and further obtains a page automatic test result, wherein the page automatic test result comprises a test passing and a test failing, when different pixel points exist in the test page picture and the reference page picture, the determination result is that the test fails, and when different pixel points do not exist in the test page picture and the reference page picture, the determination result is that the test passes.
In the embodiment of the invention, the server compares the middle character features with the middle character features corresponding to each middle character in a preset character library according to the analyzed middle character features corresponding to each single character image, calculates the feature similarity between the middle character features and each middle character feature to obtain a feature similarity number set, selects the middle character corresponding to the middle character feature with the maximum feature similarity from all the feature similarities of the feature similarity number set, and identifies the middle character as the candidate character of the single character image, so that each character in the verification code is quickly and accurately identified in the automatic page testing process, the automatic verification of the verification code can be performed according to the identified verification code information, and the efficiency and the accuracy of the automatic testing are improved.
Referring to fig. 3, an embodiment of a page automation test apparatus according to the embodiment of the present invention includes:
the detection module 301 is configured to intercept a page picture including a verification code if the verification code is detected in a process of page automation testing;
a positioning module 302, configured to position a position of the verification code in the page picture to obtain position information corresponding to the verification code;
the intercepting module 303 is configured to intercept, from the page picture, an area where the verification code is located through the location information, to obtain a corresponding verification code picture;
the processing module 304 is configured to perform image processing on the verification code picture to obtain corresponding target verification code information;
the test module 305 is configured to load the target verification code information into a verification code input box for testing, so as to obtain a corresponding test page picture;
the comparison module 306 is configured to perform pixel comparison on the test page picture and a preset reference page picture to obtain a corresponding page automation test result.
Referring to fig. 4, another embodiment of the page automation test apparatus according to the embodiment of the present invention includes:
the detection module 301 is configured to intercept a page picture including a verification code if the verification code is detected in a process of page automation testing;
a positioning module 302, configured to position a position of the verification code in the page picture to obtain position information corresponding to the verification code;
the intercepting module 303 is configured to intercept, from the page picture, an area where the verification code is located through the location information, to obtain a corresponding verification code picture;
the processing module 304 is configured to perform image processing on the verification code picture to obtain corresponding target verification code information;
the test module 305 is configured to load the target verification code information into a verification code input box for testing, so as to obtain a corresponding test page picture;
the comparison module 306 is configured to perform pixel comparison on the test page picture and a preset reference page picture to obtain a corresponding page automation test result.
Optionally, the positioning module 301 is specifically configured to: carrying out format conversion on the content information of the page picture to obtain a target document; traversing the target document according to a plurality of preset identifying code element names, acquiring identifying code elements corresponding to the identifying codes, scanning the identifying code elements, and determining corresponding identifying code description information; and determining the position information corresponding to the verification code through the verification code description information.
Optionally, the processing module 304 further includes:
an ashing unit 3041, configured to perform ashing processing on the verification code image to obtain a verification code gray image;
a calculating unit 3042, configured to perform optimal threshold calculation on the verification code grayscale image to obtain a corresponding optimal threshold, and perform binarization processing on the verification code grayscale image according to the optimal threshold to obtain a corresponding binarized picture;
a segmentation unit 3043, configured to perform character segmentation on the binarized picture, and obtain a plurality of single character images;
the recognition unit 3044 is configured to recognize characters in each single character image according to a preset character recognition manner, so as to obtain candidate characters corresponding to each single character image;
a combining unit 3045, configured to combine the candidate characters corresponding to each single character image according to an initial order to obtain a corresponding character string, and use the character string as the target verification code information.
Optionally, the ashing unit 3041 may be further specifically configured to: acquiring a plurality of coordinate values and tristimulus values corresponding to a plurality of pixels in the verification code picture; calculating a plurality of gray level transformation values corresponding to the plurality of pixels by adopting a gray level transformation formula according to the plurality of coordinate values and the three primary color values; and carrying out gray level transformation on the verification code picture based on the plurality of gray level transformation values to obtain a verification code gray level image.
Optionally, the identifying unit 3044 may be further specifically configured to: performing feature analysis on each single character image according to the definition of a preset character feature template to obtain an intermediate character feature corresponding to each single character image; calculating the feature similarity of the intermediate character features corresponding to each single character image and the feature similarity corresponding to the candidate character features in the preset character library to obtain a feature similarity number set corresponding to each single character image; and respectively carrying out numerical analysis on the similarity number sets corresponding to each single character image, and determining a candidate character corresponding to the candidate character feature with the maximum feature similarity in the feature similarity number sets corresponding to each single character image as the candidate character corresponding to each single character image, wherein the character library comprises preset candidate characters and candidate character features corresponding to the preset candidate characters.
Optionally, the alignment module 306 further includes:
the scanning unit 3061 is configured to scan the test interface picture, and determine a corresponding test case identifier;
an obtaining unit 3062, obtaining a reference page picture corresponding to the test case identifier in a preset reference image library through the test case identifier;
the comparison unit 3063 is used for comparing the image pixels of the test page picture and the reference page picture by adopting an image pixel comparison tool to obtain a comparison result;
and the output unit 3064 is configured to determine a corresponding page automation test result according to the comparison result, and output the page automation test result.
Optionally, the comparison unit 3063 may be further specifically configured to: carrying out pixel-based numerical processing on the test page picture to obtain a pixel value of each pixel; and comparing the pixel value of each pixel point of the test page picture with the pixel value of the corresponding pixel point in the reference page picture to obtain a comparison result.
Fig. 5 is a schematic structural diagram of a page automation test device 500 according to an embodiment of the present invention, where the page automation test device 500 may have a relatively large difference due to different configurations or performances, and may include one or more processors 510 (e.g., one or more processors) and a memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) for storing applications 533 or data 532. Memory 520 and storage media 530 may be, among other things, transient or persistent storage. The program stored on the storage medium 530 may include one or more modules (not shown), each of which may include a series of instructions operating on the page automation test equipment 500. Further, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the page automation test device 500.
The page automation test equipment 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input-output interfaces 560, and/or one or more operating systems 531, such as Windows Server, Mac OS, Uni, Linu, FreeBSD, etc. Those skilled in the art will appreciate that the configuration of the page automation test device shown in FIG. 5 does not constitute a limitation of the page automation test device and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components.
The invention further provides a page automation test device, which includes a memory and a processor, where the memory stores computer readable instructions, and when the computer readable instructions are executed by the processor, the processor executes the steps of the page automation test method in the above embodiments.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and which may also be a volatile computer-readable storage medium, having stored therein instructions, which, when run on a computer, cause the computer to perform the steps of the page automation test method.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. The blockchain, which is essentially a decentralized database, is a string of data blocks associated by using a cryptographic method, each data block contains information of a batch of network transactions for verifying the validity (anti-counterfeiting) of the information and generating a next block, and the blockchain may include a blockchain bottom platform, a platform product service layer, an application service layer, and the like.

Claims (10)

1. A page automatic test method is characterized by comprising the following steps:
if the verification code is detected in the process of page automatic testing, intercepting a page picture containing the verification code;
positioning the position of the verification code in the page picture to obtain position information corresponding to the verification code;
intercepting the area where the verification code is located from the page picture through the position information to obtain a corresponding verification code picture;
performing image processing on the verification code picture to obtain corresponding target verification code information;
loading the target verification code information into a verification code input box for testing to obtain a corresponding test page picture;
and comparing the pixels of the test page picture with preset reference page pictures to obtain a corresponding page automatic test result.
2. The method for automatically testing a page according to claim 1, wherein the positioning the position of the verification code in the page picture to obtain the position information corresponding to the verification code comprises:
carrying out format conversion on the content information of the page picture to obtain a target document;
traversing the target document according to a plurality of preset identifying code element names, acquiring identifying code elements corresponding to the identifying codes, scanning the identifying code elements, and determining corresponding identifying code description information;
and determining the position information corresponding to the verification code through the verification code description information.
3. The method for automatically testing the page according to claim 1, wherein the image processing of the verification code picture to obtain the corresponding target verification code information comprises:
ashing the verification code image to obtain a verification code gray image;
carrying out optimal threshold calculation on the verification code gray level image to obtain a corresponding optimal threshold, and carrying out binarization processing on the verification code gray level image according to the optimal threshold to obtain a corresponding binarization picture;
carrying out character segmentation on the binary image to obtain a plurality of single character images;
identifying characters in each single character image according to a preset character identification mode to obtain candidate characters corresponding to each single character image;
and combining the candidate characters corresponding to each single character image according to an initial sequence to obtain a corresponding character string, and taking the character string as the target verification code information.
4. The method for automatically testing pages as claimed in claim 3, wherein said ashing said verification code image to obtain a gray level verification code image comprises:
acquiring a plurality of coordinate values and tristimulus values corresponding to a plurality of pixels in the verification code picture;
calculating a plurality of gray level transformation values corresponding to the plurality of pixels by adopting a gray level transformation formula according to the plurality of coordinate values and the three primary color values;
and carrying out gray level transformation on the verification code picture based on the plurality of gray level transformation values to obtain a verification code gray level image.
5. The method for automatically testing the page according to claim 3, wherein the step of identifying the characters in each single character image according to a preset character identification mode to obtain the candidate characters corresponding to each single character image comprises:
performing feature analysis on each single character image according to the definition of a preset character feature template to obtain an intermediate character feature corresponding to each single character image;
calculating the feature similarity of the intermediate character features corresponding to each single character image and the feature similarity corresponding to the candidate character features in the preset character library to obtain a feature similarity number set corresponding to each single character image;
and respectively carrying out numerical analysis on the similarity number sets corresponding to each single character image, and determining a candidate character corresponding to the candidate character feature with the maximum feature similarity in the feature similarity number sets corresponding to each single character image as the candidate character corresponding to each single character image, wherein the character library comprises preset candidate characters and candidate character features corresponding to the preset candidate characters.
6. The method for automatically testing the page according to any one of claims 1 to 5, wherein the step of comparing the pixel of the test page picture with the pixel of a preset reference page picture to obtain a corresponding page automatic test result comprises:
scanning the test interface picture to determine a corresponding test case identifier;
acquiring a reference page picture corresponding to the test case identifier in a preset reference image library through the test case identifier;
performing image pixel comparison on the test page picture and the reference page picture by adopting an image pixel comparison tool to obtain a comparison result;
and determining a corresponding page automatic test result according to the comparison result, and outputting the page automatic test result.
7. The method for automatically testing a page according to claim 6, wherein the comparing the test page picture with the reference page picture by using an image pixel comparison tool to obtain a comparison result comprises:
carrying out pixel-based numerical processing on the test page picture to obtain a pixel value of each pixel;
and comparing the pixel value of each pixel point of the test page picture with the pixel value of the corresponding pixel point in the reference page picture to obtain a comparison result.
8. A page automatic testing device is characterized by comprising:
the detection module is used for intercepting a page picture containing a verification code if the verification code is detected in the process of page automatic testing;
the positioning module is used for positioning the position of the verification code in the page picture to obtain position information corresponding to the verification code;
the intercepting module is used for intercepting the area where the verification code is located from the page picture through the position information to obtain a corresponding verification code picture;
the processing module is used for carrying out image processing on the verification code picture to obtain corresponding target verification code information;
the test module is used for loading the target verification code information into a verification code input box for testing to obtain a corresponding test page picture;
and the comparison module is used for carrying out pixel comparison on the test page picture and a preset reference page picture to obtain a corresponding page automatic test result.
9. A page automation test device, characterized in that the page automation test device comprises: a memory and at least one processor, the memory having instructions stored therein;
the at least one processor invoking the instructions in the memory to cause the page automation test equipment to perform the page automation test method of any one of claims 1-7.
10. A computer-readable storage medium having instructions stored thereon, wherein the instructions, when executed by a processor, implement the method for automated testing of pages of any of claims 1-7.
CN202111003903.1A 2021-08-30 2021-08-30 Page automatic testing method, device, equipment and storage medium Pending CN113704111A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111003903.1A CN113704111A (en) 2021-08-30 2021-08-30 Page automatic testing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111003903.1A CN113704111A (en) 2021-08-30 2021-08-30 Page automatic testing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113704111A true CN113704111A (en) 2021-11-26

Family

ID=78656776

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111003903.1A Pending CN113704111A (en) 2021-08-30 2021-08-30 Page automatic testing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113704111A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114860604A (en) * 2022-05-24 2022-08-05 广州掌动智能科技有限公司 Automatic test method, system and storage medium for automatically identifying dynamic verification code
CN117632772A (en) * 2024-01-25 2024-03-01 鱼快创领智能科技(南京)有限公司 UI (user interface) automatic testing method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114860604A (en) * 2022-05-24 2022-08-05 广州掌动智能科技有限公司 Automatic test method, system and storage medium for automatically identifying dynamic verification code
CN117632772A (en) * 2024-01-25 2024-03-01 鱼快创领智能科技(南京)有限公司 UI (user interface) automatic testing method
CN117632772B (en) * 2024-01-25 2024-04-16 鱼快创领智能科技(南京)有限公司 UI (user interface) automatic testing method

Similar Documents

Publication Publication Date Title
CN110363102B (en) Object identification processing method and device for PDF (Portable document Format) file
US20070168382A1 (en) Document analysis system for integration of paper records into a searchable electronic database
US8958643B2 (en) Recognition of numerical characters in digital images
US8218890B2 (en) Method and apparatus for cropping images
CN108563559A (en) A kind of test method of identifying code, device, terminal device and storage medium
CN110675940A (en) Pathological image labeling method and device, computer equipment and storage medium
CN113704111A (en) Page automatic testing method, device, equipment and storage medium
RU2640322C2 (en) Methods and systems of effective automatic recognition of symbols
RU2648638C2 (en) Methods and systems of effective automatic recognition of symbols using a multiple clusters of symbol standards
CN114862845B (en) Defect detection method, device and equipment for mobile phone touch screen and storage medium
CN110728687B (en) File image segmentation method and device, computer equipment and storage medium
US8392887B2 (en) Systems and methods for identifying graphic user-interface components
CN115240213A (en) Form image recognition method and device, electronic equipment and storage medium
CN112232336A (en) Certificate identification method, device, equipment and storage medium
CN112508000B (en) Method and equipment for generating OCR image recognition model training data
CN116052193B (en) RPA interface dynamic form picking and matching method and system
CN117115823A (en) Tamper identification method and device, computer equipment and storage medium
US11906441B2 (en) Inspection apparatus, control method, and program
JP2006323779A (en) Image processing method and device
CN112861861B (en) Method and device for recognizing nixie tube text and electronic equipment
CN115631374A (en) Control operation method, control detection model training method, device and equipment
CN114241356A (en) Wood board color identification method and device, electronic equipment and storage medium
CN114003493A (en) Test data processing method, device, equipment and storage medium
CN114387600A (en) Text feature recognition method and device, computer equipment and storage medium
CN114120016B (en) Character string extraction method, device, equipment and storage medium

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