CN113360366A - Web page testing method, testing device, electronic equipment and storage medium - Google Patents
Web page testing method, testing device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113360366A CN113360366A CN202010146734.6A CN202010146734A CN113360366A CN 113360366 A CN113360366 A CN 113360366A CN 202010146734 A CN202010146734 A CN 202010146734A CN 113360366 A CN113360366 A CN 113360366A
- Authority
- CN
- China
- Prior art keywords
- web page
- test
- module
- simulation operation
- testing
- 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 273
- 238000004088 simulation Methods 0.000 claims abstract description 115
- 238000000034 method Methods 0.000 claims abstract description 65
- 230000008569 process Effects 0.000 claims description 26
- 238000004590 computer program Methods 0.000 claims description 12
- 230000008859 change Effects 0.000 claims description 10
- 230000006870 function Effects 0.000 description 32
- 230000004048 modification Effects 0.000 description 6
- 238000012986 modification Methods 0.000 description 6
- BUGBHKTXTAQXES-UHFFFAOYSA-N Selenium Chemical compound [Se] BUGBHKTXTAQXES-UHFFFAOYSA-N 0.000 description 4
- 238000001514 detection method Methods 0.000 description 4
- 229910052711 selenium Inorganic materials 0.000 description 4
- 239000011669 selenium Substances 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000010998 test method Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000012545 processing 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 embodiment of the invention provides a Web page testing method, a testing device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a script generated after simulation operation on a Web page to be tested; extracting the page element information and the information related to the simulation operation from the script and generating a configuration file; generating a test case by using the configuration file; and testing the Web page by using the test case. The embodiment of the invention can improve the testing efficiency of the Web page and is more suitable for application scenes needing large-batch test cases.
Description
Technical Field
The present invention relates to the field of Web page testing technologies, and in particular, to a Web page testing method, a testing apparatus, an electronic device, and a storage medium.
Background
In a Web (World Wide Web) page development process, a Web page needs to be tested, for example, a User Interface (UI) of the Web page is tested.
The existing test method for the Web page is mainly performed through test tools, such as selenium and webdriver, where selenium is also called selenium RC, and both of them can be used to test whether functions of the Web page are normal. In the prior art, when testing a Web page, a script is obtained by recording simulation operation of a script to be tested by using a Selenium-IDE plug-in a Selenium RC, then page element information carried in the script is manually checked, and a test case is manually generated based on the page element information to test the Web page, wherein the simulation operation refers to simulation of user operation, and the script refers to a script generated when simulating user operation.
However, since the test cases need to be obtained after being manually stored after being generated, there is a problem that it is inconvenient to execute the test cases in a batch manner, resulting in low test efficiency.
Disclosure of Invention
The embodiment of the invention aims to provide a Web page testing method, a testing device, electronic equipment and a storage medium, so as to improve the efficiency of testing a Web page. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a Web page testing method, including:
acquiring a script generated after simulation operation on a Web page to be tested, wherein the script carries: page element information of the Web page to be tested and information related to simulation operation;
extracting the page element information and the information related to the simulation operation from the script and generating a configuration file;
generating a test case by using the configuration file;
and testing the Web page by using the test case.
Optionally, the step of extracting the page element information and the information related to the simulation operation from the script and generating the configuration file includes:
generating a configuration file by utilizing preset test case function requirements and the extracted page element information and the information related to the simulation operation, wherein the test case function requirements comprise: the method comprises the following steps of requiring example backup, requiring example creation, requiring example restart, requiring example configuration information change, and requiring example process node addition, wherein the page element information comprises: the name of the page element, the positioning mode of the page element, and the position information of the page element on the Web page to be tested, wherein the information related to the simulation operation includes: operation flow information of the simulation operation and an input value of the simulation operation.
Optionally, the step of extracting the page element information and the information related to the simulation operation from the script and generating the configuration file includes:
generating a plurality of configuration files by using the preset test requirements of each functional module in the Web page to be tested and the extracted page element information and the information related to the simulation operation, wherein the functional modules comprise: the system comprises an example backup module, an example creating module, an example restarting module, an example configuration information changing module and an example process node adding module;
the step of generating the test case by using the configuration file includes:
and generating a plurality of test cases by using the plurality of configuration files, wherein different test cases are used for testing each functional module in the Web page to be tested.
Optionally, the step of testing the Web page by using the test case includes:
and utilizing each test case in the plurality of test cases to test the functional module corresponding to the test case respectively.
Optionally, before the testing the Web page by using the test case, the method further includes:
creating a test task of the test case, wherein the test task is used for testing a current functional module, and the current functional module is any module of the Web page;
the step of testing the Web page by using the test case includes:
comparing the running data of the test task with the configuration data in the test case to obtain a comparison result;
and judging whether the current functional module passes the test or not based on the comparison result.
Optionally, the step of determining whether the current functional module passes the test based on the comparison result includes:
if the comparison result is consistent, determining that the current functional module passes the test;
and if the comparison result is inconsistent, determining that the current functional module fails to pass the test.
Optionally, the step of obtaining the script generated after the simulation operation on the to-be-tested Web page includes:
carrying out simulation operation on the Web page to be tested;
and recording the simulation operation to obtain a script of the simulation operation.
In a second aspect, an embodiment of the present invention provides a Web page testing apparatus, including:
the acquisition module is used for acquiring a script generated after simulation operation on the Web page to be tested, wherein the script carries: page element information of the Web page to be tested and information related to simulation operation;
the first generation module is used for extracting the page element information and the information related to the simulation operation from the script and generating a configuration file;
the second generation module is used for generating a test case by utilizing the configuration file;
and the testing module is used for testing the Web page by using the test case.
Optionally, the first generating module is specifically configured to:
generating a configuration file by utilizing preset test case function requirements and the extracted page element information and the information related to the simulation operation, wherein the test case function requirements comprise: the method comprises the following steps of requiring example backup, requiring example creation, requiring example restart, requiring example configuration information change, and requiring example process node addition, wherein the page element information comprises: the name of the page element, the positioning mode of the page element, and the position information of the page element on the Web page to be tested, wherein the information related to the simulation operation includes: operation flow information of the simulation operation and an input value of the simulation operation.
Optionally, the first generating module is specifically configured to:
generating a plurality of configuration files by using the preset test requirements of each functional module in the Web page to be tested and the extracted page element information and the information related to the simulation operation, wherein the functional modules comprise: the system comprises an example backup module, an example creating module, an example restarting module, an example configuration information changing module and an example process node adding module;
the second generating module is specifically configured to:
and generating a plurality of test cases by using the plurality of configuration files, wherein different test cases are used for testing each functional module in the Web page to be tested.
Optionally, the test module is specifically configured to:
and utilizing each test case in the plurality of test cases to test the functional module corresponding to the test case respectively.
Optionally, the apparatus further comprises:
the creating module is used for creating a test task of the test case, the test task is used for testing a current functional module, and the current functional module is any one module of the Web page;
the test module is specifically configured to:
comparing the running data of the test task with the configuration data in the test case to obtain a comparison result;
and judging whether the current functional module passes the test or not based on the comparison result.
Optionally, the test module is specifically configured to:
if the comparison result is consistent, determining that the current functional module passes the test;
and if the comparison result is inconsistent, determining that the current functional module fails to pass the test.
Optionally, the obtaining module includes:
the simulation submodule is used for carrying out simulation operation on the Web page to be tested;
and the recording submodule is used for recording the simulation operation to obtain the script of the simulation operation.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions capable of being executed by the processor, and the processor executes the machine-executable instructions to implement the method steps of the Web page testing method provided in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method steps of the Web page testing method provided in the first aspect are implemented.
In a fifth aspect, an embodiment of the present invention further provides a computer program product containing instructions, which when run on a computer, causes the computer to perform the method steps of the Web page testing method provided in the first aspect.
In a sixth aspect, an embodiment of the present invention further provides a computer program, which when run on a computer, causes the computer to execute the method steps of the Web page testing method provided in the first aspect.
According to the Web page testing method, the testing device, the electronic equipment and the storage medium provided by the embodiment of the invention, after the script generated after the simulation operation on the Web page to be tested is acquired, the script page element information and the information related to the simulation operation of the script are extracted from the script, the configuration file is generated, and then the configuration file is used for generating the test case, so that the script Web page is tested by using the test case. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
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, 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 the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a Web page testing method according to an embodiment of the present invention;
fig. 2 is another schematic flow chart of a Web page testing method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a Web page testing apparatus according to an embodiment of the present invention;
fig. 4 is another schematic structural diagram of a Web page testing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device 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.
The existing test method for the Web Page can also adopt a method of a Page object design mode, that is, after the Page elements in the Web Page are positioned, the Page elements are put into different Page (Page) functions for automatic use, but the method is complex to operate in the process of putting the Page elements into different Page functions, is not friendly enough to inexperienced operators, and needs to reposition the Page elements each time under the condition that the Page elements are frequently changed, and the positioning process of the Page elements is complicated, so that wrong elements are easily obtained.
Referring to this, as shown in fig. 1, an embodiment of the present invention provides a Web page testing method, which may include the following steps:
s101, obtaining a script generated after simulation operation on the Web page to be tested.
In the embodiment of the present invention, the electronic device may perform a simulation operation on the to-be-tested Web page, for example, a simulation user clicks a link in the to-be-tested Web page, simulates content input by the user in an input box of the to-be-tested Web page, simulates an operation such as a value selected by the user from a pull-down list of the to-be-tested Web page, and generates a script after the simulation operation, where the script may carry: page element information of the Web page to be tested, and information related to the simulation operation. The page element information refers to information related to page elements in a Web page to be tested, and the content contained therein will be shown in the following embodiments, and the information related to simulation operation refers to information generated during simulation operation, and the content contained therein will also be shown in the following embodiments. The electronic device may refer to a server, an electronic computer, a mobile terminal, and the like.
The script may further include: the command generated after each simulation operation may be, for example, a click command for simulating an operation of a user clicking a link in a Web page to be tested, an input command for simulating an operation of a content input by the user in an input box of the Web page to be tested, and a selection command for simulating an operation of a value selected by the user from a pull-down list of the Web page to be tested.
S102, extracting page element information and information related to simulation operation from the script, and generating a configuration file.
After the script is obtained, because the script carries the page element information of the Web page to be tested and the information related to the simulation operation, the page element information and the information related to the simulation operation can be extracted from the script, so as to generate a configuration file. The suffix name of the configuration file is usually conf, an abbreviation for configuration config.
And S103, generating a test case by using the configuration file.
In the embodiment of the invention, after the configuration file is obtained, a test case can be generated by using the configuration file, and the test case can contain input parameters, execution conditions and expected results of the test so as to test the functions of the Web page to be tested.
And S104, testing the Web page by using the test case.
After the test case is generated, the embodiment of the invention can test the Web page by using the test case, for example, test each function in the Web page.
As an optional implementation manner of the embodiment of the present invention, a configuration file may be generated by using preset test case function requirements, extracted page element information, and information related to simulation operations, so that the configuration file is generated according to requirements of testers, thereby improving user experience.
The function requirement of the test case may refer to requirement information of a function that a tester can implement the test case, and may include: the method comprises the following steps of instance backup requirement, instance creation requirement, instance restart requirement, instance configuration information change requirement, instance process node increase requirement and the like, wherein an instance can be referred to as a test case for short. Of course, the function requirements of the test case can be preset according to the requirements of the testers.
The page element information may include: the name of the page element, the positioning mode of the page element, the position information of the page element on the Web page to be tested, and the path of the page element. The page element may refer to a content element constituting a Web page, and may include, for example: content elements such as characters, pictures, audio, animation, video and the like; the positioning mode of the page element may refer to positioning the current page element in the Web page by using a certain positioning method, for example, positioning through an identification number (ID) of the page element, or positioning through a name (name) of the page element, and the like; the position information of the page element on the to-be-tested Web page can refer to the position coordinates of the page element on the to-be-tested Web page. In the process of setting the Web page, different page elements can be named, or different marks are added, or the position coordinates of the page elements in the Web page are marked, so that the page elements are reasonably distinguished; the path of the page element may refer to a storage path of the page element, and is typically a path of a CSS (Cascading Style Sheets) file in which the page element is stored.
The information related to the simulation operation may include: the operation flow information of the simulation operation, for example, a target operation object of the simulation operation, an operation command of the simulation operation, and the like, may further include an input value of the simulation operation, for example, an input parameter.
As an optional implementation manner of the embodiment of the present invention, the embodiment of the present invention may generate a plurality of configuration files by using the test requirements of each function module in the preset to-be-tested Web page, the extracted page element information, and the information related to the simulation operation.
Illustratively, the functional modules may include: the system comprises an instance backup module, an instance creating module, an instance restarting module, an instance configuration information changing module and an instance process node adding module. The instance backup module is used for backing up instance data related to the Web page; the instance creating module is used for creating different instances; the instance restarting module is used for restarting the instance, for example, restarting a certain test case service; the instance configuration information changing module is used for changing the configuration information in the instance; the example flow node adding module is used for adding the flow nodes in the examples.
It can be understood that one to-be-tested Web page usually includes a plurality of function modules, and a tester usually needs to test each function module, therefore, different configuration files can be used for generating different test cases to test different function modules in the to-be-tested Web page, and for the to-be-tested Web page including the plurality of function modules, each function module can be tested in batch, so that the test flexibility is improved, and the test efficiency is further improved.
As an optional implementation manner of the embodiment of the present invention, one test case may correspond to one function module in a Web page to be tested, and then each test case in a plurality of test cases may be utilized to test the function module corresponding to the test case, so that the test is more purposeful, and a tester can test a specific function module in the Web page more specifically.
As an optional implementation manner of the embodiment of the present invention, in the process of obtaining the script generated after the simulation operation on the Web page to be tested, the simulation operation may be performed on the Web page to be tested, and the simulation operation is recorded to obtain the recorded content, so as to obtain the script of the simulation operation, and the recording manner may refer to the script recording process of the Selenium-IDE. The recorded content can be stored in a Python file form, wherein Python is a computer programming language, and data stored in the Python file is described based on the Python language.
According to the Web page testing method provided by the embodiment of the invention, after the script generated after the simulation operation on the Web page to be tested is acquired, the script Web page element information and the information of the script related to the simulation operation are extracted from the script to generate the configuration file, and then the configuration file is used for generating the test case, so that the script Web page is tested by using the test case.
An embodiment of the present invention further provides a Web page testing method, as shown in fig. 2, the method may include:
s201, acquiring a script generated after simulation operation on the Web page to be tested.
S202, extracting page element information and information related to simulation operation from the script, and generating a configuration file.
And S203, generating a test case by using the configuration file.
Steps S201 to S203 are the same as steps S101 to S103 of the embodiment shown in fig. 1, and are described in detail here.
And S204, creating a test task of the test case.
After the test case is generated, the test task of the test case can be created, wherein the test task is used for testing the current functional module, the current functional module can refer to any module of the Web page, and the test case can be simply referred to as an example.
Illustratively, for the above example backup module, the test tasks that may be created include: the method comprises a computer room selection task, an instance selection task, a data backup task and a backup file consistency detection task, wherein the tasks can relate to a backup function. For the computer room selection task, different services can be related to one Web page, and the different services can be processed in different computer rooms, so that when data of test cases corresponding to the different services are backed up, different computer rooms can be selected, and the task is a computer room selection task. For the instance selection task, it is easily understood that one Web page may relate to different instances, and thus different instances may be selected, which is the instance selection task. For the data backup task, data is generated when the Web page is operated, so that the data can be backed up, and the task is the data backup task. For the task of detecting consistency of the backup files, after the data is backed up, the information such as the state of the backup files, the number of the backup files and the like can be recorded in the backup list, so that whether the recorded information is consistent with that before the backup can be detected, and the task is the task of detecting consistency of the backup files.
For the above example creation module, the test tasks that can be created include: the computer room configuration comparison method comprises a computer room selection task, an instance creation task and an instance configuration comparison task, wherein the tasks can relate to an instance creation function. For the machine room selection task, different services can be related in one Web page, and the different services can be processed in different machine rooms, so that when test cases of different services are created, different machine rooms can be selected, and the task is the machine room selection task. For the above instance creation task, different instances may be created for the Web page, and the task is an instance creation task. For the example configuration comparison task, after the example is created, the consistency between the configuration information obtained after the example is created and the configuration information of the example described by adopting the natural language before the example is created can be compared.
For the example restart module described above, test tasks that may be created include: the method comprises the steps of machine room selection tasks, instance restarting tasks and instance configuration comparison tasks, wherein the tasks can relate to an instance restarting function. The principle of the machine room selection task and the example selection task is the same as that of the machine room selection task and the example selection task, and the machine room selection task and the example selection task are only used for the example restarting function. For the above example restart task, a restart operation may be performed for a certain example, and the task is an example restart task. For the above example configuration comparison task, after restarting the example, it can be compared whether the configuration and state before restarting the example and after restarting are consistent.
For the example configuration information modification module, the test tasks that can be created include: the method comprises a machine room selection task, an example configuration modification task, an example configuration comparison task and an example state detection task, wherein the tasks can relate to an example changing function. The principle of the machine room selection task and the instance selection task is the same as that of the machine room selection task and the instance selection task, and the machine room selection task and the instance selection task are only used for the instance configuration information changing function. For the above example configuration modification task, the configuration information of a certain example can be modified, and the task is the example configuration modification task. For the above example configuration comparison task, after the configuration information of the example is modified, the data before and after the modification of the example configuration information can be compared, and the specific comparison process is as follows: and acquiring the configuration information of the changed example, and then comparing the configuration information with the configuration information defined by the configuration parameters in the configuration command before the change. For the above example state detection task, the change situation of the state of the example after the configuration information of the example is modified can be detected.
For the above example flow node adding module, the test tasks that can be created include: the method comprises the steps of selecting tasks by a machine room, selecting tasks by examples, adding tasks from nodes by a database, comparing the configuration of the examples, and detecting the state of the examples, wherein the tasks can relate to the adding function of the nodes of the example process. The principle of the machine room selection task and the example selection task is the same as that of the machine room selection task and the example selection task, and the machine room selection task and the example selection task are only used for the function of adding the example process nodes. For the task of adding the slave node to the database, when the flow node of the instance is added, the data of the node is correspondingly added to the database. For the above example configuration comparison task, since the process node is added, the example configuration information may change, and therefore, configuration information before and after the addition of the process node is required. For the above example state detection task, similarly, since the flow node is added, the state of the example changes, and thus, the change of the state of the example after the flow node is added to the example can be detected.
S205, comparing the running data of the test task with the configuration data in the test case to obtain a comparison result.
It can be understood that the running data can be generated when the test task is executed, so that the running data can be compared with the configuration data in the test case to judge the consistency between the running data and the configuration data in the test case, thereby achieving the comparison result.
And S206, judging whether the current functional module passes the test or not based on the comparison result.
After the comparison result is obtained, the embodiment of the invention can judge whether the current functional module passes the test or not based on the comparison result.
Specifically, if the comparison result is consistent, determining that the current functional module passes the test;
and if the comparison result is inconsistent, determining that the current functional module fails to pass the test.
According to the Web page testing method provided by the embodiment of the invention, the testing task of the testing case is created, and the comparison result is obtained by comparing the running data of the testing task with the configuration data in the testing case, so that whether the current functional module passes the test or not is judged based on the comparison result, and the testing of each functional module can be performed more specifically.
Corresponding to the above method embodiment, the embodiment of the present invention also provides a corresponding device embodiment.
As shown in fig. 3, an embodiment of the present invention provides a Web page testing apparatus, including:
an obtaining module 301, configured to obtain a script generated after a simulation operation is performed on a to-be-tested Web page, where the script carries: page element information of the Web page to be tested and information related to the simulation operation.
The first generation module 302 is configured to extract page element information and information related to simulation operations from the script, and generate a configuration file.
And a second generating module 303, configured to generate a test case by using the configuration file.
And the testing module 304 is used for testing the Web page by using the test case.
The first generating module 302 is specifically configured to:
generating a configuration file by utilizing preset test case function requirements, the extracted page element information and information related to simulation operation, wherein the test case function requirements comprise: the method comprises the following steps of requiring example backup, requiring example creation, requiring example restart, requiring example configuration information change, requiring example process node addition, and requiring page element information to comprise: the name of the page element, the positioning mode of the page element, the position information of the page element on the Web page to be tested, and the information related to the simulation operation comprise: operation flow information of the simulation operation and input values of the simulation operation.
The first generating module 302 is specifically configured to:
generating a plurality of configuration files by using the testing requirements of each functional module in the preset Web page to be tested, the extracted page element information and the information related to the simulation operation, wherein the functional modules comprise: the system comprises an instance backup module, an instance creating module, an instance restarting module, an instance configuration information changing module and an instance process node adding module.
The second generating module 303 is specifically configured to:
and generating a plurality of test cases by using the plurality of configuration files, wherein different test cases are used for testing each functional module in the Web page to be tested.
The test module 304 is specifically configured to:
and utilizing each test case in the plurality of test cases to test the functional module corresponding to the test case respectively.
On the basis of the apparatus shown in fig. 3, as shown in fig. 4, the apparatus for testing a Web page according to the embodiment of the present invention may further include:
the creating module 401 is configured to create a test task of a test case, where the test task is used to test a current functional module, and the current functional module is any module of a Web page;
the test module 304 is specifically configured to:
and comparing the running data of the test task with the configuration data in the test case to obtain a comparison result, and judging whether the current functional module passes the test or not based on the comparison result.
The test module 304 is specifically configured to:
if the comparison result is consistent, determining that the current functional module passes the test;
and if the comparison result is inconsistent, determining that the current functional module fails to pass the test.
According to the Web page testing device provided by the embodiment of the invention, after the script generated after the simulation operation on the Web page to be tested is acquired, the script Web page element information and the information related to the simulation operation of the script are extracted from the script to generate the configuration file, and then the configuration file is used for generating the test case, so that the script Web page is tested by using the test case.
An embodiment of the present invention further provides an electronic device, which may be specifically a server, as shown in fig. 5, the device 500 includes a processor 501 and a machine-readable storage medium 502, where the machine-readable storage medium stores machine-executable instructions capable of being executed by the processor, and the processor executes the machine-executable instructions to implement the following steps:
acquiring a script generated after simulation operation on a Web page to be tested, wherein the script carries: page element information of the Web page to be tested and information related to simulation operation;
extracting page element information and information related to simulation operation from the script, and generating a configuration file;
generating a test case by using the configuration file;
and testing the Web page by using the test case.
The machine-readable storage medium may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
According to the electronic equipment provided by the embodiment of the invention, after the script generated after the simulation operation on the Web page to be tested is acquired, the script Web page element information and the information of the script related to the simulation operation are extracted from the script to generate the configuration file, and then the configuration file is used for generating the test case, so that the script Web page is tested by using the test case.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program is configured to perform the following steps:
acquiring a script generated after simulation operation on a Web page to be tested, wherein the script carries: page element information of the Web page to be tested and information related to simulation operation;
extracting page element information and information related to simulation operation from the script, and generating a configuration file;
generating a test case by using the configuration file;
and testing the Web page by using the test case.
According to the computer-readable storage medium provided by the embodiment of the invention, after the script generated after the simulation operation on the Web page to be tested is acquired, the script Web page is tested by using the test case through extracting the script page element information and the information of the script related to the simulation operation from the script and generating the configuration file and then generating the test case by using the configuration file.
Embodiments of the present invention also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the steps of:
acquiring a script generated after simulation operation on a Web page to be tested, wherein the script carries: page element information of the Web page to be tested and information related to simulation operation;
extracting page element information and information related to simulation operation from the script, and generating a configuration file;
generating a test case by using the configuration file;
and testing the Web page by using the test case.
According to the computer program product containing the instructions, after the script generated after the simulation operation on the Web page to be tested is acquired, the script page element information and the information of the script related to the simulation operation are extracted from the script, the configuration file is generated, and then the configuration file is used for generating the test case, so that the script Web page is tested by using the test case.
Embodiments of the present invention further provide a computer program, which when running on a computer, causes the computer to execute the following steps:
acquiring a script generated after simulation operation on a Web page to be tested, wherein the script carries: page element information of the Web page to be tested and information related to simulation operation;
extracting page element information and information related to simulation operation from the script, and generating a configuration file;
generating a test case by using the configuration file;
and testing the Web page by using the test case.
According to the computer program containing the instructions, after the script generated after the simulation operation on the Web page to be tested is acquired, the script page element information and the information of the script related to the simulation operation are extracted from the script, the configuration file is generated, and then the configuration file is used for generating the test case, so that the script Web page is tested by using the test case.
For the apparatus/electronic device/storage medium embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to part of the description of the method embodiment.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.
Claims (16)
1. A Web page testing method is characterized by comprising the following steps:
acquiring a script generated after simulation operation on a Web page to be tested, wherein the script carries: page element information of the Web page to be tested and information related to simulation operation;
extracting the page element information and the information related to the simulation operation from the script and generating a configuration file;
generating a test case by using the configuration file;
and testing the Web page by using the test case.
2. The method of claim 1, wherein the step of extracting the page element information and the information related to the simulation operation from the script and generating the configuration file comprises:
generating a configuration file by utilizing preset test case function requirements and the extracted page element information and the information related to the simulation operation, wherein the test case function requirements comprise: the method comprises the following steps of requiring example backup, requiring example creation, requiring example restart, requiring example configuration information change, and requiring example process node addition, wherein the page element information comprises: the name of the page element, the positioning mode of the page element, and the position information of the page element on the Web page to be tested, wherein the information related to the simulation operation includes: operation flow information of the simulation operation and an input value of the simulation operation.
3. The method of claim 1, wherein the step of extracting the page element information and the information related to the simulation operation from the script and generating the configuration file comprises:
generating a plurality of configuration files by using the preset test requirements of each functional module in the Web page to be tested and the extracted page element information and the information related to the simulation operation, wherein the functional modules comprise: the system comprises an example backup module, an example creating module, an example restarting module, an example configuration information changing module and an example process node adding module;
the step of generating the test case by using the configuration file includes:
and generating a plurality of test cases by using the plurality of configuration files, wherein different test cases are used for testing each functional module in the Web page to be tested.
4. The method of claim 3, wherein the step of testing the Web page using the test case comprises:
and utilizing each test case in the plurality of test cases to test the functional module corresponding to the test case respectively.
5. The method of claim 3, wherein before testing the Web page using the test case, the method further comprises:
creating a test task of the test case, wherein the test task is used for testing a current functional module, and the current functional module is any module of the Web page;
the step of testing the Web page by using the test case includes:
comparing the running data of the test task with the configuration data in the test case to obtain a comparison result;
and judging whether the current functional module passes the test or not based on the comparison result.
6. The method of claim 5, wherein the step of determining whether the current functional module passes the test based on the comparison result comprises:
if the comparison result is consistent, determining that the current functional module passes the test;
and if the comparison result is inconsistent, determining that the current functional module fails to pass the test.
7. The method of claim 1, wherein the step of obtaining the script generated after the simulation operation on the Web page to be tested comprises:
carrying out simulation operation on the Web page to be tested;
and recording the simulation operation to obtain a script of the simulation operation.
8. A Web page testing apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring a script generated after simulation operation on the Web page to be tested, wherein the script carries: page element information of the Web page to be tested and information related to simulation operation;
the first generation module is used for extracting the page element information and the information related to the simulation operation from the script and generating a configuration file;
the second generation module is used for generating a test case by utilizing the configuration file;
and the testing module is used for testing the Web page by using the test case.
9. The apparatus of claim 8, wherein the first generating module is specifically configured to:
generating a configuration file by utilizing preset test case function requirements and the extracted page element information and the information related to the simulation operation, wherein the test case function requirements comprise: the method comprises the following steps of requiring example backup, requiring example creation, requiring example restart, requiring example configuration information change, and requiring example process node addition, wherein the page element information comprises: the name of the page element, the positioning mode of the page element, and the position information of the page element on the Web page to be tested, wherein the information related to the simulation operation includes: operation flow information of the simulation operation and an input value of the simulation operation.
10. The apparatus of claim 8, wherein the first generating module is specifically configured to:
generating a plurality of configuration files by using the preset test requirements of each functional module in the Web page to be tested and the extracted page element information and the information related to the simulation operation, wherein the functional modules comprise: the system comprises an example backup module, an example creating module, an example restarting module, an example configuration information changing module and an example process node adding module;
the second generating module is specifically configured to:
and generating a plurality of test cases by using the plurality of configuration files, wherein different test cases are used for testing each functional module in the Web page to be tested.
11. The apparatus of claim 10, wherein the testing module is specifically configured to:
and utilizing each test case in the plurality of test cases to test the functional module corresponding to the test case respectively.
12. The apparatus of claim 10, further comprising:
the creating module is used for creating a test task of the test case, the test task is used for testing a current functional module, and the current functional module is any one module of the Web page;
the test module is specifically configured to:
comparing the running data of the test task with the configuration data in the test case to obtain a comparison result;
and judging whether the current functional module passes the test or not based on the comparison result.
13. The apparatus of claim 12, wherein the testing module is specifically configured to:
if the comparison result is consistent, determining that the current functional module passes the test;
and if the comparison result is inconsistent, determining that the current functional module fails to pass the test.
14. The apparatus of claim 8, wherein the obtaining module comprises:
the simulation submodule is used for carrying out simulation operation on the Web page to be tested;
and the recording submodule is used for recording the simulation operation to obtain the script of the simulation operation.
15. An electronic device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor to perform method steps of the Web page testing method of any one of claims 1-7.
16. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method steps of the Web page testing method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010146734.6A CN113360366A (en) | 2020-03-05 | 2020-03-05 | Web page testing method, testing device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010146734.6A CN113360366A (en) | 2020-03-05 | 2020-03-05 | Web page testing method, testing device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113360366A true CN113360366A (en) | 2021-09-07 |
Family
ID=77523633
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010146734.6A Pending CN113360366A (en) | 2020-03-05 | 2020-03-05 | Web page testing method, testing device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113360366A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113821437A (en) * | 2021-09-23 | 2021-12-21 | 北京光启元数字科技有限公司 | Page testing method, device, equipment and medium |
CN114860582A (en) * | 2022-04-14 | 2022-08-05 | 中国电子科技集团公司第十五研究所 | Web page test auxiliary method and system |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050267976A1 (en) * | 2004-03-11 | 2005-12-01 | Microsoft Corporation | Data driven test automation of web sites and web services |
CN104679658A (en) * | 2015-03-17 | 2015-06-03 | 百度在线网络技术(北京)有限公司 | Test method and test system for WEB pages |
CN105279076A (en) * | 2014-06-17 | 2016-01-27 | 腾讯科技(深圳)有限公司 | Webpage test method and terminal |
CN106547689A (en) * | 2016-10-20 | 2017-03-29 | 金航数码科技有限责任公司 | A kind of automatic test cases development system and method based on web |
CN107729249A (en) * | 2017-10-18 | 2018-02-23 | 北京奇虎科技有限公司 | Browser compatibility method of testing, device, system and electronic equipment |
CN108845925A (en) * | 2018-03-30 | 2018-11-20 | 新华三技术有限公司 | Web page test method, device, electronic equipment and computer-readable medium |
WO2019196274A1 (en) * | 2018-04-10 | 2019-10-17 | 平安科技(深圳)有限公司 | Web page testing method and apparatus, electronic device, and medium |
CN110851356A (en) * | 2019-10-30 | 2020-02-28 | 河海大学 | Selenium-based Web application automatic test framework and construction method and system thereof |
-
2020
- 2020-03-05 CN CN202010146734.6A patent/CN113360366A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050267976A1 (en) * | 2004-03-11 | 2005-12-01 | Microsoft Corporation | Data driven test automation of web sites and web services |
CN105279076A (en) * | 2014-06-17 | 2016-01-27 | 腾讯科技(深圳)有限公司 | Webpage test method and terminal |
CN104679658A (en) * | 2015-03-17 | 2015-06-03 | 百度在线网络技术(北京)有限公司 | Test method and test system for WEB pages |
CN106547689A (en) * | 2016-10-20 | 2017-03-29 | 金航数码科技有限责任公司 | A kind of automatic test cases development system and method based on web |
CN107729249A (en) * | 2017-10-18 | 2018-02-23 | 北京奇虎科技有限公司 | Browser compatibility method of testing, device, system and electronic equipment |
CN108845925A (en) * | 2018-03-30 | 2018-11-20 | 新华三技术有限公司 | Web page test method, device, electronic equipment and computer-readable medium |
WO2019196274A1 (en) * | 2018-04-10 | 2019-10-17 | 平安科技(深圳)有限公司 | Web page testing method and apparatus, electronic device, and medium |
CN110851356A (en) * | 2019-10-30 | 2020-02-28 | 河海大学 | Selenium-based Web application automatic test framework and construction method and system thereof |
Non-Patent Citations (2)
Title |
---|
BEDI, S等: "Observations on the implementation and testing of scripted web applications", SIXTH IEEE INTERNATIONAL WORKSHOP ON WEB SITE EVOLUTION, 1 January 2004 (2004-01-01) * |
姜文;刘立康;: "基于Selenium的Web软件自动化测试", 计算机技术与发展, no. 09, 16 May 2018 (2018-05-16) * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113821437A (en) * | 2021-09-23 | 2021-12-21 | 北京光启元数字科技有限公司 | Page testing method, device, equipment and medium |
CN113821437B (en) * | 2021-09-23 | 2024-06-11 | 腾讯云计算(北京)有限责任公司 | Page test method, device, equipment and medium |
CN114860582A (en) * | 2022-04-14 | 2022-08-05 | 中国电子科技集团公司第十五研究所 | Web page test auxiliary method and system |
CN114860582B (en) * | 2022-04-14 | 2024-01-09 | 中国电子科技集团公司第十五研究所 | Web page test auxiliary method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107896244B (en) | Version file distribution method, client and server | |
CN110908895A (en) | Page automatic testing method and device, computer equipment and storage medium | |
CN108923997B (en) | Cloud service node automatic testing method and device based on python | |
CN113360366A (en) | Web page testing method, testing device, electronic equipment and storage medium | |
CN111679976A (en) | Method and device for searching page object | |
CN111708712A (en) | User behavior test case generation method, flow playback method and electronic equipment | |
CN105912467A (en) | Performance test method and device | |
US11106571B2 (en) | Identification of input object in a graphical user interface | |
CN107102938B (en) | Test script updating method and device | |
CN112965697A (en) | Code file generation method and device and electronic equipment | |
CN109474822B (en) | Android television multi-language automatic testing method and device | |
CN116431467A (en) | Page test method, device, equipment and medium | |
CN113934617A (en) | Data processing method, device, equipment and storage medium | |
CN108563578B (en) | SDK compatibility detection method, device, equipment and readable storage medium | |
CN112765041B (en) | Game automation testing method and device and electronic equipment | |
CN116016270A (en) | Switch test management method and device, electronic equipment and storage medium | |
CN115827451A (en) | Method and device for detecting test defects, storage medium and electronic device | |
CN111367796B (en) | Application program debugging method and device | |
CN110704318B (en) | Map data automatic testing method, terminal device and storage medium | |
CN116010244A (en) | Automatic test method, device, electronic equipment and storage medium | |
CN113326193A (en) | Applet testing method and device | |
CN113946509A (en) | Buried point searching and comparing method and device, computing device and readable storage medium | |
CN112181809A (en) | Automatic graphical user interface testing method based on multiple positioning methods | |
CN114448848B (en) | Switch testing method and device, electronic equipment and storage medium | |
CN111858315A (en) | Software debugging method, device, equipment and medium based on version management |
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 |