CN103365778B - A kind of method and apparatus testing control - Google Patents

A kind of method and apparatus testing control Download PDF

Info

Publication number
CN103365778B
CN103365778B CN201310279331.9A CN201310279331A CN103365778B CN 103365778 B CN103365778 B CN 103365778B CN 201310279331 A CN201310279331 A CN 201310279331A CN 103365778 B CN103365778 B CN 103365778B
Authority
CN
China
Prior art keywords
control
mode
search
library
lookup
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
CN201310279331.9A
Other languages
Chinese (zh)
Other versions
CN103365778A (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.)
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Shangke Information Technology Co Ltd
Priority to CN201310279331.9A priority Critical patent/CN103365778B/en
Publication of CN103365778A publication Critical patent/CN103365778A/en
Application granted granted Critical
Publication of CN103365778B publication Critical patent/CN103365778B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The present invention provides a kind of method and apparatus testing control, it is possible to reduce the maintenance workload of the library of object used by automatic test of software.The method includes: preserves one or more control in library of object and searches mode information, and described control is searched in mode information and comprised the lookup mode searching control according to control position attribution in the man machine interface of software;Receive search key, the described lookup mode being suitable for according to this keyword and this keyword, predetermined control seeking scope finds out one or more control, then exports the control found out and test for this control.

Description

A kind of method and apparatus testing control
Technical field
The present invention relates to a kind of method and apparatus testing control.
Background technology
In the automatic test of software, an of paramount importance link is the maintenance of library of object, is also to determine test automation One of most important aspect realizing cost.The most traditional library of object is model based on control tree library of object, in library of object Save the object tree at each control place, due to the enormous quantity of control, necessarily cause in a library of object and there will be very Many object trees.In this case, right as long as there being an object such as to cause due to the interface of software or the amendment of logic The change of elephant, all object trees comprising this object all must revise therewith, thus cause the maintenance workload of library of object suitable Huge.
Summary of the invention
In view of this, the present invention provides a kind of method and apparatus testing control, it is possible to reduce the automatic test of software The maintenance workload of library of object used.
For achieving the above object, according to an aspect of the invention, it is provided a kind of method testing control.
The method of the test control of the present invention includes: preserves one or more control in library of object and searches mode information, Described control is searched in mode information and is comprised the lookup searching control according to control position attribution in the man machine interface of software Mode;Wherein said position attribution include search original position and search direction, described search direction include upper and lower, left, Right;Receive search key, the described lookup mode being suitable for according to this keyword and this keyword, look at predetermined control Look for and scope finds out one or more control, then export the control found out and test for this control.
Alternatively, described library of object also preserves comprise the lookup mode searching control according to the explanatory note of control Control searches mode information.
Alternatively, the control in object set during described control seeking scope is the trunk process of current tested software; Or, described control seeking scope is the control in the object set in the process specifying object of current tested software.
Alternatively, described lookup mode includes coming according to the relative position between the preselected elements in described man machine interface Search the mode of control.
According to a further aspect in the invention, it is provided that a kind of device testing control.
The device of the test control of the present invention includes: library of object module, searches mode for preserving one or more control Information, described control is searched in mode information to comprise and is searched control according to control position attribution in the man machine interface of software Lookup mode;Wherein said position attribution include search original position and search direction, described search direction include upper and lower, Left and right;Receiver module, is used for receiving search key;Search module, for the institute being suitable for according to this keyword and this keyword State lookup mode, in predetermined control seeking scope, find out one or more control;Output module, looks into for output The control found out is for test.
Alternatively, described library of object module is additionally operable to preserve and comprises the lookup side searching control according to the explanatory note of control The control of formula searches mode information.
Alternatively, the control in object set during described control seeking scope is the trunk process of current tested software; Or, described control seeking scope is the control in the object set in the process specifying object of current tested software.
Alternatively, described lookup mode includes coming according to the relative position between the preselected elements in described man machine interface Search the mode of control.
According to technical scheme, mainly identify according to control position in man machine interface, search control, nothing Object tree path need to be relied on to identify control, make the structure of library of object obtain significantly and simplify, thus significantly reduce software from The maintenance workload of the library of object used by dynamicization test.It is additionally based in the position of man machine interface to identify control, additionally aids Find the defect in terms of control location present in the man machine interface of software.
Accompanying drawing explanation
Accompanying drawing is used for being more fully understood that the present invention, does not constitute inappropriate limitation of the present invention.Wherein:
Fig. 1 is the schematic diagram of the key step of the method for test control according to embodiments of the present invention;
Fig. 2 is the schematic diagram of the basic structure of the device of the test control of basic inventive embodiments.
Detailed description of the invention
Below in conjunction with accompanying drawing, the one exemplary embodiment of the present invention is explained, various including the embodiment of the present invention Details is to help understanding, it should they are thought the most exemplary.Therefore, those of ordinary skill in the art it should be noted that Arrive, the embodiments described herein can be made various changes and modifications, without departing from scope and spirit of the present invention.With Sample, for clarity and conciseness, eliminates the description to known function and structure in description below.
In the present embodiment, in library of object, preserve one or more control in advance and search mode information, control here Lookup mode information comprises the lookup mode searching control according to control position attribution in the man machine interface of software;Then Receiving search key, the lookup mode being suitable for according to this keyword and this keyword, in predetermined control seeking scope In find out one or more control, then the control found out is tested.Hereinafter the technical scheme of the present embodiment is made in detail Describe in detail bright.
Control in the present embodiment is searched and is mainly based upon control position on software interface.Control seeking scope is in advance Determine, such as, can be the control in the object set in the trunk process of current tested software;Can also be current tested soft The control in object set in the process specifying object of part.Searching according to process is the road in order to reduce object dynamic lookup Footpath number.Each control in seeking scope to be traveled through when searching control, the big I of seeking scope presses object tree set in advance Number of levels is specified, and i.e. arranges one and searches the degree of depth.
Because being to search according to control position attribution in man machine interface, mainly obtain each control when searching The position attribution value of part also judges.According to search strategy and control type, mode can be searched there to be flexile control.Below Citing is illustrated.
It is " orientation+control type " that a kind of control searches mode.Orientation can be divided into four kinds: upper and lower, left and right.Now need Search key mainly have the original position of lookup, search direction, control type.Such as, searching original position is man-machine boundary The lower limb in face, search direction be upwards, control type be input frame, then it represents that start upwards to search from man machine interface lower limb Type is the control of input frame.Can be seen that and likely find one or more input frame, it is also possible to do not find defeated Enter frame.In the case of finding input frame, first input frame found can be exported and this input frame is tested, Then the position using this input frame continues to search for as searching original position, i.e. searches original position and can also be set as that last time looks into The position arrived when finding first control.
It should be noted that above lookup is not directly itself to carry out in man machine interface, but in above-mentioned control Part seeking scope is carried out, specifically obtains the position attribution of each control.Due to man machine interface in different display devices or Under the forms state that person is different, the display distance of actual size and wherein each control all can change, so soft During part INTERFACE DESIGN, the position attribution of control is all to describe with relative position.After getting the position attribution of control, according to Search key determines whether the position attribution of the control of acquisition meets lookup requirement.Such as search original position is to search last time To the position of control, direction is upwards, and control type is input frame, then, when searching control, on the one hand to judge currently to travel through To control type whether be input frame, on the other hand whether the position of control to be judged found the position of control in last time On, only two aspect conditions all meet, and just think that the control currently traversed is intended to the control searched.
It is " explanatory note+orientation+control type " that the second control searches mode.Because some controls comprise explanatory note Attribute, such as button, it typically has word, such as " determination ", " next step ", " submitting to " etc..According to this lookup mode, Judge when whether the control that traverses is control to be searched, it is necessary to be that explanatory note, orientation, control type three aspect all meet Search key just can confirm that the control being intended to search.
Can specify in man machine interface an element as object of reference, according to the relative position of this object of reference (upper, Under, left and right etc.) search control.Object of reference is specified the most flexibly, such as one section text, a picture or a control Part etc..So, the third control searches mode can be " object of reference mark+orientation+control type ";4th kind of control lookup side Formula can be " object of reference mark+orientation+control type ".The word mark according to control is comprised additionally, library of object also can preserve The control knowing the lookup mode searching control searches mode information.It is to say, it can also be " explanatory note that control searches mode + control type " mode.Lookup mode is similar with aforementioned.
When performing the method for test control of the present embodiment, the step shown in Fig. 1 can be used to carry out.Fig. 1 is according to this The schematic diagram of the key step of the method for the test control of inventive embodiments.
Step S11: determine control seeking scope.
Step S12: receive control search key.
Step S13: search mode information according to the control in control search key and library of object, in control seeking scope Middle lookup control.
Step S14: judge the quantity of the control found.If 0, return step S12, search key according to other controls Word makes a look up;If 1, enter step S15;If more than 1, enter step S16.Should search if the most known To at least one control, but confirm there is no control according to the judgement of this step, then can confirm that software errors, can start Follow-up error handler.And the existing mode according to object tree identification control, it is impossible to find that control is in man machine interface Position aspect defect that may be present.
Step S15: the control that output finds.Step S18 is entered after this step.
Step S16: export a control found.Step S18 is entered after this step.
Step S17: judge that the control found the most all exports.If so, return step S12, otherwise return step S16。
Step S18: the control of output is tested.
By performing above flow process, the specified type in the control seeking scope determined in step S11 and the control of position Part can be found out and acceptance test.Content in library of object used is only that control searches mode information, compared to magnanimity The substantial amounts of object tree at control place, the library of object structure in the present embodiment has obtained significantly simplifying, maintenance workload also with Be substantially reduced.
Fig. 2 is the schematic diagram of the basic structure of the device of the test control of basic inventive embodiments.As in figure 2 it is shown, test The device 20 of control mainly includes library of object module 21, receiver module 22, searches module 23 and output module 24.
Library of object module 21 searches mode information for preserving one or more control, and described control is searched in mode information Comprise the lookup mode searching control according to control position attribution in the man machine interface of software;Receiver module 22 is used for receiving Search key;Search the described lookup mode that module 23 is used for being suitable for according to this keyword and this keyword, predetermined Control seeking scope in find out one or more control;Output module 24 is for exporting the control found out for test. Library of object module 21 can be additionally used in and preserves the control lookup side comprising the lookup mode searching control according to the explanatory note of control Formula information.
Technical scheme according to embodiments of the present invention, mainly identifies according to control position in man machine interface, searches Control, it is not necessary to rely on object tree path and identify control, make the structure of library of object obtain significantly and simplify, thus significantly reduce The maintenance workload of the library of object used by software automated testing.It is additionally based in the position of man machine interface to identify control, also Contribute to finding the defect in terms of control location present in the man machine interface of software.
The ultimate principle of the present invention is described above in association with specific embodiment, however, it is desirable to it is noted that to this area For those of ordinary skill, it is to be understood that whole or any steps of the method and apparatus of the present invention or parts, Ke Yi Any calculating device (including processor, storage medium etc.) or calculate device network in, with hardware, firmware, software or Combinations thereof is realized, and this is that those of ordinary skill in the art use them in the case of the explanation having read the present invention Basic programming skill can be achieved with.
Therefore, the purpose of the present invention can also be come by running a program or batch processing on any calculating device Realize.Described calculating device can be known fexible unit.Therefore, the purpose of the present invention can also comprise only by offer The program product of the program code realizing described method or device realizes.It is to say, such program product is also constituted The present invention, and store have the storage medium of such program product also to constitute the present invention.Obviously, described storage medium can be Any known storage medium or any storage medium developed in the future.
It may also be noted that in apparatus and method of the present invention, it is clear that each parts or each step are to decompose And/or reconfigure.These decompose and/or reconfigure the equivalents that should be regarded as the present invention.Further, above-mentioned series is performed The step processed can order the most following the instructions perform in chronological order, but is not required to the most sequentially in time Perform.Some step can perform parallel or independently of one another.
Above-mentioned detailed description of the invention, is not intended that limiting the scope of the invention.Those skilled in the art should be bright White, depend on that design requires and other factors, various amendment, combination, sub-portfolio and replacement can occur.Any Amendment, equivalent and the improvement etc. made within the spirit and principles in the present invention, should be included in scope Within.

Claims (8)

1. the method testing control, it is characterised in that including:
Preserving one or more control in library of object and search mode information, described control is searched in mode information and is comprised according to control Part position attribution in the man machine interface of software searches the lookup mode of control;Wherein said position attribution includes that searches rises Beginning position and search direction, described search direction includes upper and lower, left and right;
Receiving search key, the described lookup mode being suitable for according to this keyword and this keyword, at predetermined control Seeking scope finds out one or more control, then exports the control found out and test for this control.
Method the most according to claim 1, it is characterised in that also preserve in described library of object and comprise the literary composition according to control The control of the lookup mode that control is searched in word explanation searches mode information.
Method the most according to claim 1 and 2, it is characterised in that
Described control seeking scope is the control in the object set in the trunk process of current tested software;Or,
Described control seeking scope is the control in the object set in the process specifying object of current tested software.
Method the most according to claim 1 and 2, it is characterised in that described lookup mode include according to described man-machine boundary The mode of control is searched in relative position between preselected elements in face.
5. the device testing control, it is characterised in that including:
Library of object module, searches mode information for preserving one or more control, and described control is searched in mode information and comprised The lookup mode of control is searched according to control position attribution in the man machine interface of software;Wherein said position attribution includes looking into The original position looked for and search direction, described search direction includes upper and lower, left and right;
Receiver module, is used for receiving search key;
Search module, for the described lookup mode being suitable for according to this keyword and this keyword, look at predetermined control Look for and scope finds out one or more control;
Output module, for exporting the control found out for test.
Device the most according to claim 5, it is characterised in that described library of object module is additionally operable to preservation and comprises according to control Explanatory note search control lookups mode control lookup mode information.
7. according to the device described in claim 5 or 6, it is characterised in that
Described control seeking scope is the control in the object set in the trunk process of current tested software;Or,
Described control seeking scope is the control in the object set in the process specifying object of current tested software.
8. according to the device described in claim 5 or 6, it is characterised in that described lookup mode include according to described man-machine boundary The mode of control is searched in relative position between preselected elements in face.
CN201310279331.9A 2013-07-03 2013-07-03 A kind of method and apparatus testing control Active CN103365778B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310279331.9A CN103365778B (en) 2013-07-03 2013-07-03 A kind of method and apparatus testing control

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310279331.9A CN103365778B (en) 2013-07-03 2013-07-03 A kind of method and apparatus testing control

Publications (2)

Publication Number Publication Date
CN103365778A CN103365778A (en) 2013-10-23
CN103365778B true CN103365778B (en) 2016-12-28

Family

ID=49367183

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310279331.9A Active CN103365778B (en) 2013-07-03 2013-07-03 A kind of method and apparatus testing control

Country Status (1)

Country Link
CN (1) CN103365778B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329898A (en) * 2017-06-30 2017-11-07 上海摩软通讯技术有限公司 Terminal interface automated testing method and system
CN107861779A (en) * 2017-09-20 2018-03-30 东软集团股份有限公司 Page object localization method and device, storage medium, electronic equipment
CN109800161A (en) * 2018-12-28 2019-05-24 网宿科技股份有限公司 A kind of components testing method of user interface, electronic equipment and can storage medium
CN113485909B (en) * 2021-06-01 2023-10-27 杭州网易云音乐科技有限公司 Test method, test device, computing equipment and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5943048A (en) * 1997-11-19 1999-08-24 Microsoft Corporation Method and apparatus for testing a graphic control area
CN102024050A (en) * 2010-12-16 2011-04-20 浙江大学 Web browsing method
CN103049369A (en) * 2011-10-14 2013-04-17 阿里巴巴集团控股有限公司 Automated testing method and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5943048A (en) * 1997-11-19 1999-08-24 Microsoft Corporation Method and apparatus for testing a graphic control area
CN102024050A (en) * 2010-12-16 2011-04-20 浙江大学 Web browsing method
CN103049369A (en) * 2011-10-14 2013-04-17 阿里巴巴集团控股有限公司 Automated testing method and system

Also Published As

Publication number Publication date
CN103365778A (en) 2013-10-23

Similar Documents

Publication Publication Date Title
CN109446524B (en) A kind of voice quality detecting method and device
US10216793B2 (en) Optimization of continuous queries in hybrid database and stream processing systems
CN106294038B (en) A kind of generation of fault spectrum, detection method and device based on fault spectrum
CN105653554B (en) A kind of file data comparison method and system
US20160217142A1 (en) Method and system of acquiring semantic information, keyword expansion and keyword search thereof
US20130226903A1 (en) Predicting query execution time
CN107608732B (en) Bug searching and positioning method based on bug knowledge graph
CN103365778B (en) A kind of method and apparatus testing control
US10067965B2 (en) Hierarchic model and natural language analyzer
CN107016018B (en) Database index creation method and device
CN108776678B (en) Index creation method and device based on mobile terminal NoSQL database
WO2014114137A1 (en) Method and apparatus for recommending keywords
CN107291745B (en) Data index management method and device
CN105095464B (en) A kind of detection method and device of searching system
CN105183908A (en) Point of interest (POI) data classifying method and device
CN105488599B (en) Method and device for predicting article popularity
CN105989066A (en) Information processing method and device
US20170270161A1 (en) Method for query execution planning
CN105373528A (en) Method and device for analyzing sensitivity of text contents
US10747766B2 (en) Context based access path selection
CN113448969B (en) Data processing method, device and storage medium
US20180150519A1 (en) Extreme Value Estimation for Query Optimization in Analytical Databases
CN104317903A (en) Chapter type text chapter integrity identification method and device
CN111143356B (en) Report retrieval method and device
CN107577667A (en) A kind of entity word treating method and apparatus

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant