CN105224462B - The recognition methods of control element and device - Google Patents

The recognition methods of control element and device Download PDF

Info

Publication number
CN105224462B
CN105224462B CN201510708654.4A CN201510708654A CN105224462B CN 105224462 B CN105224462 B CN 105224462B CN 201510708654 A CN201510708654 A CN 201510708654A CN 105224462 B CN105224462 B CN 105224462B
Authority
CN
China
Prior art keywords
control element
recognition
attribute
property
target widget
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510708654.4A
Other languages
Chinese (zh)
Other versions
CN105224462A (en
Inventor
李志超
聂杰峰
赵彪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiaomi Inc
Original Assignee
Xiaomi Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiaomi Inc filed Critical Xiaomi Inc
Priority to CN201510708654.4A priority Critical patent/CN105224462B/en
Publication of CN105224462A publication Critical patent/CN105224462A/en
Application granted granted Critical
Publication of CN105224462B publication Critical patent/CN105224462B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The disclosure proposes a kind of recognition methods of control element, and methods described includes:Read the recognition property of target widget element;The recognition property includes multiple control element attributes for being used to identify the target widget element in test page;Check whether the recognition property of the target widget element changes;When the recognition property of the target widget element changes, the control element attribute to be changed in the recognition property is updated;The target widget element is identified in the test page using the recognition property after renewal based on default recognition strategy.The disclosure can improve the success rate of page test, reduce testing cost.

Description

The recognition methods of control element and device
Technical field
This disclosure relates to field of terminal, more particularly to recognition methods and the device of control element.
Background technology
With the fast development of Internet technology, the iteration speed of website becomes very fast, is tested for website When, if only relying on traditional manual test, efficiency will be very low, can not meet the needs of actual.Therefore there is profit The testing scheme of part manual test is replaced with automatic test, solution releases the substantial amounts of testing time.However, enter for website During row automatic test, if the control element in the tested page changes, it is likely that test crash can be caused.
The content of the invention
To overcome problem present in correlation technique, the disclosure provides recognition methods and the device of a kind of control element.
According to the first aspect of the embodiment of the present disclosure, there is provided a kind of recognition methods of control element, methods described include:
Read the recognition property of target widget element;The recognition property includes multiple for identifying institute in test page State the control element attribute of target widget element;
Check whether the recognition property of the target widget element changes;
When the recognition property of the target widget element changes, to the control to be changed in the recognition property Element property is updated;
The target is identified in the test page using the recognition property after renewal based on default recognition strategy Control element.
Optionally, the recognition property for checking the target widget element whether change including:
Periodically gather the control element attribute of the test page;
The control element attribute of the test page of the control element attribute in the recognition property with collecting is entered Row matching;
When the part control element attribute in the recognition property can not be in the control member of the test page collected Corresponding to being matched in plain attribute during control element attribute, determine that the recognition property of the target widget element changes.
Optionally, methods described also includes:
When the control element attribute in the recognition property can not be in the control element of the test page collected Corresponding to being matched in attribute during control element attribute, prompting message is sent to tester, using prompt the tester as The target widget element resets recognition property.
Optionally, it is described the control element attribute that is changed in the recognition property is updated including:
Based on the correlation between each control element attribute in the recognition property, the control for obtaining the test page is first In plain attribute with the control element attribute of the part control element attributes match;
According in the control element attribute of the test page got with the part control element attributes match Control element attribute is updated to the part control element.
Optionally, the default recognition strategy includes one or more kinds of combinations in substrategy identified below:
Based on target widget element described in any control element Attribute Recognition specified in the recognition property;
The target widget element is identified one by one based on the multiple control elements specified in the recognition property;
Combination based on the multiple control elements specified in the recognition property identifies the target widget element;
The target control is identified based on the regular expression that the multiple control elements specified in the recognition property are created Part element.
Optionally, it is described to be known based on default recognition strategy using the recognition property after renewal in the test page Not described target widget element includes:
When the recognition strategy only includes an identification substrategy, based on the identification substrategy in the test page Identify the target widget element;
When the recognition strategy includes multiple identification substrategys, if based on any identification substrategy in the test sheets Target widget element still described in None- identified in face, then based on other identification substrategys in the multiple identification substrategy in institute State and continue to identify the target widget element in test page.
Optionally, methods described also includes:
When based on default recognition strategy using recognition property after renewal the still None- identified in the test page During the target widget element, prompting message is sent to tester, to prompt the tester as target widget member Element resets recognition property.
According to the second aspect of the embodiment of the present disclosure, there is provided a kind of identification device of control element, described device include:
Read module, it is configured as reading the recognition property of target widget element;The recognition property includes multiple be used for The control element attribute of the target widget element is identified in test page;
Module is checked, whether the recognition property for being configured to check for the target widget element changes;
Update module, it is configured as when the recognition property of the target widget element changes, the identification is belonged to The control element attribute to be changed in property is updated;
Identification module, it is configured as based on default recognition strategy using the recognition property after renewal in the test sheets The target widget element is identified in face.
Optionally, the inspection module includes:
Submodule is gathered, is configured as periodically gathering the control element attribute of the test page;
Matched sub-block, it is configured as the control element attribute in the recognition property and the test sheets collected The control element attribute in face is matched;
Determination sub-module, the part control element attribute being configured as in the recognition property can not be in the institute collected When stating control element attribute corresponding to being matched in the control element attribute of test page, the knowledge of the target widget element is determined Other attribute changes.
Optionally, the inspection module also includes:
Sending submodule, being configured as the control element attribute in the recognition property can not be described in collects Corresponding to being matched in the control element attribute of test page during control element attribute, prompting message is sent to tester, with The tester is prompted to reset recognition property for the target widget element.
Optionally, the update module includes:
Acquisition submodule, it is configured as, based on the correlation between each control element attribute in the recognition property, obtaining In the control element attribute of the test page with the control element attribute of the part control element attributes match;
Submodule is updated, is configured as in the control element attribute according to the test page got and the part The control element attribute of control element attributes match is updated to the part control element.
Optionally, the default recognition strategy includes one or more kinds of combinations in substrategy identified below:
Based on target widget element described in any control element Attribute Recognition specified in the recognition property;
The target widget element is identified one by one based on the multiple control elements specified in the recognition property;
Combination based on the multiple control elements specified in the recognition property identifies the target widget element;
The target control is identified based on the regular expression that the multiple control elements specified in the recognition property are created Part element.
Optionally, the identification module includes:
First identification submodule, it is configured as when the recognition strategy only includes an identification substrategy, based on the knowledge Small pin for the case strategy identifies the target widget element in the test page;
Second identification submodule, be configured as the recognition strategy include it is multiple identification substrategy when, if based on appoint One identification substrategy target widget element still described in None- identified in the test page, then based on the multiple sub- plan of identification Other identification substrategys in slightly continue to identify the target widget element in the test page.
Optionally, described device also includes:
Sending module, it is configured as using the recognition property after renewal based on default recognition strategy in the test In the page still described in None- identified during target widget element, prompting message is sent to tester, to prompt the tester Recognition property is reset for the target widget element.
According to the third aspect of the embodiment of the present disclosure, there is provided a kind of identification device of control element, including:
Processor;
For storing the memory of processor-executable instruction;
Wherein, the processor is configured as:
Read the recognition property of target widget element;The recognition property includes multiple for identifying institute in test page State the control element attribute of target widget element;
Check whether the recognition property of the target widget element changes;
When the recognition property of the target widget element changes, to the control to be changed in the recognition property Element property is updated;
The target is identified in the test page using the recognition property after renewal based on default recognition strategy Control element.
The technical scheme provided by this disclosed embodiment can include the following benefits:
In the above example of the disclosure, by the recognition property for reading target widget element;The recognition property includes Multiple control element attributes for being used to identify the target widget element in test page;And check the target widget element Recognition property whether change;When the recognition property of the target widget element changes, to the recognition property In the control element attribute that changes be updated, be then based on default recognition strategy and use the recognition property after renewal The target widget element is identified in the test page, it is possible to achieve when the control element attribute in test page becomes During change, automatically the control element attribute to change is updated automatically, so that when testing test page, i.e., The control element attribute in test page is changed, remain able to carry out positive general knowledge to the control element in test page Not, the success rate of test can be improved, reduces testing cost.
It should be appreciated that the general description and following detailed description of the above are only exemplary and explanatory, not The disclosure can be limited.
Brief description of the drawings
Accompanying drawing herein is merged in specification and forms the part of this specification, shows the implementation for meeting the disclosure Example, and be used to together with specification to explain the principle of the disclosure.
Fig. 1 is a kind of schematic flow sheet of the recognition methods of control element according to an exemplary embodiment;
Fig. 2 is the schematic flow sheet of the recognition methods of another control element according to an exemplary embodiment;
Fig. 3 is a kind of schematic block diagram of the identification device of control element according to an exemplary embodiment;
Fig. 4 is the schematic block diagram of the identification device of another control element according to an exemplary embodiment;
Fig. 5 is the schematic block diagram of the identification device of another control element according to an exemplary embodiment;
Fig. 6 is the schematic block diagram of the identification device of another control element according to an exemplary embodiment;
Fig. 7 is the schematic block diagram of the identification device of another control element according to an exemplary embodiment;
Fig. 8 is the schematic block diagram of the identification device of another control element according to an exemplary embodiment;
Fig. 9 is an a kind of structural representation of identification device for control element according to an exemplary embodiment Figure;
Figure 10 is that a structure of the identification device that the another kind according to an exemplary embodiment is used for control element is shown It is intended to.
Embodiment
Here exemplary embodiment will be illustrated in detail, its example is illustrated in the accompanying drawings.Following description is related to During accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawings represent same or analogous key element.Following exemplary embodiment Described in embodiment do not represent all embodiments consistent with the disclosure.On the contrary, they be only with it is such as appended The example of the consistent apparatus and method of some aspects be described in detail in claims, the disclosure.
It is only merely for the purpose of description specific embodiment in the term that the disclosure uses, and is not intended to be limiting the disclosure. " one kind " of singulative used in disclosure and the accompanying claims book, " described " and "the" are also intended to including majority Form, unless context clearly shows that other implications.It is also understood that term "and/or" used herein refers to and wrapped Containing the associated list items purpose of one or more, any or all may be combined.
It will be appreciated that though various information, but this may be described using term first, second, third, etc. in the disclosure A little information should not necessarily be limited by these terms.These terms are only used for same type of information being distinguished from each other out.For example, do not departing from In the case of disclosure scope, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as One information.Depending on linguistic context, word as used in this " if " can be construed to " ... when " or " when ... When " or " in response to determining ".
In the related art, automatic test is carried out for website, the test case edited in advance typically by operation Come what is completed.In test case, a series of test orders that editor completes in advance can be included, and need the control tested Element.When testing results use-case is tested the tested page, the control element being tested in the page can be entered first Row identification, the control element for being then based on identifying are tested one by one by running above-mentioned test order.
Wherein, the control element being tested in the page, the basic control in the page layout of the tested page is generally included. For example, the control element in the tested page can be including the edit box in the tested page, button, status bar, navigation bar, work Have the basic controls such as column.
When identification is tested the control element in the page, corresponding identification category can be generally pre-set by tester Property, the control element being tested in the page is identified for the recognition property that then sets.Wherein, the recognition property is usual For the control element attribute of target widget element to be identified.For example, the control element attribute of control element can generally include The property values such as ID, Name, ClassName, Xpath, LinkText, TagName.
At present, when identifying control element, it is typically based on single recognition strategy and is identified.Tester is setting knowledge During other attribute, one is specified in the control element attribute for the control element that can need to identify from the tested page has uniquely The control element attribute of property is as recognition property, and then the recognition property is prestored to excel, in database or script, Used when identifying control element for testing results use-case.
However, in the test process of reality, when the page layout of the tested page changes, it is tested in the page Control element attribute can also change accordingly, when the control element attribute to change is prestored by tester During the control element attribute as recognition property specified, now test case can not timely recognize current identification category Property have occurred and that change, when testing results use-case to be tested the page in control element be identified when, identification just occurs It is abnormal, so as to cause test case to perform failure.In this case, it often requires tester re-starts debugging, thus The testing time can be caused to increase, the time cost increase of manual maintenance.
To solve problem above, the disclosure proposes a kind of recognition methods of control element, by reading target widget element Recognition property;The recognition property includes multiple control elements for being used to identify the target widget element in test page Attribute;And check whether the recognition property of the target widget element changes;When the identification category of the target widget element Property when changing, the control element attribute to be changed in the recognition property is updated, is then based on default identification The recognition property after strategy use renewal identifies the target widget element in the test page, it is possible to achieve works as survey When control element attribute in the examination page changes, automatically the control element attribute to change is updated automatically, So as to when testing test page, even if the control element attribute in test page changes, remain able to surveying Control element in the examination page is normally identified, can improve the success rate of test, reduces testing cost.
As shown in figure 1, Fig. 1 is a kind of recognition methods of control element according to an exemplary embodiment, the control The recognition methods of element is used to test in terminal, comprises the following steps:
In a step 101, the recognition property of target widget element is read;The recognition property includes multiple for testing The control element attribute of the target widget element is identified in the page;
In a step 102, check whether the recognition property of the target widget element changes;
In step 103, when the recognition property of the target widget element changes, to being sent out in the recognition property The control element attribute for changing is updated;
At step 104, the recognition property after renewal is used in the test page based on default recognition strategy Identify the target widget element.
Above-mentioned test terminal can include being used for the terminal device for testing test page.Wherein, the terminal device Can be mobile terminal device, can also server.It is used to enter test page for example, the test terminal can be tester The PC terminals of row test, or the test server for being tested test page.Certainly, in the application of reality, Above-mentioned test terminal can also be other types of special test equipment, in the disclosure without being particularly limited to.
In the present embodiment, tester can edit for test in advance before testing test page The test case that the page is tested, and corresponding recognition property is set respectively for the control element in test page.
Wherein, multiple control elements for being used to identify the control element in test page can be included in the recognition property Attribute.For example, tester when setting recognition property, can need the control of control element identified from the tested page In element property, specify multiple control element attributes that the recognition property then is prestored into the first number as recognition property According in storehouse.
Wherein, first database is used to store recognition property.Multiple control elements can be preserved in the first database Recognition property.Certainly, when realizing, recognition property can also be stored by other means, for example, be saved in excel, In script or other equipment that can be stored, in the present embodiment without being particularly limited to.
When test terminal starts to test test page, the test of completion can be edited in advance with testing results personnel Use-case, the recognition property stored in the first database is read, to identify the control element in test page, then for identifying Control element tested one by one.
However, in actual applications, the control element attribute of the control element in test page may change, one The control element attribute as recognition property stored in the database of denier first is changed, and test terminal is used in testing results Example, when carrying out control element identification to test page, it is possible to element None- identified can be caused and cause test case to perform mistake Situation about losing.
To avoid the occurrence of such case, the disclosure introduces a kind of mechanism that automatically updates of recognition property, and test terminal can be with Control element in recognition property is periodically checked, once test terminal checks out that recognition property changes, Can immediately to having occurred and that the control element of change is updated in recognition property, so as to avoid due to control element without Test case performs the situation of failure caused by method identification.
The mechanism that automatically updates of above-mentioned recognition property is described in detail below.
In the present embodiment, for the control element attribute as recognition property stored in the first database, Ke Yiyou Test terminal is checked, to determine whether the control element attribute stored in the first data changes.
Wherein, terminal is tested when it is determined that whether the control element attribute stored in the first data changes, Ke Yitong Cross can the periodic collecting test page control element attribute, and by the control element attribute stored in the first database with The control element attribute of the test page collected is matched to realize.
For example, when realizing, test terminal can run the capturing webpage contents such as " reptile " instrument periodically to capture The source code of test page, such as, the interval duration of a crawl can be set, and based on the interval duration timing grab Take.For the source code grabbed, test terminal can therefrom obtain the dom nodes in the test page, and then traversal obtains The dom nodes arrived, and the control element attribute of each dom nodes is preserved temporarily.Such as the control member that test terminal preserves temporarily Plain attribute can including ID, Name, ClassName, Xpath, LinkText, TagName etc. property value.
For the control element attribute preserved temporarily, test terminal can be stored in the second database.Wherein, It is used to store the control element attribute preserved temporarily, i.e., the control element attribute of current test page in two databases.
After the control element attribute that will be preserved is stored into the second database temporarily, now testing terminal can be by first The control element attribute stored in database is matched with the control element attribute stored in the second database, to determine first Whether the control element attribute as recognition property stored in database has occurred that change.
When the control element attribute stored in the first database can match corresponding control in the second database During element property, then the control element as recognition property that can determine to store in the first database does not change.It is equivalent , when the part control element attribute stored in the first database can not match corresponding control member in the second database During plain attribute, then the control element as recognition property that can determine to store in the first database has occurred and that change.
For example, when realizing, test terminal can read a control element attribute from the first database, then will read The control element attribute gone out is searched in the second database, if found in the second database unique corresponding One control element attribute, then show that the control element attribute does not change.On the contrary, if corresponding control is not found Element property, then showing that test page may have occurred and that renewal, the control element attribute may also have occurred that change, this When using the control element attribute as recognition property, None- identified goes out corresponding control element.When the control element attribute is searched After the completion of, test terminal can continue to read next control element attribute, and continue in the manner described above in the second database In searched, until the control element attribute in the first database to be searched to completion in the second database.
After the completion of all control element attributes in the first database are searched in the second database, if the first number According to the part control element attribute in storehouse, corresponding control element attribute can not be matched in the second database, then can be true The recognition property stored in fixed first database has occurred and that change.Certainly, if the control element stored in the first database Attribute can find unique corresponding control element attribute in the second database, then can determine to store in the first database Recognition property do not change.
Wherein, what deserves to be explained is, test terminal is in the control element attribute that will be read from the first database second When being searched in database, it is possible to the situation for finding multiple corresponding control element attributes occur.
For example, for the control element attribute without uniqueness stored in the first database, such as ClassName, It is commonly used for indicating the classification of control element, the ClassName of different control elements is possible to identical, therefore when test is whole When end is searched the ClassName read out from the first database in the second database, it may find multiple Corresponding ClassName, although the ClassName now found value all same, but it is under the jurisdiction of different controls Element.
In this case, test terminal can extract the control element attribute related to the control element attribute Come, whole matching is then done, to determine whether the control element attribute changes.Wherein, it is related to the control element attribute Control element attribute, can be the other control element attributes for being under the jurisdiction of same control element with the control element.
What deserves to be explained is tree hierarchy of the source code generally use of webpage based on dom structures, same control The control element attribute of element is generally under the jurisdiction of the same object in the tree, or same layering, i.e., same Certain correlation between the control element attribute of control element generally be present, therefore in extraction and some control element attribute phase During the control element attribute of pass, the either layering (now in the object or layering of object where the control element can be searched Other control element attributes be related control element attribute identical with the control element), then extract the object or Other control element attributes in layering.
For example, still by taking ClassName as an example, although different control elements there may be identical ClassName, pass through Single matching ClassName can not distinguish different control elements, but when realizing, can will with from the first data The ClassName read in storehouse, and multiple ClassName with being found in the second database are under the jurisdiction of same control Other control element attributes of element extract, and then carry out whole matching, then can distinguish different control elements. If found by whole matching, the plurality of ClassName searched in the second database from the first database with reading To ClassName be under the jurisdiction of different control elements, can now determine not find in the second database corresponding to ClassName, the ClassName may have occurred that change.It can be seen that in this way, in the second database Multiple corresponding control element attributes have been found, have remained able to normally determine whether the control element attribute has occurred that Change.
In the present embodiment, when test terminal passes through the control element attribute that will be stored in the first database and the second data The control element attribute stored in storehouse is matched, and determines the part control as recognition property stored in the first database After element changes, this portion that can be based on the control element attribute stored in the second database to being stored in the first database Divide and have occurred and that the control element attribute of change is updated.
As previously described, because certain correlation be present between being under the jurisdiction of the control element of same control element, for For the recognition property of any control element stored in first database, the control element attribute in the recognition property, generally Same object or same layering can be under the jurisdiction of in the source code of test page.
It can be seen that if the part control element attribute in recognition property changes, test terminal can be based on the identification The control element attribute not changed in attribute, object or layering that the control element is subordinate to reversely are searched, now should Control element attribute in object or layering is the control element attribute after changing.In this case, terminal is tested The control element attribute in the object or layering can be obtained, to the control as recognition property stored in the first database Element property is updated accordingly.
For example, it is assumed that the recognition property of a certain control element stored in the first database includes ID, Name, ClassName, Xpath, if ClassName the and Xpath attributes of the control element are changed in test page, now The ClassName and Xpath of the control element stored in first database can not be found in the second database.For Such case, because the ID and Name of the control element do not change, therefore existed by the ID and Name of the control element Object or the layering that the control element is subordinate to can be smoothly found in the source code of test page, now the object or Control element attribute ClassName and Xpath in layering are the property value after changing.Therefore, the object can be utilized Or layering in ClassName and Xpath the ClassName and Xpath that are stored in the first database are updated.Can See, in this way, after the part control element in the first database changes, pass through the correlation between control element Property, the control element attribute of the control element attributes match to be changed in the second database with this part can be got, from And the control element to be changed in the first database can be updated according to these control element attributes of acquisition, to protect It is newest control element attribute to hold the control element attribute as recognition property stored in the first data.
Certainly, in actual applications, if test terminal by the control element attribute that will be stored in the first database with The control element attribute stored in second database finds after being matched, stored in the first database as recognition property Control element attribute, when corresponding control element attribute can not be matched in the second database, now in the first database The control element attribute as recognition property of storage may all be changed.
In this case, because all control element attributes stored in the first database all change, test Terminal can not find these control elements in the source code of test page based on the correlation between control element attribute The object or layering that attribute is subordinate to, now testing terminal can not be carried out to the control element attribute stored in the first database Renewal.Therefore, after hungry control element attribute is stored in the first database all changing, test terminal can be to test Personnel send a prompting message, to prompt tester to reset recognition property as control element to be identified.
Wherein, the prompting message can be prompting mail, the reminding short message or other types of sent to tester Prompting message, in the present embodiment without being particularly limited to.
Be described above recognition property automatically updates mechanism.
Mechanism is automatically updated by described above, category periodically can be identified to the conduct stored in the first database The control element attribute of property is updated.Terminal is tested when testing results use-case is tested for test page, can be made With the control element attribute after the renewal stored in the first database, control element is identified in test page, is then based on knowing The control element not gone out is tested one by one.
In the present embodiment, test terminal is being tested using the control element attribute after the renewal stored in the first database When control element is identified in the page, it can be completed based on default recognition strategy.Wherein, the default recognition strategy can use Single recognition strategy, the recognition strategy of combination can also be used.
When realizing, following identification substrategy can be provided:
Substrategy one:Based on any control element Attribute Recognition target widget element specified in recognition property.
For example, it is assumed that tester set recognition property include ID, Name, ClassName, Xpath, LinkText, The control element attribute such as TagName, tester can specify one of them to have uniqueness in these control element attributes Control element attribute identify target widget element as recognition property.When identifying target widget element, can test The control element attribute specified in the source code of the page based on this reversely search corresponding to control element, when the control specified based on this After part element property finds unique corresponding control element in the source code of test page, now identify successfully.
Substrategy two:Target widget element is identified one by one based on the multiple control elements specified in recognition property.
For example, it is assumed that tester set recognition property include ID, Name, ClassName, Xpath, LinkText, The control element attribute such as TagName, tester can specify multiple controls with uniqueness in these control element attributes Part element property identifies target widget element, when one of control element None- identified target widget element, then makes Continue to identify with other specified control elements specified, it is unique corresponding until being found in the source code in test page After control element, then identify successfully.
Substrategy three:Combination identification target widget element based on the multiple control elements specified in recognition property.
For example, it is assumed that tester set recognition property include ID, Name, ClassName, Xpath, LinkText, The control element attribute such as TagName, tester can specify multiple control element attributes in these control element attributes, and Specified the plurality of control element attribute is combined to identify target widget element., can when identifying target widget element Control element corresponding to reversely being searched with the combination based on the control element attribute in the source code of test page, when based on this After the combination of control element attribute finds unique corresponding control element in the source code of test page, now it is identified as Work(.
Substrategy four:Target control is identified based on the regular expression that the multiple control elements specified in recognition property are created Part element.
For example, it is assumed that tester set recognition property include ID, Name, ClassName, Xpath, LinkText, The control element attribute such as TagName, tester can specify multiple control element attributes in these control element attributes, and Corresponding regular expression is created according to specified the plurality of control element attribute, identified by the regular expression of establishment Target widget element., can be anti-based on the regular expression in the source code of test page when identifying target widget element To control element corresponding to lookup, when found based on the regular expression in the source code of test page it is unique corresponding to control After part element, now identify successfully.
Certainly, except substrategy described above, other types of substrategy can also be included in actual applications, at this No longer limited one by one in embodiment.
In the present embodiment, when using single recognition strategy, above-mentioned default recognition strategy can include above-mentioned identification Any one in substrategy.In this case, test terminal can directly invoke the identification substrategy, utilize the first data Control element Attribute Recognition target widget element after the renewal stored in storehouse.It is above-mentioned pre- when using the recognition strategy of combination If recognition strategy can include a variety of combinations in above-mentioned identification substrategy.In this case, when test terminal is based on being somebody's turn to do The still None- identified target widget element in the test page of any identification substrategy in substrategy combination is identified, then base Other identification substrategys in identification substrategy combination continue to identify the target widget element, Zhi Daoshi in test page Cheng Gong not.
For example, it is assumed that above-mentioned identification substrategy combination includes substrategy one described above to substrategy four, it is assumed that test The recognition property that personnel the are set control element attribute such as including ID, Name, ClassName, Xpath, LinkText, TagName, After object element is identified as recognition property by ID based on substrategy one, if recognition failures, son can be based on Name, ClassName, Xpath, LinkText, TagName are continued to identify by tactful two respectively as recognition property, such as Fruit identification still fails, and is also based on substrategy three, and Name, ClassName, Xpath, LinkText, TagName are carried out Combination, is then based on the combination and is identified, if identification still fails, is also based on Name, ClassName, Xpath, LinkText, TagName create regular expression, continue to identify.In this way, target widget element can be improved Recognition success rate, so as to reduce the situation that caused by control element None- identified test case performs failure.Wherein, The substrategy example combinations are exemplary only, and tester for substrategy when being combined, specific combination, survey Examination personnel can be set according to the testing requirement of reality, be no longer described in detail one by one in the present embodiment.
In the present embodiment, when based on above-mentioned default recognition strategy, using the knowledge after the renewal stored in the first database Other attribute, in test page still the None- identified target widget element when, now test terminal can be sent to tester One prompting message, to prompt tester to reset recognition property as control element to be identified.Wherein, the prompting disappears Breath, can be prompting mail, reminding short message or the other types of prompting message sent to tester, in the present embodiment Without being particularly limited to.
In the embodiment above, by reading the recognition property of target widget element;The recognition property includes multiple use In the control element attribute that the target widget element is identified in test page;And check the identification of the target widget element Whether attribute changes;When the recognition property of the target widget element changes, to occurring in the recognition property The control element attribute of change is updated, and is then based on default recognition strategy using the recognition property after renewal described The target widget element is identified in test page, it is possible to achieve when the control element attribute in test page changes, Automatically the control element attribute to change is updated automatically, so that when testing test page, even if surveying Control element attribute in the examination page changes, and remains able to normally identify the control element in test page, can To improve the success rate of test, testing cost is reduced.
As shown in Fig. 2 Fig. 2 is the recognition methods of another control element according to an exemplary embodiment, the control The recognition methods of part element is used to test in terminal, comprises the following steps:
In step 201, the recognition property of target widget element is read;The recognition property includes multiple for testing The control element attribute of the target widget element is identified in the page.
In step 202, the control element attribute of the test page is periodically gathered.
In step 203, by the control of the control element attribute in the recognition property and the test page collected Part element property is matched.
In step 204, when the part control element attribute in the recognition property can not be in the test collected Corresponding to being matched in the control element attribute of the page during control element attribute, the recognition property of the target widget element is determined Change.
In step 205, when the recognition property of the target widget element changes, based in the recognition property Correlation between each control element attribute, obtain in the control element attribute of the test page with the part control element The control element attribute of attributes match.
In step 206, according to first with the part control in the control element attribute of the test page got The control element attribute of plain attributes match is updated to the part control element.
In step 207, the recognition property after renewal is used in the test page based on default recognition strategy Identify the target widget element.
Above-mentioned test terminal can include being used for the terminal device for testing test page.Wherein, the terminal device Can be mobile terminal device, can also server.It is used to enter test page for example, the test terminal can be tester The PC terminals of row test, or the test server for being tested test page.Certainly, in the application of reality, Above-mentioned test terminal can also be other types of special test equipment, in the disclosure without being particularly limited to.
In the present embodiment, tester can edit for test in advance before testing test page The test case that the page is tested, and corresponding recognition property is set respectively for the control element in test page.
Wherein, multiple control elements for being used to identify the control element in test page can be included in the recognition property Attribute.For example, tester when setting recognition property, can need the control of control element identified from the tested page In element property, specify multiple control element attributes that the recognition property then is prestored into the first number as recognition property According in storehouse.
Wherein, first database is used to store recognition property.Multiple control elements can be preserved in the first database Recognition property.Certainly, when realizing, recognition property can also be stored by other means, for example, be saved in excel, In script or other equipment that can be stored, in the present embodiment without being particularly limited to.
When test terminal starts to test test page, the test of completion can be edited in advance with testing results personnel Use-case, the recognition property stored in the first database is read, to identify the control element in test page, then for identifying Control element tested one by one.
However, in actual applications, the control element attribute of the control element in test page may change, one The control element attribute as recognition property stored in the database of denier first is changed, and test terminal is used in testing results Example, when carrying out control element identification to test page, it is possible to element None- identified can be caused and cause test case to perform mistake Situation about losing.
To avoid the occurrence of such case, the disclosure introduces a kind of mechanism that automatically updates of recognition property, and test terminal can be with Control element in recognition property is periodically checked, once test terminal checks out that recognition property changes, Can immediately to having occurred and that the control element of change is updated in recognition property, so as to avoid due to control element without Test case performs the situation of failure caused by method identification.
The mechanism that automatically updates of above-mentioned recognition property is described in detail below.
In the present embodiment, for the control element attribute as recognition property stored in the first database, Ke Yiyou Test terminal is checked, to determine whether the control element attribute stored in the first data changes.
Wherein, terminal is tested when it is determined that whether the control element attribute stored in the first data changes, Ke Yitong Cross can the periodic collecting test page control element attribute, and by the control element attribute stored in the first database with The control element attribute of the test page collected is matched to realize.
For example, when realizing, test terminal can run the capturing webpage contents such as " reptile " instrument periodically to capture The source code of test page, such as, the interval duration of a crawl can be set, and based on the interval duration timing grab Take.For the source code grabbed, test terminal can therefrom obtain the dom nodes in the test page, and then traversal obtains The dom nodes arrived, and the control element attribute of each dom nodes is preserved temporarily.Such as the control member that test terminal preserves temporarily Plain attribute can including ID, Name, ClassName, Xpath, LinkText, TagName etc. property value.
For the control element attribute preserved temporarily, test terminal can be stored in the second database.Wherein, It is used to store the control element attribute preserved temporarily, i.e., the control element attribute of current test page in two databases.
After the control element attribute that will be preserved is stored into the second database temporarily, now testing terminal can be by first The control element attribute stored in database is matched with the control element attribute stored in the second database, to determine first Whether the control element attribute as recognition property stored in database has occurred that change.
When the control element attribute stored in the first database can match corresponding control in the second database During element property, then the control element as recognition property that can determine to store in the first database does not change.It is equivalent , when the part control element attribute stored in the first database can not match corresponding control member in the second database During plain attribute, then the control element as recognition property that can determine to store in the first database has occurred and that change.
For example, when realizing, test terminal can read a control element attribute from the first database, then will read The control element attribute gone out is searched in the second database, if found in the second database unique corresponding One control element attribute, then show that the control element attribute does not change.On the contrary, if corresponding control is not found Element property, then showing that test page may have occurred and that renewal, the control element attribute may also have occurred that change, this When using the control element attribute as recognition property, None- identified goes out corresponding control element.When the control element attribute is searched After the completion of, test terminal can continue to read next control element attribute, and continue in the manner described above in the second database In searched, until the control element attribute in the first database to be searched to completion in the second database.
After the completion of all control element attributes in the first database are searched in the second database, if the first number According to the part control element attribute in storehouse, corresponding control element attribute can not be matched in the second database, then can be true The recognition property stored in fixed first database has occurred and that change.Certainly, if the control element stored in the first database Attribute can find unique corresponding control element attribute in the second database, then can determine to store in the first database Recognition property do not change.
Wherein, what deserves to be explained is, test terminal is in the control element attribute that will be read from the first database second When being searched in database, it is possible to the situation for finding multiple corresponding control element attributes occur.
For example, for the control element attribute without uniqueness stored in the first database, such as ClassName, It is commonly used for indicating the classification of control element, the ClassName of different control elements is possible to identical, therefore when test is whole When end is searched the ClassName read out from the first database in the second database, it may find multiple Corresponding ClassName, although the ClassName now found value all same, but it is under the jurisdiction of different controls Element.
In this case, test terminal can extract the control element attribute related to the control element attribute Come, whole matching is then done, to determine whether the control element attribute changes.Wherein, it is related to the control element attribute Control element attribute, can be the other control element attributes for being under the jurisdiction of same control element with the control element.
What deserves to be explained is tree hierarchy of the source code generally use of webpage based on dom structures, same control The control element attribute of element is generally under the jurisdiction of the same object in the tree, or same layering, i.e., same Certain correlation between the control element attribute of control element generally be present, therefore in extraction and some control element attribute phase During the control element attribute of pass, the either layering (now in the object or layering of object where the control element can be searched Other control element attributes be related control element attribute identical with the control element), then extract the object or Other control element attributes in layering.
For example, still by taking ClassName as an example, although different control elements there may be identical ClassName, pass through Single matching ClassName can not distinguish different control elements, but when realizing, can will with from the first data The ClassName read in storehouse, and multiple ClassName with being found in the second database are under the jurisdiction of same control Other control element attributes of element extract, and then carry out whole matching, then can distinguish different control elements. If found by whole matching, the plurality of ClassName searched in the second database from the first database with reading To ClassName be under the jurisdiction of different control elements, can now determine not find in the second database corresponding to ClassName, the ClassName may have occurred that change.It can be seen that in this way, in the second database Multiple corresponding control element attributes have been found, have remained able to normally determine whether the control element attribute has occurred that Change.
In the present embodiment, when test terminal passes through the control element attribute that will be stored in the first database and the second data The control element attribute stored in storehouse is matched, and determines the part control as recognition property stored in the first database After element changes, this portion that can be based on the control element attribute stored in the second database to being stored in the first database Divide and have occurred and that the control element attribute of change is updated.
As previously described, because certain correlation be present between being under the jurisdiction of the control element of same control element, for For the recognition property of any control element stored in first database, the control element attribute in the recognition property, generally Same object or same layering can be under the jurisdiction of in the source code of test page.
It can be seen that if the part control element attribute in recognition property changes, test terminal can be based on the identification The control element attribute not changed in attribute, object or layering that the control element is subordinate to reversely are searched, now should Control element attribute in object or layering is the control element attribute after changing.In this case, terminal is tested The control element attribute in the object or layering can be obtained, to the control as recognition property stored in the first database Element property is updated accordingly.
For example, it is assumed that the recognition property of a certain control element stored in the first database includes ID, Name, ClassName, Xpath, if ClassName the and Xpath attributes of the control element are changed in test page, now The ClassName and Xpath of the control element stored in first database can not be found in the second database.For Such case, because the ID and Name of the control element do not change, therefore existed by the ID and Name of the control element Object or the layering that the control element is subordinate to can be smoothly found in the source code of test page, now the object or Control element attribute ClassName and Xpath in layering are the property value after changing.Therefore, the object can be utilized Or layering in ClassName and Xpath the ClassName and Xpath that are stored in the first database are updated.Can See, in this way, after the part control element in the first database changes, pass through the correlation between control element Property, the control element attribute of the control element attributes match to be changed in the second database with this part can be got, from And the control element to be changed in the first database can be updated according to these control element attributes of acquisition, to protect It is newest control element attribute to hold the control element attribute as recognition property stored in the first data.
Certainly, in actual applications, if test terminal by the control element attribute that will be stored in the first database with The control element attribute stored in second database finds after being matched, stored in the first database as recognition property Control element attribute, when corresponding control element attribute can not be matched in the second database, now in the first database The control element attribute as recognition property of storage may all be changed.
In this case, because all control element attributes stored in the first database all change, test Terminal can not find these control elements in the source code of test page based on the correlation between control element attribute The object or layering that attribute is subordinate to, now testing terminal can not be carried out to the control element attribute stored in the first database Renewal.Therefore, after hungry control element attribute is stored in the first database all changing, test terminal can be to test Personnel send a prompting message, to prompt tester to reset recognition property as control element to be identified.
Wherein, the prompting message can be prompting mail, the reminding short message or other types of sent to tester Prompting message, in the present embodiment without being particularly limited to.
Be described above recognition property automatically updates mechanism.
Mechanism is automatically updated by described above, category periodically can be identified to the conduct stored in the first database The control element attribute of property is updated.Terminal is tested when testing results use-case is tested for test page, can be made With the control element attribute after the renewal stored in the first database, control element is identified in test page, is then based on knowing The control element not gone out is tested one by one.
In the present embodiment, test terminal is being tested using the control element attribute after the renewal stored in the first database When control element is identified in the page, it can be completed based on default recognition strategy.Wherein, the default recognition strategy can use Single recognition strategy, the recognition strategy of combination can also be used.
When realizing, following identification substrategy can be provided:
Substrategy one:Based on any control element Attribute Recognition target widget element specified in recognition property.
For example, it is assumed that tester set recognition property include ID, Name, ClassName, Xpath, LinkText, The control element attribute such as TagName, tester can specify one of them to have uniqueness in these control element attributes Control element attribute identify target widget element as recognition property.When identifying target widget element, can test The control element attribute specified in the source code of the page based on this reversely search corresponding to control element, when the control specified based on this After part element property finds unique corresponding control element in the source code of test page, now identify successfully.
Substrategy two:Target widget element is identified one by one based on the multiple control elements specified in recognition property.
For example, it is assumed that tester set recognition property include ID, Name, ClassName, Xpath, LinkText, The control element attribute such as TagName, tester can specify multiple controls with uniqueness in these control element attributes Part element property identifies target widget element, when one of control element None- identified target widget element, then makes Continue to identify with other specified control elements specified, it is unique corresponding until being found in the source code in test page After control element, then identify successfully.
Substrategy three:Combination identification target widget element based on the multiple control elements specified in recognition property.
For example, it is assumed that tester set recognition property include ID, Name, ClassName, Xpath, LinkText, The control element attribute such as TagName, tester can specify multiple control element attributes in these control element attributes, and Specified the plurality of control element attribute is combined to identify target widget element., can when identifying target widget element Control element corresponding to reversely being searched with the combination based on the control element attribute in the source code of test page, when based on this After the combination of control element attribute finds unique corresponding control element in the source code of test page, now it is identified as Work(.
Substrategy four:Target control is identified based on the regular expression that the multiple control elements specified in recognition property are created Part element.
For example, it is assumed that tester set recognition property include ID, Name, ClassName, Xpath, LinkText, The control element attribute such as TagName, tester can specify multiple control element attributes in these control element attributes, and Corresponding regular expression is created according to specified the plurality of control element attribute, identified by the regular expression of establishment Target widget element., can be anti-based on the regular expression in the source code of test page when identifying target widget element To control element corresponding to lookup, when found based on the regular expression in the source code of test page it is unique corresponding to control After part element, now identify successfully.
Certainly, except substrategy described above, other types of substrategy can also be included in actual applications, at this No longer limited one by one in embodiment.
In the present embodiment, when using single recognition strategy, above-mentioned default recognition strategy can include above-mentioned identification Any one in substrategy.In this case, test terminal can directly invoke the identification substrategy, utilize the first data Control element Attribute Recognition target widget element after the renewal stored in storehouse.It is above-mentioned pre- when using the recognition strategy of combination If recognition strategy can include a variety of combinations in above-mentioned identification substrategy.In this case, when test terminal is based on being somebody's turn to do The still None- identified target widget element in the test page of any identification substrategy in substrategy combination is identified, then base Other identification substrategys in identification substrategy combination continue to identify the target widget element, Zhi Daoshi in test page Cheng Gong not.
For example, it is assumed that above-mentioned identification substrategy combination includes substrategy one described above to substrategy four, it is assumed that test The recognition property that personnel the are set control element attribute such as including ID, Name, ClassName, Xpath, LinkText, TagName, After object element is identified as recognition property by ID based on substrategy one, if recognition failures, son can be based on Name, ClassName, Xpath, LinkText, TagName are continued to identify by tactful two respectively as recognition property, such as Fruit identification still fails, and is also based on substrategy three, and Name, ClassName, Xpath, LinkText, TagName are carried out Combination, is then based on the combination and is identified, if identification still fails, is also based on Name, ClassName, Xpath, LinkText, TagName create regular expression, continue to identify.In this way, target widget element can be improved Recognition success rate, so as to reduce the situation that caused by control element None- identified test case performs failure.Wherein, The substrategy example combinations are exemplary only, and tester for substrategy when being combined, specific combination, survey Examination personnel can be set according to the testing requirement of reality, be no longer described in detail one by one in the present embodiment.
In the present embodiment, when based on above-mentioned default recognition strategy, using the knowledge after the renewal stored in the first database Other attribute, in test page still the None- identified target widget element when, now test terminal can be sent to tester One prompting message, to prompt tester to reset recognition property as control element to be identified.Wherein, the prompting disappears Breath, can be prompting mail, reminding short message or the other types of prompting message sent to tester, in the present embodiment Without being particularly limited to.
In the embodiment above, by reading the recognition property of target widget element;The recognition property includes multiple use In the control element attribute that the target widget element is identified in test page;And check the identification of the target widget element Whether attribute changes;When the recognition property of the target widget element changes, to occurring in the recognition property The control element attribute of change is updated, and is then based on default recognition strategy using the recognition property after renewal described The target widget element is identified in test page, it is possible to achieve when the control element attribute in test page changes, Automatically the control element attribute to change is updated automatically, so that when testing test page, even if surveying Control element attribute in the examination page changes, and remains able to normally identify the control element in test page, can To improve the success rate of test, testing cost is reduced.
Corresponding with the recognition methods embodiment of aforementioned controls element, the disclosure additionally provides the identification device of control element Embodiment.
Fig. 3 is a kind of schematic block diagram of the identification device of control element according to an exemplary embodiment.
As shown in figure 3, a kind of identification device 30 of control element according to an exemplary embodiment, including:Read Module 301, check module 302, update module 303 and identification module 304;Wherein:
The read module 301, it is configured as reading the recognition property of target widget element;The recognition property includes more The individual control element attribute for being used to identify the target widget element in test page;
Whether the inspection module 302, the recognition property for being configured to check for the target widget element change;
The update module 303, it is configured as when the recognition property of the target widget element changes, to described The control element attribute to be changed in recognition property is updated;
The identification module 304, it is configured as based on default recognition strategy using the recognition property after renewal in institute State and the target widget element is identified in test page.
In the embodiment above, by reading the recognition property of target widget element;The recognition property includes multiple use In the control element attribute that the target widget element is identified in test page;And check the identification of the target widget element Whether attribute changes;When the recognition property of the target widget element changes, to occurring in the recognition property The control element attribute of change is updated, and is then based on default recognition strategy using the recognition property after renewal described The target widget element is identified in test page, it is possible to achieve when the control element attribute in test page changes, Automatically the control element attribute to change is updated automatically, so that when testing test page, even if surveying Control element attribute in the examination page changes, and remains able to normally identify the control element in test page, can To improve the success rate of test, testing cost is reduced.
Fig. 4 is referred to, Fig. 4 is the identification device of another control element of the disclosure according to an exemplary embodiment Block diagram, for the embodiment on the basis of foregoing embodiment illustrated in fig. 3, the inspection module 302 can include collection submodule 302A, matched sub-block 302B, determination sub-module 302C;Wherein:
The collection submodule 302A, it is configured as periodically gathering the control element attribute of the test page;
The matched sub-block 302B, it is configured as the control element attribute in the recognition property and the institute collected The control element attribute for stating test page is matched;
The determination sub-module 302C, the part control element attribute being configured as in the recognition property can not adopted Corresponding to being matched in the control element attribute of the test page collected during control element attribute, the target widget is determined The recognition property of element changes.
Fig. 5 is referred to, Fig. 5 is the identification device of another control element of the disclosure according to an exemplary embodiment Block diagram, for the embodiment on the basis of foregoing embodiment illustrated in fig. 4, the inspection module 302 can also include sending submodule 302D;Wherein:
The sending submodule 302D, being configured as the control element attribute in the recognition property can not gather To the test page control element attribute in match corresponding to control element attribute when, to tester send prompt Message, to prompt the tester to reset recognition property as the target widget element.
It should be noted that the sending submodule 302D shown in device embodiment shown in above-mentioned Fig. 5 structure also may be used Included in the device embodiment of earlier figures 3, to be not limited to this disclosure.
Fig. 6 is referred to, Fig. 6 is the identification device of another control element of the disclosure according to an exemplary embodiment Block diagram, for the embodiment on the basis of foregoing embodiment illustrated in fig. 3, the update module 303 can include acquisition submodule 303A and renewal submodule 303B;Wherein:
The acquisition submodule 303A, it is configured as based on the correlation between each control element attribute in the recognition property Property, obtain the control element attribute with the part control element attributes match in the control element attribute of the test page;
The renewal submodule 303B is configured as, according in the control element attribute of the test page got with The control element attribute of the part control element attributes match is updated to the part control element.
It should be noted that the acquisition submodule 303A and renewal submodule that are shown in device embodiment shown in above-mentioned Fig. 6 Block 303B structure can also be not limited included in earlier figures 4-5 device embodiment to this disclosure.
In various embodiments above, the default recognition strategy includes one or more kinds of in substrategy identified below Combination:
Based on target widget element described in any control element Attribute Recognition specified in the recognition property;
The target widget element is identified one by one based on the multiple control elements specified in the recognition property;
Combination based on the multiple control elements specified in the recognition property identifies the target widget element;
The target control is identified based on the regular expression that the multiple control elements specified in the recognition property are created Part element.
Fig. 7 is referred to, Fig. 7 is the identification device of another control element of the disclosure according to an exemplary embodiment Block diagram, for the embodiment on the basis of foregoing embodiment illustrated in fig. 3, the identification module 304 can include the first identification submodule The identification submodules of block 304A and second 304B;Wherein:
The first identification submodule 304A, it is configured as when the recognition strategy only includes an identification substrategy, The target widget element is identified in the test page based on the identification substrategy;
The second identification submodule 304B, it is configured as when the recognition strategy includes multiple identification substrategys, such as Fruit is based on any identification substrategy target widget element still described in None- identified in the test page, then based on the multiple Other identification substrategys in identification substrategy continue to identify the target widget element in the test page.
It should be noted that the first identification submodule 304A and second shown in device embodiment shown in above-mentioned Fig. 7 Identify that submodule 304B structure can also be not limited included in earlier figures 4-6 device embodiment to this disclosure.
Fig. 8 is referred to, Fig. 8 is the identification device of another control element of the disclosure according to an exemplary embodiment Block diagram, for the embodiment on the basis of foregoing embodiment illustrated in fig. 3, described device 30 can also include sending module 305;Its In:
The sending module 305, it is configured as using the recognition property after renewal existing based on default recognition strategy In the test page still described in None- identified during target widget element, prompting message is sent to tester, with described in prompting Tester is that the target widget element resets recognition property.
It should be noted that the structure of the sending module 305 shown in device embodiment shown in above-mentioned Fig. 8 can also wrap It is contained in earlier figures 4-7 device embodiment, this disclosure is not limited.
The function of modules and the implementation process of effect specifically refer to and step are corresponded in the above method in said apparatus Implementation process, it will not be repeated here.
For device embodiment, because it corresponds essentially to embodiment of the method, so related part is real referring to method Apply the part explanation of example.Device embodiment described above is only schematical, wherein described be used as separating component The module of explanation can be or may not be physically separate, can be as the part that module is shown or can also It is not physical module, you can with positioned at a place, or can also be distributed on multiple mixed-media network modules mixed-medias.Can be according to reality Need to select some or all of module therein to realize the purpose of disclosure scheme.Those of ordinary skill in the art are not paying In the case of going out creative work, you can to understand and implement.
Accordingly, the disclosure also provides a kind of identification device of control element, and described device includes:
Processor;
For storing the memory of processor-executable instruction;
Wherein, the processor is configured as:
Read the recognition property of target widget element;The recognition property includes multiple for identifying institute in test page State the control element attribute of target widget element;
Check whether the recognition property of the target widget element changes;
When the recognition property of the target widget element changes, to the control to be changed in the recognition property Element property is updated;
The target is identified in the test page using the recognition property after renewal based on default recognition strategy Control element.
Accordingly, the disclosure also provides a kind of test terminal, and the test terminal includes memory, and one or More than one program, one of them or more than one program storage are configured to by one or one in memory Individual above computing device is one or more than one program bag contains the instruction for being used for being operated below:
Check whether the recognition property of the target widget element changes;
When the recognition property of the target widget element changes, to the control to be changed in the recognition property Element property is updated;
The target is identified in the test page using the recognition property after renewal based on default recognition strategy Control element.
Fig. 9 is a kind of structural representation of the identification device of control element according to an exemplary embodiment.
As shown in figure 9, a kind of identification device 900 of control element according to an exemplary embodiment, the device 900 Can be computer, mobile phone, digital broadcast terminal, messaging devices, game console, tablet device, Medical Devices, Body-building equipment, personal digital assistant etc..
Reference picture 9, device 900 can include following one or more assemblies:Processing component 901, memory 902, power supply Component 903, multimedia groupware 904, audio-frequency assembly 905, the interface 906 of input/output (I/O), sensor cluster 907, and Communication component 908.
The integrated operation of the usual control device 900 of processing component 901, such as communicated with display, call, data, phase The operation that machine operates and record operation is associated.Processing component 901 can refer to including one or more processors 909 to perform Order, to complete all or part of step of above-mentioned method.In addition, processing component 901 can include one or more modules, just Interaction between processing component 901 and other components.For example, processing component 901 can include multi-media module, it is more to facilitate Interaction between media component 904 and processing component 901.
Memory 902 is configured as storing various types of data to support the operation in device 900.These data are shown Example includes the instruction of any application program or method for being operated on device 900, contact data, telephone book data, disappears Breath, picture, video etc..Memory 902 can be by any kind of volatibility or non-volatile memory device or their group Close and realize, as static RAM (SRAM), Electrically Erasable Read Only Memory (EEPROM) are erasable to compile Journey read-only storage (EPROM), programmable read only memory (PROM), read-only storage (ROM), magnetic memory, flash Device, disk or CD.
Power supply module 903 provides electric power for the various assemblies of device 900.Power supply module 903 can include power management system System, one or more power supplys, and other components associated with generating, managing and distributing electric power for device 900.
Multimedia groupware 904 is included in the screen of one output interface of offer between described device 900 and user.One In a little embodiments, screen can include liquid crystal display (LCD) and touch panel (TP).If screen includes touch panel, screen Curtain may be implemented as touch-screen, to receive the input signal from user.Touch panel includes one or more touch sensings Device is with the gesture on sensing touch, slip and touch panel.The touch sensor can not only sensing touch or sliding action Border, but also detect and touched or the related duration and pressure of slide with described.In certain embodiments, more matchmakers Body component 904 includes a front camera and/or rear camera.When device 900 is in operator scheme, such as screening-mode or During video mode, front camera and/or rear camera can receive outside multi-medium data.Each front camera and Rear camera can be a fixed optical lens system or have focusing and optical zoom capabilities.
Audio-frequency assembly 905 is configured as output and/or input audio signal.For example, audio-frequency assembly 905 includes a Mike Wind (MIC), when device 900 is in operator scheme, during such as call model, logging mode and speech recognition mode, microphone by with It is set to reception external audio signal.The audio signal received can be further stored in memory 902 or via communication set Part 908 is sent.In certain embodiments, audio-frequency assembly 905 also includes a loudspeaker, for exports audio signal.
I/O interfaces 902 provide interface between processing component 901 and peripheral interface module, and above-mentioned peripheral interface module can To be keyboard, click wheel, button etc..These buttons may include but be not limited to:Home button, volume button, start button and lock Determine button.
Sensor cluster 907 includes one or more sensors, and the state for providing various aspects for device 900 is commented Estimate.For example, sensor cluster 907 can detect opening/closed mode of device 900, and the relative positioning of component, for example, it is described Component is the display and keypad of device 900, and sensor cluster 907 can be with 900 1 components of detection means 900 or device Position change, the existence or non-existence that user contacts with device 900, the orientation of device 900 or acceleration/deceleration and device 900 Temperature change.Sensor cluster 907 can include proximity transducer, be configured to detect in no any physical contact The presence of neighbouring object.Sensor cluster 907 can also include optical sensor, such as CMOS or ccd image sensor, for into As being used in application.In certain embodiments, the sensor cluster 907 can also include acceleration transducer, gyro sensors Device, Magnetic Sensor, pressure sensor or temperature sensor.
Communication component 908 is configured to facilitate the communication of wired or wireless way between device 900 and miscellaneous equipment.Device 900 can access the wireless network based on communication standard, such as WiFi, 2G or 3G, or combinations thereof.In an exemplary implementation In example, communication component 908 receives broadcast singal or broadcast related information from external broadcasting management system via broadcast channel. In one exemplary embodiment, the communication component 908 also includes near-field communication (NFC) module, to promote junction service.Example Such as, in NFC module radio frequency identification (RFID) technology can be based on, Infrared Data Association (IrDA) technology, ultra wide band (UWB) technology, Bluetooth (BT) technology and other technologies are realized.
In the exemplary embodiment, device 900 can be believed by one or more application specific integrated circuits (ASIC), numeral Number processor (DSP), digital signal processing appts (DSPD), PLD (PLD), field programmable gate array (FPGA), controller, microcontroller, microprocessor or other electron component are realized, for performing the above method.
In the exemplary embodiment, a kind of non-transitorycomputer readable storage medium including instructing, example are additionally provided Such as include the memory 902 of instruction, above-mentioned instruction can be performed to complete the above method by the processor 909 of device 900.For example, The non-transitorycomputer readable storage medium can be ROM, random access memory (RAM), CD-ROM, tape, floppy disk With optical data storage devices etc..
Wherein, when computing device of the instruction in the storage medium by mobile terminal so that mobile terminal can A kind of recognition methods of control element is performed, including:
Check whether the recognition property of the target widget element changes;
When the recognition property of the target widget element changes, to the control to be changed in the recognition property Element property is updated;
The target is identified in the test page using the recognition property after renewal based on default recognition strategy Control element.
Accordingly, the disclosure also provides a kind of identification device of control element, and described device includes:
Processor;
For storing the memory of processor-executable instruction;
Wherein, the processor is configured as:
Check whether the recognition property of the target widget element changes;
When the recognition property of the target widget element changes, to the control to be changed in the recognition property Element property is updated;
The target is identified in the test page using the recognition property after renewal based on default recognition strategy Control element.
Figure 10 is a kind of block diagram of identification device 1000 for control element according to an exemplary embodiment.Example Such as, device 1000 may be provided in a server.
Reference picture 10, device 1000 include processing component 1022, and it further comprises one or more processors, Yi Jiyou Memory resource representated by memory 1032, can be by the instruction of the execution of processing component 1022, such as using journey for storing Sequence.The application program stored in memory 1032 can include it is one or more each correspond to the mould of one group of instruction Block.In addition, processing component 1022 is configured as execute instruction, to perform the said equipment binding method.
Device 1000 can also include a power supply module 1026 and be configured as the power management of performs device 1000, one Wired or wireless network interface 1050 is configured as device 1000 being connected to network, and input and output (I/O) interface 1058.Device 1000 can be operated based on the operating system for being stored in memory 1032, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or similar.
Those skilled in the art will readily occur to the disclosure its after considering specification and putting into practice invention disclosed herein Its embodiment.The application is intended to any modification, purposes or the adaptations of the disclosure, these modifications, purposes or Person's adaptations follow the general principle of the disclosure and including the undocumented common knowledges in the art of the disclosure Or conventional techniques.Description and embodiments are considered only as exemplary, and the true scope of the disclosure and spirit are by following Claim is pointed out.
It should be appreciated that the precision architecture that the disclosure is not limited to be described above and is shown in the drawings, and And various modifications and changes can be being carried out without departing from the scope.The scope of the present disclosure is only limited by appended claim.

Claims (13)

1. a kind of recognition methods of control element, it is characterised in that methods described includes:
Read the recognition property of target widget element;The recognition property includes multiple for identifying the mesh in test page Mark the control element attribute of control element;The test page is the page of tested website;
Check whether the recognition property of the target widget element changes, including:
Periodically gather the control element attribute of the test page;
By the progress of the control element attribute of the control element attribute in the recognition property and the test page collected Match somebody with somebody;
When the part control element attribute in the recognition property can not be in the control element category of the test page collected Property in match corresponding to control element attribute when, determine that the recognition property of the target widget element changes;
When the recognition property of the target widget element changes, to the control element to be changed in the recognition property Attribute is updated;
The target widget is identified in the test page using the recognition property after renewal based on default recognition strategy Element.
2. the method as described in claim 1, it is characterised in that methods described also includes:
When the control element attribute in the recognition property can not be in the control element attribute of the test page collected In match corresponding to control element attribute when, to tester send prompting message, be described to prompt the tester Target widget element resets recognition property.
3. the method as described in claim 1, it is characterised in that the control element to being changed in the recognition property Attribute be updated including:
Based on the correlation between each control element attribute in the recognition property, the control element category of the test page is obtained Control element attribute in property with the part control element attributes match;
According to the control in the control element attribute of the test page got with the part control element attributes match Element property is updated to the part control element attribute.
4. the method as described in claim 1, it is characterised in that the default recognition strategy is included in substrategy identified below One or more kinds of combinations:
Based on target widget element described in any control element Attribute Recognition specified in the recognition property;
The target widget element is identified one by one based on the multiple control element attributes specified in the recognition property;
Combination based on the multiple control element attributes specified in the recognition property identifies the target widget element;
The target control is identified based on the regular expression that the multiple control element attributes specified in the recognition property are created Part element.
5. method as claimed in claim 4, it is characterised in that described that the knowledge after renewal is used based on default recognition strategy Other attribute identifies that the target widget element includes in the test page:
When the recognition strategy only includes an identification substrategy, identified based on the identification substrategy in the test page The target widget element;
When the recognition strategy includes multiple identification substrategys, if based on any identification substrategy in the test page Target widget element still described in None- identified, then based on other identification substrategys in the multiple identification substrategy in the survey Continue to identify the target widget element in the examination page.
6. the method as described in claim 1, it is characterised in that methods described also includes:
When based on default recognition strategy using recognition property after renewal in the test page still described in None- identified During target widget element, prompting message is sent to tester, to prompt the tester as the target widget element weight It is new that recognition property is set.
7. a kind of identification device of control element, it is characterised in that described device includes:
Read module, it is configured as reading the recognition property of target widget element;The recognition property includes multiple for surveying The control element attribute of the target widget element is identified in the examination page;The test page is the page of tested website;
Module is checked, whether the recognition property for being configured to check for the target widget element changes, the inspection module Including:
Submodule is gathered, is configured as periodically gathering the control element attribute of the test page;
Matched sub-block, it is configured as the control element attribute in the recognition property and the test page that collects Control element attribute is matched;
Determination sub-module, the part control element attribute being configured as in the recognition property can not be in the survey collected When trying to match corresponding control element attribute in the control element attribute of the page, the identification category of the target widget element is determined Property changes;
Update module, it is configured as when the recognition property of the target widget element changes, in the recognition property The control element attribute to change is updated;
Identification module, it is configured as using the recognition property after renewal in the test page based on default recognition strategy Identify the target widget element.
8. device as claimed in claim 7, it is characterised in that the inspection module also includes:
Sending submodule, being configured as the control element attribute in the recognition property can not be in the test collected Corresponding to being matched in the control element attribute of the page during control element attribute, prompting message is sent to tester, with prompting The tester is that the target widget element resets recognition property.
9. device as claimed in claim 7, it is characterised in that the update module includes:
Acquisition submodule, it is configured as based on the correlation between each control element attribute in the recognition property, described in acquisition In the control element attribute of test page with the control element attribute of the part control element attributes match;
Submodule is updated, is configured as in the control element attribute according to the test page got and the part control The control element attribute of element property matching is updated to the part control element attribute.
10. device as claimed in claim 7, it is characterised in that the default recognition strategy is included in substrategy identified below One or more kinds of combinations:
Based on target widget element described in any control element Attribute Recognition specified in the recognition property;
The target widget element is identified one by one based on the multiple control element attributes specified in the recognition property;
Combination based on the multiple control element attributes specified in the recognition property identifies the target widget element;
The target control is identified based on the regular expression that the multiple control element attributes specified in the recognition property are created Part element.
11. device as claimed in claim 10, it is characterised in that the identification module includes:
First identification submodule, it is configured as when the recognition strategy only includes an identification substrategy, based on identification Strategy identifies the target widget element in the test page;
Second identification submodule, it is configured as when the recognition strategy includes multiple identification substrategys, if based on any knowledge Small pin for the case strategy target widget element still described in None- identified in the test page, then based in the multiple identification substrategy Other identification substrategys continue to identify the target widget element in the test page.
12. device as claimed in claim 7, it is characterised in that described device also includes:
Sending module, it is configured as using the recognition property after renewal based on default recognition strategy in the test page In still described in None- identified during target widget element, prompting message is sent to tester, to prompt the tester as institute State target widget element and reset recognition property.
A kind of 13. identification device of control element, it is characterised in that including:
Processor;
For storing the memory of processor-executable instruction;
Wherein, the processor is configured as:
Read the recognition property of target widget element;The recognition property includes multiple for identifying the mesh in test page Mark the control element attribute of control element;The test page is the page of tested website;
Check whether the recognition property of the target widget element changes, including:
Periodically gather the control element attribute of the test page;
By the progress of the control element attribute of the control element attribute in the recognition property and the test page collected Match somebody with somebody;
When the part control element attribute in the recognition property can not be in the control element category of the test page collected Property in match corresponding to control element attribute when, determine that the recognition property of the target widget element changes;
When the recognition property of the target widget element changes, to the control element to be changed in the recognition property Attribute is updated;
The target widget is identified in the test page using the recognition property after renewal based on default recognition strategy Element.
CN201510708654.4A 2015-10-27 2015-10-27 The recognition methods of control element and device Active CN105224462B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510708654.4A CN105224462B (en) 2015-10-27 2015-10-27 The recognition methods of control element and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510708654.4A CN105224462B (en) 2015-10-27 2015-10-27 The recognition methods of control element and device

Publications (2)

Publication Number Publication Date
CN105224462A CN105224462A (en) 2016-01-06
CN105224462B true CN105224462B (en) 2018-02-13

Family

ID=54993447

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510708654.4A Active CN105224462B (en) 2015-10-27 2015-10-27 The recognition methods of control element and device

Country Status (1)

Country Link
CN (1) CN105224462B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109656816A (en) * 2018-12-04 2019-04-19 泰康保险集团股份有限公司 Control recognition methods, device, equipment and storage medium

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105743736B (en) * 2016-01-27 2019-01-04 武汉联影医疗科技有限公司 Automated testing method and system
CN105824629B (en) * 2016-03-16 2019-03-12 烽火通信科技股份有限公司 The method of child window control information is collected under C-sharp language in parent window
CN107423221A (en) * 2017-08-04 2017-12-01 郑州云海信息技术有限公司 A kind of web applies sustainable method of testing and system
CN110096392A (en) * 2018-01-29 2019-08-06 北京京东尚科信息技术有限公司 Method and apparatus for output information
CN110297752A (en) * 2018-03-23 2019-10-01 华为软件技术有限公司 Acquisition methods and device, automatization test system, the storage medium of control element
CN108804181B (en) * 2018-05-28 2021-09-28 北京小米移动软件有限公司 Control content obtaining method and device and storage medium
CN109634859A (en) * 2018-12-10 2019-04-16 宋航 A kind of test method that control property identification is combined with image recognition
CN109739764A (en) * 2018-12-29 2019-05-10 中国联合网络通信集团有限公司 A kind of applied program testing method and device
CN112527688B (en) * 2021-01-18 2021-12-17 杭银消费金融股份有限公司 Test case processing method and system for page elements
CN114463730B (en) * 2021-07-15 2023-07-14 荣耀终端有限公司 Page identification method and terminal equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101960448A (en) * 2008-02-29 2011-01-26 惠普开发有限公司 Identification of elements of currently-executing component script
CN102541728A (en) * 2010-12-14 2012-07-04 北京新媒传信科技有限公司 Method for expanding identifiable control of automatic test tool
US8832590B1 (en) * 2007-08-31 2014-09-09 Google Inc. Dynamically modifying user interface elements
CN104516633A (en) * 2014-11-19 2015-04-15 微梦创科网络科技(中国)有限公司 User interface element management method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8832590B1 (en) * 2007-08-31 2014-09-09 Google Inc. Dynamically modifying user interface elements
CN101960448A (en) * 2008-02-29 2011-01-26 惠普开发有限公司 Identification of elements of currently-executing component script
CN102541728A (en) * 2010-12-14 2012-07-04 北京新媒传信科技有限公司 Method for expanding identifiable control of automatic test tool
CN104516633A (en) * 2014-11-19 2015-04-15 微梦创科网络科技(中国)有限公司 User interface element management method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109656816A (en) * 2018-12-04 2019-04-19 泰康保险集团股份有限公司 Control recognition methods, device, equipment and storage medium

Also Published As

Publication number Publication date
CN105224462A (en) 2016-01-06

Similar Documents

Publication Publication Date Title
CN105224462B (en) The recognition methods of control element and device
US20190012188A1 (en) Dynamically configurable workflow in a mobile environment
CN105493481B (en) The method and system of the automatic display for changing graphic user interface
CN104965790B (en) Method for testing software and system based on crucial word drive
CN107330019A (en) Searching method and device
CN105930247A (en) Method, device and mobile terminal for processing problem of system restart
CN106790895A (en) A kind of fault handling method and device
CN108369528A (en) Service is called back for productivity application
CN107967209A (en) It is a kind of to detect method, detection device and server wrong in the web page code of front end
CN104915290A (en) Application testing method and device
CN107368550A (en) Information acquisition method, device, medium, electronic equipment, server and system
CN106547547A (en) Collecting method and device
KR20140106887A (en) A method for displaying program and an electronic device thereof
CN105550336A (en) Mining method and device of single entity instance
CN110347672A (en) Verification method and device, the electronic equipment and storage medium of tables of data related update
CN105354284A (en) Template processing method and apparatus and short message identification method and apparatus
CN104636164A (en) Generating method and device for starting page
CN105630987A (en) User agent self-adaption uniform resource locator prefix mining method and device
CN116069612A (en) Abnormality positioning method and device and electronic equipment
CN107229698B (en) A kind of method and device of information processing
CN105893249A (en) Software testing method and device
CN105045686A (en) File recovery method and apparatus
CN112783779A (en) Test case generation method and device, electronic equipment and storage medium
CN107329744A (en) The functional module of application program starts method and device
CN107506496A (en) Scrap cleaning method, device and computer-readable recording medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant