CN112069063A - 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 PDF

Info

Publication number
CN112069063A
CN112069063A CN202010876958.2A CN202010876958A CN112069063A CN 112069063 A CN112069063 A CN 112069063A CN 202010876958 A CN202010876958 A CN 202010876958A CN 112069063 A CN112069063 A CN 112069063A
Authority
CN
China
Prior art keywords
component
tag
label
content
dojo
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.)
Granted
Application number
CN202010876958.2A
Other languages
Chinese (zh)
Other versions
CN112069063B (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202010876958.2A priority Critical patent/CN112069063B/en
Publication of CN112069063A publication Critical patent/CN112069063A/en
Application granted granted Critical
Publication of CN112069063B publication Critical patent/CN112069063B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-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

Method for obtaining label ID of designated component by dojo framework and automatic testing method
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, returns the label ID of the specified sub-component, and returns null if the label 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.
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 sub-component under the specific component to the component according to the parent 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 (9)

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;
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.
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. The method of claim 1, wherein the method for obtaining the tag ID of the specified component according to the text content of the component comprises: 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.
7. The method of claim 1, wherein the method for acquiring the tag ID of the specified component by the dojo framework comprises the following steps: and the xth sub-component under the specific component is positioned to the component according to the parent node, returns the label ID of the specified sub-component, and returns null if the label is null.
8. The method as claimed in claim 1, wherein the method for acquiring the tag ID of the specified component by the dojo framework 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.
9. 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:
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.
CN202010876958.2A 2020-08-27 2020-08-27 Method for obtaining label ID of designated component by dojo framework and automatic testing method Active CN112069063B (en)

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 true CN112069063A (en) 2020-12-11
CN112069063B 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)

* Cited by examiner, † Cited by third party
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

Patent Citations (2)

* Cited by examiner, † Cited by third party
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
CN112069063B (en) 2022-08-12

Similar Documents

Publication Publication Date Title
CN101908071B (en) Method and device thereof for improving search efficiency of search engine
CN102135938B (en) Software product testing method and system
CN1955963B (en) System and method for searching dates in electronic documents
US8572233B2 (en) Method and system for site path evaluation using web session clustering
CN107423391B (en) Information extraction method of webpage structured data
US10127313B2 (en) Method of retrieving attributes from at least two data sources
CN102760151B (en) Implementation method of open source software acquisition and searching system
US20120102015A1 (en) Method and System for Performing a Comparison
Azir et al. Wrapper approaches for web data extraction: A review
CN106126648A (en) A kind of based on the distributed merchandise news reptile method redo log
CN106599153A (en) Multi-data-source-based waste industry search system and method
CN110019384A (en) A kind of acquisition methods of blood relationship data provide the method and device of blood relationship data
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
CN116303402A (en) Data cleaning method based on data warehouse
KR20000049333A (en) Engine for comparatively searching product of internet shopping mole with intelligence type
EP3422177A1 (en) Systems and methods for code parsing and lineage detection
US7283989B1 (en) System and method for use of application metadata
CN109725982B (en) Data object construction method and device
CN104424215A (en) Data search method and search server
CN112749186B (en) Data processing method, device, electronic equipment and computer readable storage medium
CN105224539B (en) Page file processing method and device
Van Wettere Affiliation information in datacite dataset metadata: a flemish case study

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