CN104239206B - Webpage method of testing and device - Google Patents
Webpage method of testing and device Download PDFInfo
- Publication number
- CN104239206B CN104239206B CN201410476081.2A CN201410476081A CN104239206B CN 104239206 B CN104239206 B CN 104239206B CN 201410476081 A CN201410476081 A CN 201410476081A CN 104239206 B CN104239206 B CN 104239206B
- Authority
- CN
- China
- Prior art keywords
- text
- tree
- webpage
- render
- benchmark
- 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
- 238000010998 test method Methods 0.000 title claims abstract description 21
- 238000012360 testing method Methods 0.000 claims abstract description 105
- 238000009877 rendering Methods 0.000 claims description 13
- 238000000034 method Methods 0.000 abstract description 17
- 230000006870 function Effects 0.000 description 8
- 230000000007 visual effect Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 230000006978 adaptation Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 235000013399 edible fruits Nutrition 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 239000012634 fragment Substances 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 210000003733 optic disk Anatomy 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a kind of webpage method of testing, including:Obtain the web data of webpage to be tested;Load and render web data, to generate document dbject model dom tree and/or render tree according to web data;Text is compared according to dom tree and/or render tree generation;And will compare text be compared with benchmark text with treat test webpage tested.The webpage method of testing of the embodiment of the present invention, can cause in test process, and inconsistent position can easily be oriented by being compared by will compare text and benchmark text, be dramatically saves on the human cost of webpage test, improved the efficiency of test.The invention also discloses a kind of webpage test device.
Description
Technical field
The present invention relates to Internet technical field, more particularly to a kind of webpage method of testing and device.
Background technology
With developing rapidly for Internet technology, the life of people and the relation of internet are increasingly close, and people are to webpage
Requirement more and more higher, the typesetting of such as webpage, the real-time update of web page contents etc., it is therefore desirable to which developer updates in time
Webpage.After developer more new web page, in order to ensure the quality of webpage, it is necessary to test webpage.
The main test webpage of webpage test is to the compatibility and the correctness of webpage logic of different browsers, prior art
In webpage test mainly by manual type recognize webpage test target, for example, by tester search webpage in where
It is individual place or content displaying it is incorrect or abnormal.But be the problem of exist:It is a large amount of that existing test usually requires input
Human cost, and easily omit, so as to cause less efficient, it is impossible to which the high efficiency for adapting to the test of high-volume webpage will
Ask, the testing time is long in addition, have impact on the renewal speed of webpage.
The content of the invention
The purpose of the present invention is intended at least solve one of above-mentioned technical problem to a certain extent.
Therefore, first purpose of the present invention is to propose a kind of webpage method of testing.This method can cause in test
During, inconsistent position can easily be oriented by being compared by will compare text and benchmark text, greatly
The human cost of webpage test is saved, the efficiency of test is improved.
Second object of the present invention is to propose a kind of webpage test device.
Third object of the present invention is to propose a kind of terminal.
To achieve these goals, the webpage method of testing of first aspect present invention embodiment, including:Obtain net to be tested
The web data of page;Load and render the web data, to generate document dbject model dom tree according to the web data
And/or render tree;Text is compared according to the dom tree and/or render tree generation;And compare text and benchmark text by described
It is compared to test the webpage to be tested.
The webpage method of testing of the embodiment of the present invention, can first obtain the web data of webpage to be tested, afterwards can be by clear
Device of looking at loads and renders the web data, to generate dom tree and/or render tree according to the web data, and according to dom tree and/
Or render tree generation compare text, and will compare text be compared with benchmark text with treat test webpage tested,
So that in test process, by will compare text be compared with benchmark text can easily orient it is inconsistent
Position, dramatically saves on webpage test human cost, improve the efficiency of test.
To achieve these goals, the webpage test device of second aspect of the present invention embodiment, including:First obtains mould
Block, the web data for obtaining webpage to be tested;First generation module, for loading and rendering the web data, with root
Document dbject model dom tree and/or render tree are generated according to the web data;Second generation module, for according to the dom tree
And/or render tree generation compares text;And test module, for the comparison text to be compared with right with benchmark text
The webpage to be tested is tested.
The webpage test device of the embodiment of the present invention, can obtain the webpage number of webpage to be tested by the first acquisition module
According to the first generation module is loaded by browser and renders web data to generate dom tree according to the web data and/or render
Tree, the second generation module compares text according to dom tree and/or render tree generation, and test module will compare text and benchmark text
It is compared and is tested with treating test webpage, so that in test process, by the way that text and benchmark text will be compared
Inconsistent position can easily be oriented by being compared, and be dramatically saves on the human cost of webpage test, improved
The efficiency of test.
To achieve these goals, the terminal of third aspect present invention embodiment, including:Shell, processor and circuit board;
The circuit board is placed in the interior volume that the shell is surrounded, and the processor is arranged on the circuit board;The processing
Device is used to run application program, specifically for:Obtain the web data of webpage to be tested;Load and render the web data,
To generate document dbject model dom tree and/or render tree according to the web data;Given birth to according to the dom tree and/or render tree
Into comparison text;And the comparison text is compared with benchmark text to test the webpage to be tested.
The terminal of the embodiment of the present invention, can first obtain the web data of webpage to be tested, can be loaded afterwards by browser
And the web data is rendered, to generate dom tree and/or render tree according to the web data, and according to dom tree and/or render tree
Generation compare text, and will compare text be compared with benchmark text with treat test webpage tested so that
In test process, inconsistent position can easily be oriented by being compared by will compare text and benchmark text,
The human cost of webpage test is dramatically saves on, the efficiency of test is improved.
The additional aspect of the present invention and advantage will be set forth in part in the description, and will partly become from the following description
Obtain substantially, or recognized by the practice of the present invention.
Brief description of the drawings
Of the invention above-mentioned and/or additional aspect and advantage will become from the following description of the accompanying drawings of embodiments
Substantially and be readily appreciated that, wherein:
Fig. 1 is the flow chart of webpage method of testing according to an embodiment of the invention;
Fig. 2 is the flow chart of webpage method of testing in accordance with another embodiment of the present invention;And
Fig. 3 is the structural representation of webpage test device according to an embodiment of the invention.
Embodiment
Embodiments of the invention are described below in detail, the example of the embodiment is shown in the drawings, wherein from beginning to end
Same or similar label represents same or similar element or the element with same or like function.Below with reference to attached
The embodiment of figure description is exemplary, it is intended to for explaining the present invention, and be not considered as limiting the invention.
In order to solve, when the content that webpage is included is more and complex, to usually require to put into substantial amounts of manpower during test
Cost, and easily omit, so that the problem of causing less efficient, the present invention proposes a kind of webpage method of testing and dress
Put.Specifically, below with reference to the accompanying drawings webpage method of testing according to embodiments of the present invention and device are described.
Fig. 1 is the flow chart of webpage method of testing according to an embodiment of the invention.
As shown in figure 1, the webpage method of testing can include:
S100, obtains the web data of webpage to be tested.
For example, the URL (Uniform Resource Locator, URL) of webpage to be tested can first be read
Address, afterwards can be according to the web data of the URL address acquisitions webpage to be tested.And for example, it can be captured by testing tool
To obtain the web data of webpage to be tested.
S101, loads and renders web data, with according to web data generate DOM (Document Object Model,
Document dbject model) set and/or render tree.
Specifically, in an embodiment of the present invention, it can be loaded by browser and render web data, and according to the net
Page data generates dom tree and/or render tree.That is, after being loaded by browser and rendering web data, can parse
The web data is to generate dom tree, after dom tree, which is set up, to be completed, and can start to generate render tree.
Wherein, in an embodiment of the present invention, dom tree may include DOM element and attribute node, and it is HTML (Hyper
Text Markup language, HyperText Markup Language) document objectification description, be also HTML element with it is extraneous (such as
Javascript interface).In addition, render tree is made up of the visual elements in element display sequence, it is the visualization of document
Represent, be that can draw content by correctly order according to render tree.
S102, text is compared according to dom tree and/or render tree generation.
Specifically, text can be saved as by generated dom tree and/or render tree are abstract, to generate comparison text.Example
Such as, generated dom tree and/or render tree can be saved as text in the form of abstract object so that compare the structure of text
Content is made up of multiple abstract objects, such as " obj1 ... obj2 ... obj3 ... ".
S103, will compare text be compared with benchmark text with treat test webpage tested.
Wherein, in an embodiment of the present invention, benchmark text is construed as received text set in advance.Citing and
Speech, can by text compare instrument by compare text be compared with benchmark text, compare their structure and content whether one
Show the test for completing to treat test webpage.
The webpage method of testing of the embodiment of the present invention, can first obtain the web data of webpage to be tested, afterwards can be by clear
Device of looking at loads and renders the web data, to generate dom tree and/or render tree according to the web data, and according to dom tree and/
Or render tree generation compare text, and will compare text be compared with benchmark text with treat test webpage tested,
So that in test process, by will compare text be compared with benchmark text can easily orient it is inconsistent
Position, dramatically saves on webpage test human cost, improve the efficiency of test.
Fig. 2 is the flow chart of webpage method of testing in accordance with another embodiment of the present invention.
It should be noted that in one embodiment of the invention, compare text may include dom tree compare text and/or
Render tree compares text, and benchmark text may include dom tree benchmark text and/or render tree benchmark text.So can be first by dom tree
Compare text and/or render tree compares text and is compared respectively with dom tree benchmark text and/or render tree benchmark text, it
Different operations can be carried out according to comparison result afterwards.Specifically, as shown in Fig. 2 the webpage method of testing can include:
S200, obtains the web data of webpage to be tested.
For example, the URL addresses of webpage to be tested can be first read, afterwards can be according to the URL address acquisitions webpage to be tested
Web data.And for example, it can be captured to obtain the web data of webpage to be tested by testing tool.
S201, loads and renders web data, to generate dom tree and/or render tree according to web data.
Specifically, in an embodiment of the present invention, it can be loaded by browser and render web data, and according to the net
Page data generates dom tree and/or render tree.That is, after being loaded by browser and rendering web data, can parse
The web data is to generate dom tree, after dom tree, which is set up, to be completed, and can start to generate render tree.
Wherein, in an embodiment of the present invention, dom tree may include DOM element and attribute node, and it is pair of html document
It is also the interface of HTML element and extraneous (such as Javascript) as changing description.In addition, render tree is in element display sequence
Visual elements are constituted, and it is the visable representation of document, are that can draw content by correctly order according to render tree.
S202, text is compared according to dom tree and/or render tree generation.
Specifically, text can be saved as by generated dom tree and/or render tree are abstract, to generate comparison text.Example
Such as, generated dom tree and/render tree can be saved as text in the form of abstract object so that in the structure for comparing text
Appearance is made up of multiple abstract objects, such as " obj1 ... obj2 ... obj3 ... ".
Wherein, in one embodiment of the invention, comparing text may include that dom tree compares text and/or render tree ratio
To text.In addition, benchmark text may include dom tree benchmark text and/or render tree benchmark text.It should be noted that benchmark
Text is construed as received text set in advance.
S203, by dom tree compare text and/or render tree compare text respectively with dom tree benchmark text and/or render tree
Benchmark text is compared.
Wherein, in an embodiment of the present invention, dom tree, which compares text, may include multiple DOM tree nodes and each DOM
Attribute information of tree node etc..It may include multiple to render tree node and each render tree node in addition, render tree compares text
Attribute information etc..It should be appreciated that attribute information may include nodename, nodal value, node type etc..
For example, instrument can be compared by text dom tree is compared into multiple DOM tree nodes in text and each
The attribute information of DOM tree node respectively with the multiple DOM tree nodes and the category of each DOM tree node in dom tree benchmark text
Property information be compared, and/or, multiple render tree node and each category for rendering tree node by what render tree compared in text
Property information tree node is rendered with multiple in render tree benchmark text respectively and each attribute informations for rendering tree node are carried out
Compare, it is whether consistent with content to compare their structure.
S204, if dom tree compares text and/or render tree and compares text respectively with dom tree benchmark text and/or rendering
Set benchmark text consistent, then judge that webpage to be tested passes through test.
If that is, dom tree compare text and/or render tree compare text respectively with dom tree benchmark text and/or
Render tree benchmark text is consistent with being in content in structure, then can determine whether and determine that webpage to be tested passes through test.
S205, if dom tree compares text and/or render tree and compares text respectively with dom tree benchmark text and/or rendering
Tree benchmark text is inconsistent, then obtains the first difference text between dom tree comparison text and dom tree benchmark text, and/or obtain
Render tree is taken to compare the second difference text between text and render tree benchmark text.
It should be appreciated that in an embodiment of the present invention, the first difference text and/or the second difference text are respectively DOM
Tree compares the difference or repugnancy between text and dom tree benchmark text, and/or render tree compares text and render tree base
Difference or repugnancy between quasi- text.
S206, treats test webpage according to the first difference text and/or the second difference text and carries out location of mistake.
Thus, it may be such that in test process, it is easy to which ground can orient position and the reason of mistake, it is to avoid logical
The problem of manual type is crossed to recognize webpage test target, greatlys save the human cost of webpage test, improves test effect
Rate, enables adaptation to the high efficiency requirement of high-volume webpage test.
The webpage method of testing of the embodiment of the present invention, can compare dom tree the structure and content and/or render tree ratio of text
To the structure and content of text respectively with the structure and content of dom tree benchmark text and/or the structure of render tree benchmark text and
Content is compared, if unanimously, can determine whether that webpage to be tested, by test, if inconsistent, can obtain the area between them
Other part or repugnancy, and test webpage progress location of mistake is treated according to difference part or repugnancy, so as to carry
The high degree of accuracy of test.
In order to realize above-described embodiment, the invention also provides a kind of webpage test device.
Fig. 3 is the structural representation of webpage test device according to an embodiment of the invention.
Given birth to as shown in figure 3, the webpage test device can include the first acquisition module 10, the first generation module 20, second
Into module 30 and test module 40.
Specifically, the first acquisition module 10 can be used for the web data for obtaining webpage to be tested.For example, the first acquisition module
10 can first read the URL addresses of webpage to be tested, afterwards can be according to the web data of the URL address acquisitions webpage to be tested.Again
Such as, the first acquisition module 10 can be captured to obtain the web data of webpage to be tested by testing tool.
First generation module 20 can be used for loading and rendering web data, to generate document dbject model according to web data
Dom tree and/or render tree.Specifically, in an embodiment of the present invention, the first generation module 20 can be by browser loading simultaneously
Web data is rendered, to generate dom tree and/or render tree according to the web data.That is, the first generation module 20 is logical
Cross after browser loads and render web data, the web data can be parsed to generate dom tree, when dom tree sets up completion
Afterwards, it can start to generate render tree.
Wherein, in an embodiment of the present invention, dom tree may include DOM element and attribute node, and it is pair of html document
It is also the interface of HTML element and extraneous (such as Javascript) as changing description.In addition, render tree is in element display sequence
Visual elements are constituted, and it is the visable representation of document, are that can draw content by correctly order according to render tree.
Second generation module 30 can be used for comparing text according to dom tree and/or render tree generation.More specifically, the second life
Text can be saved as by generated dom tree and/or render tree are abstract, into module 30 to generate comparison text.For example, the second life
Generated dom tree and/or render tree can be saved as text in the form of abstract object into module 30 so that compare text
Structure content is made up of multiple abstract objects, such as " obj1 ... obj2 ... obj3 ... ".
Test module 40 can be used for will compare text be compared with benchmark text with treat test webpage tested.Its
In, in an embodiment of the present invention, benchmark text is construed as received text set in advance.For example, test module
40 can compare instrument by text is compared text is compared with benchmark text, compares their structure whether consistent with content
To complete the test for treating test webpage.
In addition, in one embodiment of the invention, comparing text may include that dom tree compares text and/or render tree ratio
To text, received text may include dom tree benchmark text and/or render tree benchmark text.
From above-described embodiment, in an embodiment of the present invention, as shown in figure 3, test module 40 may include to compare list
Member 41 and judging unit 42.
Specifically, comparing unit 41 can be used for by dom tree compare text and/or render tree compare text respectively with dom tree
Benchmark text and/or render tree benchmark text are compared.Wherein, in an embodiment of the present invention, dom tree compares text and can wrapped
Attribute information of multiple DOM tree nodes and each DOM tree node etc. is included, render tree, which compares text, may include multiple render trees
Node, and each render attribute information of tree node etc..It should be appreciated that attribute information may include nodename, nodal value, section
Vertex type etc..
For example, comparing unit 41 can compare instrument by multiple DOM tree nodes in dom tree comparison text by text
And the attribute information of each DOM tree node respectively with the multiple DOM tree nodes and each dom tree in dom tree benchmark text
The attribute information of node is compared, and/or, render tree is compared in text and multiple renders tree node and each render tree
The attribute information of node renders tree node and each attributes for rendering tree node with multiple in render tree benchmark text respectively
Whether information is compared, consistent with content to compare their structure.
Judging unit 42 can be used for dom tree compare text and/or render tree compare text respectively with dom tree benchmark text
And/or render tree benchmark text it is consistent when, judge webpage to be tested pass through test.That is, when dom tree compare text and/
Or it is respectively consistent in structure and content with dom tree benchmark text and/or render tree benchmark text that render tree, which compares text,
When, judging unit 42 can determine whether and determine that webpage to be tested passes through test.
Further, in one embodiment of the invention, as shown in figure 3, the webpage test device may also include second
Acquisition module 50 and locating module 60.Specifically, the second acquisition module 50 can be used for comparing text and/or render tree in dom tree
Compare text respectively with dom tree benchmark text and/or inconsistent render tree benchmark text when, obtain dom tree and compare text and DOM
Set the first difference text between benchmark text, and/or obtain render tree compare between text and render tree benchmark text the
Two difference texts.Locating module 60 can be used for treating test webpage progress according to the first difference text and/or the second difference text
Location of mistake.
Thus, it may be such that in test process, it is easy to which ground can orient position and the reason of mistake, it is to avoid logical
The problem of manual type is crossed to recognize webpage test target, greatlys save the human cost of webpage test, improves test effect
Rate, enables adaptation to the high efficiency requirement of high-volume webpage test.
Thus, by above-mentioned two embodiment, comparing unit can by dom tree compare text structure and content and/
Or render tree compares structure and content and/or render tree the benchmark text of the structure and content of text respectively with dom tree benchmark text
This structure and content is compared, if unanimously, judging unit can determine whether webpage to be tested by test, if inconsistent, the
Two acquisition modules can be obtained in place of difference between them or repugnancy, locating module according to difference part or it is inconsistent it
Place treats test webpage and carries out location of mistake, so as to improve the degree of accuracy of test.
The webpage test device of the embodiment of the present invention, can obtain the webpage number of webpage to be tested by the first acquisition module
According to the first generation module is loaded by browser and renders web data to generate dom tree according to the web data and/or render
Tree, the second generation module compares text according to dom tree and/or render tree generation, and test module will compare text and benchmark text
It is compared and is tested with treating test webpage, so that in test process, by the way that text and benchmark text will be compared
Inconsistent position can easily be oriented by being compared, and be dramatically saves on the human cost of webpage test, improved
The efficiency of test.
In order to realize above-described embodiment, the invention also provides a kind of terminal, it is necessary to illustrate, in the implementation of the present invention
In example, terminal can be regarded as PC (Personal Computer, personal computer) machine, mobile phone, tablet personal computer etc. with various behaviour
Make the hardware device of system.It may include:Shell, processor and circuit board;Circuit board is placed in the interior volume that shell is surrounded,
Processor is set on circuit boards;Processor is used to run application program, specifically for:
S101 ', obtains the web data of webpage to be tested.
For example, the URL addresses of webpage to be tested can be first read, afterwards can be according to the URL address acquisitions webpage to be tested
Web data.And for example, it can be captured to obtain the web data of webpage to be tested by testing tool.
S102 ', loads and renders web data, to generate document dbject model dom tree according to web data and/or render
Tree.
Specifically, in an embodiment of the present invention, it can be loaded by browser and render web data, and according to the net
Page data generates dom tree and/or render tree.That is, after being loaded by browser and rendering web data, can parse
The web data is to generate dom tree, after dom tree, which is set up, to be completed, and can start to generate render tree.
Wherein, in an embodiment of the present invention, dom tree may include DOM element and attribute node, and it is pair of html document
It is also the interface of HTML element and extraneous (such as Javascript) as changing description.In addition, render tree is in element display sequence
Visual elements are constituted, and it is the visable representation of document, are that can draw content by correctly order according to render tree.
S103 ', text is compared according to dom tree and/or render tree generation.
Specifically, text can be saved as by generated dom tree and/or render tree are abstract, to generate comparison text.Example
Such as, generated dom tree and/or render tree can be saved as text in the form of abstract object so that compare the structure of text
Content is made up of multiple abstract objects, such as " obj1 ... obj2 ... obj3 ... ".
Wherein, in one embodiment of the invention, comparing text may include that dom tree compares text and/or render tree ratio
To text, benchmark text may include dom tree benchmark text and/or render tree benchmark text.It can be wrapped in addition, dom tree compares text
Attribute information of multiple DOM tree nodes and each DOM tree node etc. is included, render tree, which compares text, may include multiple render trees
Node and each render attribute information of tree node etc..It should be appreciated that attribute information may include nodename, nodal value, section
Vertex type etc..
S104 ', will compare text be compared with benchmark text with treat test webpage tested.
Wherein, in an embodiment of the present invention, benchmark text is construed as received text set in advance.Citing and
Speech, can by text compare instrument by compare text be compared with benchmark text, compare their structure and content whether one
Show the test for completing to treat test webpage.
The terminal of the embodiment of the present invention, can first obtain the web data of webpage to be tested, can be loaded afterwards by browser
And the web data is rendered, to generate dom tree and/or render tree according to the web data, and according to dom tree and/or render tree
Generation compare text, and will compare text be compared with benchmark text with treat test webpage tested so that
In test process, inconsistent position can easily be oriented by being compared by will compare text and benchmark text,
The human cost of webpage test is dramatically saves on, the efficiency of test is improved.
In the description of the invention, it is to be understood that term " first ", " second " are only used for describing purpose, and can not
It is interpreted as indicating or implies relative importance or the implicit quantity for indicating indicated technical characteristic.Thus, define " the
One ", at least one this feature can be expressed or be implicitly included to the feature of " second ".In the description of the invention, " multiple "
It is meant that at least two, such as two, three etc., unless otherwise specifically defined.
Any process described otherwise above or method description are construed as in flow chart or herein, represent to include
Module, fragment or the portion of the code of one or more executable instructions for the step of realizing specific logical function or process
Point, and the scope of the preferred embodiment of the present invention includes other realization, wherein can not be by shown or discussion suitable
Sequence, including according to involved function by it is basic simultaneously in the way of or in the opposite order, carry out perform function, this should be of the invention
Embodiment person of ordinary skill in the field understood.
Represent in flow charts or logic and/or step described otherwise above herein, for example, being considered use
In the order list for the executable instruction for realizing logic function, it may be embodied in any computer-readable medium, for
Instruction execution system, device or equipment (such as computer based system including the system of processor or other can be held from instruction
The system of row system, device or equipment instruction fetch and execute instruction) use, or combine these instruction execution systems, device or set
It is standby and use.For the purpose of this specification, " computer-readable medium " can any can be included, store, communicate, propagate or pass
Defeated program is for instruction execution system, device or equipment or the dress for combining these instruction execution systems, device or equipment and using
Put.The more specifically example (non-exhaustive list) of computer-readable medium includes following:Electricity with one or more wirings
Connecting portion (electronic installation), portable computer diskette box (magnetic device), random access memory (RAM), read-only storage
(ROM), erasable edit read-only storage (EPROM or flash memory), fiber device, and portable optic disk is read-only deposits
Reservoir (CDROM).In addition, can even is that can be in the paper of printing described program thereon or other are suitable for computer-readable medium
Medium, because can then enter edlin, interpretation or if necessary with it for example by carrying out optical scanner to paper or other media
His suitable method is handled electronically to obtain described program, is then stored in computer storage.
It should be appreciated that each several part of the present invention can be realized with hardware, software, firmware or combinations thereof.Above-mentioned
In embodiment, the software that multiple steps or method can in memory and by suitable instruction execution system be performed with storage
Or firmware is realized.If, and in another embodiment, can be with well known in the art for example, realized with hardware
Any one of row technology or their combination are realized:With the logic gates for realizing logic function to data-signal
Discrete logic, the application specific integrated circuit with suitable combinational logic gate circuit, programmable gate array (PGA), scene
Programmable gate array (FPGA) etc..
Those skilled in the art are appreciated that to realize all or part of step that above-described embodiment method is carried
Rapid to can be by program to instruct the hardware of correlation to complete, described program can be stored in a kind of computer-readable storage medium
In matter, the program upon execution, including one or a combination set of the step of embodiment of the method.
In addition, each functional unit in each embodiment of the invention can be integrated in a processing module, can also
That unit is individually physically present, can also two or more units be integrated in a module.Above-mentioned integrated mould
Block can both be realized in the form of hardware, it would however also be possible to employ the form of software function module is realized.The integrated module is such as
Fruit is realized using in the form of software function module and as independent production marketing or in use, can also be stored in a computer
In read/write memory medium.
Storage medium mentioned above can be read-only storage, disk or CD etc..
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show
The description of example " or " some examples " etc. means to combine specific features, structure, material or the spy that the embodiment or example are described
Point is contained at least one embodiment of the present invention or example.In this manual, to the schematic representation of above-mentioned term not
Identical embodiment or example must be directed to.Moreover, specific features, structure, material or the feature of description can be with office
Combined in an appropriate manner in one or more embodiments or example.In addition, in the case of not conflicting, the skill of this area
Art personnel can be tied the not be the same as Example or the feature of example and non-be the same as Example or example described in this specification
Close and combine.
Although embodiments of the invention have been shown and described above, it is to be understood that above-described embodiment is example
Property, it is impossible to limitation of the present invention is interpreted as, one of ordinary skill in the art within the scope of the invention can be to above-mentioned
Embodiment is changed, changed, replacing and modification.
Claims (6)
1. a kind of webpage method of testing, it is characterised in that including:
Obtain the web data of webpage to be tested;
Load and render the web data, to generate document dbject model dom tree according to the web data and/or render
Tree;
Text is compared according to the dom tree and/or render tree generation;And
The comparison text is compared with benchmark text to test the webpage to be tested;
Wherein, the comparison text includes dom tree comparison text and/or render tree compares text, and the benchmark text includes DOM
Benchmark text and/or render tree benchmark text are set, it is described that the comparison text is compared with benchmark text to be treated to described
Test webpage carries out test and specifically included:
By the dom tree compare text and/or render tree compare text respectively with dom tree benchmark text and/or render tree benchmark
Text is compared;And
If the dom tree compares text and/or render tree compare text respectively with dom tree benchmark text and/or render tree base
Quasi- text is consistent, then judges that the webpage to be tested passes through test;
If the dom tree compares text and/or render tree compare text respectively with dom tree benchmark text and/or render tree base
Quasi- text is inconsistent, then obtains the first difference text between the dom tree comparison text and dom tree benchmark text, and/or obtain
The render tree is taken to compare the second difference text between text and render tree benchmark text;And
Location of mistake is carried out to the webpage to be tested according to the described first difference text and/or the second difference text.
2. webpage method of testing as claimed in claim 1, it is characterised in that the dom tree, which compares text, includes multiple dom trees
Node, and each attribute information of DOM tree node, the render tree compare text and render tree node including multiple, and often
The individual attribute information for rendering tree node.
3. webpage method of testing as claimed in claim 1, it is characterised in that loaded by browser and render the webpage number
According to.
4. a kind of webpage test device, it is characterised in that including:
First acquisition module, the web data for obtaining webpage to be tested;
First generation module, for loading and rendering the web data, to generate file object mould according to the web data
Type dom tree and/or render tree;
Second generation module, for comparing text according to the dom tree and/or render tree generation;And
Test module, for the comparison text to be compared with benchmark text to test the webpage to be tested;
Wherein, the comparison text includes dom tree comparison text and/or render tree compares text, and the benchmark text includes DOM
Benchmark text and/or render tree benchmark text are set, the test module includes:
Comparing unit, for by the dom tree compare text and/or render tree compare text respectively with dom tree benchmark text and/
Or render tree benchmark text is compared;And
Judging unit, for the dom tree compare text and/or render tree compare text respectively with dom tree benchmark text and/
Or render tree benchmark text it is consistent when, judge the webpage to be tested pass through test;
Second acquisition module, it is literary with dom tree benchmark respectively for comparing text in dom tree comparison text and/or render tree
When this and/or render tree benchmark text are inconsistent, first between the dom tree comparison text and dom tree benchmark text is obtained
Text is distinguished, and/or obtains the second difference text between the render tree comparison text and render tree benchmark text;And
Locating module, it is wrong for being carried out according to the described first difference text and/or the second difference text to the webpage to be tested
Position by mistake.
5. webpage test device as claimed in claim 4, it is characterised in that the dom tree, which compares text, includes multiple dom trees
Node, and each attribute information of DOM tree node, the render tree compare text and render tree node including multiple, and often
The individual attribute information for rendering tree node.
6. webpage test device as claimed in claim 4, it is characterised in that first generation module is loaded by browser
And render the web data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410476081.2A CN104239206B (en) | 2014-09-17 | 2014-09-17 | Webpage method of testing and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410476081.2A CN104239206B (en) | 2014-09-17 | 2014-09-17 | Webpage method of testing and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104239206A CN104239206A (en) | 2014-12-24 |
CN104239206B true CN104239206B (en) | 2017-08-29 |
Family
ID=52227322
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410476081.2A Active CN104239206B (en) | 2014-09-17 | 2014-09-17 | Webpage method of testing and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104239206B (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104809061B (en) * | 2015-04-09 | 2018-08-10 | 百度在线网络技术(北京)有限公司 | regression testing method and device |
CN104993943A (en) * | 2015-05-18 | 2015-10-21 | 百度在线网络技术(北京)有限公司 | Detection method and device for page availability |
CN104899336B (en) * | 2015-07-01 | 2018-05-22 | 北京博睿宏远数据科技股份有限公司 | It is a kind of to measure the first method for shielding complete render time of webpage |
CN106371987A (en) * | 2015-07-24 | 2017-02-01 | 北京奇虎科技有限公司 | Test method and device |
CN106095674B (en) * | 2016-06-07 | 2019-05-24 | 百度在线网络技术(北京)有限公司 | A kind of website automation test method and device |
CN108153659B (en) * | 2016-12-02 | 2021-12-07 | 腾讯科技(深圳)有限公司 | Program vulnerability detection method and related device |
CN111104636B (en) * | 2019-12-30 | 2023-03-24 | 上海海事大学 | Webpage shipping date data extraction method based on multi-view learning |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102654861A (en) * | 2011-03-01 | 2012-09-05 | 腾讯科技(深圳)有限公司 | Method and system for calculating webpage extraction accuracy |
CN102932197A (en) * | 2011-08-11 | 2013-02-13 | 阿里巴巴集团控股有限公司 | Testing method and system |
CN103544213A (en) * | 2013-09-16 | 2014-01-29 | 青岛英网资讯股份有限公司 | Network content upgrading detection assessment method and system |
CN103853656A (en) * | 2012-11-30 | 2014-06-11 | 阿里巴巴集团控股有限公司 | Webpage testing method and webpage testing device |
-
2014
- 2014-09-17 CN CN201410476081.2A patent/CN104239206B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102654861A (en) * | 2011-03-01 | 2012-09-05 | 腾讯科技(深圳)有限公司 | Method and system for calculating webpage extraction accuracy |
CN102932197A (en) * | 2011-08-11 | 2013-02-13 | 阿里巴巴集团控股有限公司 | Testing method and system |
CN103853656A (en) * | 2012-11-30 | 2014-06-11 | 阿里巴巴集团控股有限公司 | Webpage testing method and webpage testing device |
CN103544213A (en) * | 2013-09-16 | 2014-01-29 | 青岛英网资讯股份有限公司 | Network content upgrading detection assessment method and system |
Non-Patent Citations (1)
Title |
---|
"基于网页DOM树比对的SQL注入漏洞检测";张晨等;《计算机工程》;20120920;第38卷(第18期);文章第112页第4.2节,第114页第5节 * |
Also Published As
Publication number | Publication date |
---|---|
CN104239206A (en) | 2014-12-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104239206B (en) | Webpage method of testing and device | |
CN107220094B (en) | Page loading method and device and electronic equipment | |
CN104050078B (en) | Test script generates system | |
CN104217029B (en) | The amending method and device of a kind of configuration file | |
CN105045645B (en) | Webpage loading method, Apparatus and system | |
CN107908959A (en) | Site information detection method, device, electronic equipment and storage medium | |
CN102760139A (en) | Webpage processing method and webpage processing system | |
CN111858371A (en) | Software testing method, system, storage medium and computer equipment | |
CN110221968A (en) | Method for testing software and Related product | |
US11544176B1 (en) | Systems and methods for automatically assessing and conforming software development modules to accessibility guidelines in real-time | |
CN104956362A (en) | Analyzing structure of web application | |
CN109947637A (en) | Webpage compatibility automated test method, device, equipment and medium | |
CN108614762A (en) | A kind of browser testing method and device | |
CN106294413A (en) | The loading method of picture and device | |
CN105912328A (en) | Method and device for displaying web system page, and web system | |
CN105224465B (en) | Webpage adjustment method and device | |
CN104239441A (en) | Web page loading control method and device | |
CN106095674B (en) | A kind of website automation test method and device | |
CN109657125A (en) | Data processing method, device, equipment and storage medium based on web crawlers | |
CN110908907A (en) | Web page testing method, device, equipment and storage medium | |
US8813036B2 (en) | Visual representation of a difference between Cartesian product models | |
CN104809053A (en) | Control style testing method and device | |
CN110297957A (en) | Data processing method and device, electronic equipment and storage medium | |
CN104866359B (en) | Webpage loading method and device | |
CN116701215A (en) | Interface test case generation method, system, equipment and storage medium |
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 |