CN108563559A - A kind of test method of identifying code, device, terminal device and storage medium - Google Patents
A kind of test method of identifying code, device, terminal device and storage medium Download PDFInfo
- Publication number
- CN108563559A CN108563559A CN201810198355.4A CN201810198355A CN108563559A CN 108563559 A CN108563559 A CN 108563559A CN 201810198355 A CN201810198355 A CN 201810198355A CN 108563559 A CN108563559 A CN 108563559A
- Authority
- CN
- China
- Prior art keywords
- identifying code
- picture
- character
- code
- information
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Abstract
The present invention relates to field of computer technology, providing a kind of test method of identifying code, device, terminal device and storage medium, the test method includes:During automatic test, if detecting identifying code to be tested, interception includes the user interface picture of identifying code;Obtain location information of the identifying code in the user interface picture;According to the positional information, the identifying code picture where intercepting the identifying code in the user interface picture;Image procossing is carried out to the identifying code picture, identifies verification code information;According to the verification code information identified, the automatic test to the identifying code is completed.Technical scheme of the present invention realizes under the frame of automatic test, completes automatic acquisition and identification to identifying code, reduces manual intervention, improve test accuracy, while also improving the efficiency of automatic test.
Description
Technical field
The present invention relates to field of computer technology more particularly to a kind of test method of identifying code, device, terminal device and
Storage medium.
Background technology
Currently, much malicious script is constantly trying to log in order to prevent for application (Application, APP) or webpage
Using increasing identifying code function in login page.Identifying code is substantially a small picture generated at random, and script can not obtain
The content of picture is taken, can only can prevent malicious script from logging in application by manual identified and input, therefore using identifying code.
But during the production development of software, it would be desirable to software is tested, it is past in order to improve testing efficiency
It is past to need to introduce automatic technology.And automatized script can not obtain the content of identifying code, such as mesh also as malicious script
The automated test tools such as appium, selenium of preceding mainstream cannot all obtain verification digital content.
Currently, in order to realize automatic test, often first the function of identifying code is removed in the process of development, i.e., is only needed
It inputs username and password may log into, automatic tests is waited to complete, identifying code function is added in production link.It is this
On the one hand mode increases the workload of development process, true ring can not effectively be simulated in test session by the other hand also resulting in
Border, and identifying code function can not be tested, influence the accuracy of test result.If by passing through people during the test
The mode of work input identifying code is tested, and the efficiency of automatic test can be also reduced.
Invention content
The embodiment of the present invention provides a kind of test method of identifying code, device, terminal device and storage medium, to solve mesh
It is preceding under automated test frame can not to identifying code carry out automatic test cause the accuracy of test result not high and from
The low problem of dynamicization testing efficiency.
In a first aspect, the embodiment of the present invention provides a kind of test method of identifying code, including:
During automatic test, if detecting identifying code to be tested, interception includes the use of the identifying code
Family interface images;
Obtain location information of the identifying code in the user interface picture;
According to the positional information, the identifying code picture where intercepting the identifying code in the user interface picture;
Image procossing is carried out to the identifying code picture, identifies verification code information;
According to the verification code information identified, the automatic test to the identifying code is completed.
Second aspect, the embodiment of the present invention provide a kind of test device of identifying code, including:
Detection module, for during automatic test, if detecting identifying code to be tested, interception to include institute
State the user interface picture of identifying code;
Acquisition module, for obtaining location information of the identifying code in the user interface picture;
Interception module, for according to the positional information, intercepting the identifying code place from the user interface picture
Identifying code picture;
Identification module identifies verification code information for carrying out image procossing to the identifying code picture;
Test module, for according to the verification code information identified, completing the automatic test to the identifying code.
The third aspect, the embodiment of the present invention provide a kind of terminal device, including memory, processor and are stored in described
In memory and the computer program that can run on the processor, the processor are realized when executing the computer program
The step of test method.
Fourth aspect, the embodiment of the present invention provide a kind of computer readable storage medium, the computer-readable storage medium
The step of matter is stored with computer program, and the computer program realizes the test method when being executed by processor.
The embodiment of the present invention has the following advantages that compared with prior art:The test of identifying code provided in an embodiment of the present invention
In method, apparatus, terminal device and storage medium, in automatic test course, if detecting identifying code to be tested, cut
The user interface picture for including the identifying code is taken, the location information of identifying code in the user interface picture is obtained, according to the position
Information cuts user interface picture, is verified a yard picture, then carry out image procossing to the identifying code picture, identification is tested
Code information is demonstrate,proved, and completes, to the automatic test of identifying code, to realize in automatic test according to the verification code information identified
In the process to the automatic acquisition and identification of identifying code, completion automatically enters identifying code in automatic test course and identification is tested
The function of demonstrate,proving code improves test accuracy, while reducing manual intervention to effectively simulate true environment, improves certainly
The efficiency of dynamicization test.
Description of the drawings
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below by institute in the description to the embodiment of the present invention
Attached drawing to be used is needed to be briefly described, it should be apparent that, the accompanying drawings in the following description is only some implementations of the present invention
Example, for those of ordinary skill in the art, without having to pay creative labor, can also be according to these attached drawings
Obtain other attached drawings.
Fig. 1 is the flow chart of the test method of the identifying code provided in the embodiment of the present invention 1;
Fig. 2 be the identifying code provided in the embodiment of the present invention 1 test method in step S2 implementation flow chart;
Fig. 3 be the identifying code provided in the embodiment of the present invention 1 test method in step S4 implementation flow chart;
Fig. 4 be the identifying code provided in the embodiment of the present invention 1 test method in step S44 implementation flow chart;
Fig. 5 is the schematic diagram of the test device of the identifying code provided in the embodiment of the present invention 2;
Fig. 6 is the schematic diagram of the terminal device provided in the embodiment of the present invention 4.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation describes, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair
Embodiment in bright, the every other implementation that those of ordinary skill in the art are obtained without creative efforts
Example, shall fall within the protection scope of the present invention.
Embodiment 1
Referring to Fig. 1, Fig. 1 shows the implementation process of the test method of identifying code provided in this embodiment.The identifying code
Test method is applied in automatic test platform, for realizing the automatic acquisition and identification to identifying code, completes identifying code
Automatic test.Details are as follows:
S1:During automatic test, if detecting identifying code to be tested, interception includes the user of identifying code
Interface images.
In embodiments of the present invention, identifying code to be tested is specially graphical verification code, is composed of various characters,
In automatic test course based on automated test frame, if detecting current test session, there are graphic verifications to be tested
Code then carries out screenshotss operation to the user interface picture comprising the graphical verification code.
Specifically, when carrying out screenshotss operation to picture, using the screenshotss function of automated test tool, to including verification
The user interface picture of code is intercepted, and the picture after interception is saved under preset path.
S2:Obtain location information of the identifying code in user interface picture.
Specifically, it is traversed by the content to the present user interface comprising identifying code, obtains identifying code current
Location information in the corresponding user interface picture of user interface.
Specific traversal mode can be lookup " identifying code " keyword in the content of present user interface, according to inquiring
" identifying code " keyword location information of the location determination identifying code in user interface picture, can also be in active user
The description information that verification data code is searched in the content at interface obtains verification according to the description information of the verification data code inquired
Code and then is verified location information of the code in user interface picture in the position coordinates of user interface picture.
S3:According to location information, the identifying code picture where intercepting identifying code in user interface picture.
Specifically, the user interface picture that preservation is extracted from the preset paths step S1, obtains according to step S2
Identifying code location information, identifying code picture is intercepted from user interface picture, and the identifying code picture is stored in default
Storing path under.
Such as:In automated test frame appium, it can will be obtained by directly invoking javax imageio functions
Identifying code incoming parameter of the location information as javax imageio functions, the identifying code picture after being intercepted.
S4:Image procossing is carried out to identifying code picture, identifies verification code information.
In embodiments of the present invention, verification code information refers to the character information on identifying code picture, by identifying code figure
Piece carries out image procossing, identifies the verification code information on identifying code picture.
Specifically, may include to the detailed process of identifying code picture progress image procossing:First to identifying code picture into
The processing of row gray processing and binary conversion treatment, obtain binary image, then scan binary image progress Character segmentation and obtain list
A character picture, then character recognition is carried out to single character picture, target character is obtained, the target character group that finally will identify that
At verification code information.
S5:According to the verification code information identified, the automatic test to the identifying code is completed.
Specifically, the step S4 verification code informations identified are automatically entered into identifying code input frame, are completed to be measured
The automatic test of the identifying code of examination.
In the corresponding embodiments of Fig. 1, in the automatic test course based on automated test frame, waited for if detecting
The identifying code of test, then interception includes the user interface picture of the identifying code, and obtains the identifying code in user interface picture
Location information, by the location information to user interface picture carry out screenshotss processing, be verified a yard picture, then this tested
It demonstrate,proves code picture and carries out image procossing, extract verification code information, finally automatically enter in the verification code information to identifying code input frame,
The automatic test for completing identifying code realizes automatic acquisition and identification to identifying code in automatic test course, completes
Identifying code is automatically entered in automatic test course and identifies the function of identifying code, to effectively simulate true environment,
Test accuracy is improved, while reducing manual intervention, improves the efficiency of automatic test.
Next, on the basis of the corresponding embodiments of Fig. 1, come to step S2 below by a specific embodiment
Mentioned in the concrete methods of realizing of location information of the acquisition identifying code in user interface picture be described in detail.
Referring to Fig. 2, Fig. 2 shows the specific implementation flow of step S2 provided in an embodiment of the present invention, details are as follows:
S21:It is destination document by the Content Transformation of the user interface comprising identifying code.
In embodiments of the present invention, destination document can be specifically extensible markup language (Extensible Markup
Language, XML) document, identify that identifying code needs first to identify therefore the content of the user interface comprising identifying code needs first
It is XML document by the Content Transformation of the user interface comprising identifying code.
Specifically, the description information of each element in the currently user interface comprising identifying code is obtained, and according to getting
Each element description information generate XML document.For example, in user's registration interface, element may include mail address, close
Code, confirmation password, phone number and identifying code etc..
The description information of each element for describing attribute of an element, attribute include the title of element, element position letter
Whether breath, element are visible etc..Wherein, the location information of element can specifically include element top left corner pixel point position coordinates,
The width of element and height etc., the location information of element can also include position coordinates, the upper right corner of element top left corner pixel point
The position coordinates etc. of the position coordinates of pixel, the position coordinates of lower left corner pixel and lower right corner pixel.
It should be noted that the specific structure definition of the specific object and each attribute that include in the description information of element
It can be configured according to the needs of practical application, be not limited herein.
In automated test frame appium, the getPageSource () method provided by calls tool can be straight
The all the elements for taking user interface are obtained, according to each attribute of an element of the Context resolution got, it includes each element to generate
Description information XML document in.For example, the description information for verifying data code in XML document is as follows:
<XCUIElementTypeButton
Type=" XCUIElementTypeButton "
Enabled=" true "
Visible=" true "
X=" 574 "
Y=" 382 "
Width=" 100 "
Height=" 45 "/>
Wherein, XCUIElementTypeButton is the title for verifying data code, and x and y are respectively identifying code picture upper left
The x coordinate and y-coordinate of angle pixel, width are the width of identifying code picture, and height is the height of identifying code picture.
S22:Destination document is traversed according to the title of verification data code, obtains the description information of verification data code.
Specifically, the obtained XML documents of step S21 are traversed, searches the title of verification data code, and according to lookup
To verification data code name acquiring verification data code in XML document description information.
For example, by taking the description information for the verification data code enumerated in step S21 as an example, inquired in XML document
" XCUIElementTypeButton " character string, when inquiring the character string, by comprising including the character string symbol "<”
With symbol ">" between content be determined as verify data code description information.
S23:The location information of identifying code is extracted from the description information of verification data code.
Specifically, it is defined according to the structure of pre-set attribute, the description to the step S22 verification data codes got
Information is parsed, the location information of extraction verification data code, for example, the location information can specifically include an identifying code picture left side
The position coordinates of upper angle pixel and the width and height of identifying code picture.
By taking the description information for the verification data code enumerated in step S21 as an example, the position letter of the extraction identifying code extracted
Breath is:The coordinate of identifying code picture top left corner pixel point is (574,382), and identifying code width width is 100, identifying code height
Height is 45.
In the corresponding embodiments of Fig. 2, the user interface content comprising identifying code is converted into XML document, according to verification
The title of data code traverses XML document, and the description information of verification data code is searched and extracted in XML document, is passed through
The description information determines location information of the identifying code in user interface picture, to realize automatic identification user interface picture
The specific location of middle identifying code provides condition for the automatic identifying code that obtains, so as to realize the automatic test of identifying code, carries
The efficiency and accuracy of high automatic test.
On the basis of the corresponding embodiments of Fig. 1, below by a specific embodiment come to being carried in step S4
And to identifying code picture carry out image procossing, identify that the concrete methods of realizing of verification code information is described in detail.
Referring to Fig. 3, Fig. 3 shows the specific implementation flow of step S4 provided in an embodiment of the present invention, details are as follows:
S41:Gray processing processing is carried out to identifying code picture, obtains ashing image.
In embodiments of the present invention, the accurate extraction to realize to the information content in identifying code picture, it is necessary first to testing
It demonstrate,proves code picture and carries out gray processing processing.
RGB models are a kind of currently used colour information expression ways, it is come using the brightness of Red Green Blue
Quantificational expression color.The model is also referred to as additive color colour mixture model, be with RGB three coloured lights mutually the superimposed method to realize colour mixture,
Thus it is suitable for the display of the illuminators such as display.
Gray processing refers in RGB models, if when R=G=B, color representation only has a kind of greyscale color, wherein R
The value of=G=B is gray value, and therefore, each pixel of gray level image only needs a byte storage gray value, tonal range 0-
255.Specific the methods of component method, maximum value process, mean value method or weighted mean method of may be used carries out ash to coloured image
Degreeization processing.
Specifically, by obtaining the RGB component value of each pixel in identifying code picture, pass through formula g (x, y)=k1*R
(x, y)+k2*G (x, y)+k3*B (x, y) carries out gray processing processing to each pixel of identifying code picture, obtains ashing image.
Wherein, x and y indicates that the abscissa and ordinate of each pixel in identifying code picture, g (x, y) indicate pixel
(x, y) gray processing treated gray value, R (x, y) indicate that the color component in the channels R of pixel (x, y), G (x, y) indicate picture
The color component in the channels G of vegetarian refreshments (x, y), B (x, y) indicate that the color component of the channel B of pixel (x, y), k1, k2, k3 divide
Not Wei the channels R, the channels G, the corresponding accounting parameter of channel B, and k1+k2+k3=1, specific value can be according to actually answering
Needs are configured, if for example, the luminance information of pixel is mainly distributed on channel B, the value of k3 in identifying code picture
More than k1 and k2, for example, k1=0, k2=0, k3=1.
S42:Binary conversion treatment is carried out to ashing image, obtains binary image.
In embodiments of the present invention, on the basis of the ashing image that step S41 is obtained, in order to allow image pixel value only
It is presented 0 or 255, i.e. two kinds of colors of black and white are only presented in image, need further to carry out binary conversion treatment to the ashing image.
Binaryzation exactly sets the pixel value of the pixel on image to 0 or 255, that is, whole image is presented
Go out and significantly there was only black and white visual effect.
Specifically, scanning gray processing treated ashing image in each pixel, if the pixel value of the pixel is small
In preset pixel threshold, then the pixel value of the pixel is set as 0, as pixel becomes black;If the picture of the pixel
The pixel value of the pixel is then set as 255 by element value more than or equal to the pixel threshold of preset value, i.e. pixel becomes white, obtains
To binary image.
S43:Character segmentation is carried out to binary image, obtains single character picture.
In embodiments of the present invention, identifying code picture kind contains multiple characters, is needed during identifying identifying code
Each character is identified, it is therefore desirable to Character segmentation first be carried out to step S42 treated binary images, to will
Including the binary image of multiple characters is divided into each single character picture.
Specifically, scanning step S42 treated binary images pass through and find blank line and blank column, i.e. pixel value
All 255 row or column is split the character in image, obtains single character.
Further, common character segmentation method further includes equidistant segmentation, integral projection segmentation, crosspoint segmentation, asks
Connected region etc. specifically can need selection character segmentation method according to application, not be limited herein.
For example, if character on identifying code picture is ABCD, and the feelings between this four characters without any intersection
Condition, after carrying out binary conversion treatment to the identifying code picture, the pixel value of the pixel of tetra- characters of ABCD is equal on the picture
It is set as 0, that is, is set to black, the pixel value of rest of pixels point is all set as 255, that is, white is set to, by column scan
The identifying code picture after binary conversion treatment, if the pixel value for recognizing column of pixels point is 255, i.e. blank column, then to this
Blank column is split, and the image that the pixel value comprising pixel obtained after over-segmentation is 0, what is as split is single
The image of character.
If character on identifying code picture is ABCD, and there is the case where partial intersection between this four characters, then it can be with
Using the method equidistantly divided, according to preset threshold value by entire identifying code image segmentation at quarter, then per a as single
A character picture.
S44:The character in each single character picture is identified according to preset character recognition mode.
Specifically, the single character picture obtained to step S43 identifies the single word according to preset character recognition mode
Accord with the character in image.
It should be noted that preset character recognition mode can be character recognition algorithm based on template matches, be based on
The character recognition algorithm of neural network, or the character based on support vector machines (Support Vector Machine, SVM) are known
Other algorithm etc. can specifically be configured according to the needs of practical application, not be limited herein.
For example, when carrying out character recognition according to the character recognition algorithm based on template matches, character feature template is specific
Can be the pixel value feature templates of character pixels point, or charcter topology feature templates etc..
Further, in automated test frame, optical character identification (Optical can also directly be used
Character Recognition, OCR) character in tool identification identifying code picture in each single character picture.
S45:The each character composition verification code information that will identify that.
Specifically, single character step S44 identified forms character string, which is verification code information.
In the corresponding embodiments of Fig. 3, gray processing processing and binary conversion treatment are carried out to identifying code picture first, obtain two
Value image, then to the binary image carry out Character segmentation, obtain single character picture, by single character picture according to
Preset character recognition mode each of carries out character recognition, then will identify that the character composition identifying code in single character picture
Information, to realize in automatic test course, to accurately identifying for each character in identifying code, so as to according to knowledge
The verification code information not gone out carries out the automatic test of identifying code, manual intervention is reduced, to improve the accurate of automatic test
Property and efficiency.
On the basis of the corresponding embodiments of Fig. 3, come to step S44 according to pre- below by a specific embodiment
If character recognition mode identify that the concrete methods of realizing of the character in each single character picture is described in detail.
Referring to Fig. 4, Fig. 4 shows the specific implementation flow of step S44 provided in an embodiment of the present invention, details are as follows:
S441:According to the definition of preset character feature template, feature analysis is carried out to each single character picture, is obtained
The corresponding target character feature of the single character picture.
In embodiments of the present invention, preset character feature template is specifically as follows the pixel value character modules of character pixels point
Plate, or charcter topology feature templates etc. are not limited herein.
Specifically, according to character feature template, feature recognition is carried out to the single character picture that step S43 is obtained, is obtained
The corresponding target character feature of single character picture.
By taking the pixel value feature templates of character pixels point as an example, it is assumed that the definition of pixel value feature templates is by binary image
In each pixel pixel value as condition code, the pixel that condition code is combined according to preset combination
It is worth character string, the as corresponding pixel value feature templates of the character in the binary image, then each single character picture is pressed
Definition according to the pixel value feature templates carries out feature analysis, obtains the corresponding target character feature of the single character picture.
S442:For each single character picture, calculate the corresponding target character feature of the single character picture with it is default
Character repertoire in standard character feature between characteristic similarity, the maximum standard character feature of characteristic similarity is corresponding
Character of the standard character as the single character picture, wherein character repertoire includes preset standard character and its corresponding standard
Character feature.
In embodiments of the present invention, contained in preset character repertoire common standard character and each standard character according to
The standard character feature that preset character feature template obtains.Commonly standard character includes but not limited to:0-9, A-Z, and
A-z etc..Specifically, the corresponding target character feature of single character picture each of is parsed according to step S441, by the target
Character feature standard character feature corresponding with each standard character in preset character repertoire is compared, and calculates the target word
Accord with the characteristic similarity between feature and each standard character feature, from obtained whole characteristic similarities, selected characteristic phase
Like the corresponding standard character of maximum standard character feature is spent, it is identified as the character of the single character picture.
In the corresponding embodiments of Fig. 4, word is carried out according to the definition of preset character feature template to single character picture
Feature analysis is accorded with, obtains the corresponding target character feature of single character picture, and by the target character feature and preset character
The standard character feature of each standard character in library is matched, and is chosen between the target character feature and standard character feature
Character of the corresponding standard character of the maximum standard character feature of characteristic similarity as the single character picture, to realize
In automatic test course, the quickly and accurately identification to each character in identifying code, so as to according to identifying
Verification code information carry out identifying code automatic test, to improve efficiency and the accuracy of automatic test.
On the basis of the corresponding embodiments of Fig. 1, below by a specific embodiment come to being carried in step S5
And the verification code information that identifies of basis, complete to carry out specifically the concrete methods of realizing of the automatic test of the identifying code
It is bright.
Specifically, the specific implementation flow of step S5 provided in an embodiment of the present invention includes:
The verification code information that will identify that is automatically entered into identifying code input frame, or random generation and the verification code information
Different errors validity code information, and the errors validity code information is automatically entered into identifying code input frame, it completes to verification
The automatic test of code.
In embodiments of the present invention, identifying code input frame is for inputting verification code information.
When carrying out automatic test to identifying code, on the one hand, the verification code information that can identify step S4 is automatic
It is input in identifying code input frame, to complete the automatic test to correct verification code;On the other hand, it can also generate at random
The errors validity code information is automatically entered into and tests by the errors validity code information different from the verification code information that step S4 is identified
It demonstrate,proves in code input frame, to complete the automatic test to errors validity code.
For example, identifying code to be tested is ABCD, it is ABCD according to the verification code information that step S4 is identified, if by ABCD
After being automatically entered into identifying code input frame, the result of the automatic test of the identifying code is to be proved to be successful;If according to ABCD with
Machine generate errors validity code information be ABDE, then after ABDE being automatically entered into identifying code input frame, the identifying code from
The result of dynamicization test is authentication failed.
In embodiments of the present invention, identifying code input is automatically entered by the verification code information for identifying step S4
In frame, or the errors validity code information different from verification code information is generated at random, and the errors validity code information is automatically defeated
Enter into identifying code input frame, complete the automatic test to identifying code, realizes according to the accurate verification automatically identified
Code information completes the automatic test course of the automatic test course and authentication failed including being proved to be successful so that identifying code
Automatic test can realizing route all standing, can effectively simulate true environment, reduce manual intervention, it is accurate to improve test
The efficiency of property and automatic test.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each process
Execution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limit
It is fixed.
Embodiment 2
Corresponding to the test method of the identifying code in embodiment 1, Fig. 5 shows the survey of the identifying code provided with embodiment 1
The test device of the one-to-one identifying code of method for testing illustrates only and the relevant portion of the embodiment of the present invention for convenience of description
Point.
As shown in figure 5, the test device of the identifying code includes:Detection module 51, interception module 53, is known acquisition module 52
Other module 54 and test module 55.Detailed description are as follows for each function module:
Detection module 51, for during automatic test, if detecting identifying code to be tested, interception to include
The user interface picture of identifying code;
Acquisition module 52, for obtaining location information of the identifying code in user interface picture;
Interception module 53 is used for according to location information, the identifying code figure where intercepting identifying code in user interface picture
Piece;
Identification module 54 identifies verification code information for carrying out image procossing to identifying code picture;
Test module 55, for according to the verification code information identified, completing the automatic test to identifying code.
Further, acquisition module 52 includes:
Transform subblock 521, for being destination document by the Content Transformation comprising the user interface of identifying code;
Submodule 522 is traversed, for being traversed to destination document according to the title of verification data code, obtains verification symbol
The description information of element;
Extracting sub-module 523, the location information for extracting identifying code from description information.
Further, identification module 54 includes:
It is ashed submodule 541, for carrying out gray processing processing to identifying code picture, obtains ashing image;
Binaryzation submodule 542 obtains binary image for carrying out binary conversion treatment to ashing image;
Divide submodule 543, for carrying out Character segmentation to binary image, obtains single character picture;
Matched sub-block 544, for identifying the character in each single character picture according to preset character recognition mode;
Submodule 545 is formed, each character for will identify that forms verification code information.
Further, matched sub-block 544 includes:
Feature acquiring unit 5441, for the definition according to preset character feature template, to each single character picture
Feature analysis is carried out, the corresponding target character feature of the single character picture is obtained;
Character acquiring unit 5442, for for each single character picture, calculating the corresponding mesh of the single character picture
The characteristic similarity between the standard character feature in character feature and preset character repertoire is marked, by the maximum mark of characteristic similarity
Character of the corresponding standard character of quasi- character feature as the single character picture, wherein character repertoire includes preset standard word
Symbol and its corresponding standard character feature.
Further, test module 55 is additionally operable to:
The verification code information that will identify that is automatically entered into identifying code input frame, or random generation and verification code information
Different errors validity code information, and the errors validity code information is automatically entered into identifying code input frame, it completes to verification
The automatic test of code.
Each module realizes the process of respective function in a kind of test device of identifying code provided in this embodiment, can specifically join
The description of previous embodiment 1 is examined, details are not described herein again.
Embodiment 3
The present embodiment provides a computer readable storage medium, computer journey is stored on the computer readable storage medium
Sequence realizes the test method of identifying code in embodiment 1, alternatively, the computer program when computer program is executed by processor
The function of each module in the test device of identifying code in embodiment 2 is realized when being executed by processor.To avoid repeating, here no longer
It repeats.
It is to be appreciated that the computer readable storage medium may include:The computer program code can be carried
Any entity or device, recording medium, USB flash disk, mobile hard disk, magnetic disc, CD, computer storage, read-only memory
(Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), electric carrier signal and
Telecommunication signal etc..
Embodiment 4
Fig. 6 is the schematic diagram for the terminal device that one embodiment of the invention provides.As shown in fig. 6, the terminal of the embodiment is set
Standby 60 include:Processor 61, memory 62 and it is stored in the computer journey that can be run in memory 62 and on processor 61
Sequence 63, for example, identifying code test program.Processor 61 realizes the test of above-mentioned each identifying code when executing computer program 63
Step in embodiment of the method, such as step S1 shown in FIG. 1 to step S5.Alternatively, processor 61 executes computer program 63
The function of each module in the above-mentioned each device embodiments of Shi Shixian, such as module 51 shown in Fig. 5 is to the function of module 55.
Illustratively, computer program 63 can be divided into one or more modules, one or more module is deposited
Storage executes in memory 62, and by processor 61, to complete the present invention.One or more modules can be can complete it is specific
The series of computation machine program instruction section of function, the instruction segment is for describing execution of the computer program 63 in terminal device 60
Process.For example, computer program 63 can be divided into detection module, acquisition module, interception module, identification module and test mould
Block, each module concrete function are as follows:
Detection module, for during automatic test, if detecting identifying code to be tested, interception to include to test
Demonstrate,prove the user interface picture of code;
Acquisition module, for obtaining location information of the identifying code in user interface picture;
Interception module is used for according to location information, the identifying code picture where intercepting identifying code in user interface picture;
Identification module identifies verification code information for carrying out image procossing to identifying code picture;
Test module, for according to the verification code information identified, completing the automatic test to identifying code.
Further, acquisition module includes:
Transform subblock, for being destination document by the Content Transformation comprising the user interface of identifying code;
Submodule is traversed, for being traversed to destination document according to the title of verification data code, obtains verification data code
Description information;
Extracting sub-module, the location information for extracting identifying code from description information.
Further, identification module includes:
It is ashed submodule, for carrying out gray processing processing to identifying code picture, obtains ashing image;
Binaryzation submodule obtains binary image for carrying out binary conversion treatment to ashing image;
Divide submodule, for carrying out Character segmentation to binary image, obtains single character picture;
Matched sub-block, for identifying the character in each single character picture according to preset character recognition mode;
Submodule is formed, each character for will identify that forms verification code information.
Further, matched sub-block includes:
Feature acquiring unit carries out each single character picture for the definition according to preset character feature template
Feature analysis obtains the corresponding target character feature of the single character picture;
Character acquiring unit, for for each single character picture, calculating the corresponding target word of the single character picture
The characteristic similarity between the standard character feature in feature and preset character repertoire is accorded with, by the maximum standard word of characteristic similarity
Accord with character of the corresponding standard character of feature as the single character picture, wherein character repertoire include preset standard character and
Its corresponding standard character feature.
Further, test module is additionally operable to:
The verification code information that will identify that is automatically entered into identifying code input frame, or random generation and verification code information
Different errors validity code information, and the errors validity code information is automatically entered into identifying code input frame, it completes to verification
The automatic test of code.
Terminal device 60 can be the computing devices such as desktop PC, notebook, palm PC and cloud server.Eventually
End equipment 60 may include, but be not limited only to, processor 61, memory 62.It will be understood by those skilled in the art that Fig. 6 is only
The example of terminal device 60 does not constitute the restriction to terminal device 60, may include components more more or fewer than diagram, or
Person combines certain components or different components, such as terminal device 60 can also be set including input-output equipment, network insertion
Standby, bus etc..
Alleged processor 61 can be central processing unit (Central Processing Unit, CPU), can also be
Other general processors, digital signal processor (Digital Signal Processor, DSP), application-specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor can also be any conventional processor
Deng.
Memory 62 can be the internal storage unit of terminal device 60, such as the hard disk or memory of terminal device 60.It deposits
Reservoir 62 can also be the plug-in type hard disk being equipped on the External memory equipment of terminal device 60, such as terminal device 60, intelligence
Storage card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card)
Deng.Further, memory 62 can also both include terminal device 60 internal storage unit and also including External memory equipment.It deposits
Reservoir 62 is used to store other programs and data needed for computer program and terminal device 60.Memory 62 can be also used for
Temporarily store the data that has exported or will export.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each work(
Can unit, module division progress for example, in practical application, can be as needed and by above-mentioned function distribution by different
Functional unit, module are completed, i.e., the internal structure of described device are divided into different functional units or module, more than completion
The all or part of function of description.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although with reference to aforementioned reality
Applying example, invention is explained in detail, it will be understood by those of ordinary skill in the art that:It still can be to aforementioned each
Technical solution recorded in embodiment is modified or equivalent replacement of some of the technical features;And these are changed
Or replace, the spirit and scope for various embodiments of the present invention technical solution that it does not separate the essence of the corresponding technical solution should all
It is included within protection scope of the present invention.
Claims (10)
1. a kind of test method of identifying code, which is characterized in that the test method includes:
During automatic test, if detecting identifying code to be tested, interception includes user circle of the identifying code
Face picture;
Obtain location information of the identifying code in the user interface picture;
According to the positional information, the identifying code picture where intercepting the identifying code in the user interface picture;
Image procossing is carried out to the identifying code picture, identifies verification code information;
According to the verification code information identified, the automatic test to the identifying code is completed.
2. test method as described in claim 1, which is characterized in that described to obtain the identifying code in the user interface map
Location information in piece includes:
It is destination document by the Content Transformation of the user interface comprising the identifying code;
The destination document is traversed according to the title of verification data code, obtains the description information of the verification data code;
The location information of the identifying code is extracted from the description information.
3. test method as described in claim 1, which is characterized in that it is described that image procossing is carried out to the identifying code picture,
Identify that verification code information includes:
Gray processing processing is carried out to the identifying code picture, obtains ashing image;
Binary conversion treatment is carried out to the ashing image, obtains binary image;
Character segmentation is carried out to the binary image, obtains single character picture;
The character in each single character picture is identified according to preset character recognition mode;
It each of will identify that the character composition verification code information.
4. test method as claimed in claim 3, which is characterized in that it is described identified according to preset character recognition mode it is each
Character in the single character picture includes:
According to the definition of preset character feature template, feature analysis is carried out to each single character picture, obtains the list
The corresponding target character feature of a character picture;
For each single character picture, the single corresponding target character feature of character picture and preset character are calculated
The characteristic similarity between standard character feature in library, by the corresponding mark of the maximum standard character feature of the characteristic similarity
Character of the quasi- character as the single character picture, wherein the character repertoire includes preset standard character and its corresponding mark
Quasi- character feature.
5. test method as described in claim 1, which is characterized in that the verification code information that the basis identifies, it is complete
The automatic test of the identifying code includes in pairs:
The verification code information that will identify that is automatically entered into identifying code input frame, or random generation and the identifying code
The different errors validity code information of information, and the errors validity code information is automatically entered into the identifying code input frame, it is complete
The automatic test of the pairs of identifying code.
6. a kind of test device of identifying code, which is characterized in that the test device includes:
Detection module, for during automatic test, if detecting identifying code to be tested, interception to be tested comprising described
Demonstrate,prove the user interface picture of code;
Acquisition module, for obtaining location information of the identifying code in the user interface picture;
Interception module is used for according to the positional information, testing where intercepting the identifying code in the user interface picture
Demonstrate,prove code picture;
Identification module identifies verification code information for carrying out image procossing to the identifying code picture;
Test module, for according to the verification code information identified, completing the automatic test to the identifying code.
7. test device as claimed in claim 6, which is characterized in that the acquisition module includes:
Transform subblock, for being destination document by the Content Transformation comprising the user interface of the identifying code;
Submodule is traversed, for being traversed to the destination document according to the title of verification data code, obtains the identifying code
The description information of element;
Extracting sub-module, the location information for extracting the identifying code from the description information.
8. test device as claimed in claim 6, which is characterized in that the identification module includes:
It is ashed submodule, for carrying out gray processing processing to the identifying code picture, obtains ashing image;
Binaryzation submodule obtains binary image for carrying out binary conversion treatment to the ashing image;
Divide submodule, for carrying out Character segmentation to the binary image, obtains single character picture;
Matched sub-block, for identifying the character in each single character picture according to preset character recognition mode;
Submodule is formed, for each of will identify that the character forms verification code information.
9. a kind of terminal device, including memory, processor and it is stored in the memory and can be on the processor
The computer program of operation, which is characterized in that the processor realizes such as claim 1 to 5 when executing the computer program
The step of test method of any one identifying code.
10. a kind of computer readable storage medium, the computer-readable recording medium storage has computer program, feature to exist
In realizing the test method of identifying code as described in any one of claim 1 to 5 when the computer program is executed by processor
Step.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810198355.4A CN108563559A (en) | 2018-03-12 | 2018-03-12 | A kind of test method of identifying code, device, terminal device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810198355.4A CN108563559A (en) | 2018-03-12 | 2018-03-12 | A kind of test method of identifying code, device, terminal device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108563559A true CN108563559A (en) | 2018-09-21 |
Family
ID=63532584
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810198355.4A Pending CN108563559A (en) | 2018-03-12 | 2018-03-12 | A kind of test method of identifying code, device, terminal device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108563559A (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109726121A (en) * | 2018-12-12 | 2019-05-07 | 北京云测信息技术有限公司 | A kind of identifying code acquisition methods and terminal device |
CN110032970A (en) * | 2019-04-11 | 2019-07-19 | 深圳市华付信息技术有限公司 | Biopsy method, device, computer equipment and the storage medium of high-accuracy |
CN111143213A (en) * | 2019-12-24 | 2020-05-12 | 北京数衍科技有限公司 | Software automation test method and device and electronic equipment |
CN111274957A (en) * | 2020-01-20 | 2020-06-12 | 阳光人寿保险股份有限公司 | Webpage verification code identification method, device, terminal and computer storage medium |
CN111352827A (en) * | 2018-12-24 | 2020-06-30 | 中移信息技术有限公司 | Automatic testing method and device |
CN111723891A (en) * | 2019-03-18 | 2020-09-29 | 北京京东尚科信息技术有限公司 | Graphic code generation method and device and computer readable storage medium |
CN112035821A (en) * | 2020-09-04 | 2020-12-04 | 平安科技(深圳)有限公司 | Method and device for identifying graphic verification code, computer equipment and storage medium |
CN112241640A (en) * | 2019-07-18 | 2021-01-19 | 杭州海康威视数字技术股份有限公司 | Graphic code determination method and device and industrial camera |
CN113760730A (en) * | 2021-01-27 | 2021-12-07 | 北京京东振世信息技术有限公司 | Automatic testing method and device |
CN114860604A (en) * | 2022-05-24 | 2022-08-05 | 广州掌动智能科技有限公司 | Automatic test method, system and storage medium for automatically identifying dynamic verification code |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101944177A (en) * | 2010-08-30 | 2011-01-12 | 深圳市多赢软件技术有限公司 | Method for recognizing verification code |
US20120291019A1 (en) * | 2011-05-12 | 2012-11-15 | Canon Kabushiki Kaisha | Program verification apparatus based on model verifying and storage medium |
CN102946334A (en) * | 2012-11-28 | 2013-02-27 | 中国移动(深圳)有限公司 | Method and system for acquiring valid image verification code |
CN104021376A (en) * | 2014-06-05 | 2014-09-03 | 北京乐动卓越科技有限公司 | Verification code identifying method and device |
CN106650398A (en) * | 2017-01-03 | 2017-05-10 | 深圳博十强志科技有限公司 | Recognition system and recognition method for verification code of mobile platform |
CN107454118A (en) * | 2017-10-11 | 2017-12-08 | 北京安博通科技股份有限公司 | Identifying code acquisition methods and device, login method and system |
-
2018
- 2018-03-12 CN CN201810198355.4A patent/CN108563559A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101944177A (en) * | 2010-08-30 | 2011-01-12 | 深圳市多赢软件技术有限公司 | Method for recognizing verification code |
US20120291019A1 (en) * | 2011-05-12 | 2012-11-15 | Canon Kabushiki Kaisha | Program verification apparatus based on model verifying and storage medium |
CN102946334A (en) * | 2012-11-28 | 2013-02-27 | 中国移动(深圳)有限公司 | Method and system for acquiring valid image verification code |
CN104021376A (en) * | 2014-06-05 | 2014-09-03 | 北京乐动卓越科技有限公司 | Verification code identifying method and device |
CN106650398A (en) * | 2017-01-03 | 2017-05-10 | 深圳博十强志科技有限公司 | Recognition system and recognition method for verification code of mobile platform |
CN107454118A (en) * | 2017-10-11 | 2017-12-08 | 北京安博通科技股份有限公司 | Identifying code acquisition methods and device, login method and system |
Non-Patent Citations (1)
Title |
---|
LUCAS__LIU: "验证码识别处理--基于python(一)", 《HTTPS://BLOG.CSDN.NET/LB245557472/ARTICLE/DETAILS/71518576》 * |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109726121B (en) * | 2018-12-12 | 2022-02-18 | 北京云测信息技术有限公司 | Verification code obtaining method and terminal equipment |
CN109726121A (en) * | 2018-12-12 | 2019-05-07 | 北京云测信息技术有限公司 | A kind of identifying code acquisition methods and terminal device |
CN111352827A (en) * | 2018-12-24 | 2020-06-30 | 中移信息技术有限公司 | Automatic testing method and device |
CN111723891A (en) * | 2019-03-18 | 2020-09-29 | 北京京东尚科信息技术有限公司 | Graphic code generation method and device and computer readable storage medium |
CN110032970A (en) * | 2019-04-11 | 2019-07-19 | 深圳市华付信息技术有限公司 | Biopsy method, device, computer equipment and the storage medium of high-accuracy |
CN112241640B (en) * | 2019-07-18 | 2023-06-30 | 杭州海康威视数字技术股份有限公司 | Graphic code determining method and device and industrial camera |
CN112241640A (en) * | 2019-07-18 | 2021-01-19 | 杭州海康威视数字技术股份有限公司 | Graphic code determination method and device and industrial camera |
CN111143213A (en) * | 2019-12-24 | 2020-05-12 | 北京数衍科技有限公司 | Software automation test method and device and electronic equipment |
CN111274957A (en) * | 2020-01-20 | 2020-06-12 | 阳光人寿保险股份有限公司 | Webpage verification code identification method, device, terminal and computer storage medium |
CN112035821A (en) * | 2020-09-04 | 2020-12-04 | 平安科技(深圳)有限公司 | Method and device for identifying graphic verification code, computer equipment and storage medium |
CN113760730A (en) * | 2021-01-27 | 2021-12-07 | 北京京东振世信息技术有限公司 | Automatic testing method and device |
CN114860604A (en) * | 2022-05-24 | 2022-08-05 | 广州掌动智能科技有限公司 | Automatic test method, system and storage medium for automatically identifying dynamic verification code |
CN114860604B (en) * | 2022-05-24 | 2023-04-21 | 广州掌动智能科技有限公司 | Automatic test method, system and storage medium for automatically identifying dynamic verification code |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108563559A (en) | A kind of test method of identifying code, device, terminal device and storage medium | |
CN109977935A (en) | A kind of text recognition method and device | |
CN102750555B (en) | Expression identification device applied to instant messaging tool | |
CN110675940A (en) | Pathological image labeling method and device, computer equipment and storage medium | |
CN106845508A (en) | The methods, devices and systems of release in a kind of detection image | |
CN112559341A (en) | Picture testing method, device, equipment and storage medium | |
CN116168351B (en) | Inspection method and device for power equipment | |
CN108734849B (en) | Automatic invoice true-checking method and system | |
CN112818852A (en) | Seal checking method, device, equipment and storage medium | |
CN108182457A (en) | For generating the method and apparatus of information | |
US20150023599A1 (en) | Optical Match Character Classification | |
CN110378886B (en) | Image comparison method, image comparison device, electronic device and medium | |
CN113704111A (en) | Page automatic testing method, device, equipment and storage medium | |
CN112632926B (en) | Bill data processing method and device, electronic equipment and storage medium | |
CN110414522A (en) | A kind of character identifying method and device | |
TW201933179A (en) | Image data retrieving method and image data retrieving device | |
US9881210B2 (en) | Generating a computer executable chart visualization by annotating a static image | |
CN110880023A (en) | Method and device for detecting certificate picture | |
CN112084103A (en) | Interface test method, device, equipment and medium | |
JP6365117B2 (en) | Information processing apparatus, image determination method, and program | |
CN110764685A (en) | Method and device for identifying two-dimensional code | |
JP5712859B2 (en) | Image recognition apparatus and image recognition method | |
CN113315995B (en) | Method and device for improving video quality, readable storage medium and electronic equipment | |
CN114782955A (en) | Buried point processing method, electronic device, and storage medium | |
CN109753217B (en) | Dynamic keyboard operation method and device, storage medium and electronic equipment |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180921 |
|
RJ01 | Rejection of invention patent application after publication |