CN110908907A - Web page testing method, device, equipment and storage medium - Google Patents
Web page testing method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN110908907A CN110908907A CN201911131368.0A CN201911131368A CN110908907A CN 110908907 A CN110908907 A CN 110908907A CN 201911131368 A CN201911131368 A CN 201911131368A CN 110908907 A CN110908907 A CN 110908907A
- Authority
- CN
- China
- Prior art keywords
- web page
- page
- xml file
- changed
- elements
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 199
- 238000000034 method Methods 0.000 claims description 34
- 238000004590 computer program Methods 0.000 claims description 12
- 238000001545 Page's trend test Methods 0.000 claims description 10
- 230000008859 change Effects 0.000 abstract description 12
- 235000013351 cheese Nutrition 0.000 description 8
- 230000006870 function Effects 0.000 description 7
- 230000008569 process Effects 0.000 description 6
- BUGBHKTXTAQXES-UHFFFAOYSA-N Selenium Chemical compound [Se] BUGBHKTXTAQXES-UHFFFAOYSA-N 0.000 description 4
- 238000004891 communication Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 229910052711 selenium Inorganic materials 0.000 description 4
- 239000011669 selenium Substances 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 240000002129 Malva sylvestris Species 0.000 description 1
- 235000006770 Malva sylvestris Nutrition 0.000 description 1
- 235000013365 dairy product Nutrition 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012905 input function Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention provides a Web page testing method, a device, equipment and a storage medium, wherein an XML file corresponding to a Web page to be tested is obtained from a storage unit, and the XML file comprises page elements and a positioning mode in the Web page; judging whether page elements in the Web page are changed or not according to the XML file; if the Web page has the changed page elements, determining the changed page elements and outputting prompt information to prompt a tester to modify the test script; and acquiring the modified test script, and running the modified test script to perform regression test on the Web page. By determining the changed page elements in the Web page before running the test script, modifying the test script according to the changed page elements and running the modified test script, the interruption of the test script caused by the change of the page elements in the Web page can be effectively avoided, the time cost and the labor cost are saved, and the test efficiency is improved.
Description
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus, a device, and a storage medium for testing a Web page.
Background
With the rapid development of network technology, especially the popularization of Web and its application programs, various Web-based application programs are continuously the key points of software development due to their convenience, rapidness, easy operation, etc. The method can attract as many users as possible, and the long-time attention to the users is a main target pursued by the website and is a main index for measuring whether the website is successful, so that higher requirements are provided for the correctness, the effectiveness and the integrity of the webpage function, and the Web page test becomes an important link in the application development process.
When a Web page is an important object of current automated testing, an automated testing tool such as Selenium (browser automated testing framework) is usually adopted for the existing automated testing of the Web page to run a testing script, but because page elements often change, the automated testing of the Web page is also a difficult point of automated testing of the Web page, when the automated testing tool runs the testing script, interruption of the whole testing process caused by the change of one page element is often found out only when the testing script is quickly run and completed, the testing script needs to be modified again according to the changed page element, and the testing script is run again from the beginning, so that a large amount of time cost and labor cost are wasted, and the testing efficiency is low.
Disclosure of Invention
The invention provides a Web page testing method, a Web page testing device, Web page testing equipment and a Web page testing storage medium, which are used for effectively avoiding the interruption of a testing script caused by the change of page elements in a Web page when the Web page is tested, saving time cost and labor cost and improving testing efficiency.
The first aspect of the present invention provides a Web page testing method, including:
acquiring an XML file corresponding to a Web page to be tested from a storage unit, wherein the XML file comprises page elements and a positioning mode in the Web page;
judging whether page elements in the Web page are changed or not according to the XML file;
if the Web page has changed page elements, determining the changed page elements, and outputting prompt information, wherein the prompt information is used for prompting a tester to modify a test script according to the changed page elements;
and acquiring the modified test script, and running the modified test script to perform regression test on the Web page.
According to an embodiment of the present invention, the determining whether a page element in the Web page is changed according to the XML file includes:
traversing page elements in the Web page contained in the XML file, and respectively comparing the page elements in the Web page contained in the XML file with actual page elements in the Web page;
and if the page elements in the Web page contained in the XML file are inconsistent with the actual page elements in the Web page in comparison, determining that the page elements in the Web page are changed.
According to one embodiment of the invention, page elements in the Web page are identified in the XML file by predetermined tags; the traversing of page elements in the Web page contained in the XML file includes: and traversing page elements in the Web page contained in the XML file according to the preset label.
According to an embodiment of the present invention, before the obtaining the XML file corresponding to the Web page to be tested from the storage unit, the method further includes:
and acquiring page elements and a positioning mode in the Web page to generate the XML file, and storing the XML file in the storage unit.
According to an embodiment of the present invention, the running the modified test script to perform the regression test on the Web page includes:
and positioning the position of the page element in the Web page by the test script according to the positioning mode of the page element in the XML file, and testing according to the test data corresponding to the page element.
According to an embodiment of the present invention, after the determining the changed page element, the method further includes:
updating the XML file according to the changed page elements;
after the obtaining of the modified test script and before the running of the modified test script performs regression testing on the Web page, the method further includes:
and judging whether the page elements in the Web page are changed again according to the updated XML file.
According to an embodiment of the present invention, the determining whether a page element in the Web page is changed according to the XML file includes:
judging whether the page elements in the Web page are changed or not according to the XML file at regular time; or
And when the Web page is detected to be updated, judging whether the page elements in the Web page are changed or not according to the XML file.
The second aspect of the present invention provides a Web page testing apparatus, including:
the reading module is used for acquiring an XML file corresponding to a Web page to be tested from a storage unit, wherein the XML file comprises page elements and a positioning mode in the Web page;
the judging module is used for judging whether the page elements in the Web page are changed or not according to the XML file;
the output module is used for determining the changed page elements and outputting prompt information if the page elements in the Web page are changed, wherein the prompt information is used for prompting a tester to modify the test script according to the changed page elements;
and the testing module is used for acquiring the modified testing script and running the modified testing script to perform regression testing on the Web page.
A third aspect of the present invention provides a Web page test apparatus, including:
a memory;
a processor; and
a computer program;
wherein the computer program is stored in the memory and configured to be executed by the processor to implement the apparatus of the first aspect.
A fourth aspect of the present invention is to provide a computer-readable storage medium having stored thereon a computer program;
the computer program, when executed by a processor, implements an apparatus as described in the first aspect.
According to the Web page testing method, the Web page testing device, the Web page testing equipment and the Web page testing storage medium, the XML file corresponding to the Web page to be tested is obtained from the storage unit, wherein the XML file comprises the page elements and the positioning mode in the Web page; judging whether page elements in the Web page are changed or not according to the XML file; if the Web page has changed page elements, determining the changed page elements, and outputting prompt information, wherein the prompt information is used for prompting a tester to modify a test script according to the changed page elements; and acquiring the modified test script, and running the modified test script to perform regression test on the Web page. By determining the changed page elements in the Web page before running the test script, modifying the test script according to the changed page elements and then running the modified test script, the interruption of the test script caused by the change of the page elements in the Web page can be effectively avoided, the time cost and the labor cost are saved, and the test efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flowchart of a method for testing a Web page according to an embodiment of the present invention;
FIG. 2 is a flowchart of a Web page testing method according to another embodiment of the present invention;
fig. 3 is a structural diagram of a Web page testing apparatus according to an embodiment of the present invention;
fig. 4 is a structural diagram of a Web page test apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the embodiment of the invention, the test of the Web page is realized by running the test script, wherein the test script is used for configuring corresponding test data for the page elements for various functions (such as an input box, a registration login function and a search function) of the Web page, so that the page elements need to be sequentially positioned and tested according to the test data when the test script is run, for example, for the Web page logged in at a vehicle insurance, the input functions of personal information, vehicle information, strong insurance information, business insurance information and the like need to be tested, and therefore, the test data in each page needs to be input into the corresponding input box through the test script; when page elements in the Web page are changed but the original test script is still used, the test script cannot accurately input test data, so that the running of the test script is interrupted; according to the Web page testing method, before the testing script is operated, the changed page elements in the Web page are determined, the testing script is modified according to the changed page elements, and then the modified testing script is operated, so that the interruption of the testing script caused by the change of the page elements in the Web page can be effectively avoided, the time cost and the labor cost are saved, and the testing efficiency is improved. It should be noted that the Web page testing method provided by the embodiment of the present invention may be executed at regular time or executed each time the related item of the Web page is updated.
The following describes the Web page testing method according to an embodiment of the present invention in detail with reference to specific embodiments.
Fig. 1 is a flowchart of a Web page testing method according to an embodiment of the present invention. The embodiment provides a Web page testing method, which comprises the following specific steps:
s101, obtaining an XML file corresponding to a Web page to be tested from a storage unit, wherein the XML file comprises page elements and a positioning mode in the Web page.
In this embodiment, before the Web page test, the page elements and the positioning manner in the Web page may be obtained in advance to generate the XML file, for example, for a Web page for vehicle insurance login, the page elements may be packaged into an XML file as shown below:
< page name >
< Element eleName ═ id ═ userNameInput ═ isElement ═ true >
< Element elenmeme ═ password "id ═ password" isElement ═ true >
< Element elenmeme ═ registration "xpath ═// [ @ type ═ loginbutton' ]" isElement ═ true "/>, and
</page>
the eleName is "username", which indicates that the name of the page element is "username", the id is "UserNameInput", which indicates that the positioning manner of the page element on the Web page can be positioned by id (for example, the Selenium browser automation test framework can be used to position the page element in the Web page according to id), and the isElement is "true", which is a predetermined tag, and is used to quickly position the page element in the XML file when the page element in the XML file needs to be traversed subsequently. The XML file is stored in the storage unit after being generated.
When the related items of the Web page are updated, that is, the Web page may have updates, a regression test of the Web page is required to be performed to confirm that no new error is introduced to the update of the Web page or other codes are erroneous, or a regression test task (no waiting for the update of the items) may be performed at regular time, and the XML file may be read from the storage unit before the test script of the Web page is run, so as to determine whether the page elements in the Web page are changed according to the XML file before the test script is run, modify the test script if the page elements are changed, and update the XML file. That is, the page elements in the Web page included in the XML file are actually the page elements in the Web page of the historical version before the regression test of this time, and preferably the page elements in the Web page after the last regression test.
And S102, judging whether the page elements in the Web page are changed or not according to the XML file.
In this embodiment, because the page elements in the Web page of the historical version before the regression test of this time are maintained in the XML file, whether the page elements in the Web page are changed or not can be determined according to the XML file.
Specifically, as shown in fig. 2, the determining, by the XML file, whether a page element in the Web page is changed includes:
s201, traversing Web page elements in the Web page contained in the XML file, and comparing the Web page elements in the Web page contained in the XML file with actual page elements in the Web page respectively;
s202, if the page elements in the Web page contained in the XML file are not consistent with the actual page elements in the Web page in comparison, determining that the page elements in the Web page are changed.
In this embodiment, page elements in a Web page recorded by an XML file may be traversed, for any page element, a corresponding page element may be searched for in the Web page according to its positioning manner, and if the corresponding page element can be searched for, it is indicated that the page element exists in the Web page and is not modified; in addition, the page elements can also be acquired from the Web page, and the acquired page elements are compared with the page elements in the Web page contained in the XML file, so that the change of the page elements is determined.
In an optional embodiment, the page elements in the Web page are identified in the XML file by a predetermined tag, for example, "isElement" true "in the XML file is a predetermined tag, and traversing the page elements in the Web page included in the XML file according to the predetermined tag can locate the page elements in the Web page included in the XML file faster in the traversing process. Specifically, the traversal of the page elements in the Web page contained in the XML file can be realized by the following codes:
in addition, when a Web page is updated and a test script is written, changed page elements and the positioning mode thereof can be added into an XML file in advance, for example, new page elements are added into the Web page, the added page elements and the positioning mode thereof can be added into the XML file in advance when the Web page is updated and the test script is written, and further, when S201-S202 is executed, if the new page elements are added into the Web page, the test script and the XML file at the same time, the change of the page elements cannot be detected; however, if the new page element is added to both the test script and the XML file, but the new page element is not added to the Web page, it indicates that the new page element is changed in the Web page.
S103, if the page elements in the Web page are changed, determining the changed page elements, and outputting prompt information, wherein the prompt information is used for prompting a tester to modify the test script according to the changed page elements.
And S104, acquiring the modified test script, and running the modified test script to perform regression test on the Web page.
In this embodiment, when it is determined that a page element in the Web page has changed, the changed page element may be determined, and a prompt message may be sent, a tester modifies the test script according to the prompt message, then runs the test script after the modification, and performs a regression test on the Web page, which may effectively avoid interruption of script operation due to the change of the page element in the Web page but still using the original test script, save time cost and labor cost, and improve test efficiency.
Of course, if it is determined that the Web page has page elements that are not changed, the test script may be directly run without modifying the test script to complete the regression test of the Web page.
Further, when running the modified test script to perform the regression test on the Web page, the method may specifically include:
and positioning the position of the page element in the Web page by the test script according to the positioning mode of the page element in the XML file, and testing according to the test data corresponding to the page element.
In this embodiment, when a test script is run (not limited to the modified test script, and any test script may be run), the test script may locate the position of the page element in the Web page according to the positioning manner of the page element in the XML file, and then perform a test according to the corresponding test data, for example, test the input frame module, and may locate the position of the input frame according to the positioning manner of the page element of the input frame module in the XML file, and then input the test data into the input frame for the test.
In the method for testing a Web page provided by this embodiment, an XML file corresponding to a Web page to be tested is acquired from a storage unit, where the XML file includes a page element and a positioning manner in the Web page; judging whether page elements in the Web page are changed or not according to the XML file; if the Web page has changed page elements, determining the changed page elements, and outputting prompt information, wherein the prompt information is used for prompting a tester to modify a test script according to the changed page elements; and acquiring the modified test script, and running the modified test script to perform regression test on the Web page. By determining the changed page elements in the Web page before running the test script, modifying the test script according to the changed page elements and then running the modified test script, the interruption of the test script caused by the change of the page elements in the Web page can be effectively avoided, the time cost and the labor cost are saved, and the test efficiency is improved.
On the basis of the foregoing embodiment, before acquiring the XML file corresponding to the Web page to be tested from the storage unit, the method may further include:
and acquiring page elements and a positioning mode in the Web page to generate the XML file, and storing the XML file in the storage unit.
In this embodiment, the page elements in the Web page may be located by the Selenium browser automation test frame, specifically, the Selenium browser automation test frame locates the page elements in the Web page, such as id, name, xpath, tag, class, CSS, link, partial _ link, and the locating manners are respectively as follows. After the page elements and the positioning mode in the Web page are obtained, the XML file as shown in the figure can be generated and stored.
WebElement element=driver.findElement(By.id(″elementID″));
List<WebElement>cheeses=driver.findElements(By.className(″cheese″));
WebElement frame=driver.findElement(By.tagName(″ifame″));
WebElementcheese=driver.findElement(By.name(″cheese″));
WebElement cheese=driver.findElement(By.linkText(″cheese″));
WebElement cheese=driver.findElement(By.partialLinkText(″cheese″));
WebElement cheese=driver.findElement(By.cssSelector(″#foodspan.dairy.aged″));
List<WebElement>inputs=driver.findElement(By.xpath(″//input″));
On the basis of any of the above embodiments, after the determining the changed page element, the method further includes:
updating the XML file according to the changed page elements;
in this embodiment, after determining the changed page elements in the Web page, the test script is modified and the XML file needs to be updated, that is, the changed page elements and the positioning manner in the XML file are updated, so that the updated XML file is used as a basis when the Web page test is performed next time.
Further, after the tester modifies the test script according to the changed page element and before the regression test is performed on the Web page by running the modified test script, the method further includes:
and judging whether the page elements in the Web page are changed again according to the updated XML file.
In this embodiment, after determining the changed page elements in the Web page and modifying the test script, it may be determined again whether the page elements in the Web page have changed according to the updated XML file, so as to prevent missing the changed page elements, especially, there may be a new change of the page elements in the process of modifying the test script, or the missing changed page elements are not recognized in the last determination.
Fig. 3 is a structural diagram of a Web page testing apparatus according to an embodiment of the present invention. The Web page testing apparatus provided in this embodiment may execute the processing flow provided in the Web page testing method embodiment, as shown in fig. 3, the Web page testing apparatus 30 includes a reading module 31, a determining module 32, an output module 33, and a testing module 34.
The reading module 31 is configured to obtain an XML file corresponding to a to-be-tested Web page from a storage unit, where the XML file includes a page element and a positioning mode in the Web page;
a judging module 32, configured to judge whether a page element in the Web page changes according to the XML file;
the output module 33 is configured to determine a changed page element if the page element in the Web page is changed, and output a prompt message, where the prompt message is used to prompt a tester to modify a test script according to the changed page element;
and the test module 34 is configured to obtain the modified test script, and run the modified test script to perform regression test on the Web page.
On the basis of the above embodiment, when determining whether a page element in the Web page is changed according to the XML file, the determining module 32 is configured to:
traversing page elements in the Web page contained in the XML file, and respectively comparing the page elements in the Web page contained in the XML file with actual page elements in the Web page;
and if the page elements in the Web page contained in the XML file are inconsistent with the actual page elements in the Web page in comparison, determining that the page elements in the Web page are changed.
On the basis of the above embodiment, the page elements in the Web page are identified by predetermined tags in the XML file;
when traversing page elements in the Web page included in the XML file, the determining module 32 is configured to:
and traversing page elements in the Web page contained in the XML file according to the preset label.
On the basis of the above embodiment, the apparatus further includes a generating module, configured to obtain a page element and a positioning manner in the Web page to generate an XML file before obtaining the XML file corresponding to the Web page to be tested from a storage unit, and store the XML file in the storage unit.
On the basis of the foregoing embodiment, when the modified test script is run to perform the regression test on the Web page, the test module 34 is configured to:
and positioning the position of the page element in the Web page by the test script according to the positioning mode of the page element in the XML file, and testing according to the test data corresponding to the page element.
On the basis of the above embodiment, the generating module is further configured to update the XML file according to the changed page element after determining the changed page element;
the determining module 32 is further configured to determine again whether a page element in the Web page is changed according to the updated XML file after the modified test script is obtained and before the modified test script is run to perform the regression test on the Web page.
On the basis of the above embodiment, when determining whether a page element in the Web page is changed according to the XML file, the determining module 32 is configured to:
judging whether the page elements in the Web page are changed or not according to the XML file at regular time; or
And when the Web page is detected to be updated, judging whether the page elements in the Web page are changed or not according to the XML file.
The Web page testing apparatus provided in the embodiment of the present invention may be specifically configured to execute the method embodiment provided in fig. 1, and specific functions are not described herein again.
The Web page testing device provided by the embodiment of the invention acquires the XML file corresponding to the Web page to be tested from the storage unit, wherein the XML file comprises the page elements and the positioning mode in the Web page; judging whether page elements in the Web page are changed or not according to the XML file; if the Web page has changed page elements, determining the changed page elements, and outputting prompt information, wherein the prompt information is used for prompting a tester to modify a test script according to the changed page elements; and acquiring the modified test script, and running the modified test script to perform regression test on the Web page. By determining the changed page elements in the Web page before running the test script, modifying the test script according to the changed page elements and then running the modified test script, the interruption of the test script caused by the change of the page elements in the Web page can be effectively avoided, the time cost and the labor cost are saved, and the test efficiency is improved.
Fig. 4 is a schematic structural diagram of a Web page test device according to an embodiment of the present invention. The Web page test device provided by the embodiment of the present invention may execute the processing flow provided by the Web page test method embodiment, as shown in fig. 4, the Web page test device 40 includes a memory 41, a processor 42, a computer program, and a communication interface 43; wherein the computer program is stored in the memory 41 and is configured to be executed by the processor 42 for the Web page testing method as described in the above embodiments.
The Web page testing device in the embodiment shown in fig. 4 may be used to implement the technical solution of the above method embodiment, and the implementation principle and the technical effect are similar, which are not described herein again.
In addition, the present embodiment also provides a computer-readable storage medium on which a computer program is stored, the computer program being executed by a processor to implement the Web page testing method described in the above embodiment.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working process of the device described above, reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (10)
1. A Web page testing method is characterized by comprising the following steps:
acquiring an XML file corresponding to a Web page to be tested from a storage unit, wherein the XML file comprises page elements and a positioning mode in the Web page;
judging whether page elements in the Web page are changed or not according to the XML file;
if the Web page has changed page elements, determining the changed page elements, and outputting prompt information, wherein the prompt information is used for prompting a tester to modify a test script according to the changed page elements;
and acquiring the modified test script, and running the modified test script to perform regression test on the Web page.
2. The method of claim 1, wherein said determining whether a page element in the Web page has changed according to the XML file comprises:
traversing page elements in the Web page contained in the XML file, and respectively comparing the page elements in the Web page contained in the XML file with actual page elements in the Web page;
and if the page elements in the Web page contained in the XML file are inconsistent with the actual page elements in the Web page in comparison, determining that the page elements in the Web page are changed.
3. The method of claim 2, wherein page elements in the Web page are identified in the XML file with predetermined tags;
the traversing of page elements in the Web page contained in the XML file includes:
and traversing page elements in the Web page contained in the XML file according to the preset label.
4. The method of claim 1, wherein before retrieving the XML file corresponding to the Web page to be tested from the storage unit, the method further comprises:
and acquiring page elements and a positioning mode in the Web page to generate the XML file, and storing the XML file in the storage unit.
5. The method of any of claims 1-4, wherein running the modified test script to perform regression testing on the Web page comprises:
and positioning the position of the page element in the Web page by the test script according to the positioning mode of the page element in the XML file, and testing according to the test data corresponding to the page element.
6. The method of claim 1, wherein after said determining changed page elements, the method further comprises:
updating the XML file according to the changed page elements;
after the obtaining of the modified test script and before the running of the modified test script performs regression testing on the Web page, the method further includes:
and judging whether the page elements in the Web page are changed again according to the updated XML file.
7. The method of claim 1, wherein said determining whether a page element in the Web page has changed according to the XML file comprises:
judging whether the page elements in the Web page are changed or not according to the XML file at regular time; or
And when the Web page is detected to be updated, judging whether the page elements in the Web page are changed or not according to the XML file.
8. A Web page testing apparatus, comprising:
the reading module is used for acquiring an XML file corresponding to a Web page to be tested from a storage unit, wherein page elements and a positioning mode in the Web page are recorded in the XML file;
the judging module is used for judging whether the page elements in the Web page are changed or not according to the XML file;
the output module is used for determining the changed page elements and outputting prompt information if the page elements in the Web page are changed, wherein the prompt information is used for prompting a tester to modify the test script according to the changed page elements;
and the testing module is used for acquiring the modified testing script and running the modified testing script to perform regression testing on the Web page.
9. A Web page test apparatus, comprising:
a memory;
a processor; and
a computer program;
wherein the computer program is stored in the memory and configured to be executed by the processor to implement the method of any one of claims 1-7.
10. A computer-readable storage medium, having stored thereon a computer program;
the computer program, when executed by a processor, implementing the method of any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911131368.0A CN110908907A (en) | 2019-11-19 | 2019-11-19 | Web page testing method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911131368.0A CN110908907A (en) | 2019-11-19 | 2019-11-19 | Web page testing method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110908907A true CN110908907A (en) | 2020-03-24 |
Family
ID=69818046
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911131368.0A Pending CN110908907A (en) | 2019-11-19 | 2019-11-19 | Web page testing method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110908907A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112559372A (en) * | 2020-12-24 | 2021-03-26 | 南方电网深圳数字电网研究院有限公司 | Interface test case generation method, system and storage medium |
CN113032279A (en) * | 2021-04-22 | 2021-06-25 | 东南大学 | Web application testing and repairing method based on semantic path search |
CN113760717A (en) * | 2020-11-23 | 2021-12-07 | 北京沃东天骏信息技术有限公司 | Method and device for testing page component |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103034583A (en) * | 2011-09-30 | 2013-04-10 | 国际商业机器公司 | Method and system for processing automatic test scrip of software |
CN107451065A (en) * | 2017-08-18 | 2017-12-08 | 郑州云海信息技术有限公司 | A kind of method and system of reparation web automatic test scripts |
CN107451052A (en) * | 2017-07-11 | 2017-12-08 | 广州慧睿思通信息科技有限公司 | One kind is based on Web system positioning webpage element test method |
-
2019
- 2019-11-19 CN CN201911131368.0A patent/CN110908907A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103034583A (en) * | 2011-09-30 | 2013-04-10 | 国际商业机器公司 | Method and system for processing automatic test scrip of software |
CN107451052A (en) * | 2017-07-11 | 2017-12-08 | 广州慧睿思通信息科技有限公司 | One kind is based on Web system positioning webpage element test method |
CN107451065A (en) * | 2017-08-18 | 2017-12-08 | 郑州云海信息技术有限公司 | A kind of method and system of reparation web automatic test scripts |
Non-Patent Citations (1)
Title |
---|
邢伟超,高晓桐: "网页自动化测试框架的设计与实现" * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113760717A (en) * | 2020-11-23 | 2021-12-07 | 北京沃东天骏信息技术有限公司 | Method and device for testing page component |
CN112559372A (en) * | 2020-12-24 | 2021-03-26 | 南方电网深圳数字电网研究院有限公司 | Interface test case generation method, system and storage medium |
CN112559372B (en) * | 2020-12-24 | 2024-05-14 | 南方电网数字平台科技(广东)有限公司 | Method, system and storage medium for generating interface test case |
CN113032279A (en) * | 2021-04-22 | 2021-06-25 | 东南大学 | Web application testing and repairing method based on semantic path search |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108683562B (en) | Anomaly detection positioning method and device, computer equipment and storage medium | |
EP3161610B1 (en) | Optimized browser rendering process | |
US20170192882A1 (en) | Method and system for automatically generating a plurality of test cases for an it enabled application | |
CN110908907A (en) | Web page testing method, device, equipment and storage medium | |
CN104657274B (en) | software interface test method and device | |
CN109947637B (en) | Automatic testing method, device, equipment and medium for webpage compatibility | |
US20150089415A1 (en) | Method of processing big data, apparatus performing the same and storage media storing the same | |
CN112380255A (en) | Service processing method, device, equipment and storage medium | |
US20180210819A1 (en) | System and method of controlling a web browser plug-in for testing analytics | |
CN111949607B (en) | Method, system and device for monitoring UDT file | |
US11151026B2 (en) | System and method for autonomous testing | |
CA2786418A1 (en) | Identifying equivalent javascript events | |
CN113505895B (en) | Machine learning engine service system, model training method and configuration method | |
CN105739717B (en) | Data inputting method and device | |
US20160299880A1 (en) | Method and device for updating web page | |
CN103593429A (en) | Commodity template failure detection method and device | |
CN111949510A (en) | Test processing method and device, electronic equipment and readable storage medium | |
CN111400245B (en) | Art resource migration method and device | |
CN108572900B (en) | Blank pit position monitoring method, system, electronic equipment and storage medium | |
US11755455B1 (en) | Detecting and correcting user interface discrepancies | |
US20220244975A1 (en) | Method and system for generating natural language content from recordings of actions performed to execute workflows in an application | |
KR102349495B1 (en) | A computer system and method for processing large log files from virtual servers. | |
CN111309623B (en) | Coordinate class data classification test method and device | |
CN113590496A (en) | Automatic testing method and device | |
CN110275731B (en) | Information processing method, information processing apparatus, storage medium, and electronic device |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200324 |