CN112069063B - Method for obtaining label ID of designated component by dojo framework and automatic testing method - Google Patents
Method for obtaining label ID of designated component by dojo framework and automatic testing method Download PDFInfo
- Publication number
- CN112069063B CN112069063B CN202010876958.2A CN202010876958A CN112069063B CN 112069063 B CN112069063 B CN 112069063B CN 202010876958 A CN202010876958 A CN 202010876958A CN 112069063 B CN112069063 B CN 112069063B
- Authority
- CN
- China
- Prior art keywords
- component
- tag
- content
- label
- sub
- 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
- 238000000034 method Methods 0.000 title claims abstract description 37
- 238000012360 testing method Methods 0.000 title claims abstract description 26
- 241001275944 Misgurnus anguillicaudatus Species 0.000 title claims abstract description 24
- 238000001914 filtration Methods 0.000 claims description 8
- 238000013507 mapping Methods 0.000 claims description 3
- BUGBHKTXTAQXES-UHFFFAOYSA-N Selenium Chemical compound [Se] BUGBHKTXTAQXES-UHFFFAOYSA-N 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 229910052711 selenium Inorganic materials 0.000 description 1
- 239000011669 selenium Substances 0.000 description 1
- 238000010998 test method Methods 0.000 description 1
Images
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/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
- G06F9/44526—Plug-ins; Add-ons
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Document Processing Apparatus (AREA)
Abstract
The invention discloses a method for acquiring a label ID of a designated component by a dojo frame and an automatic testing method, wherein the method for acquiring the label ID of the designated component comprises the following steps: step one, parsing html content into a DOM tree; step two, extracting related components according to different types; step three, analyzing and extracting relevant components according to the html content after the operation of the step one and the step two; step four, comparing the component contents obtained in the step two and the step three; and step five, acquiring the label ID of the specific component according to the text content of the component, the xth sub-component under the specific component and the sub-component under the specific component, wherein the text content of the sub-component is the specific content. The method is a method for flexibly acquiring the tag ID of the dojo frame assembly, and repeated operation caused by improper operation is avoided.
Description
Technical Field
The invention relates to the technical field of automatic testing, in particular to a method for a dojo framework to acquire a label ID of a designated component and an automatic testing method.
Background
The web interface is developed using a dojo framework, and the tag ID is automatically generated by the framework, not exclusively, which is one of the advantages of the framework. However, in the same interface, if the sequence of clicking the components is different, the tag IDs of the subsequently generated same components are different, which brings great invariance to the automated testing.
Disclosure of Invention
The invention aims to solve the problems, provides a method for acquiring the label ID of the appointed component by the dojo frame and an automatic test method, and solves the test problem caused by the non-unique label ID of the dojo frame.
In order to achieve the purpose, the invention adopts the following technical scheme:
a method for obtaining a tag ID of a specified component by a dojo framework comprises the following steps:
step one, parsing html content into a DOM tree;
step two, extracting related components according to different types;
step three, analyzing and extracting relevant components according to the html content after the operation of the step one and the step two;
step four, comparing the component contents obtained in the step two and the step three;
and step five, acquiring the label ID of the specific component according to the text content of the component, the xth sub-component under the specific component and the sub-component under the specific component, wherein the text content of the sub-component is the specific content.
In the second step, the different types comprise Button, Radio, Text, Lable, Table, Grid and View.
And in the second step, extracting related components comprises extracting corresponding label ID and text content, keeping a hierarchical relationship, extracting a label class attribute corresponding to a filtering condition and filtering.
In the fourth step, the component contents are compared, and the newly added component list and the invisible component list are respectively identified.
The identified new and invisible component list contains the tag ID, the tag category, the tag text content and the parent node to which the tag belongs.
The method for acquiring the tag ID of the component according to the text content of the component comprises the following steps: and returning a corresponding component list according to the searched text content, wherein the list element only contains the component tag ID, and if no tag ID exists, returning to be null.
The method for acquiring the tag ID of the component by the xth sub-component under the specific component comprises the following steps: and the xth sub-component under the specific component is positioned to the component according to the parent node, the label ID of the specified sub-component is returned, and if the label is null, the label is returned to be null.
The method for acquiring the tag ID of the component by using the xth sub-component under the specific component and the text content of the sub-component as the tag ID of the specific content acquisition component comprises the following steps: and positioning the assembly according to the father node, extracting the sub-assembly, filtering the text content of the sub-assembly into the assembly with the specified content, returning the corresponding label ID, and if the label is null, returning to null.
The automatic testing method of the dojo frame, which adopts the method of obtaining the label ID of the appointed component by the dojo frame, comprises the following steps:
starting a test environment, and logging in a test website;
step two, obtaining html content, analyzing the component content by adopting the method of claim 1, and obtaining the label ID of the specific component;
step three, operating the assembly obtained in the step two;
step four, waiting for the new component to be loaded, acquiring html content, analyzing the component content by adopting the method of claim 1, and acquiring the label ID of the specific component;
step five, comparing and analyzing the component contents obtained in the step two and the step four, extracting a component change list, a mapping relation between the component text contents and the label ID, and a component tree;
and step six, judging whether the test is finished or not, finishing the test if the test is finished, and otherwise returning to the step two.
The invention has the beneficial effects that:
the invention designs a method for flexibly acquiring the Dojo frame assembly label ID, and avoids repeated operation caused by improper operation.
Drawings
FIG. 1 is a flow chart of the testing method of the present invention.
Detailed Description
The invention is further described with reference to the following figures and examples.
A method for obtaining a tag ID of a specified component by a dojo framework comprises the following steps:
step one, parsing html content into a DOM tree;
extracting corresponding label id and Text content according to different types of Button/Radio/Text/label/Table/Grid/View, maintaining a hierarchical relationship, and extracting and filtering conditions to filter corresponding label class attributes;
step three, analyzing and extracting relevant components according to the html content after the operation of the step one-step two pairs;
comparing the contents of the two components, and respectively identifying a newly added and invisible component list, wherein the list comprises a label id, a label category, a label text content and a father node to which the label belongs;
step five, acquiring the component tag ID by three methods:
A) returning a corresponding component list according to the searched text content, wherein the list element only contains a component tag ID, and if no tag ID exists, returning to be null;
B) locating the x-th certain sub-component under the specific component to the component according to the father node, returning the label ID of the specified sub-component, and if the label is null, returning to null;
C) and locating the subassembly according to the father node, extracting the subassembly, filtering the text content of the subassembly into the subassembly with the specified content, returning the corresponding label ID, and if the label is null, returning to null.
A method for automatically testing a dojo frame, as shown in fig. 1, a method for acquiring a tag ID of a specified component by using the dojo frame is adopted, there are multiple Web automated test tool frames, and in this embodiment, a selenium test frame is taken as an example to describe the method:
starting a test environment, and logging in a website (the website is developed by a dojo framework);
step two, obtaining html content, and analyzing the ID of the dojo component and the component text content;
step three, obtaining the tag ID of the specific component by using different methods: the method comprises three methods, namely, according to the text content of the component, the xth certain sub-component under the specific component, and the text content of the sub-component under the specific component, wherein the text content of the sub-component is specific content;
step four, operating the assembly obtained in the step three;
fifthly, acquiring html content after the new component is loaded, and analyzing the dojo component;
step six, analyzing and comparing the component contents obtained in the step two, extracting a component change list, a mapping relation between the component text contents and the label ID, and a component tree;
step seven, acquiring the tag ID of the specific component by using different methods: according to the text content of the component, the xth certain sub-component under the specific component, the text content of the sub-component under the specific component is the specific content, and the like;
step eight, operating the assembly obtained in the step seven;
step nine, judging whether the test is finished: if not, continuing to execute the third step to the eighth step; if the test is complete, it ends.
Although the embodiments of the present invention have been described with reference to the accompanying drawings, it is not intended to limit the scope of the present invention, and it should be understood by those skilled in the art that various modifications and variations can be made without inventive efforts by those skilled in the art based on the technical solution of the present invention.
Claims (6)
1. A method for obtaining a tag ID of a designated component by a dojo framework is characterized by comprising the following steps:
step one, parsing html content into a DOM tree;
step two, extracting related components according to different types;
step three, analyzing and extracting relevant components according to the html content after the operation of the step one and the step two;
step four, comparing the component contents obtained in the step two and the step three;
step five, acquiring the label ID of the specific assembly according to the text content of the assembly, the xth sub-assembly under the specific assembly and the sub-assembly under the specific assembly, wherein the text content of the sub-assembly is the specific content;
the method for acquiring the tag ID of the component according to the text content of the component comprises the following steps: returning a corresponding component list according to the searched text content, wherein the list element only contains a component tag ID, and if no tag ID exists, returning to be null;
the method for acquiring the tag ID of the component by the xth sub-component under the specific component comprises the following steps: the xth sub-component under the specific component is positioned to the component according to the father node, the label ID of the specified sub-component is returned, and if the label is null, the return is null;
the method for acquiring the tag ID of the component by using the xth sub-component under the specific component and the text content of the sub-component as the tag ID of the specific content acquisition component comprises the following steps: and positioning the assembly according to the father node, extracting the sub-assembly, filtering the text content of the sub-assembly into the assembly with the specified content, returning the corresponding label ID, and if the label is null, returning to null.
2. The method as claimed in claim 1, wherein in the second step, the different types include Button, Radio, Text, Lable, Table, Grid and View.
3. The method for obtaining the tag ID of the designated component by the dojo framework as claimed in claim 1, wherein in the second step, extracting the related component comprises extracting the corresponding tag ID and text content, maintaining the hierarchical relationship, extracting the tag class attribute corresponding to the filtering condition, and filtering.
4. The method as claimed in claim 1, wherein the dojo framework obtains the tag ID of the specified component, and wherein in the fourth step, the component contents are compared to identify the new and invisible component lists respectively.
5. The method as claimed in claim 4, wherein the dojo framework obtains the tag ID of the designated component, wherein the identified new and invisible component list comprises the tag ID, the tag type, the tag text content and the parent node to which the tag belongs.
6. A method for automated testing of a dojo frame using the method for obtaining tag IDs of designated components of a dojo frame as claimed in any one of claims 1 to 5, comprising:
step one, starting a test environment and logging in a test website;
step two, obtaining html content, analyzing the component content by adopting the method of claim 1, and obtaining the label ID of the specific component;
step three, operating the assembly obtained in the step two;
step four, waiting for the new component to be loaded, acquiring html content, analyzing the component content by adopting the method of claim 1, and acquiring the label ID of the specific component;
step five, comparing and analyzing the component contents obtained in the step two and the step four, extracting a component change list, a mapping relation between the component text contents and the label ID, and a component tree;
and step six, judging whether the test is finished or not, finishing the test if the test is finished, and otherwise, returning to the step two.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010876958.2A CN112069063B (en) | 2020-08-27 | 2020-08-27 | Method for obtaining label ID of designated component by dojo framework and automatic testing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010876958.2A CN112069063B (en) | 2020-08-27 | 2020-08-27 | Method for obtaining label ID of designated component by dojo framework and automatic testing method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112069063A CN112069063A (en) | 2020-12-11 |
CN112069063B true CN112069063B (en) | 2022-08-12 |
Family
ID=73660356
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010876958.2A Active CN112069063B (en) | 2020-08-27 | 2020-08-27 | Method for obtaining label ID of designated component by dojo framework and automatic testing method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112069063B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103049536A (en) * | 2012-11-01 | 2013-04-17 | 广州汇讯营销咨询有限公司 | Webpage main text content extracting method and webpage text content extracting system |
CN103226599A (en) * | 2013-04-23 | 2013-07-31 | 翁杰 | Method and system for accurately extracting webpage content |
-
2020
- 2020-08-27 CN CN202010876958.2A patent/CN112069063B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103049536A (en) * | 2012-11-01 | 2013-04-17 | 广州汇讯营销咨询有限公司 | Webpage main text content extracting method and webpage text content extracting system |
CN103226599A (en) * | 2013-04-23 | 2013-07-31 | 翁杰 | Method and system for accurately extracting webpage content |
Also Published As
Publication number | Publication date |
---|---|
CN112069063A (en) | 2020-12-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102135938B (en) | Software product testing method and system | |
CN1955963B (en) | System and method for searching dates in electronic documents | |
CN102890681B (en) | A kind of method and system of generating web page stay in place form | |
CN101908071A (en) | Method and device thereof for improving search efficiency of search engine | |
US8572233B2 (en) | Method and system for site path evaluation using web session clustering | |
CN107423391B (en) | Information extraction method of webpage structured data | |
CN102760151B (en) | Implementation method of open source software acquisition and searching system | |
EP1482424A2 (en) | System and method of query transformation | |
US20170262539A1 (en) | Method of retrieving attributes from at least two data sources | |
US8131757B2 (en) | Taxonomy based indexing and searching | |
CN103051637A (en) | User identification method and device | |
Azir et al. | Wrapper approaches for web data extraction: A review | |
CN103793461B (en) | The analysis method and device of info web | |
US20070130328A1 (en) | Progress tracking method for uptime improvement | |
CN112307191A (en) | Multi-system interactive log query method, device, equipment and storage medium | |
CN112069063B (en) | Method for obtaining label ID of designated component by dojo framework and automatic testing method | |
CN111813443A (en) | Method and tool for automatically filling code sample by JavaFX | |
US6895412B1 (en) | Methods for dynamically configuring the cardinality of keyword attributes | |
US20110144786A1 (en) | Material management system and method for retooling and producing a manufacturing line | |
US20030236772A1 (en) | Network distributed product manager system | |
KR19990070968A (en) | How to Search and Database Your Internet Resources | |
CN116303402A (en) | Data cleaning method based on data warehouse | |
CN101576933A (en) | Fully-automatic grouping method of WEB pages based on title separator | |
CN109948034B (en) | Method and device for extracting page information based on filtering session | |
US20060212287A1 (en) | Method for data processing with a view to extracting the main attributes of a product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |