CN104516813B - The choosing method and device of the test node of Webpage - Google Patents

The choosing method and device of the test node of Webpage Download PDF

Info

Publication number
CN104516813B
CN104516813B CN201310452563.XA CN201310452563A CN104516813B CN 104516813 B CN104516813 B CN 104516813B CN 201310452563 A CN201310452563 A CN 201310452563A CN 104516813 B CN104516813 B CN 104516813B
Authority
CN
China
Prior art keywords
node
datum
similar
path
child
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201310452563.XA
Other languages
Chinese (zh)
Other versions
CN104516813A (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.)
Tencent Technology Beijing Co Ltd
Original Assignee
Tencent Technology Beijing 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 Tencent Technology Beijing Co Ltd filed Critical Tencent Technology Beijing Co Ltd
Priority to CN201310452563.XA priority Critical patent/CN104516813B/en
Priority to PCT/CN2014/085252 priority patent/WO2015043352A1/en
Publication of CN104516813A publication Critical patent/CN104516813A/en
Application granted granted Critical
Publication of CN104516813B publication Critical patent/CN104516813B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

Abstract

This application discloses a kind of choosing methods and device of the test node of Webpage, including:Datum node module obtains the datum node of Webpage;Path module obtains path of the datum node in Webpage;Searching module is in the Webpage, since the datum node, according to the level in the path of the datum node, searches the similar node of the datum node step by step;Module is submitted to submit found datum node and its similar node.Using the present invention, the efficiency and accuracy rate for choosing test node can be improved, reduces maintenance cost.

Description

The choosing method and device of the test node of Webpage
Technical field
This application involves computer and internet data processing technology field more particularly to a kind of test sections of Webpage The choosing method and device of point.
Background technology
There is many networks (Web) automatization testing technique in industry at present, in these technical solutions, can operate Web automatic tests are realized in control in Web, the operations such as input, the click of analog subscriber.Its principle is browsed by calling The document dbject model of the com interface and hypertext markup language (HTML, Hypertext Markup Language) of device (DOM, Document Object Model) carries out test operation to browser and WEB test objects.
In existing automatic test course, if tested WEB page is there are multiple similar samples, the sample is Node generally has following two technical solutions then in order to obtain multiple test samples in automatic test:
The automatic testing schemes of the first WEB inject identical label category in WEB page code in similar test sample Property, so that automatic test program can identify these similar test samples.Fig. 1 is similar in WEB page code Test sample injects a kind of schematic diagram of class tag attributes.Referring to Fig. 1, for similar test sample, in WEB page, Test sample is referred to as test node, and similar test node is 101 and 102 in Fig. 1, in the two test nodes 101 With 102 in be all filled with identical tag attributes class, such automatic test program can be according to these class labels Attribute Recognition goes out similar test node, to carry out subsequent test process.Certain tag attributes are not limited to class, Can also be other tag attributes.
The automatic testing schemes of second of WEB are used visualization tool in WEB page, are selected one by one using mouse multiple Test node.Fig. 2 is a kind of schematic diagram for showing test node using visualization tool in WEB page and manually choosing.Ginseng See Fig. 2, using visualization tool, the network node of tested WEB page can be shown, mouse is then passed through by tester The tested similar test node of artificial selection, such as " praising " button therein are marked, autotest program is submitted to after the completion of selection, Automatic test program can test these similar test nodes in this way.
But the above-mentioned prior art has the following disadvantages:
1) the first above-mentioned scheme and second scheme are required for manually labelling to similar test node one by one or people Work selects similar test node one by one, when similar node quantity is more, takes time and effort, inefficiency.
2) due to being manual operation, it is easy to appear no marking label or leakage selection conditions, reduce the accuracy rate of test.
3) maintenance cost is high, if you need to change datum node, also needs manually to change similar node one by one.
4) when the similar node in WEB page is dynamically generated, then using the scheme of the first scheme to label, by Uncertain in producing method, number of nodes is unknowable, thus the program can not normal use, or to implement cost very high;If Using the artificial selection scheme one by one of second scheme, because node is dynamically generated, can not select in advance, thus the program also without Method normal use.
Invention content
In view of this, the main object of the present invention is to provide a kind of choosing method and dress of the test node of Webpage It sets, to improve the efficiency and accuracy rate of choosing test node, reduces maintenance cost.
The technical proposal of the invention is realized in this way:
A kind of choosing method of the test node of Webpage, including:
Obtain the datum node of Webpage;
Obtain path of the datum node in Webpage;
In the Webpage, since the datum node, according to the level in the path of the datum node, step by step Search the similar node of the datum node;
Submit found datum node and its similar node.
A kind of selecting device of the test node of Webpage, including:
Datum node module, the datum node for obtaining Webpage;
Path module, for obtaining path of the datum node in Webpage;
Searching module is used in the Webpage, since the datum node, according to the road of the datum node The level of diameter searches the similar node of the datum node step by step;
Module is submitted, for submitting found datum node and its similar node.
Compared with prior art, the present invention first obtains the benchmark of Webpage when choosing the test node of Webpage Node and its path in Webpage, then in the Webpage, since the datum node, according to the base The level in the path of quasi- node, searches the similar node of the datum node step by step, submit found datum node and its Similar node is tested as test node.In the present invention, due to needing artificial the step of participating in only to choose datum node This step, other steps can be automatically performed by program according to datum node, so as to reduce manually-operated quantity, The shortcomings that improving the efficiency for choosing test node, while also avoiding manually choosing often error, will not make similar node It is selected at leakage, improves the accuracy rate for choosing test node;And it if necessary to modification datum node, also need not manually change successively Its similar node, reduces maintenance cost;When Webpage is dynamically generated, also a datum node need to be only selected just Its similar node can be chosen automatically, and the Webpage of dynamic generation is applicable in very much.
Description of the drawings
Fig. 1 is a kind of schematic diagram of the similar test sample injection class tag attributes in WEB page code;
Fig. 2 is a kind of schematic diagram for showing test node using visualization tool in WEB page and manually choosing;
Fig. 3 is a kind of flow chart of the choosing method of the test node of Webpage of the present invention;
Fig. 4 is a kind of path schematic diagram of the node in Webpage;
Fig. 5 is the path schematic diagram of the node of a Webpage in the embodiment;
Fig. 6 is a kind of composition schematic diagram of embodiment of the selecting device of the test node of Webpage of the present invention;
Fig. 7 is a kind of composition schematic diagram of the searching module;
Fig. 8 is the composition signal of another embodiment of the selecting device of the test node of Webpage of the present invention Figure.
Specific implementation mode
Below in conjunction with the accompanying drawings and specific embodiment the present invention is further described in more detail.
Fig. 3 is a kind of flow chart of the choosing method of the test node of Webpage of the present invention.Referring to Fig. 3, the stream Journey includes:
Step 301, the datum node for obtaining Webpage.
The datum node is exactly the node chosen by tester, on the basis of the node, executes subsequent step, To find out the similar node of the datum node.The feature of the similar node can be defined by tester, and can be with Search criterion in subsequent step is set with this.Such as in a preferred embodiment, the similar node refers in network Function is similar in the page, the similar node in position, and quantizating index is:Only there are one the different sections of node ID in its path Point, each other similar node;That is only there are one node ID and the datum node path in the path of the similar node In node ID it is different.Such as Fig. 2 be in all " praising " buttons all similar node, all "+TA honors " are pressed each other Button also all similar node each other.
In an advantageous embodiment, the datum node for obtaining Webpage can be automated using existing WEB Visualization select tool in testing tool is chosen, and specifically with Webpage to be tested is opened in a browser, opens Visualization select tool in dynamic WEB automated test tools, such as the Webpage described in Fig. 2 can be shown, then survey Examination personnel choose one of node as datum node using mouse, and the present invention is detecting click of the user to certain node After after instruction or further detecting submission instruction, then judgement obtains the datum node of the Webpage.
Step 302 obtains path of the datum node in Webpage.
Path of the datum node in Webpage represents hierarchical structure of the datum node in Webpage The position and.Such as the path schematic diagram that Fig. 4 is the node in a kind of Webpage.Path of the node in Webpage is usual Using XML Path Language (XPath, XML Path Language) or the representation of the paths Finder or other equivalences To indicate.
XPath is that one kind is used for determining extensible markup language (XML, Extensible Markup Language) document In certain portion language.What it is such as "/html/body/div [2]/table [3]/tr [4]/td [5] " expression is marked in body The 5th td label in the 4th tr in the 3rd table in the 2nd div in label, as shown in Fig. 4 dash areas.
The paths Finder are that JavaScript language of certain node in full page is identifiable unique in representation page Path, example below have used jQuery function libraries.
Its representation method is such as:
“$("body").children("div").eq(1).children("table").eq(2).children(" tr").eq(3).children("td").eq(4)”
It is also the 5th td marks in the 4th tr in the 3rd table in the 2nd div indicated in body labels Label, as shown in Fig. 4 dash areas.
Step 303, in the Webpage, since the datum node, according to the path of the datum node Level searches the similar node of the datum node step by step.
In this step, described since the datum node, it is specific to wrap step by step to upper layer structure lookup similar node It includes:
A, using the datum node as present node, following steps are executed:
B, the father node of present node is determined;
C, all child nodes for determining the father node, the son section where removing present node in all child nodes Point obtains remaining child node;
D, the remaining child node is traversed, the similar node of the datum node is therefrom searched;
E, judge whether the father node is body nodes, if it is terminate the flow for searching similar node;Otherwise by institute Father node is stated as present node, return to step B.
The similar node for searching the datum node is specially:In the path of the similar node only there are one node ID with Node ID in the datum node path is different.
In an advantageous embodiment, the step D is specifically included:The remaining child node is traversed, it is surplus for each Remaining node obtains the path of the residue child node, compares the path in the path and the datum node of the residue child node, at this Only judge the residue there are one when node ID and the node ID difference in the datum node path in remaining child node path Child node is the similar node of the datum node.
In another preferred embodiment, the similar node of the datum node is searched for convenience, can be arranged and be looked into Condition is looked for, the initial value of the search criterion is set as empty;And the step D is specifically included:The remaining child node is traversed, Therefrom lookup and the matched remaining node of the search criterion, using the matched remaining node as the phase of the datum node Like node;The step E is specifically included:If the father node is not body nodes, institute is subtracted with the datum node path Father node path is stated, difference path is obtained, sets the search criterion to the difference path, using the father node as current Node, return to step B.
Step 304 submits found datum node and its similar node.
In a preferred embodiment, the datum node and its similar node submitted can be used as test node It is tested.
In another preferred embodiment, the datum node and its similar node submitted can also be used as candidate Test node shows tester, is further screened for tester.Specific embodiment is:In the submission institute After the datum node and its similar node that find, further comprise:It shows the datum node and its similar node, is connecing After receiving the selection instruction to a certain datum node or similar node, the similar node of the datum node is automatically selected, or automatic Select the datum node of the similar node and other similar nodes of the datum node.As shown in Fig. 2, when user selects wherein one After a " praising " button, then other all " praising " buttons in the current network page can be also selected, and can accomplish to select in this way One datum node or similar node, program can automatically select its all similar node, to realize intelligent selection phase Like the effect of node, without specified manually.
In addition, when in test case with the presence of multiple node similar nodes (such as a nodes have similar node a1, a2, a3;B nodes have similar node b1, b2, b3), and have following two requirements in test case:A, the similar node number of b nodes Amount needs identical;A, the similar node of two nodes of b needs to correspond.A1 is needed and b1 matchings, a2 and b2 matchings.In the case, existing Having the second scheme matching of the first scheme and the prior art of technology to get up all will be abnormal difficult.
And in the present invention, in order to solve the problems, such as above-mentioned matching, in a preferred embodiment, the base of the acquisition The quantity of quasi- node can also at least two, for each datum node may be by the method described in the present invention choose Its similar node, and after the submission found datum node and its similar node, this method can also be into one Step includes:It shows the datum node and its similar node, the selection of a certain datum node or similar node is referred to receiving After order, the units of pages where the datum node or similar node is determined, automatically select other benchmark sections in the units of pages Point or similar node.Such as shown in Fig. 2, " praising " button is a datum node, and the "+TA honors " button is also one Datum node, in user selects behind " praising " button 201, then "+TA honors " button of the 201 same units of pages of button 202 can also be chosen automatically, to realize when, there are when multigroup similar node, can reaching intelligent Matching in the tested network page Go out the effect of multiple use-cases.
In addition, in further preferred embodiment, the present invention can further include:According to the datum node Path record level, and record the similar node of the corresponding datum node of each level.It in this way can be by similar node It is grouped according to level, tester is facilitated to implement the test case of grouping classification.
In conclusion intellectual search similar node may be implemented in the present invention, need to only automatization test system be used to select one A datum node can find all similar nodes, and no leakage choosing, efficient, accuracy is also high;And it can be for more Group similar node carries out the matching one by one of intelligence, without specified manually;Simultaneously because the present invention can be by program according to the step It is rapid automatic to execute, when Webpage is dynamically generated, also need to only select a datum node can full dose choose it Similar node is applicable in the Webpage of dynamic generation very much;In addition, the maintenance cost of the present invention is also very low, if you need to change Datum node, similar node are replaced automatically, unhelpful to change one by one.Also, the present invention can be presented to after choosing similar node Tester carries out second selecting, and visualized operation may be implemented, easy to operate, judges clear.
Below with a more specifically embodiment, the technical solution is further illustrated the present invention.
Fig. 5 is the path schematic diagram of the node of a Webpage in the embodiment.Referring to Fig. 5,
1) assume that the datum node chosen is node 502.Its html structure feature is:In the 1st div in body The 2nd span in the 1st li in 1st ul, its path is described as with XPath:/html/body/div[1]/ul [1]/li[1]/a[1]/span[2]。
The similar node of the datum node is specially:In the path of the similar node only there are one node ID with it is described Node ID in datum node path is different, then according to this requirement, the similar section of each level of the datum node Point is as follows:
2) similar node of the first layer of the datum node 502 is node 501 and node 503, and XPath is respectively:
Node 501:/html/body/div[1]/ul[1]/li[1]/a[1]/span[1]
Node 503:/html/body/div[1]/ul[1]/li[1]/a[1]/span[3]
3) similar node of the second layer of the datum node 502 is node 505, and XPath is respectively:
Node 505:/html/body/div[1]/ul[1]/li[1]/a[2]span[2]
4) similar node of the third layer of the datum node 502 is node 508, and XPath is respectively:
Node 508:/html/body/div[1]/ul[1]/li[2]/a[1]/span[2]
5) the 4th layer of similar node of the datum node 502 is node 512, and XPath is respectively:
Node 512:/html/body/div[1]/ul[3]/li[1]/a[1]/span[2]
6) similar node of the layer 5 of the datum node 502 is node 517 and node 519, and XPath is respectively:
Node 517:/html/body/div[3]/ul[1]/li[1]/a[1]/span[2]
Node 519:/html/body/div[4]/ul[1]/li[1]/a[1]/span[2]
The tool of the similar node for each level that the datum node 502 is chosen using the method for the present invention is described in detail below Body step:
Step 601 opens item page in a browser, starts visualization Web automated test tools.
Step 602 chooses datum node using visualization select tool from Webpage, such as is to have chosen section herein Point 502.
Step 603 is obtained hierarchical structure of the datum node in Webpage, such as is calculated using JavaScript Go out the path of datum node, such as be the paths XPath herein, and it is XPATH to save as variable, the path that present node is arranged is Xpath, and xpath=XPATH, wherein the path of the datum node is as follows:
Var XPATH=:/html/body/div[1]/ul[1]/li[1]/a[1]/span[2]
Step 604 is set search criterion as sky, and is indicated with variable seach;If number of levels is 1, and with variable level tables Show, it is as follows:
Var seach=' ';
Var level=1;
Step 605, the node type for obtaining xpath, and variable tagName is saved as, it is as follows:
Var tagName=span;
Step 606 obtains sequences of the tagName in xpath, and it is index to save as variable, is such as herein:
Var index=2;
Step 607, obtain xpath father node path be parent, it is as follows:
Var parent=:/html/body/div[1]/ul[1]/li[1]/a[1];
Step 608 obtains all tagName child nodes of parent, and removes i-th ndex child node, obtains array NodeList, it is as follows:
Var nodeList={ span [1], span [3] };
Whether step 609 carries out searching loop to all nodes of the nodeList, judge in each node to include matching The respective nodes of seach, if matched node can be found, which is level layers of similar section of datum node Point.It can not be searched if seach is sky, all nodes for giving tacit consent to the nodeList are all the similar nodes of datum node.
Such as seach is sky at this moment, the similar node of the first layer similar with datum node found be node 501 and Node 503.Its path XPath is respectively:
Node 501:/html/body/div[1]/ul[1]/li[1]/a[1]/span[1]
Node 503:/html/body/div[1]/ul[1]/li[1]/a[1]/span[3]
Step 6010 stores level layers of all similar nodes into two-dimensional array similarity [level], The similar node that datum node has at level layers can be indicated with the form of two-dimensional array.
Step 6011 subtracts the father node path parent with the path XPATH of datum node, and difference path is set as New querying condition seach, then current father node path parent is set as new xpath, level is as follows from increasing 1:
Seach=XPATH-parent
=/span [2];
Xpath=parent;
level++;
Step 6012, return to step 605, until tagName is body.
Below again by taking the search procedure of second layer similar node as an example, illustrate after return to step 605, similar node is looked into Look for process, the search procedure of the similar node of other levels and so on.
Above-mentioned steps 6012 are connect, it is described in return to step 605:
Seach=XPATH-parent
=/span [2];
Xpath=parent=:/html/body/div[1]/ul[1]/li[1]/a[1];
Level=2;
The search procedure of so second layer similar node is as follows:
Step 605, the node type for obtaining xpath, and variable tagName is saved as, it is as follows:
Var tagName=a;
Step 606 obtains sequences of the tagName in xpath, and it is index to save as variable, is such as herein:
Var index=1;
Step 607, obtain xpath father node path be parent, it is as follows:
Var parent=:/html/body/div[1]/ul[1]/li[1];
Step 608 obtains all tagName child nodes of parent, and removes i-th ndex child node, obtains array NodeList, it is as follows:
Var nodeList={ a [2], a [3] };
Whether step 609 carries out searching loop to all nodes of the nodeList, judge in each node to include matching The respective nodes of seach, if matched node can be found, which is level layers of similar section of datum node Point.
Such as [2] seach=/span, the second layer similar node similar with datum node found are node at this moment 505, XPath Route Routes are:/html/body/div[1]/ul[1]/li[1]/a[2]span[2].
All level layers of similar node (i.e. the node 505) storage is arrived two-dimensional array by step 6010 In similarity [level], you can the similar section having at level layers to indicate datum node in the form of two-dimensional array Similar node can be grouped by point according to level in this way, and tester is facilitated to implement the test case of grouping classification.
Step 6011 subtracts the father node path parent with the path XPATH of datum node, and difference path is set as New querying condition seach, then current father node path parent is set as new xpath, level is as follows from increasing 1:
Seach=XPATH-parent
=a [1]/span [2];
Xpath=parent=:/html/body/div[1]/ul[1]/li[1]
Level=3;
Step 6012, return to step 605 search the third layer similar node of datum node, until tagName is that body is Only.
So utilize above-mentioned steps 605 to step 6012 method, can once search datum node 502 third layer, 4th layer, the similar node node of layer 5, until tagName is body.So far, 502 each layer of datum node is had found All similar nodes, i.e. node 501,503,505,508,512,517,519.
These similar nodes can finally be exported to autotest program, to complete the survey to the Webpage Examination.
Corresponding with the above method, the invention also discloses a kind of selecting devices of the test node of Webpage, for holding The row above method.Fig. 6 is a kind of composition signal of embodiment of the selecting device of the test node of Webpage of the present invention Figure.Referring to Fig. 6, which specifically includes:
Datum node module 621, the datum node for obtaining Webpage.
Path module 622, for obtaining path of the datum node in Webpage.
Searching module 623 is used in the Webpage, since the datum node, according to the datum node Path level, search the similar node of the datum node step by step.Preferably, the similar node of the datum node is specific For:Only there are one the node ID nodes different from the node ID in the datum node path in path.
Module 624 is submitted, for submitting found datum node and its similar node.
Fig. 7 is a kind of composition schematic diagram of the searching module.Referring to Fig. 7, the searching module 623 specifically includes:
First unit 701, for using the datum node as present node;
Second unit 702, the father node for determining present node;
Third unit 703, all child nodes for determining the father node remove current from all child nodes Child node where node obtains remaining child node;
4th unit 704 therefrom searches the similar node of the datum node for traversing the remaining child node;
5th unit 705 if it is terminates for judging whether the father node is body nodes;Otherwise by the father Node returns to second unit as present node.
Wherein, the 4th unit 704 is specifically used for:
The remaining child node is traversed, for each remaining node, the path of the residue child node is obtained, it is surplus to compare this The path in the path of minor node and the datum node, in the residue child node path only there are one node ID with it is described When the node ID difference in datum node path, judge that the residue child node is the similar node of the datum node.
In another embodiment specific implementation mode, which can further include search criterion unit 700, For search criterion to be arranged, the initial value of the search criterion is sky;
4th unit 704 is specifically used for:The remaining child node is traversed, therefrom searches and is matched with the search criterion Remaining node, using the matched remaining node as the similar node of the datum node;
5th unit 705 is specifically used for:If the father node is not body nodes, with the datum node path The father node path is subtracted, difference path is obtained, the search criterion is set to the difference path, the father node is made For present node, second unit 702 is returned.
Fig. 8 is another composition schematic diagram of the selecting device of the test node of Webpage of the present invention.Referring to figure 8, which still further comprises level logging modle 625 in addition to module shown in fig. 6, for according to the datum node Path record level, and record the similar node of the corresponding datum node of each level.
The device further comprises the first screening module 626, for showing the base after the submission module 624 Quasi- node and its similar node automatically select the base after receiving to the selection instruction of a certain datum node or similar node The similar node of quasi- node, or automatically select the datum node of the similar node and other similar nodes of the datum node.
The device can further include the second screening module 627, for showing after the submission module 624 The datum node and its similar node, after receiving to the selection instruction of a certain datum node or similar node, determining should Units of pages where datum node or similar node automatically selects other datum nodes in the units of pages or similar section Point.
Selecting device of the present invention can include first screening module, 626 and second screening module 627 simultaneously, One can be only included.
In addition, each function module in each embodiment of the present invention can be integrated in a processing unit, it can also It is that modules physically exist alone, it can also be during two or more modules be integrated in one unit.Above-mentioned integrated list The form that hardware had both may be used in member is realized, can also be realized in the form of SFU software functional unit.The work(of each embodiment Energy module can be located at a terminal or network node, or may be distributed on multiple terminals or network node.
In addition, each embodiment of the present invention can pass through the data processing by data processing equipment such as computer execution Program is realized.Obviously, data processor constitutes the present invention.In addition, being generally stored inside the data in a storage medium Processing routine by program by directly reading out storage medium or by installing or copying to data processing equipment by program It is executed in storage device (such as hard disk and/or memory).Therefore, such storage medium also constitutes the present invention.Storage medium can be with Use any kind of recording mode, such as paper storage medium (such as paper tape), magnetic storage medium (such as floppy disk, hard disk, flash memory Deng), optical storage media (such as CD-ROM), magnetic-optical storage medium (such as MO) etc..
Therefore the invention also discloses a kind of storage mediums, wherein it is stored with data processor, the data processor Any type embodiment for executing the above method of the present invention.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention With within principle, any modification, equivalent substitution, improvement and etc. done should be included within the scope of protection of the invention god.

Claims (14)

1. a kind of choosing method of the test node of Webpage, which is characterized in that including:
Obtain the datum node of Webpage;
Obtain path of the datum node in Webpage;
In the Webpage, since the datum node, according to the level in the path of the datum node, search step by step The similar node of the datum node;
Submit found datum node and its similar node;
Wherein, described since the datum node, step by step to upper layer structure lookup similar node, specifically include:
A, using the datum node as present node, following steps are executed:
B, the father node of present node is determined;
C, all child nodes for determining the father node, the child node where removing present node in all child nodes, Obtain remaining child node;
D, the remaining child node is traversed, the similar node of the datum node is therefrom searched;
E, judge whether the father node is body nodes, if it is terminate the flow for searching similar node;Otherwise by the father Node is as present node, return to step B.
2. according to the method described in claim 1, it is characterized in that, the step D is specifically included:
The remaining child node is traversed, for each remaining node, the path of the residue child node is obtained, compares residue The path in the path of node and the datum node, only there are one node ID and the benchmark in the residue child node path When the node ID difference of node path, judge that the residue child node is the similar node of the datum node.
3. according to the method described in claim 1, it is characterized in that, this method further comprise be arranged search criterion, this is looked into The initial value of condition is looked for be set as empty;
The step D is specifically included:The remaining child node is traversed, is therefrom searched and the matched remaining section of the search criterion Point, using the matched remaining node as the similar node of the datum node;
The step E is specifically included:If the father node is not body nodes, father node is subtracted with the datum node path Path obtains difference path, and set the search criterion to the difference path returns using the father node as present node Return step B.
4. according to the method described in claim 1, it is characterized in that, this method further comprises:
Level is recorded according to the path of the datum node, and records the similar section of the corresponding datum node of each level Point.
5. according to the method described in claim 1, it is characterized in that, in the found datum node and its similar submitted After node, this method further comprises:It shows the datum node and its similar node, is receiving to a certain datum node Or after the selection instruction of similar node, the similar node of the datum node is automatically selected, or automatically selects the base of the similar node Other similar nodes of quasi- node and the datum node.
6. according to the method described in claim 1, it is characterized in that,
The quantity at least two of the datum node of the acquisition;
After the submission found datum node and its similar node, this method further comprises:Show the base Quasi- node and its similar node determine the benchmark section after receiving to the selection instruction of a certain datum node or similar node Units of pages where point or similar node, automatically selects other datum nodes or the similar node in the units of pages.
7. method according to any one of claims 1 to 6, which is characterized in that search the similar node of the datum node Specially:Only there are one node ID is different from the node ID in the datum node path in the path of the similar node.
8. a kind of selecting device of the test node of Webpage, which is characterized in that including:
Datum node module, the datum node for obtaining Webpage;
Path module, for obtaining path of the datum node in Webpage;
Searching module, in the Webpage, since the datum node, according to the path of the datum node Level searches the similar node of the datum node step by step;
Module is submitted, for submitting found datum node and its similar node;
Wherein, the searching module specifically includes:
First unit, for using the datum node as present node;
Second unit, the father node for determining present node;
Third unit, all child nodes for determining the father node remove present node institute from all child nodes Child node, obtain remaining child node;
Unit the 4th therefrom searches the similar node of the datum node for traversing the remaining child node;
Unit the 5th if it is terminates for judging whether the father node is body nodes;Otherwise using the father node as Present node returns to second unit.
9. device according to claim 8, which is characterized in that Unit the 4th is specifically used for:
The remaining child node is traversed, for each remaining node, the path of the residue child node is obtained, compares residue The path in the path of node and the datum node, only there are one node ID and the benchmark in the residue child node path When the node ID difference of node path, judge that the residue child node is the similar node of the datum node.
10. device according to claim 8, which is characterized in that the searching module further comprises search criterion unit, uses In search criterion is arranged, the initial value of the search criterion is sky;
Unit the 4th is specifically used for:The remaining child node is traversed, is therefrom searched and the matched residue of the search criterion Node, using the matched remaining node as the similar node of the datum node;
Unit the 5th is specifically used for:If the father node is not body nodes, father is subtracted with the datum node path Node path obtains difference path, sets the search criterion to the difference path, using the father node as working as prosthomere Point returns to second unit.
11. device according to claim 8, which is characterized in that the device further comprises level logging modle, for pressing Level is recorded according to the path of the datum node, and records the similar node of the corresponding datum node of each level.
12. device according to claim 8, which is characterized in that the device further comprises after the submission module First screening module is being received for showing the datum node and its similar node to a certain datum node or similar section Point selection instruction after, automatically select the similar node of the datum node, or automatically select the similar node datum node and Other similar nodes of the datum node.
13. device according to claim 8, which is characterized in that the device further comprises after the submission module Second screening module is being received for showing the datum node and its similar node to a certain datum node or similar section After the selection instruction of point, determines the units of pages where the datum node or similar node, automatically select in the units of pages Other datum nodes or similar node.
14. according to claim 8 to 13 any one of them device, which is characterized in that the similar node of the datum node has Body is:Only there are one the node ID nodes different from the node ID in the datum node path in path.
CN201310452563.XA 2013-09-26 2013-09-26 The choosing method and device of the test node of Webpage Active CN104516813B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201310452563.XA CN104516813B (en) 2013-09-26 2013-09-26 The choosing method and device of the test node of Webpage
PCT/CN2014/085252 WO2015043352A1 (en) 2013-09-26 2014-08-27 Method and apparatus for selecting test nodes on webpages

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310452563.XA CN104516813B (en) 2013-09-26 2013-09-26 The choosing method and device of the test node of Webpage

Publications (2)

Publication Number Publication Date
CN104516813A CN104516813A (en) 2015-04-15
CN104516813B true CN104516813B (en) 2018-07-27

Family

ID=52742012

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310452563.XA Active CN104516813B (en) 2013-09-26 2013-09-26 The choosing method and device of the test node of Webpage

Country Status (2)

Country Link
CN (1) CN104516813B (en)
WO (1) WO2015043352A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109814957B (en) * 2017-11-20 2022-06-07 北京京东尚科信息技术有限公司 Label adding method and device for IOS (input/output system)
CN108845925B (en) * 2018-03-30 2022-02-11 新华三技术有限公司 Web page testing method and device, electronic equipment and computer readable medium
CN110554950B (en) * 2018-05-30 2024-02-02 广州腾讯科技有限公司 Interface debugging method and device and storage medium
CN112527621A (en) * 2019-09-17 2021-03-19 中移动信息技术有限公司 Test path construction method, device, equipment and storage medium
CN111488544B (en) * 2020-03-31 2023-02-24 腾讯科技(深圳)有限公司 Method, device, equipment and storage medium for determining similar sub-elements of webpage
CN111966600B (en) * 2020-08-31 2023-08-04 平安健康保险股份有限公司 Webpage testing method, webpage testing device, computer equipment and computer readable storage medium
CN115543927B (en) * 2022-10-31 2023-06-30 永道工程咨询有限公司 Method and device for extracting field information of cost file, equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103268226A (en) * 2013-05-17 2013-08-28 瑞斯康达科技发展股份有限公司 Test script file generation method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6804634B1 (en) * 2000-02-17 2004-10-12 Lucent Technologies Inc. Automatic generation and regeneration of a covering test case set from a model
CN101593184B (en) * 2008-05-29 2013-05-15 国际商业机器公司 System and method for self-adaptively locating dynamic web page elements
US8387018B2 (en) * 2010-09-01 2013-02-26 International Business Machines Corporation Fault localization using directed test generation
CN103502952B (en) * 2011-03-08 2017-06-09 惠普发展公司,有限责任合伙企业 Create test case

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103268226A (en) * 2013-05-17 2013-08-28 瑞斯康达科技发展股份有限公司 Test script file generation method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于HTML树的网页结构相似度研究;宋明秋等;《情报学报》;20110228;第30卷(第2期);第161-165页 *

Also Published As

Publication number Publication date
CN104516813A (en) 2015-04-15
WO2015043352A1 (en) 2015-04-02

Similar Documents

Publication Publication Date Title
CN104516813B (en) The choosing method and device of the test node of Webpage
CN102831121B (en) Method and system for extracting webpage information
CN102890681B (en) A kind of method and system of generating web page stay in place form
CN104424087B (en) A kind of method of Web page surface element positioning, apparatus and system
US8806330B2 (en) Automatic detection of item lists within a web page
CN102521121A (en) Page testing method and page testing device
CN107122368A (en) A kind of data verification method, device and electronic equipment
CN105320778A (en) Commodity labeling method suitable for electronic commerce Chinese website
CN104699613B (en) A kind of spacecraft-testing demand automatic creation system and its method
CN105279089B (en) A kind of method and device for obtaining page elements
CN103488560B (en) Test object processing method and test object processing device for webpage test
CN110188165A (en) Contract template acquisition methods, device, storage medium and computer equipment
CN103631706B (en) A kind of browser testing method and apparatus
CN116680162B (en) Test case multiplexing method, device, medium, equipment and product
CN107194007A (en) A kind of integrated management system of spacecraft isomery test data
CN106951495A (en) Method and apparatus for information to be presented
CN104462461B (en) The method and device of investigation processing empty value is carried out to list
CN112860581A (en) Test case execution method, device, equipment and storage medium
CN110286882B (en) Foreground system design and verification method based on model detection
CN107741905B (en) Test case, analytic model thereof, execution method, storage medium and processor
CN113051874B (en) User behavior data rendering method and device
CN104317704A (en) Measuring software integration method for production line automatic test system
Furche et al. Amber: Automatic supervision for multi-attribute extraction
CN105204997A (en) Software defect detection method and device
Pavkovic et al. Sinfo–structure-driven incremental forum crawler that optimizes user-generated content retrieval

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