CN104268083B - Automatic software test method and device - Google Patents
Automatic software test method and device Download PDFInfo
- Publication number
- CN104268083B CN104268083B CN201410522269.6A CN201410522269A CN104268083B CN 104268083 B CN104268083 B CN 104268083B CN 201410522269 A CN201410522269 A CN 201410522269A CN 104268083 B CN104268083 B CN 104268083B
- Authority
- CN
- China
- Prior art keywords
- interface element
- complexity
- software
- information
- test
- 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
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
A kind of automatic software test method and device, wherein, methods described includes:By the way that by the identification information of the interface element of software, compared with preset kind information, the type of the interface element of identification software is simple type interface element or complexity interface element;The control corresponding to the identification information of method of testing set pair simple type interface element is called to be tested;Position deviation of the preset test environment relative to default standard test environment is calculated, obtains position of the complexity interface element on test system interface;According to position of the complexity interface element on test system interface, the control corresponding to complexity interface element is tested.By methods described and device, the efficiency and accuracy of automatic test can be improved.
Description
Technical field
The present invention relates to software testing technology field, more particularly to a kind of automatic software test method and device.
Background technology
With the development of IT industry and the expansion of scope of the enterprise, tradition only relies on manpower to be surveyed to product
Examination has seemed unable to do what one wishes gradually, it is difficult to meets test request, while can cause the wasting of resources again.Therefore, automatic test
Paid attention in increasing research and development company, such as by Web browser automatic login system, and call automatically or
Triggering software functionality controls are tested system.Although current automatic test can not also substitute manual testing completely, two
The combination of person can largely improve testing efficiency.
Existing increasing automatization testing technique is used and given birth at present, such as is used in the figure for understanding tested test system
On the basis of family interface (Graphical User Interface, GUI) associated inner code, application programming interfaces are utilized
(Application Programming Interface, API) carries out automatic test.Or can also be according on gui interface
Image primitive usually carry out automatic test operation.
But all there is the defects of respective in above-mentioned automated testing method.The test of automatic test is carried out by API
Method, when the structure of control is more complicated, it is necessary to which the test code write also can be extremely complex.And use according on gui interface
Image primitive usually carry out automatic test operation, then tested person environment has a great influence., can direct shadow if test environment changes
Ring the accuracy of test.These problems and then can all have influence on the efficiency of test.
The content of the invention
The present invention solves the problems, such as it is how to improve the efficiency and accuracy of automatic test.
To solve the above problems, the embodiment of the present invention provides a kind of automatic software test method, including:By by described in
Compared with preset kind information, identify the type of the interface element of the software is the identification information of the interface element of software
Simple type interface element or complexity interface element;Call the identification information institute of simple type interface element described in method of testing set pair
Corresponding control is tested;Position deviation of the preset test environment relative to default standard test environment is calculated, obtains institute
State position of the complexity interface element on the test system interface;According to the complexity interface element in the test system
The position united on interface, is tested the control corresponding to the complexity interface element.
Optionally, the identification information of the interface element of the software is to be obtained by the application programming interfaces of the software.
Optionally, the calculating preset test environment includes relative to the position deviation of default standard test environment:Obtain
Take the coordinate position of browser information under standard test environment, resolution information and the complexity interface element;Obtain
Browser information and resolution information under preset test environment;By contrast the browser information under preset test environment,
Resolution information and browser information, resolution information under the standard test environment, are calculated complexity circle
The deviation of the coordinate position of surface element.
Optionally, also include behind the position for obtaining the complexity interface element on the test system interface:
The coordinate position of browser information, resolution information and the complexity interface element under storage preset test environment.
Optionally, the control to corresponding to the complexity interface element, which carries out test, includes:Call method of testing
Collection, operated by analog mouse, simulating keyboard operation, or analog mouse and keyboard operation simultaneously, to the complexity Interface Element
Control corresponding to element is tested.
In order to solve above-mentioned technical scheme, the embodiment of the present invention additionally provides a kind of software automated testing device, bag
Include:Comparing unit, for by the identification information of the interface element of the software compared with preset kind information;Identification is single
Member, for the comparative result according to the comparing unit, the type for identifying the interface element of the software is simple type Interface Element
Element or the test cell of complexity interface element first, for calling the mark of simple type interface element described in method of testing set pair to believe
The corresponding control of breath is tested;Computing unit, for calculating preset test environment relative to default standard test environment
Position deviation, obtain position of the complexity interface element on the test system interface;Second test cell, according to
Position of the complexity interface element on the test system interface, to the control corresponding to the complexity interface element
Tested.
Optionally, the identification information of the interface element of the software is to be obtained by the application programming interfaces of the software.
Optionally, the computing unit includes:First obtains subelement, for obtaining the browser under standard test environment
The coordinate position of information, resolution information and the complexity interface element;Second obtains subelement, for obtaining current survey
Browser information and resolution information under test ring border;Computation subunit, for clear under preset test environment by contrasting
Look at device information, resolution information and browser information, resolution information under the standard test environment, be calculated described
The deviation of the coordinate position of complexity interface element.
Optionally, the software automated testing device also includes:Memory cell, for storing under preset test environment
The coordinate position of browser information, resolution information and the complexity interface element.
Optionally, second test cell, for by calling method of testing collection, being operated, being simulated by analog mouse
Keyboard operation, or analog mouse and keyboard operation simultaneously, are tested the control corresponding to the complexity interface element.
Compared with prior art, the technical scheme of the embodiment of the present invention has advantages below:
By the type feature for the interface element for distinguishing tested software, to different types of interface element class test.
Specifically, for simple, general, immobilization control, tested by traditional method of testing;It is and complicated for level
Control, coordinate position of the control at interface is obtained by coordinate setting, so as to perform corresponding test operation.Pass through combination
The advantages of accurate quick obtaining simple controls of conventional automated test, and coordinate setting complex control is simplified it is excellent
Point, improve the efficiency and accuracy of automatic test.
Further, by storing the position of complexity interface element under different test environments, so if record survey
Test ring is tested in border, then need not recalculate skew, so as to improve the efficiency of test.
Brief description of the drawings
Fig. 1 is a kind of flow chart of automatic software test method in the embodiment of the present invention;
Fig. 2 is a kind of structural representation of software automated testing device in the embodiment of the present invention.
Embodiment
In existing software automated testing technology, most of automatic tests for GUI are all to understand GUI phases
Close on the basis of internal code realizes, the API that is matched by bottom, come the element object for identifying and obtaining interface, so as to right
Element on interface carries out related operation.This method can accurately obtain corresponding control according to the id information of element
Part, but if encountering the control that design is more personalized or hierarchical structure is complicated, in order to obtain this specific element, just need
Complex code is write, and these control structures once change, and original test code is also required to rewrite.Have
When even it is also possible that because code structure is complicated, even if the pictorial element can be obtained, also it can not accordingly be grasped
The situation of work.
It is the operation that above-mentioned acquisition element is usually performed according to interface image member also to have automated testing method at present, still
The browser test environment factor different with monitor resolution is not considered.The change of these factors will directly influence
The accuracy of automatic test result.In order to solve this problem, existing method is opened respectively for different test environments
The automated test tool bag that to send out a set of different.But easily produced when can so cause the redundancy of resource to waste, and use mixed
Disorderly.
The embodiment of the present invention is by distinguishing the type feature of the interface element of tested software, to different types of Interface Element
Plain class test.Specifically, for simple, general, immobilization control, tested by traditional method of testing;And
For the control that level is complicated, coordinate position of the control at interface is obtained by coordinate setting, so as to perform corresponding test
Operation.By combine conventional automated test accurate quick obtaining simple controls the advantages of, and coordinate setting by complexity control
The advantages of part is simplified, improve the efficiency and accuracy of automatic test.
It is understandable to enable the above objects, features and advantages of the present invention to become apparent, below in conjunction with the accompanying drawings to the present invention
Specific embodiment be described in detail.
The embodiments of the invention provide a kind of automatic software test method.Reference picture 1, below by way of specific steps to this
Inventive embodiments are described in detail.
Step S101, the type for identifying the interface element of the software are simple type interface element or complexity Interface Element
Element.
In specific implementation, the software automated testing can be entered by web test modes to the interface of the software
Row test.For example, Webdriver test platforms can be used, by browser, analog subscriber is clicked on, the behaviour such as information input
Make, complete to test the purpose of corresponding control function.
In specific implementation, the identification information of the interface element of the software can be connect by the application program of the software
Mouth obtains.The method that this step obtains interface element corresponding assembly with prior art by API is identical, i.e., according to interface element phase
The specific implementation of control is answered, from matching Basic API, the identification information of acquisition interface page element, such as id information.
, can be by by the boundary of the software after identification information of interface element of software is obtained in specific implementation
The type of the interface element of software is identified compared with preset kind information for the identification information of surface element.
In specific implementation, every class interface element of software can all be predefined a type, and these types and boundary
The corresponding relation of the identification information of surface element is stored in an element class libraries.During automatic test is carried out, pass through
Contrast the identifier of the interface element, it can be determined which kind of type it belongs to, and is category so as to determine the interface element automatically
In simple type element or complexity element, and then corresponding acquisition modes are taken to obtain element and operate on it.
The complexity element refers to the interface element that control design is more personalized, hierarchical structure is complex;And institute
Simple type element is stated then on the contrary, accusing simple, the general interface element of part.By identifying the type of interface element, can select
Corresponding method of testing carries out automatic test respectively.
Step S102, the control described in method of testing set pair corresponding to the identification information of simple type interface element is called to carry out
Test.
In specific implementation, when by the step S101, judge interface element for simple type interface element when, you can press
According to the method for testing of prior art, after the id information that interface element is obtained by Basic API, the Interface Element is further called
The control of element, and corresponding method of testing collection is selected, such as automated test tool bag, the control of interface element is performed accordingly
Test case.
Step S103, obtain position of the complexity interface element on the test system interface.
In specific implementation, when by the step S101, judge interface element for complexity interface element when, Ke Yitong
Cross and calculate position deviation of the preset test environment relative to default standard test environment, obtain complexity interface element exactly
Position on test system interface, so that in the case where not directly invoking the interface element control, to the Interface Element
Element is tested.
In specific implementation, the standard test environment information can include:Browser information, resolution information and institute
The coordinate position of complexity interface element is stated, have recorded a kind of position letter of the complexity pictorial element under test environment
Breath, for example, the version of browser is IE7, resolution ratio is 1280x960, and coordinate position is (266,115).
In specific implementation, the identification information of interface element and the standard test environment information can be collectively forming pin
To the configuration file of a complexity element position data., can be by above-mentioned complexity element position after testing tool is started
The configuration file of data is parsed and stored into a global Map set, can such as be expressed as Map<Key, value>.Its
In, key represents to implement identification information of the complexity element in whole project, and value represents the standard test environment information,
Above-mentioned browser version, monitor resolution and the co-ordinate position information to match can be included, so as to realize component identification
The correspondence of information and standard test environment information.As an alternative embodiment, the complexity element position data
Configuration file can be represented by extensible markup language (eXtensible Markup Language, XML).
When carrying out test initialization, the interface element for being determined as complexity element, if under preset test environment
Browser version, the browser version in the standard environment information in monitor resolution and the Map set, display point
Resolution is identical, then need not calculate position deviation of the preset test environment relative to default standard test environment, direct basis
Co-ordinate position information in standard test environment data message can obtain position of the complexity element in interface.
If browser version, monitor resolution under preset test environment and the standard environment in Map set
Browser version, monitor resolution in information is different, then is browsed according in preset test environment and standard test environment
The difference of device version and monitor resolution, calculate the deviation of the display location on different display interfaces, you can obtain interface
Element tests system so as to obtain the complexity interface element relative to the position deviation of default standard test environment described
The accurate coordinate position united on interface.
In above-mentioned specific implementation, in the case of preset test environment is different from standard test environment, calculating
To after accurate coordinate position of the complexity interface element on the test system interface, preset test environment can be believed
Breath storage is into the configuration file of global Map set and element position data.When restarting next time, if running into phase
With test environment, you can according to the coordinate information calculated, the direct coordinate position of acquisition complexity element, without
The deviation between preset test environment and standard test environment is calculated again, improves the efficiency of software automated testing.
Step S104, the control corresponding to the complexity interface element is tested.
After position of the complexity interface element on the test system interface being calculated by the step S103,
Can calls method of testing collection, is operated by analog mouse, simulating keyboard operation, or analog mouse and keyboard operation simultaneously,
Control corresponding to the complexity interface element is tested.For example, to button control or drop down list control etc., simulation
Carry out mouse click;To Input, simulation carries out input through keyboard.
Above-mentioned automatic software test method, will by selecting different types of interface element different test modes
The advantages of the advantages of accurate quick obtaining simple controls of conventional automated test simplifies complex control with coordinate setting phase
With reference to reducing automatic test difficulty, improve the efficiency of automatic test.
The embodiment of the invention also discloses a kind of software automated testing corresponding with above-mentioned automatic software test method
Device.As shown in Fig. 2 the software automated testing device 20 can include:
Comparing unit 201, for by the identification information of the interface element of the software compared with preset kind information;
Recognition unit 202, for the comparative result according to the comparing unit, identify the class of the interface element of the software
Type is simple type interface element or complexity interface element
First test cell 203, for calling the identification information institute of simple type interface element described in method of testing set pair right
The control answered is tested;
Computing unit 204, for calculating position deviation of the preset test environment relative to default standard test environment, obtain
Take position of the complexity interface element on the test system interface;
Second test cell 205, according to position of the complexity interface element on the test system interface, to institute
The control corresponding to complexity interface element is stated to be tested.
In specific implementation, the identification information of the interface element of the software can be connect by the application program of the software
Mouth obtains.
In specific implementation, the computing unit 204 can include:First obtains subelement, for obtaining standard testing
The coordinate position of browser information, resolution information and the complexity interface element under environment;Second obtains subelement,
For obtaining browser information and resolution information under preset test environment;Computation subunit, for current by contrasting
Browser information, resolution information under test environment and the browser information under the standard test environment, resolution ratio letter
Breath, the deviation of the coordinate position of the complexity interface element is calculated.
In specific implementation, the software automated testing device 20 can also include:Memory cell, it is current for storing
The coordinate position of browser information, resolution information and the complexity interface element under test environment.
In specific implementation, second test cell 205, for by calling method of testing collection, passing through analog mouse
Operation, simulating keyboard operation, or analog mouse and keyboard operation simultaneously, enter to the control corresponding to the complexity interface element
Row test.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is can
To instruct the hardware of correlation to complete by program, the program can be stored in computer-readable recording medium, and storage is situated between
Matter can include:ROM, RAM, disk or CD etc..
Although present disclosure is as above, the present invention is not limited to this.Any those skilled in the art, this is not being departed from
In the spirit and scope of invention, it can make various changes or modifications, therefore protection scope of the present invention should be with claim institute
The scope of restriction is defined.
Claims (10)
- A kind of 1. automatic software test method, it is characterised in that including:By the way that compared with preset kind information, the identification information of the interface element of the software is identified into the boundary of the software The type of surface element is simple type interface element or complexity interface element;The control described in method of testing set pair corresponding to the identification information of simple type interface element is called to be tested;The complexity interface element is calculated in the display location of preset test environment relative to default standard test environment The position deviation of display location, obtain position of the complexity interface element on test system interface;According to position of the complexity interface element on the test system interface, to the complexity interface element, institute is right The control answered is tested.
- 2. automatic software test method as claimed in claim 1, it is characterised in that the mark of the interface element of the software Information is to be obtained by the application programming interfaces of the software.
- 3. automatic software test method as claimed in claim 1, it is characterised in that described to calculate the complexity Interface Element Element includes in the display location of preset test environment relative to the position deviation of the display location of default standard test environment:The coordinate bit of browser information, resolution information and the complexity interface element under acquisition standard test environment Put;Obtain the browser information and resolution information under preset test environment;By contrasting browsing under the browser information under preset test environment, resolution information and the standard test environment Device information, resolution information, the deviation of the coordinate position of the complexity interface element is calculated.
- 4. automatic software test method as claimed in claim 3, it is characterised in that described to obtain the complexity Interface Element Element also includes behind the position on test system interface:The coordinate bit of browser information, resolution information and the complexity interface element under storage preset test environment Put.
- 5. automatic software test method as claimed in claim 1, it is characterised in that described to the complexity interface element Corresponding control, which carries out test, to be included:Method of testing collection is called, is operated by analog mouse, simulating keyboard operation, or analog mouse and keyboard operation simultaneously, it is right Control corresponding to the complexity interface element is tested.
- A kind of 6. software automated testing device, it is characterised in that including:Comparing unit, for by the identification information of the interface element of the software compared with preset kind information;Recognition unit, for the comparative result according to the comparing unit, the type for identifying the interface element of the software is letter Monotype interface element or complexity interface elementFirst test cell, for calling the control corresponding to the identification information of simple type interface element described in method of testing set pair Tested;Computing unit, for calculating the complexity interface element in the display location of preset test environment relative to default mark The position deviation of the display location of quasi- test environment, obtain position of the complexity interface element on test system interface;Second test cell, according to position of the complexity interface element on the test system interface, to the complexity Control corresponding to type interface element is tested.
- 7. software automated testing device as claimed in claim 6, it is characterised in that the mark of the interface element of the software Information is to be obtained by the application programming interfaces of the software.
- 8. software automated testing device as claimed in claim 6, it is characterised in that the computing unit includes:First obtains subelement, for obtaining the browser information under standard test environment, resolution information and the complexity The coordinate position of type interface element;Second obtains subelement, for obtaining browser information and resolution information under preset test environment;Computation subunit, for by contrasting the browser information under preset test environment, resolution information and the standard Browser information, resolution information under test environment, the deviation of the coordinate position of the complexity interface element is calculated Value.
- 9. software automated testing device as claimed in claim 8, it is characterised in that also include:Memory cell, for storing The coordinate position of browser information, resolution information and the complexity interface element under preset test environment.
- 10. software automated testing device as claimed in claim 6, it is characterised in that second test cell, for leading to Calling method of testing collection is crossed, is operated by analog mouse, simulating keyboard operation, or analog mouse and keyboard operation simultaneously, to institute The control corresponding to complexity interface element is stated to be tested.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410522269.6A CN104268083B (en) | 2014-09-30 | 2014-09-30 | Automatic software test method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410522269.6A CN104268083B (en) | 2014-09-30 | 2014-09-30 | Automatic software test method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104268083A CN104268083A (en) | 2015-01-07 |
CN104268083B true CN104268083B (en) | 2018-01-12 |
Family
ID=52159606
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410522269.6A Active CN104268083B (en) | 2014-09-30 | 2014-09-30 | Automatic software test method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104268083B (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106033387B (en) * | 2015-03-11 | 2018-09-11 | 广州市动景计算机科技有限公司 | The method and apparatus for testing flash intrinsic controls |
CN104778121B (en) * | 2015-03-25 | 2018-09-18 | 网易(杭州)网络有限公司 | The test method of games, apparatus and system |
CN104978270A (en) * | 2015-07-03 | 2015-10-14 | 上海触乐信息科技有限公司 | Automatic software testing method and apparatus |
CN107220170A (en) * | 2016-03-22 | 2017-09-29 | 阿里巴巴集团控股有限公司 | A kind of method of testing, device and electronic equipment |
CN105866574B (en) * | 2016-03-29 | 2018-07-17 | 东莞华贝电子科技有限公司 | Automatic test assists in identifying method and assists in identifying system |
CN110231959A (en) * | 2018-03-06 | 2019-09-13 | 优酷网络技术(北京)有限公司 | A kind of synchronous method of manipulation instruction, system and control centre |
CN108681508B (en) * | 2018-05-15 | 2022-04-01 | 福建天泉教育科技有限公司 | Testing method based on visual recognition and terminal |
CN109669873B (en) * | 2018-12-27 | 2022-06-21 | 拉扎斯网络科技(上海)有限公司 | User interface automatic test method and device, electronic equipment and storage medium |
CN112231033A (en) * | 2019-12-23 | 2021-01-15 | 北京来也网络科技有限公司 | Software interface element matching method and device combining RPA and AI |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101853204A (en) * | 2010-06-01 | 2010-10-06 | 华南理工大学 | Complex control testing system in windows environment |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8151276B2 (en) * | 2008-02-27 | 2012-04-03 | Accenture Global Services Gmbh | Test script transformation analyzer with change guide engine |
-
2014
- 2014-09-30 CN CN201410522269.6A patent/CN104268083B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101853204A (en) * | 2010-06-01 | 2010-10-06 | 华南理工大学 | Complex control testing system in windows environment |
Non-Patent Citations (1)
Title |
---|
复杂GUI应用自动化测试框架设计与实现;张艳雪;《万方学位论文》;20140225;第1页、第13页第3.1节-第27页第3.6节及第45页-第52页 * |
Also Published As
Publication number | Publication date |
---|---|
CN104268083A (en) | 2015-01-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104268083B (en) | Automatic software test method and device | |
US20230385183A1 (en) | User Interface Test Coverage | |
US9720811B2 (en) | Unified model for visual component testing | |
US7979849B2 (en) | Automatic model-based testing | |
CN103914375B (en) | A kind of test method and device for drawing interface software certainly | |
CN109739855B (en) | Method and system for realizing data sheet splicing and automatically training machine learning model | |
CN103377119B (en) | A kind of non-standard control automated testing method and device | |
US10936804B2 (en) | Spreadsheet cell calculation view providing multiple-representation editing | |
CN104375934B (en) | Method for testing reliability of Android mobile phone software | |
US20200327043A1 (en) | System and a method for automated script generation for application testing | |
CN104915297B (en) | A kind of automated testing method of the APP power consumption of android equipment | |
EP3227785B1 (en) | Playback and automatic execution of a process to control a computer system | |
TWI476587B (en) | Testing method and testing apparatus for testing function of electronic apparatus | |
CN111651368B (en) | User graphical interface testing method and computer readable storage medium | |
CN109101410A (en) | A kind of risk driven test method and device and computer readable storage medium | |
CN109725958A (en) | The method and device that the file of resource manager management is handled | |
CN113760282A (en) | Configuration method, device, equipment, medium and program product of form interface | |
CN105354138A (en) | Method for determining specific control attribute of mobile phone page | |
US20160162398A1 (en) | Automated test generation and execution for testing a process to control a computer system | |
CN105653273A (en) | Personalized customizing method for client function under B/S architecture | |
US11106571B2 (en) | Identification of input object in a graphical user interface | |
CN111125564A (en) | Thermodynamic diagram generation method and device, computer equipment and storage medium | |
JP2019106107A (en) | Program, information processing apparatus, and screen test system | |
US20160162168A1 (en) | Interaction sensing and recording of a process to control a computer system | |
CN109359042A (en) | A kind of automated testing method based on path search algorithm |
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 | ||
CP01 | Change in the name or title of a patent holder |
Address after: 201807 2258 Chengbei Road, Jiading District, Shanghai Patentee after: Shanghai Lianying Medical Technology Co., Ltd Address before: 201807 2258 Chengbei Road, Jiading District, Shanghai Patentee before: SHANGHAI UNITED IMAGING HEALTHCARE Co.,Ltd. |
|
CP01 | Change in the name or title of a patent holder |