CN106354649A - Layered script design method for automated testing of webpages - Google Patents
Layered script design method for automated testing of webpages Download PDFInfo
- Publication number
- CN106354649A CN106354649A CN201610827816.0A CN201610827816A CN106354649A CN 106354649 A CN106354649 A CN 106354649A CN 201610827816 A CN201610827816 A CN 201610827816A CN 106354649 A CN106354649 A CN 106354649A
- Authority
- CN
- China
- Prior art keywords
- layer
- web page
- page element
- script
- webpage
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
Abstract
The invention discloses a layered script design method for automated testing of webpages. The method specifically comprises steps as follows: step 1, a script is written in a layered manner during design to have a webpage element index layer, a webpage element positioning packaging layer, an element basis operation packaging layer and a test step writing layer; step 2, modular processing is performed on each layer; step 3, the script is executed and tested. Compared with a conventional un-layered script design method for automated testing of webpages, the layered script design method has the advantages that the coupling degree of script design is reduced through layered writing of the script and modular processing and packaging, and the maintenance cost of the automated testing script is reduced.
Description
Technical field
The present invention relates to webpage measuring technology association area, specifically a kind of layer-stepping webpage automatic test script
Method for designing.
Background technology
In existing webpage automatic test, the method for designing of script is mainly linear structure, that is, press practical operation and walk
Suddenly script is designed writing.As needed then to be positioned in the place of required use during location element, same element is multiple
Also result in during use and positioning is repeated several times.
The maximum problem of this method is huge workload during later maintenance script, and the version with webpage development alternates, very
The positioning of multiple web pages element and web page operation step can produce change with webpage version, therefore the element in automatic test script
Positioning and operating procedure also must be followed webpage actual change and be adjusted.The localization and expression formula of same element is different, may
Lead to many places modification in test script, even result in the omission of part change, make the maintenance of test script become to take time and effort.
Content of the invention
The technical assignment of the present invention is to provide a kind of layer-stepping webpage automatic test script method for designing.
The technical assignment of the present invention is realized in the following manner, a kind of layer-stepping webpage automatic test script design side
Method, method is as follows: the first step, carries out layer-stepping and write when script is designed, and is written as web page element index level, webpage unit
Plain positioning package layer, elemental basis operation encapsulated layer, testing procedure write layer;Second step, each layer is carried out modularized processing;
3rd step, perform script is simultaneously tested.
Preferably, wherein: described web page element index level, the localization and expression formula of web page element is separately stored as one
Web page element index database;
Page elements are positioned according to Web page classifying and are encapsulated by described web page element positioning package layer;
Described elemental basis operation encapsulated layer, realizes the basic operation of web page element, such as click keys, input text etc..
Described testing procedure writes layer, and the basic operation to web page element carries out assembling combination and completes testing procedure.
Preferably, described web page element index level, html for main flow webpage test in, using id positioning, css fixed
Position or xpath positioning mode, by above localization and expression formula being stored with text mode and being appointed as positioning storehouse to be used, from
And complete writing of web page element index level;Storage mode is, element term-localization and expression formula type-concrete localization and expression formula,
Only need to when calling specify element term to obtain concrete localization method;If the position of web page element and localization method change, only
This index database need to be changed without modification upper procedure interface.
Preferably, described web page element positioning package layer, positions to element by using positioning command, required fixed
Position expression formula obtains from web page element index level;This layer is positioned to web page element and is encapsulated, by the institute in the same page
Element is had to be categorized in same program genus, such by initializing, directly obtained by the public variable method calling class
Take all elements in this page, change of element etc. in webpage can be adjusted by changing alignment layers.
Preferably, described elemental basis operation encapsulated layer, basic web page operation is write, during using web page element
Call the public variable of father net page element alignment layers, this layer focuses primarily upon writes fundamental operation action group, in webpage
Operation carries out modular classification arrangement, each little module is write with web page operation step and is encapsulated in script, only work as net
When page operations flow process changes, this layer of script just need to accordingly be changed.
Preferably, described testing procedure writes layer, by calling the webpage basic operation of last layer, completes operation module
Between combination, and then complete the test of whole webpage, this layer few change with web-page change it is ensured that global procedures framework steady
Fixed.
Compared to the prior art a kind of layer-stepping webpage automatic test script method for designing of the present invention, is carried out to script
During design, web page element is indexed, web page element positioning, web page element operate, test action step carries out layer-stepping and writes, will
Each layer carries out modularized processing, thus reaching web page element positioning, web page element operates detached purpose, and then reduces program
The degree of coupling of design, reduces complexity when safeguarding modification script, is not layered the design of webpage automatic test script for tradition
Method, is write script and is carried out modularized processing and encapsulation by layering, reduces the degree of coupling of script formulation, thus reducing automatically
Change the maintenance cost of test script.
Brief description
Fig. 1 is automatic test script hierarchical design schematic diagram.
Specific embodiment
It is not layered webpage automatic test script method for designing for tradition, write script and carry out modularity by layering
Process and encapsulate, reduce the degree of coupling of script formulation.The innovation of this method is the middle-level definition of script formulation and makes
With.If just using multilayered structure at the beginning of script formulation, the operation to each layer of webpage carries out modularized encapsulation, in reality
Corresponding module and level only need to be changed, thus realizing reducing the purpose of maintenance cost during webpage change.
It is not layered webpage automatic test script method for designing for tradition, write script and carry out modularity by layering
Process and encapsulate, reduce the degree of coupling of script formulation.
Embodiment 1:
1st, write web page element index database: obtain the localization and expression formula of element needed for web page operation, it may include id positioning, css are fixed
Position or xpath positioning.All localization and expression formulas are left in unified text document facilitates superstructure to call.Text lattice
Formula can use the mode of " element term-localization and expression formula type-concrete localization and expression formula ", indicate using what positioning mode with
And the particular content of localization and expression formula.
2nd, write web page element positioning package layer: on the basis of having write web page element index database, right by page difference
Element is classified, and with testing tool actually used positioning command, element is positioned, and each Page-saving is one
Individual single program file, positions the element used in all pages and facilitates upper strata to call as public variable in file.
3rd, write elemental basis motion action layer: after completing web page element positioning package layer, by commonly use to web page element
Operating unit carries out writing encapsulation.Each action is encapsulated as a single program file, and action is with the minimum journey of conventional operation
Degree is divided, and such as click keys, empties and inputs the web page operations such as text.Write the action completing to supply as public method
Upper strata is called.
4th, write testing procedure layer: this layer carries out assembling combination to the unit operation of basic motion action layer and complete whole
Each test is used.Each use-case can call multiple basis actions and can add logical judgment.
5th, perform script being tested: by test case perform script, each use-case is corresponding to use a test step
Suddenly write the program file of layer.
By specific embodiment above, described those skilled in the art can readily realize the present invention.But should
Work as understanding, the present invention is not limited to above-mentioned several specific embodiments.On the basis of disclosed embodiment, described technology
The technical staff in field can the different technical characteristic of combination in any, thus realizing different technical schemes.
Claims (6)
1. a kind of layer-stepping webpage automatic test script method for designing is it is characterised in that method is as follows:
The first step, carries out layer-stepping and writes when script is designed, be written as web page element index level, web page element positioning envelope
Dress layer, elemental basis operation encapsulated layer, testing procedure write layer;
Second step, each layer is carried out modularized processing;
3rd step, perform script is simultaneously tested.
2. a kind of layer-stepping webpage automatic test script method for designing according to claim 1 it is characterised in that its
In: described web page element index level, the localization and expression formula of web page element is separately stored as a web page element index database;
Page elements are positioned according to Web page classifying and are encapsulated by described web page element positioning package layer;
Described elemental basis operation encapsulated layer, realizes the basic operation of web page element;
Described testing procedure writes layer, and the basic operation to web page element carries out assembling combination and completes testing procedure.
3. a kind of layer-stepping webpage automatic test script method for designing according to claim 2 is it is characterised in that described
Web page element index level, html for main flow webpage test in, using id positioning, css positioning or xpath positioning mode,
By storing above localization and expression formula with text mode and being appointed as positioning storehouse to be used, thus completing web page element index
Layer write;During storage, mode is, element term-localization and expression formula type-concrete localization and expression, only needs to specify unit when calling
The concrete localization method of plain name acquiring.
4. a kind of layer-stepping webpage automatic test script method for designing according to claim 2 is it is characterised in that described
Web page element positioning package layer, by using positioning command, element is positioned, required location expression formula is from web page element
Index level obtains;This layer is positioned to web page element and is encapsulated, and all elements in the same page is categorized in same
In program genus, such by initializing, by calling all elements in public variable method this page of direct access of class.
5. a kind of layer-stepping webpage automatic test script method for designing according to claim 2 is it is characterised in that described
Elemental basis operation encapsulated layer, basic web page operation is write, during using web page element, calls father net page element fixed
The public variable of position layer, this layer focuses primarily upon writes fundamental operation action group, carries out modular classification to the operation in webpage
Arrange, web page operation step is write to each little module and is encapsulated in script.
6. a kind of layer-stepping webpage automatic test script method for designing according to claim 2 is it is characterised in that described
Testing procedure write layer, by calling the webpage basic operation of last layer, complete the combination between operation module, and then complete whole
Individual webpage test.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610827816.0A CN106354649A (en) | 2016-09-18 | 2016-09-18 | Layered script design method for automated testing of webpages |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610827816.0A CN106354649A (en) | 2016-09-18 | 2016-09-18 | Layered script design method for automated testing of webpages |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106354649A true CN106354649A (en) | 2017-01-25 |
Family
ID=57858635
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610827816.0A Pending CN106354649A (en) | 2016-09-18 | 2016-09-18 | Layered script design method for automated testing of webpages |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106354649A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107153614A (en) * | 2017-05-12 | 2017-09-12 | 郑州云海信息技术有限公司 | A kind of automatic test page navigation method for organizing |
CN107733741A (en) * | 2017-10-30 | 2018-02-23 | 中国电力科学研究院有限公司 | Software architectural method and platform for testing protocol consistency |
CN107957948A (en) * | 2017-12-07 | 2018-04-24 | 郑州云海信息技术有限公司 | A kind of user interface automatic test device and method |
CN108733571A (en) * | 2018-05-28 | 2018-11-02 | 北京五八信息技术有限公司 | A kind of test method, device, equipment and computer readable storage medium |
CN108897684A (en) * | 2018-06-28 | 2018-11-27 | 郑州云海信息技术有限公司 | A kind of feed-back type webpage automatic test script design method based on TestNG |
CN113505060A (en) * | 2021-06-25 | 2021-10-15 | 北京控制工程研究所 | Python automatic test script compiling method for spacecraft attitude and orbit control software |
CN117591438A (en) * | 2024-01-19 | 2024-02-23 | 易方信息科技股份有限公司 | Automatic testing method and related device for UI component atomization |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101996131A (en) * | 2009-08-19 | 2011-03-30 | 航天信息股份有限公司 | Automatic test method and automatic test platform for graphic user interface (GUI) based on x extensive makeup language (XML) packaging key word |
US20120124495A1 (en) * | 2009-11-23 | 2012-05-17 | Nitsan Amichai | System and method for object relationship identification in a user interface |
-
2016
- 2016-09-18 CN CN201610827816.0A patent/CN106354649A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101996131A (en) * | 2009-08-19 | 2011-03-30 | 航天信息股份有限公司 | Automatic test method and automatic test platform for graphic user interface (GUI) based on x extensive makeup language (XML) packaging key word |
US20120124495A1 (en) * | 2009-11-23 | 2012-05-17 | Nitsan Amichai | System and method for object relationship identification in a user interface |
CN102667696A (en) * | 2009-11-23 | 2012-09-12 | 惠普发展公司,有限责任合伙企业 | System and method for object relationship identification in a user interface |
Non-Patent Citations (2)
Title |
---|
张添: "基于Selenium的Web自动化测试", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
秦海光: "基于Selenium自动化测试框架的改进与应用", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107153614A (en) * | 2017-05-12 | 2017-09-12 | 郑州云海信息技术有限公司 | A kind of automatic test page navigation method for organizing |
CN107733741A (en) * | 2017-10-30 | 2018-02-23 | 中国电力科学研究院有限公司 | Software architectural method and platform for testing protocol consistency |
CN107957948A (en) * | 2017-12-07 | 2018-04-24 | 郑州云海信息技术有限公司 | A kind of user interface automatic test device and method |
CN108733571A (en) * | 2018-05-28 | 2018-11-02 | 北京五八信息技术有限公司 | A kind of test method, device, equipment and computer readable storage medium |
CN108733571B (en) * | 2018-05-28 | 2022-05-31 | 北京五八信息技术有限公司 | Test method, device, equipment and computer readable storage medium |
CN108897684A (en) * | 2018-06-28 | 2018-11-27 | 郑州云海信息技术有限公司 | A kind of feed-back type webpage automatic test script design method based on TestNG |
CN113505060A (en) * | 2021-06-25 | 2021-10-15 | 北京控制工程研究所 | Python automatic test script compiling method for spacecraft attitude and orbit control software |
CN113505060B (en) * | 2021-06-25 | 2023-11-10 | 北京控制工程研究所 | Python automatic test script writing method for spacecraft attitude and orbit control software |
CN117591438A (en) * | 2024-01-19 | 2024-02-23 | 易方信息科技股份有限公司 | Automatic testing method and related device for UI component atomization |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106354649A (en) | Layered script design method for automated testing of webpages | |
AU2017202599B2 (en) | System architecture with visual modeling tool for designing and deploying complex models to distributed computing clusters | |
CN103441900B (en) | Centralized cross-platform automatization test system and control method thereof | |
CN107220064B (en) | A kind of digital control system interface configuration development approach | |
CN103019928B (en) | A kind of automated testing method and system | |
CN103345387B (en) | The method realizing component reusing technology based on component package | |
CN101661460B (en) | Method and device for generating management system report | |
CN103383645B (en) | Code generating method and system | |
CN100356738C (en) | Automatization testing frame system and method | |
CN103500087A (en) | Code generation method and device based on maven plug-in and freemarker template | |
CN105022615A (en) | Interface generating method and system | |
McGinnis et al. | Ontologies and simulation: a practical approach | |
CN107729230A (en) | A kind of WEB automatic test devices and method of testing based under control scheme | |
CN106648587A (en) | Annotation-based Web application code generation method | |
CN107368346A (en) | A kind of code generating method and device based on metadata and script engine | |
CN110334169B (en) | Novel geographical calculation device | |
CN104615431A (en) | Method and device for achieving Web application | |
CN102722616A (en) | Method for drawing exploration point plan based on Excel | |
CN106991243A (en) | A kind of quick inspection silk-screen layer method overlapping with solder mask | |
CN101561671B (en) | Method for deigning ladder diagram based on components | |
CN104978411A (en) | Train model development method and apparatus for high-speed train | |
CN106326604B (en) | A kind of finite element analysis method of servicing based on cloud manufacturing platform | |
CN104484163A (en) | Heterogeneous model transformation method based on unified modeling environment | |
CN104063231B (en) | Test resource rapid access method based on HIT-TENA | |
CN102142114A (en) | Reliable data modeling method for complex products |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20170125 |