Summary of the invention
Based on the above issues, this application provides a kind of recording and playback test method and relevant apparatus, to improve software survey
The reliability and accuracy of examination.
The embodiment of the present application discloses following technical solution:
In a first aspect, the application provides a kind of recording and playback test method, it to be used for test software, which comprises
The sequence of operation recorded when obtaining manual operation tested software;The sequence of operation record has execution sequence to determine
Multi-mode operation and each corresponding operation interface screenshot of operation;It is described comprising the control that is triggered in the operation interface screenshot
The control that is triggered is operated with described with corresponding relationship;
Utilize the semantic information for the control that is triggered described in operation interface screenshot acquisition;The semanteme of the control that is triggered
Information comprises at least one of the following: classification information, text information or the characteristics of image for the control that is triggered;
The real-time interface screenshot of the tested software is obtained, and obtains the real-time interface using the real-time interface screenshot
The corresponding semantic information of each control for including in screenshot;The corresponding semantic information of each control includes following at least one
Kind: the corresponding classification information of each control, text information or characteristics of image;
According to the semantic information of the control that is triggered and the corresponding semantic information of each control, determine described real-time
It whether include the target widget to match with the control that is triggered in the screenshot of interface, if it is, to the target widget mould
Be triggered the corresponding operation of control described in quasi- playback;
According to the corresponding playback result of operations that the sequence of operation records, determine whether the tested software passes through
Test.
Optionally, the semantic information using the control that is triggered described in operation interface screenshot acquisition, specifically includes:
Classify to the control that is triggered described in the operation interface screenshot, the classification for the control that is triggered described in acquisition
Information;
And/or text information identification is carried out to the control that is triggered, obtain the text of the control that is triggered recognized
Word information;
And/or characteristics of image identification is carried out to the control that is triggered, obtain the figure of the control that is triggered recognized
As feature.
Optionally, described that each control pair for including in the real-time interface screenshot is obtained using the real-time interface screenshot
The semantic information answered, specifically includes:
Classify to each control in the real-time interface screenshot, obtains the corresponding classification letter of each control
Breath;
And/or text information identification is carried out to the control in each control including text information, it obtains and recognizes
The corresponding text information of the control comprising text information;
And/or characteristics of image identification is carried out to each control, obtain the corresponding figure of each control of recognize described
As feature.
Optionally, method further include:
The real-time interface screenshot is split, multiple mutually independent image regions are obtained;Each described image
Subregion includes a control;
Each control in the real-time interface screenshot is classified, and is specifically included:
Classify respectively to the control in each described image subregion;
It is described that text information identification is carried out to the control in each control including text information, it specifically includes:
Text information identification is carried out respectively to the control in each described image subregion including text information;
It is described that characteristics of image identification is carried out to each control, it specifically includes:
Characteristics of image identification is carried out respectively to the control in each described image subregion.
Optionally, method further include:
According to the operation interface screenshot obtain described in be triggered the location information of control;And according to the real-time boundary
Face screenshot obtains the corresponding location information of each control;
The semantic information and the corresponding semantic information of each control of the control that is triggered according to, determine described in
Whether include the target widget to match with the control that is triggered in the screenshot of real-time interface, specifically include:
According to the semantic information of the control that is triggered and the corresponding semantic information of each control and described touched
The location information and the corresponding location information of each control for sending out control, determine in the real-time interface screenshot whether comprising with
The target widget that the control that is triggered matches.
Optionally, the semantic information of the control that is triggered according to and the corresponding semantic information of each control,
And the location information and the corresponding location information of each control of the control that is triggered, determine the real-time interface screenshot
In whether comprising the target widget that matches with the control that is triggered, specifically include:
Each control is subjected to the scoring of semantic information matching with the control that is triggered respectively, is obtained described each
The corresponding first matching score value of control;Each control is carried out location information matching with the control that is triggered respectively to comment
Point, obtain the corresponding second matching score value of each control;
According to each corresponding first matching score value of control and the second matching score value, obtain described each
The corresponding comprehensive matching score value of control;
The control that the comprehensive matching score value is higher than preset matching score value is judged whether there is, if it is, by described comprehensive
It closes the matching highest control of score value and is determined as the target widget to match with the control that is triggered.
Optionally, method further include:
If not including the target widget to match with the control that is triggered in the real-time interface screenshot, wait pre-
If after the time, judging whether the corresponding current number of retries of the operation interface screenshot is more than preset times, if it is not, then obtaining
New real-time interface screenshot is taken, and 1 is added to the corresponding number of retries of the operation interface screenshot;
Determine in the new real-time interface screenshot whether include the target widget to match with the control that is triggered, such as
Fruit is no, then continues to retry, until the operation playback failure is determined when the number of retries is more than the preset times, or
Until before the number of retries is more than the preset times, it is determining to include in working as the secondary new real-time interface screenshot obtained
The target widget to match with the control that is triggered.
Optionally, described according to the corresponding playback result of the operations recorded in the sequence of operation, determine the quilt
It surveys whether software passes through test, specifically includes:
If the playback result of all operations is to play back successfully, it is determined that the tested software passes through test;
Alternatively, if in the playback result of all operations more than pre-set ratio operation playback result be playback at
Function, it is determined that the tested software passes through test.
Optionally, method further include: operation important in the multi-mode operation of sequence of operation record is marked;
It is described according to the corresponding playback result of the operations recorded in the sequence of operation, determine that the tested software is
It is no by test, specifically include:
Whether the labeled corresponding playback result of the operation of judgement is to play back successfully, if it is, described in determining
Tested software passes through test;If it is not, then determining that the tested software does not pass through test.
Optionally, method further include:
Obtain the corresponding first response interface screenshot of the operation;
Mark at least one referring to control in the first response interface screenshot;It is described to be played back referring to control control
It is not triggered by operation in journey;
The semantic information referring to control is obtained using the first response interface screenshot;The semanteme referring to control
Information comprises at least one of the following: classification information, text information or the characteristics of image referring to control;
It is triggered after the corresponding operation of control described to described in target widget simulation playback, described in acquisition
Operate corresponding second response interface screenshot;
It whether determines in the second response interface screenshot comprising semantic information and the semantic information phase referring to control
Mutual matched control, if it is, the operation plays back successfully;If it is not, then the operation playback failure.
Second aspect, the application provide a kind of recording and playback test device, are used for test software, and described device includes:
The sequence of operation obtains module, the sequence of operation recorded when for obtaining manual operation tested software;The operation sequence
The multi-mode operation and each corresponding operation interface screenshot of operation that column record has execution sequence to determine;The operation interface is cut
Comprising the control that is triggered in figure, the control that is triggered has corresponding relationship with the operation;
Semantic information first obtains module, for the semanteme using the control that is triggered described in operation interface screenshot acquisition
Information;The semantic information of the control that is triggered comprises at least one of the following: the classification information of the control that is triggered, text information or
Characteristics of image;
Semantic information second obtains module, for obtaining the real-time interface screenshot of the tested software, and utilizes the reality
When interface screenshot obtain the corresponding semantic information of each control for including in the real-time interface screenshot;Each control is corresponding
Semantic information comprise at least one of the following: the corresponding classification information of each control, text information or characteristics of image;
Control matching module, semantic information and the corresponding semanteme of each control for the control that is triggered according to
Information determines in the real-time interface screenshot whether include the target widget to match with the control that is triggered, if it is,
Operation playback module is to the corresponding operation of control that is triggered described in target widget simulation playback;
Software test result determining module, the corresponding playback knot of operations for being recorded according to the sequence of operation
Fruit, determines whether the tested software passes through test.
Compared to the prior art, the application has the advantages that
Recording and playback test method provided by the present application is controlled when based on recording and when playback in the operation interface of tested software
The semantic information (such as classification information, text information or characteristics of image etc.) of part is determined and is recorded from operation interface when playback
The target widget that the control that is triggered when processed in operation interface matches.The operation applied when recording for the control that is triggered,
Target widget can be accordingly applied to when playback, to realize the playback to operation interface corresponding operation when recording.For record
Each operation in the sequence of operation being made, executes sequence according to operations in the sequence of operation, one by one according to above-mentioned side
Formula determines target widget and executes corresponding operation, and so as to complete the playback of whole operation sequence, final determine is tested
The test result of software.
This method matches control according to the semantic information of control, thus it is guaranteed that target widget and the control that is triggered
Consistency can accurately trigger target widget to carry out simulated operation when subsequent playback.This method does not depend solely on behaviour
Make the playback that the coordinate position on screenshot is operated, therefore the probability of playback failure can be effectively reduced, it is seen then that applies the party
Method carries out software test, and the reliability of test is improved.Further, since testing reliability improves, it is thus possible to obtain
The test result of more accurate tested software.In addition, this method is independent of coordinate position, therefore, it is compatible in it is a variety of not
Same equipment, and test the software of different version and/or styles.
Specific embodiment
It describes as discussed above, when current recording and playback test method is applied to software test, playback success or not is very big
It is influenced in degree by the coordinate position that operation when recording acts on, thus is once applied the position of (be triggered control) in reality
There are slight deviations in the application of border, that is, the result for causing playback to fail.To the reliability and accuracy of Software function test.
Based on the above issues, inventor after study, provides a kind of recording and playback test method and relevant apparatus.This Shen
In the technical solution that please be provide, the control that tester's manual operation is triggered when recording is defined as the control that is triggered, when need
When carrying out operation playback, according to the matching of each control in real-time interface screenshot and the control semantic information that is triggered, determine
With the presence or absence of target widget, which is to need to simulate the control for applying same operation when playing back.For recording gained
The sequence of operation in each operation, find one by one in the above described manner target widget and apply operation in sequence, be finally completed pair
The playback of whole operation sequence.The technical solution matches control according to semantic information, so as to guarantee target widget and touched
The consistency of control is sent out, the probability of operation playback failure is reduced.Further improve the reliability and accuracy of test.
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention
Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only this
Invention a part of the embodiment, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art exist
Every other embodiment obtained under the premise of creative work is not made, shall fall within the protection scope of the present invention.
Embodiment of the method one
Referring to Fig. 1, which is a kind of flow chart of recording and playback test method provided by the embodiments of the present application.This method is answered
For testing software.
As shown in Figure 1, recording and playback test method provided by the embodiments of the present application, comprising:
Step 101: the sequence of operation recorded when obtaining manual operation tested software.
It should be noted that in the present embodiment, multi-mode operation that sequence of operation record has execution sequence to determine and each
Operate corresponding operation interface screenshot.As an example, software test personnel successively execute n operations, successively will in the sequence of operation
It is denoted as: operation 1, operation 2 ... operation n.Wherein n is the integer more than or equal to 2.Operation 1, operation 2 ... operation n are respectively right
The operation interface screenshot answered successively is operation interface screenshot 1, operation interface screenshot 2 ... operation interface screenshot n.
In the present embodiment, the correspondence with operation interface screenshot is operated, can be embodied in the correspondence of time.
As an example, T milliseconds of moment collected operation interface screenshot is as corresponding operation circle of the operation before operation applies the moment
Face screenshot, wherein T is the numerical value greater than 0.
It is understood that comprising the control that is triggered in operation interface screenshot, the control that is triggered has corresponding close with operation
System.For example, operation 1 corresponds to operation interface screenshot 1, operation 1 acts on the control 1 of tested software, and control 1 is i.e. as operation 1
The corresponding control that is triggered includes the control 1 in the operation interface screenshot 1 of acquisition.
In the present embodiment, other controls other than being triggered control be may also contain in operation interface screenshot, these
Other controls are not triggered by the corresponding operation of the operation interface screenshot.The quantity of the corresponding control that is triggered of one operation may
It is 1, it is also possible to be multiple.The same control that is triggered may operate triggering by a certain item in the sequence of operation, it is also possible to by grasping
Make the multi-mode operation triggering in sequence, for example, operation 1 is identical with the 3 corresponding controls that are triggered of operation.
In practical applications, operating the corresponding control that is triggered may be input frame, button or text etc..The present embodiment
In, concrete form, the type etc. of the control that is triggered are not limited.It should be noted that the control requirement that is triggered is
It can be through operation triggering in replayed section.
Step 102: utilizing the semantic information for the control that is triggered described in operation interface screenshot acquisition.
In the present embodiment, the semantic information for the control that is triggered includes but is not limited to: the classification information for the control that is triggered, text
Information or characteristics of image.That is, the semantic information for the control that is triggered can appointing for its classification information, text information or characteristics of image
Meaning combination.
To those skilled in the art, classified, identified the text in a certain piece of region to a certain piece of region in image
Word information, and the characteristics of image in a certain piece of region of identification, belong to the technology of comparative maturity, therefore, how this step is for obtain
Must be triggered control semantic information without repeating.
Step 103: obtaining the real-time interface screenshot of the tested software, and using described in the real-time interface screenshot acquisition
The corresponding semantic information of each control for including in the screenshot of real-time interface.
It should be noted that real-time interface screenshot in this step, tester carries out manual testing to tested software, and obtains
After the sequence of operation for enrolling system, carrying out can be from the collected real-time interface screenshot of tested software when operation plays back.Example
Such as, it needs to operate first item in the sequence of operation, that is, operates 1, played back, then obtain the real-time of a tested software in real time
Interface screenshot then obtains the corresponding semantic information of each control in the picture.
It include at least one control in every real-time interface screenshot in the present embodiment.The corresponding semantic information of each control
Including but not limited to: the corresponding classification information of each control, text information or characteristics of image.For example, being wrapped in the screenshot of interface in real time
Containing 3 controls, respectively control K1, control K2 and control K3, wherein the semantic information of control K1 includes classification information and text
Information, the semantic information of control K2 include classification information and characteristics of image, and the semantic information of control K3 includes classification information, text
Information and characteristics of image.
The concrete mode for obtaining the corresponding semantic information of each control for including in real-time interface screenshot, is referred to aforementioned
The implementation of the semantic information for the control that is triggered is obtained in step 102.Herein, it is not repeated here.
Step 104: according to the semantic information of the control that is triggered and the corresponding semantic information of each control, determining
It whether include the target widget to match with the control that is triggered in the real-time interface screenshot, if so, thening follow the steps
105。
Step 105: to the corresponding operation of control that is triggered described in target widget simulation playback.
In the present embodiment, it searches out comprising the target widget to match with the control that is triggered in real-time interface screenshot, and
After being applied to the operation being triggered on control to target widget simulation playback, that is, show to be back the playback result of the operation
Success is put, smoothly simulation executes the operation in target widget.
Step 106: the corresponding playback result of operations recorded according to the sequence of operation determines the tested software
Whether test is passed through.
It is understood that when being played back, sequence and operation sequence that operations in the sequence of operation are played back
The sequence consensus of operations in column.For example, in the sequence of operation comprising operation 1, operation 2 and operation 3, if operation 1 playback at
Function then repeats this method from step 102 for operation 2 thereafter, if operation 2 also plays back successfully, thereafter for operation 3
This method is repeated from step 102.If operate item number greater than 3 in the sequence of operation, analogize according to foregoing description.The application
When whether determining that tested software test passes through, it is contemplated that the corresponding playback result of whole operation sequence operations.As one
The illustrative implementation of kind, if operations play back success in the sequence of operation, it is determined that tested software passes through this and surveys
Examination.
It is understood that in practical applications, the type and the differences such as involved technical field of tested software are answered, it can
There can be different tests to pass through standard.Such as, it is also possible to when operations playback success rate reaches pre-set ratio in the sequence of operation
When, determine that tested software passes through test.Therefore, in the present embodiment, the specific implementation of step 106 is not limited.
It is above a kind of recording and playback test method provided by the embodiments of the present application.This method be based on record when and playback
When tested software operation interface on control semantic information (such as classification information, text information or characteristics of image etc.), from return
The target widget to match with the control that is triggered when recording in operation interface is determined when putting in operation interface.When recording for
The operation that the control that is triggered applies can accordingly be applied to target widget in playback, to realize to operation interface when recording
The playback of corresponding operation.Each operation in the sequence of operation obtained for recording, according to operations in the sequence of operation
Sequence is executed, determine target widget in the manner described above one by one and executes corresponding operation, so as to complete whole operation
The playback of sequence, the final test result for determining tested software.
This method matches control according to the semantic information of control, thus it is guaranteed that target widget and the control that is triggered
Consistency can accurately trigger target widget to carry out simulated operation when subsequent playback.This method does not depend solely on behaviour
Make the playback that the coordinate position on screenshot is operated, therefore the probability of playback failure can be effectively reduced, it is seen then that applies the party
Method carries out software test, and the reliability of test is improved.Further, since testing reliability improves, it is thus possible to obtain
The test result of more accurate tested software.In addition, this method is independent of coordinate position, therefore, it is compatible in it is a variety of not
Same equipment, and test the software of different version and/or styles.
Current existing recording and playback test method is divided into base between operations in the sequence of operation obtained when recording
It is quasi-.For example, being divided into 50ms between operating between 1 and operation 2 when recording, then also simulates and play back according to 50ms time interval when playing back.
In practical applications, this mode has certain problems.For example, operation 1 is the operation of searched page, operation 2 is click word
The operation of item, when simulation plays back and since page load time is too long, until entry does not occur yet, therefore can not after 50ms
Playback operation 2.To lead to 2 playback failure of operation.However, the problem of this playback failure, equally also will affect software test
Reliability and accuracy.
Based on previous embodiment, in view of the above-mentioned problems, present invention also provides another recording and playback test methods.Below
The specific implementation of this method is described in detail with attached drawing in conjunction with the embodiments.
Embodiment of the method two
Referring to fig. 2, which is the flow chart of another recording and playback test method provided by the embodiments of the present application.
As shown in Fig. 2, recording and playback test method provided in this embodiment, comprising:
Step 201: the sequence of operation recorded when obtaining manual operation tested software.
In the present embodiment, the implementation of step 201 is identical as the implementation of step 101 in previous embodiment.About
The associated description of step 201 can refer to previous embodiment, and details are not described herein again.
Step 202: classifying to the control that is triggered described in the operation interface screenshot, be triggered control described in acquisition
The classification information of part;And/or text information identification is carried out to the control that is triggered, obtain the control that is triggered recognized
The text information of part;And/or characteristics of image identification is carried out to the control that is triggered, obtain the control that is triggered recognized
The characteristics of image of part.
When executing this step, the classification information and text information of the control that is triggered can be obtained according to following example mode:
Classify first to the control that is triggered.The type for the control that is triggered is determined are as follows: button, single file text or input
Frame etc..In the present embodiment, the optional Type Range for the control that is triggered is not limited.
After classification, if the control that is triggered belongs to the control class comprising text information, such as the control that is triggered is uniline
Text type, the then control that is triggered include the text information that can be identified.For such control that is triggered, can use it is a variety of can
The character recognition technology of choosing identifies text information, such as optical character identification (Optical Character
Recognition, OCR) technology.This step text information identification method corresponding for the control that is triggered is not limited.
Obviously, after classification, can more easily and fast determine whether the control that is triggered includes text information, if
The control that needs to be triggered to this carries out Text region.To save semantic information acquisition time.
It is understood that the characteristics of image for the control that is triggered is its another feature for being different from other controls.Therefore, after
When the continuous control that be triggered is matched with the semantic information of other controls in real-time interface screenshot, the characteristics of image of control can also be made
For a kind of important coupling element.
In the present embodiment, when executing this step, if in operation interface screenshot also including its other than being triggered control
He can also obtain respectively corresponding semanteme to all controls in operation interface screenshot and believe control as another implementation
Breath.Thereafter, when needing to play back other operations, it may have occurred variation since other operate the corresponding control that is triggered, if
Other operate the control for obtaining semantic information in corresponding operation interface screenshot comprising before and at this as the control that is triggered
Part then can directly extract other when executing this step and operate the semantic information of the corresponding control that is triggered, then execute subsequent
The operation of step.
Step 203: the real-time interface screenshot of the tested software is obtained, to each control in the real-time interface screenshot
Classify, obtains the corresponding classification information of each control;And/or to including text information in each control
Control carries out text information identification, obtains the corresponding text information of the control comprising text information recognized;And/or
Characteristics of image identification is carried out to each control, obtains the corresponding characteristics of image of each control of recognize described.
When executing this step, similarly with step 202, it can be obtained according to following example mode each in real-time interface screenshot
The corresponding classification information of a control and text information:
Classify first to each control.It will be determined by the type of each control are as follows: button, single file text or input frame
Deng.In the present embodiment, the optional Type Range of each control is not limited.
After classification, belong in the control class comprising text information, such as each control if there is some controls, control
A is single file text type, then the text information in control A comprising that can identify.It, can for such control comprising text information
To be identified using character recognition technology to text information, such as OCR technique.This step is for the control comprising text information
Corresponding text information identification method is not limited.For example, identifying that the text information of control A is " transmission ".
Obviously, after to the classification of each control, it can more easily and fast determine which control includes text information, be
It is no to need to carry out Text region to this kind control.To save the acquisition time of the corresponding semantic information of each control.
It is understood that the characteristics of image of controlled member is its another feature for being different from other controls.Such as red is pressed
Button is different from the color of the green button.The semantic information of other controls in subsequent be triggered control and real-time interface screenshot
Timing, the characteristics of image of control also can be used as a kind of important coupling element in real-time interface screenshot.
It should be noted that the present embodiment is gone back before above-mentioned steps 202 and step 203 obtain the semantic information of control
Operation interface screenshot and real-time interface screenshot can be split in advance, be divided into multiple mutually independent image regions.
It include a control in each image region.It is understood that being obtained in image region again after image is split
The semantic information of control can further increase the acquisition speed of semantic information.
In the present embodiment, in the presence or absence for determining target widget, it can also join the location information of control as judge
Examine one of foundation.It is described below by step 204 to 205.
Step 204: the location information for the control that is triggered according to operation interface screenshot acquisition;And according to institute
It states real-time interface screenshot and obtains the corresponding location information of each control.
As an example, the position for the control that is triggered is (xt, yt);Include two controls in real-time interface screenshot, control B and
Control C, wherein the position of control B is (xB, yB), and the position of control C is (xC, yC).
Step 205: according to the semantic information of the control that is triggered and the corresponding semantic information of each control, and
The location information of the control that is triggered and the corresponding location information of each control, determining in the real-time interface screenshot is
The no target widget comprising matching with the control that is triggered.If so, thening follow the steps 206;If not, thening follow the steps
207。
As a kind of possible implementation of this step, it can determine that target widget exists by way of matching scoring
Whether.The implementation is specifically introduced below with S1~S3.
S1: each control is subjected to the scoring of semantic information matching with the control that is triggered respectively, described in acquisition
Each control corresponding first matches score value;Each control is subjected to location information matching with the control that is triggered respectively
Property scoring, obtain the corresponding second matching score value of each control.
Due to may be comprising a variety of in semantic information, such as classification information, text information and characteristics of image of control etc., because
This can specifically will be each when carrying out the scoring of semantic information matching with the control that is triggered respectively to each control
The matching that control carries out classification information, text information and characteristics of image with the control that is triggered respectively scores, and obtains each
The corresponding classification information matching score value of control, text information matching score value and Image Feature Matching score value, according to these scorings
As a result it adds up, finally obtains the corresponding first matching score value of each control.
A kind of possible implementation that score value is matched as acquisition second, can be with specific reference to the control that is triggered
Location information and the corresponding location information of each control, seek each control and are triggered at a distance from control.It presets
Have each apart from the corresponding score value of gear, such as distance less than the first pre-determined distance, then the second matching score value for giving control is
90 points, distance is then given between the first pre-determined distance and the second pre-determined distance (the second pre-determined distance is greater than the first pre-determined distance)
The the second matching score value for giving control is 80 points.
It should be noted that the setting standard of the first matching score value and the second matching score value is not added in the present embodiment
To limit.
S2: according to the corresponding first matching score value of each control and the second matching score value, described in acquisition
The corresponding comprehensive matching score value of each control.
It is that each control corresponding first can be matched to the second corresponding matching score value phase of score value in specific implementation
Add, it is resulting with as the corresponding comprehensive matching score value of the control.For example, control B is relative to the control that is triggered, the first of acquisition
Matching score value is 90 points, and the second matching score value is 80 points, then the comprehensive matching score value that control B is finally obtained is 170 points.
Certainly, other modes also can be used in practical applications and obtain comprehensive matching score value.For example, first matching score value
The first weight and the second weight are assigned respectively with the second matching score value, ask the first matching score value and the first weight and and second
Match score value and the second weight and, and by two with do addition, finally obtained result is as comprehensive matching score value.
The above is only S2 example implementations, the present embodiment is for obtaining the specific of the corresponding comprehensive matching score value of control
Method is not limited.
S3: judging whether there is the control that the comprehensive matching score value is higher than preset matching score value, if it is, will be described
The highest control of comprehensive matching score value is determined as the target widget to match with the control that is triggered.
It is right comprising control B, control C and control D in real-time interface screenshot for example, preset matching score value is 160 points
The comprehensive matching score value answered is respectively 140 points, 165 points and 170 points.Since the comprehensive matching score value of control D is higher than preset matching
Score value and control D is therefore determined as target widget for highest comprehensive matching score value.It can application controls D execution subsequent step
206。
It is understood that above S1~S3 is only the example implementations of this step.It in practical applications can also base
In the semantic information and the corresponding semantic information of each control of the control that is triggered, and the location information of the control that is triggered and described
The corresponding location information of each control, the presence or absence of target widget is determined using other modes.Therefore, the present embodiment is for step
Rapid 205 specific implementation is not limited.
It is understood that being determined in real time by executing step 204 to 205 comprehensive utilization semantic informations and location information
Target widget in the screenshot of interface can be improved the accuracy of identified target widget, guarantee target widget and operation interface
The control height that is triggered in screenshot is consistent, to further promote the accuracy tested for tested software.
Step 206: to the corresponding operation of control that is triggered described in target widget simulation playback.
Step 207: after waiting preset time, judging whether the corresponding current number of retries of the operation interface screenshot surpasses
Preset times are crossed, if it is, the corresponding operation playback failure of the operation interface;If not, thening follow the steps 208.
Step 208: obtaining new real-time interface screenshot, and 1 is added to the corresponding number of retries of the operation interface screenshot.Really
It whether include the target widget to match with the control that is triggered in the fixed new real-time interface screenshot, if it is not, then after
It is continuous to retry, until determining the operation playback failure, or until described when the number of retries is more than the preset times
Before number of retries is more than the preset times, determine in the new real-time interface screenshot when time acquisition comprising being touched with described
The target widget that hair control matches.
In the present embodiment, if not including the target widget being mutually matched with the control that is triggered in the screenshot of interface in real time, then
New real-time interface screenshot is waited and constantly reacquires, until number of retries is more than preset times.For example, number of retries is 10
It is secondary, if currently not finding target widget and number of retries is more than 10 times, it is determined that the corresponding operation of operation interface screenshot plays back
Failure, and if being less than 10 times, it can continue to retry.
Recording and playback test method provided in this embodiment, for operations in the sequence of operation playback to search target
Based on control, when searching target widget, carried out by the polling mode of step 207 to 208 descriptions.It mentions compared with the prior art
The recording and playback test method of confession, in playback operation, not to record when operation between time interval as foundation, but to look into
It finds and carries out operation playback on the basis of target widget, as long as target widget can be found in default number of retries, can return
Operation is put, is considered as and plays back successfully.To avoid the problem that leading to playback failure because of reasons such as load times.
Step 209: the corresponding playback result of operations recorded according to the sequence of operation determines the tested software
Whether test is passed through.
Present invention also provides a kind of illustrative implementations of step 209.For example, in advance to important in the sequence of operation
Operation be marked.It should be noted that for different tested softwares, important test operation evaluation during being tested
Criterion may be different.Therefore, what is important operation without specifically limiting for.When executing this step, judgement is labeled
The corresponding playback result of the operation whether be to play back successfully, if it is, determining that the tested software passes through test;Such as
Fruit is no, it is determined that the tested software does not pass through test.
It is above another recording and playback test method provided by the embodiments of the present application.This method passes through in preset times
Lubrication groove interrogates the mode for looking for target widget, further ensure that the playback chance of success and stability of operation, reduces because of operation
Load time be longer than playback failure probability caused by the operating interval time.In addition, the present embodiment is according to semantic information and position
Informix, which matches, determines target widget, and wherein semantic information may also contain classification information and text in addition to comprising characteristics of image
Information, so that semantic information is very rich, the target widget determined according to this method is more accurate, to further mention
The high accuracy of test.
In practical applications, the response results that may also be combined with operation carry out testing judgement whether passing through.For example, operation 1
For delivery operation, after when recording executes operation 1, in response to operation 1,90 yuan are shown on software interface, and after playing back the operation 1,
80 yuan are shown on software interface.Response results when due to recording and playback are different, and the response results of operation 1 are for entirely surveying
It is extremely important for examination process, operation 1 is performed even if then searching out target widget and simulating, since response results are undesirable,
Also to determine this test crash of tested software.
In response to this problem, the application still further provides another recording and playback test method.Below with reference to embodiment
The specific implementation of this method is described in detail with attached drawing.
Embodiment of the method three
Referring to Fig. 3, which is the flow chart of another recording and playback test method provided by the embodiments of the present application.
As shown in figure 3, recording and playback test method provided in this embodiment, comprising:
Step 301: the sequence of operation recorded when obtaining manual operation tested software.
Step 302: utilizing the semantic information for the control that is triggered described in operation interface screenshot acquisition.
Step 303: obtaining the corresponding first response interface screenshot of the operation.
The control that is triggered on tested software operation interface screenshot when first response interface screenshot refers to recording is by operation
After the corresponding operation triggering of interface screenshot, the screenshot for the response effect that tested software is presented.
Step 304: marking at least one referring to control in the first response interface screenshot.
It is previously mentioned, in the present embodiment, refer in replayed section referring to control not by the control of operation triggering.As showing
Example, tested software are the software with payment function, and what is marked on software interface can be display payment numerical value referring to control
Control.In addition, may also contain in software it is certain have show with response Trigger Function control, these controls are also possible to make
Reference control for the label referred in embodiment.The present embodiment of the concrete form referring to control in to(for) label is not limited
It is fixed.
By label referring to control be used for subsequent evaluation playback by whether and test by whether when carry out semantic letter
The comparison of breath.
Step 305: obtaining the semantic information referring to control using the first response interface screenshot.
The semantic information referring to control comprises at least one of the following: the classification information referring to control, text letter
Breath or characteristics of image.As an example, the semantic information referring to control can be only comprising the text information referring to control, such as " 90
Member ".
The specific implementation obtained referring to the semantic information of control can be found in acquisition control semanteme letter in previous embodiment
The associated description of breath.Details are not described herein again.
Step 306: obtaining the real-time interface screenshot of the tested software, and using described in the real-time interface screenshot acquisition
The corresponding semantic information of each control for including in the screenshot of real-time interface.
Step 307: according to the semantic information of the control that is triggered and the corresponding semantic information of each control, determining
It whether include the target widget to match with the control that is triggered in the real-time interface screenshot, if so, thening follow the steps
308。
Step 308: to the corresponding operation of control that is triggered described in target widget simulation playback.
Step 309: obtaining the corresponding second response interface screenshot of the operation.
Target widget passes through operation circle on the real-time interface screenshot of tested software when second response interface screenshot refers to playback
After the corresponding operation triggering of face screenshot, the screenshot for the response effect that tested software is presented.
In practical applications, judge that operation playback success or not can cut the first response interface screenshot and the second response interface
Figure carries out whole comparison, can also will be to be that comparison target is compared referring to control.It is carried out below for latter implementation mode
Description.
Step 310: whether determining in the second response interface screenshot comprising semantic information and the language referring to control
The control that adopted information is mutually matched, if it is, the operation plays back successfully;If it is not, then the operation playback failure.
It should be noted that can believe the semantic of each control in the second response interface screenshot is obtained in the present embodiment
Breath, then the semantic information of each control is compared with the semantic information referring to control in the second response interface screenshot.If
There are matched controls, then show that the corresponding operation of operation interface screenshot plays back successfully.Otherwise, show playback failure.
Step 311: the corresponding playback result of operations recorded according to the sequence of operation determines the tested software
Whether test is passed through.
For any one or multi-mode operation recorded in the sequence of operation, response results and record when being played back in combination with it
The comparison result of response results when processed carries out the evaluation and determination of operation playback result.
It is above another recording and playback test method provided by the embodiments of the present application.The response of this method binding operation
As a result it determines operation playback result, so that the accuracy for operating playback result improves, and further improves the standard of test result
True property.
Based on the recording and playback test method that previous embodiment provides, correspondingly, the application also provides a kind of recording and playback
Test device.The specific implementation of the device is described below with reference to embodiment and attached drawing.
Installation practice
Referring to fig. 4, which is a kind of structural schematic diagram of recording and playback test device provided by the embodiments of the present application.The dress
It sets and is applied to test software.
As shown in figure 4, recording and playback test device provided in this embodiment, comprising: the sequence of operation obtains module 401, language
Adopted information first obtains module 402, and semantic information second obtains module 403, and control matching module 404 operates playback module
405 and software test result determining module 406.
Wherein, the sequence of operation obtains module 401, the sequence of operation recorded when for obtaining manual operation tested software;Institute
State the multi-mode operation and each corresponding operation interface screenshot of operation that sequence of operation record has execution sequence to determine;The behaviour
Make comprising the control that is triggered in the screenshot of interface, the control that is triggered has corresponding relationship with the operation;
Semantic information first obtains module 402, for utilizing the control that is triggered described in operation interface screenshot acquisition
Semantic information;The semantic information of the control that is triggered comprises at least one of the following: the classification information for the control that is triggered, text letter
Breath or characteristics of image;
Semantic information second obtains module 403, for obtaining the real-time interface screenshot of the tested software, and described in utilization
Real-time interface screenshot obtains the corresponding semantic information of each control for including in the real-time interface screenshot;Each control pair
The semantic information answered comprises at least one of the following: the corresponding classification information of each control, text information or characteristics of image;
Control matching module 404, it is corresponding for the semantic information for the control that is triggered according to and each control
Semantic information determines in the real-time interface screenshot whether include the target widget to match with the control that is triggered, if
It is then to operate playback module 405 to the corresponding operation of control that is triggered described in target widget simulation playback;
Software test result determining module 406, the corresponding playback of operations for being recorded according to the sequence of operation
As a result, determining whether the tested software passes through test.
The device based on record when and playback when tested software operation interface on control semantic information (such as classification letter
Breath, text information or characteristics of image etc.), it is determined from operation interface when playback and the control that is triggered when recording in operation interface
The target widget that part matches.For the operation for the control application that is triggered when recording, target can be accordingly applied in playback
Control, to realize the playback to operation interface corresponding operation when recording.For recording each in the obtained sequence of operation
Operation executes sequence according to operations in the sequence of operation, one by one determines target widget and execution pair in the manner described above
The operation answered, so as to complete the playback of whole operation sequence, the final test result for determining tested software.
The device matches control according to the semantic information of control, thus it is guaranteed that target widget and the control that is triggered
Consistency can accurately trigger target widget to carry out simulated operation when subsequent playback.The device does not depend solely on behaviour
Make the playback that the coordinate position on screenshot is operated, therefore the probability of playback failure can be effectively reduced, it is seen then that applies the dress
Carry out software test is set, the reliability of test is improved.Further, since testing reliability improves, it is thus possible to obtain
The test result of more accurate tested software.In addition, the device is independent of coordinate position, therefore, it is compatible in it is a variety of not
Same equipment, and test the software of different version and/or styles.
Optionally, institute's semantic information first obtains module 402, can specifically include:
Classification information first acquisition unit, for dividing the control that is triggered described in the operation interface screenshot
Class, the classification information for the control that is triggered described in acquisition;
And/or text information first acquisition unit is obtained for carrying out text information identification to the control that is triggered
The text information of the control that is triggered recognized;
And/or characteristics of image first acquisition unit is obtained for carrying out characteristics of image identification to the control that is triggered
The characteristics of image of the control that is triggered recognized.
Optionally, semantic information second obtains module 403, can specifically include:
Classification information second acquisition unit is obtained for classifying to each control in the real-time interface screenshot
The corresponding classification information of each control;
And/or text information second acquisition unit, for being carried out to the control in each control including text information
Text information identification, obtains the corresponding text information of the control comprising text information recognized;
And/or characteristics of image second acquisition unit is known for carrying out characteristics of image identification to each control
The corresponding characteristics of image of each control being clipped to.
Optionally, above-mentioned apparatus further include:
Divide module, for being split to the real-time interface screenshot, obtains multiple mutually independent image regions;
Each described image subregion includes a control;
The classification information second acquisition unit, specifically for being carried out respectively to the control in each described image subregion
Classification;
The text information second acquisition unit, specifically for including text information in each described image subregion
Control carries out text information identification respectively;
Described image feature second acquisition unit, specifically for being carried out respectively to the control in each described image subregion
Characteristics of image identification.
Optionally, above-mentioned apparatus further include:
Position information acquisition module, the position letter for the control that is triggered according to operation interface screenshot acquisition
Breath;And the corresponding location information of each control is obtained according to the real-time interface screenshot.
Optionally, control matching module 404, specifically includes:
First matching unit, semantic information and the corresponding semanteme of each control for the control that is triggered according to
The location information and the corresponding location information of each control of information and the control that is triggered, determine the real-time boundary
It whether include the target widget to match with the control that is triggered in the screenshot of face.
Optionally, the first matching unit specifically includes:
Score unit, comments for each control to be carried out semantic information matching with the control that is triggered respectively
Point, obtain the corresponding first matching score value of each control;Each control is carried out with the control that is triggered respectively
The scoring of location information matching obtains the corresponding second matching score value of each control;
Scoring unit, for according to each corresponding first matching score value of control and second matching point
Value obtains the corresponding comprehensive matching score value of each control;
Matching judgment unit, the control for being higher than preset matching score value for judging whether there is the comprehensive matching score value,
If it is, the highest control of comprehensive matching score value to be determined as to the target control to match with the control that is triggered
Part.
Current existing recording and playback testing scheme is divided into base between operations in the sequence of operation obtained when recording
It is quasi-.For example, being divided into 50ms between operating between 1 and operation 2 when recording, then also simulates and play back according to 50ms time interval when playing back.
In practical applications, this mode has certain problems.For example, operation 1 is the operation of searched page, operation 2 is click word
The operation of item, when simulation plays back and since page load time is too long, until entry does not occur yet, therefore can not after 50ms
Playback operation 2.To lead to 2 playback failure of operation.However, the problem of this playback failure, equally also will affect software test
Reliability and accuracy.
To solve this problem, recording and playback test device provided by the embodiments of the present application can also further comprise:
First retries judgment module, matches for working as not including in the real-time interface screenshot with the control that is triggered
Target widget, wait preset time after, judge whether the corresponding current number of retries of the operation interface screenshot is more than pre-
If number, if it is not, then obtaining new real-time interface screenshot, and 1 is added to the corresponding number of retries of the operation interface screenshot;
Second retries judgment module, for determine in the new real-time interface screenshot whether include and the control that is triggered
The target widget that part matches, if it is not, then continuing to retry, until determining when the number of retries is more than the preset times
The operation playback failure, or up to before the number of retries is more than the preset times, determining when time acquisition
Target widget in new real-time interface screenshot comprising matching with the control that is triggered.
First, which retries judgment module and second, retries judgment module, looks for target widget by interrogating in preset times lubrication groove
Mode further ensure that the playback chance of success and stability of operation, reduce because the load time of operation is longer than operation room
The playback failure probability caused by the time.
Optionally, the software test result determining module 406, specifically includes:
First result determination unit, in the case where the playback result of all operations is the successful situation of playback, really
The fixed tested software passes through test;
Alternatively, the second result determination unit, for being more than the behaviour of pre-set ratio in the playback result of all operations
The playback result of work is to play back in successful situation, determines that the tested software passes through test.
Optionally, above-mentioned apparatus can also further comprise:
First mark module, important operation is marked in the multi-mode operation for recording to the sequence of operation;
The software test result determining module 406, specifically includes:
Third result determination unit, for judge the labeled corresponding playback result of the operation whether be playback at
Function, if it is, determining that the tested software passes through test;If it is not, then determining that the tested software does not pass through test.
In practical applications, the response results that may also be combined with operation carry out testing judgement whether passing through.For example, operation 1
For delivery operation, after when recording executes operation 1, in response to operation 1,90 yuan are shown on software interface, and after playing back the operation 1,
80 yuan are shown on software interface.Response results when due to recording and playback are different, and the response results of operation 1 are for entirely surveying
It is extremely important for examination process, operation 1 is performed even if then searching out target widget and simulating, since response results are undesirable,
Also to determine this test crash of tested software.
In response to this problem, the recording and playback test device of aforementioned offer can also further comprise:
Image first obtains module, for obtaining the corresponding first response interface screenshot of the operation;
Second mark module, for marking at least one referring to control in the first response interface screenshot;Referring to control
Part control is not triggered in replayed section by operation;
Semantic information third obtains module, for obtaining the language referring to control using the first response interface screenshot
Adopted information;The semantic information referring to control comprises at least one of the following: the classification information referring to control, text information
Or characteristics of image;
Image second obtains module, for described corresponding to the control that is triggered described in target widget simulation playback
After the operation, the corresponding second response interface screenshot of the operation is obtained;
Matching and playback result determining module, for whether determining in the second response interface screenshot comprising semantic information
The control being mutually matched with the semantic information referring to control, if it is, the operation plays back successfully;If it is not, then institute
State operation playback failure.
By above several modules, the response results which is capable of binding operation determine operation playback result, to grasp
The accuracy for making playback result improves, and further improves the accuracy of test result.
It should be noted that all the embodiments in this specification are described in a progressive manner, each embodiment it
Between same and similar part may refer to each other, each embodiment focuses on the differences from other embodiments.
For equipment and system embodiment, since it is substantially similar to the method embodiment, so describe fairly simple,
The relevent part can refer to the partial explaination of embodiments of method.Equipment and system embodiment described above is only schematic
, wherein unit may or may not be physically separated as illustrated by the separation member, as unit prompt
Component may or may not be physical unit, it can and it is in one place, or may be distributed over multiple networks
On unit.Some or all of the modules therein can be selected to achieve the purpose of the solution of this embodiment according to the actual needs.
Those of ordinary skill in the art can understand and implement without creative efforts.
The above, only a kind of specific embodiment of the application, but the protection scope of the application is not limited thereto,
Within the technical scope of the present application, any changes or substitutions that can be easily thought of by anyone skilled in the art,
Should all it cover within the scope of protection of this application.Therefore, the protection scope of the application should be with scope of protection of the claims
Subject to.