Summary of the invention
Present invention contemplates that providing the automatic test approach and system of a kind of application software, does not need user and encoded i.e.
Application software can be tested automatically, that is, not needing user has the ability for writing or generating script, in addition, also not needing to answer
Work is write and recorded with what software development was completed can to start test script.
According to one aspect, the present invention provides a kind of method tested automatically for application software.The method includes connecing
Receive the text information for indicating test target and corresponding test action;Receive the view image of the application software;In the view
The test target is identified in figure image and determines position of the test target in the view image;And based on described
Represented by the test target of the application program is called by the corresponding test action in the position of test target
Test operation.
Thus, it is only necessary to which user can input the text information for indicating test target and corresponding test action, according to this
The method of invention can execute automatically test to application software according to the requirement of user, not need user with code capacity.
In addition, due to having been able to determine that (such as " Login " etc. is pressed each test target in application software substantially in the design phase
Button) and test action (such as " click "), it is therefore not necessary to which applied software development is waited to complete, so that it may write be related to respectively in advance
Test script corresponding to a test moving-target and the test operation of test action, therefore, this makes test job and applies journey
The development of sequence can carry out parallel, may shift to an earlier date the issuing date of application program significantly.
In one embodiment, receiving one of in the following way indicates that the test target and the corresponding test are dynamic
The text information of work: user's input;Or the sequential selection from pre-generated list.Thus, on the one hand, user can be directly defeated
Enter test target and corresponding test action, on the other hand, it includes test target and correspondence that user, which can store pre-generated,
Test action list, the list is imported when needing, therefrom sequential selection test target and corresponding test action.This is to use
Family provides can be with the mode of operation of flexible choice.
In one embodiment, the method also includes receiving the text information of natural language description, the text information
Natural language description including indicating one or more test targets and corresponding test action;Based on predefined rule to institute
The natural language description in text information is stated to be parsed with the one or more of test targets of determination and the correspondence
Test action;Generate the list including one or more of test targets and the corresponding test action.
According to this embodiment, when user input be the natural language description that computer is unable to Direct Recognition text information
When, these text informations can be parsed, so that being converted to computer can be with the language of Direct Recognition.Such as when input
When being test case, which can be parsed, determine test target wherein included and corresponding test action,
List is generated, in case using when operation test.
In one embodiment, the method also includes identifying the text information of each element and position in the view image
Confidence breath;Wherein, by by the text information of each element compared with the text information for indicating the test target relatively come in institute
It states and identifies the test target in view image, and the location information by determining element corresponding with the test target
To determine the position of the test target.This make it possible to based on the received test target in the view image of application software from
The position of dynamic identification test target.
In a further embodiment, using the text detection algorithm based on machine learning, such as CTPN (Detecting
Text in Natural Image with Connectionist Text Proposal Network), detect the view
Character in image;The text filed of corresponding each element is determined based on the character detected;It text filed is cut into described
Indicate the subregion of each character;Use the character recognition algorithm based on machine learning, such as CRNN (Convolutional
Recurrent Neural Network), identify the character in each subregion to identify each member in the view image
The text information of element.
More accurate identification can be obtained and tie by carrying out text detection and character recognition using the algorithm based on machine learning
Fruit.
The present invention provides a kind of system tested automatically for application software, including receiving module according to another aspect,
It is configured as receiving the text information for indicating test target and corresponding test action;Picture recognition module is configured as
The test target is identified in the view image of the application software and determines the test target in the view image
Position;And calling module, the position based on the test target is configured as to described in the application program
Test target calling is by the test operation represented by the corresponding test action.
The present invention provides a kind of system tested automatically for application software according to another aspect,.The system comprises
Interface is configured from the external text information for receiving expression test target and corresponding test action;And processor, matched
It is set to the automatic test approach for executing each embodiment according to the present invention.
The present invention provides a kind of machine readable media according to another aspect, is stored with computer program code, the meter
Calculation machine program code executes the computer according to the present invention to application software to be tested
Each embodiment automatic test approach.
Specific embodiment
The embodiment of the present invention provides the system and method tested automatically for being used for application software.Application software includes but not
It is confined to mobile application, the equally applicable each embodiment of the invention of application software on computers is installed.
By means of the system and method for the embodiment of the present invention, only need to use when executing the automatic test to application software
Family, such as Test Engineer, input indicate the text information of test target and corresponding test action, so that it may automatically soft in application
The test target is identified in the view image of part, and to test target calling by the test operation represented by test action.By
This, realizes full automatic test process, alleviates the burden of user, does not need user's intervention during the test, and
Not needing user has the ability for writing or generating script, as long as he is capable of providing test target and movement.Furthermore due to
Test target is, for example, certain buttons on software interface, and test action is, for example, the click carried out to these buttons, cunning
Therefore the operation of dynamic, long-pressing etc., test target and test action are often just it is known that, use in the design process of application software
The system and method for embodiment according to the present invention, can software also it is untapped come out before, such as provide interaction design
It beginning to prepare test program relevant to each test action in the case where original text, this shortens the process of software development, so that
Software can be issued as early as possible.
Fig. 1 shows the system 10 according to an embodiment of the invention that test automatically for application software.It is described
System 10 includes receiving module 11, picture recognition module 13, calling module 14 and action executing module 15, preferably further includes solution
Analyse module 12.
Receiving module 11 is configured as receiving the text information for indicating test target and test action.Test target can be
Button on the interface of application software, text box etc..Test action includes but is not limited to click, input, sliding, long-pressing etc..
Receiving module 11 can input the interface of text information via user interface, such as user, receive text information.
Such as receiving module 11 receives user " Click ' the Login ID ' " that inputs via interface, " Input ' tngd0003 ' " and
Check ' Reload ' etc..For the application software of Chinese interface, receiving module 11 can receive the Chinese text letter of user's input
Breath, such as " clicking ' next step ' " this text information in the case where the view of application software is as shown in Figure 2, can be received.
Alternatively, receiving module 11 can import text information from the file that is stored in advance/generates, such as from pre-generated listing file
Import the list including test target and test action.Preferably, receiving module 11 can receive the view image of application software,
Such as screenshotss image.In the text information indicate test target text be not only limited to application software in the street in button
Title can also include the nickname that each button is arranged in user.
The system 10 preferably includes parsing module 12, when be not via the received text information of receiving module 11 can
By the text information of computer Direct Recognition, i.e., computer can not be directly determined test target by text information and test is dynamic
In the case where work, for example, user has input test target and the test action of natural language description, or packet has been imported from file
The test case of the natural language description to test target and test action is included, in order to by the test target of the natural language description
It is converted into the language that computer can identify with test action, parsing module 12 can be based on predefined rule to natural language
Description is parsed, so that it is determined that included one or more test targets and corresponding test action in text information.
These test targets and corresponding test action can be stored in a list.The parsing performed by parsing module 12
Operation will be specifically described later referring to embodiment shown in Fig. 4.
System 10 further includes picture recognition module 13, calling module 14 and action executing module 15.Passing through receiving module
11 receive or from as described above by the tab sequential that parsing module 12 generates selected test target and corresponding test action it
Afterwards, the processing that picture recognition module 13 carries out being preferably based on machine learning by the view image to application software is in the view figure
The test target is identified as in and determines position of the test target in view image.In one embodiment, image recognition
Module 13 can identify the text information and its location information of each element in view image, by by the text envelope of each element
Breath is compared with received test target, to identify the test target in view image, and then passes through the determining and test
The location information of the corresponding element of target determines the position of the test target.
In a preferred embodiment, picture recognition module 13 include character machining device 131, text filed determiner 132,
Character separator 133 and Character recognizer 134.Character machining device 131 is detected using the text detection algorithm based on machine learning
Character in view image out, it is preferred to use CTPN algorithm detects the character in view image.In one embodiment,
Character machining device 131 can slide algorithm in conjunction with forms to detect the character of each element in view image.Fig. 2 shows combine
The signal scene that forms sliding algorithm handles the view image of application software, arrow instruction forms therein are on the image
Sliding.Preferably, text filed determiner 132 determines text filed, the example of corresponding each element based on the character detected
Such as " next step ", this is text filed.This can be by carrying out expansion process to the character zone detected to form connected domain
To realize.Character separator 133 cuts the text filed of each element, obtains the subregion for indicating each character, this
Also algorithm can be slided in conjunction with forms to realize.Character recognizer 134 identifies the character execution character in each subregion and calculates
Method, to identify the text information of corresponding each element, such as " next step ".Preferably, using such as CRNN based on engineering
The character recognition algorithm of habit identifies the character in each subregion.It is expected that in some cases, it is convenient to omit text area
Domain determiner 132 and character separator 133, such as each region only include a character.
Picture recognition module 13 can also include identification module (not shown), by the text of each element of the correspondence identified
This information is compared with received test target, if the two matches, it is determined that the location information of the element, and then by this yuan
The location information of element determines the position of test target, i.e., position of the element in view image is determined as to the position of test target
It sets.
Calling module 14 receives corresponding with test target test action, based on the position of determining test target,
It executes in test process and test action institute corresponding with the test target is called to the test target in the view of application software
The test operation of expression.Test operation represented by each test action corresponding from different test targets can be compiled in advance
Journey is in action executing module 15, and when needing to be implemented test operation represented by a certain test action, calling module 14 is only needed
The correspondence submodule being invoked in the action executing module 15, that is, call corresponding test operation.
Have been described above with reference to fig. 1 it is according to an embodiment of the invention for application software test automatically be
System, it is also contemplated that realizing the various functions of the system by processor.For example, it is a kind of for application software test automatically be
System includes interface & processor, and processor executes above-mentioned receiving module 11, parsing module 12, picture recognition module 13, calls mould
The function of block 14 and action executing module 15.
Fig. 3 shows the method 100 according to an embodiment of the invention that test automatically for application software.According to
The embodiment receives the text information for indicating test target and corresponding test action, this may be such that computer 101
It is capable of the text information of Direct Recognition test target and test action.If computer can not directly be known according to text information
Other test target and corresponding test action, for example, providing the text information of natural language description, then 102, according to pre-
The rule of definition parses the natural language description in text information, so that it is determined that test target and corresponding test are dynamic
Make.This can be realized by parsing module 12.103, start application software, receives or store the view image of application software.Example
The view image at each interface of application software can such as be stored in advance before being tested.
Above step is related to the preparation tested application software.Although describing this method referring to preparing
100 step 101-103, it is contemplated that one or more of these steps can also execute when running test.Example
Such as, step 103 can be executed when executing test.
Following steps are related to running the test to application program.104, known in view image using image recognition algorithm
Other test target and the position for determining test target, it is preferable that the text information of each element and position in identification view image
Information, by relatively knowing the text information of each element in view image compared with the text information for indicating the test target
Other test target, and determine test target in view figure by determining the location information of element corresponding with test target
Position as in.105, the test target of application program is called by corresponding with test target in the position based on test target
Test action represented by test operation.
Fig. 4 shows the process 200 of natural language according to an embodiment of the invention parsing, this and the step in Fig. 2
Rapid 102 is corresponding, and can be executed by parsing module 12.Wherein, 201, the natural language description such as test case is received
Text information, and by i be set as 0, i be row serial number, indicate text information in the i-th row.When text information only
It can ignore when including a line.202, i+1 is assigned to i.203, judge whether gone to text information last 1
Row, n indicate total line number of text information.Terminate text resolution 204 if last 1 row for having gone to text information
And output listing;If going to last 1 row of the text not yet, the style of writing sheet is read 205, in 206 pairs of styles of writing
This is parsed, so that it is determined that test target included in it and corresponding test action.207, by identified test
List is added in target and corresponding test action.Then 202 are returned, next line text is parsed.
Above by reference to the mode parsed line by line, text resolution performed by parsing module 12 is illustrated, this is only one
Preferred embodiment is not limiting, and those skilled in the art can be considered to be solved with the other modes in addition to parsing line by line
Text information is analysed, this can be adjusted according to the feature of text information to be resolved.
Fig. 5 shows the process of application software testing according to an embodiment of the invention, the step in this corresponding diagram 2
104 and 105, and the operation executed by picture recognition module 13 and calling module 14 is related generally to, such as having received
By being executed after the determining list including test target and corresponding test action of natural language parsing.
Firstly, starting application software to be tested by user, it is assumed that exist in the list a series of test target and
Its corresponding test action, then line number can be similarly by i being initially set to 0, i 301, indicate multiple included in list
Test target and its row serial number of corresponding test action, it is also contemplated that it only indicates multiple test targets and its corresponding survey
The serial number of examination movement.302, i is assigned a value of i+1.303, judge whether i is greater than m, m indicates the test mesh for including in list
The sum of mark and corresponding test action, such as total line number of list are thereby determined whether for all test mesh in list
Mark and test action perform test.If all test targets and test action that have been directed in list perform test,
Then terminate to test and carry out resource reclaim 304, exports test report, carry out log upload.If not yet in list
All test targets and test action execute test, then 305 from list read row serial number i test target and correspondence
Test action.306, the view image of application software is received, which can be the screen picture of the software of interception,
Or the view image saved in advance.307, image recognition, such as picture recognition module 13 are carried out to received view image
It can identify the text information and its location information of each element in view image.308, by the text information of each element with
The test target read before compares, to identify in view image and the matched text information of the test target.Such as
Fruit has identified the text information to match with test target in view image, then 309, passes through the determining and test target
The location information of corresponding element determines the position of the test target.If not identifying and testing in view image
The text information that target matches, then return to 302, continues to read next test target and test action.This has been determined 309
After position of the test target in view image, can 310 check read it is corresponding with test target movement whether with
The movement that action executing module 15 is supported matches, if action executing module 15 does not include the journey for supporting the test action
Sequence continues to read next test target and test action then then returning to 302;If supported, held in 311 call actions
Correspondence test operation in row module 15 executes the correspondence test operation to the test target on the page of application program.
It is expected that in addition to starting software to be tested, each step is by picture recognition module in above-mentioned each step
13 and calling module 14 execute.It is also contemplated that realizing above-mentioned process using processor.
Fig. 6 shows the stream of the image recognition executed according to one embodiment of present invention by picture recognition module 13
Journey.401, algorithm is slided preferably in combination with forms come soft in application based on the text detection algorithm of machine learning using such as CTPN
Character is detected in the view image of part.402, image expansion is carried out to each character zone detected, forms connected domain, from
And it determines for the text filed of each element.403, to each text filed son for cutting, obtaining being directed to each character
Region.404, it is based on these subregions, execution character identification operation, such as use the algorithm based on machine learning of such as CRNN
To execute the character recognition.In addition to CTPN and CRNN, other word detection/recognition algorithms based on machine learning are also can be pre-
Phase.
Although illustrating each operation of the embodiment of the present invention with reference to above-mentioned each flow chart, those skilled in the art are answered
Work as understanding, this purpose being merely to illustrate that, rather than it is restrictive.Each step in above method process can be closed
And modify, change, even delete, to modify or omit corresponding function.
It is appreciated that the system/method tested automatically for application software of each embodiment of the invention can be by
Computer program/software is realized.These softwares can be loaded into the working storage of data processor, be used for when running
The method for executing each embodiment according to the present invention.
Following the two of exemplary embodiment covering of the invention: computer journey of the invention is created that/used from the beginning
Sequence/software, and switch to existing program/software using computer program/software of the invention by means of updating.In a reality
It applies in example, can be transformed on the basis of current open source test program/existing software to obtain reality according to the present invention
Apply the product of example.For example, being able to use the computer vision library such as OpenCV to realize that the image of various embodiments of the present invention is known
Other function, and then realize with other suites the system/method of various embodiments of the present invention.
Other embodiment according to the present invention provides a kind of machine (such as computer) readable medium, such as CD-ROM, wherein
The readable medium has the computer program element being stored in thereon, which is used to execute when running
The method of each embodiment according to the present invention.The machine readable media is, for example, together with other hardware or as other hardware
The optical storage medium or solid state medium of part supply.
The computer program for being used to execute the method for each embodiment according to the present invention can also be distributed otherwise,
Such as via internet or other wired or wireless telecommunication systems.Computer program also may be provided in such as WWW
On network, and can be from the working computer that such network is downloaded to data processor.
It must be noted that the embodiment of the present invention is described with reference to different themes.In particular, some embodiments are references
Method type claim describes, and other embodiments are reference device type claims to describe.However, this field skill
Art personnel will learn from described above and below, unless otherwise specified, in addition to belong to a type of theme feature it is any
Other than combination, be related to any combination between the feature of different themes be also regarded as by this application discloses.Further, it is possible to combine
Whole features provide the synergistic effect simply summed it up greater than feature.
The present invention is described above by reference to specific embodiment, it will be appreciated by those skilled in the art that without departing substantially from the present invention
Spirit and essential characteristics in the case where, can realize technical solution of the present invention in various ways.Specific embodiment is only
It is only illustrative, and not restrictive.In addition, between these embodiments can any combination, to achieve the object of the present invention.
Protection scope of the present invention is defined by appended claims.
One word of " comprising " in description and claims is not excluded for the presence of other element or steps.It says in the description
The function of each element that is bright or recording in the claims can also be split or combine, by corresponding multiple element or list
One element is realized.