CN108628741B - Webpage testing method and device, electronic equipment and medium - Google Patents

Webpage testing method and device, electronic equipment and medium Download PDF

Info

Publication number
CN108628741B
CN108628741B CN201810316068.9A CN201810316068A CN108628741B CN 108628741 B CN108628741 B CN 108628741B CN 201810316068 A CN201810316068 A CN 201810316068A CN 108628741 B CN108628741 B CN 108628741B
Authority
CN
China
Prior art keywords
error
elements
tested
operation element
detected
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810316068.9A
Other languages
Chinese (zh)
Other versions
CN108628741A (en
Inventor
彭明强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201810316068.9A priority Critical patent/CN108628741B/en
Priority to PCT/CN2018/099282 priority patent/WO2019196274A1/en
Publication of CN108628741A publication Critical patent/CN108628741A/en
Application granted granted Critical
Publication of CN108628741B publication Critical patent/CN108628741B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

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 webpage testing method, a webpage testing device, electronic equipment and a webpage testing medium. The webpage testing method comprises the following steps: starting a browser by adopting an automatic testing tool, and starting a website to be tested; acquiring an operation element on a page of the website to be detected and an operation event of the operation element; selecting an operation element to be detected from the obtained operation elements; sending the operation element to be tested and the operation event of the operation element to be tested to the page of the website to be tested for testing, thereby carrying out targeted robustness test on the webpage and judging whether the page of the website to be tested has error information or not; when the page of the website to be tested has error reporting information, the error reporting information is output, and the test scheme has pertinence, so that other functions of the system to be tested cannot be influenced, and the stability of the system to be tested and the integrity of the functions of the system to be tested are ensured.

Description

Webpage testing method and device, electronic equipment and medium
Technical Field
The invention relates to the technical field of testing, in particular to a webpage testing method, a webpage testing device, electronic equipment and a webpage testing medium.
Background
In the prior art, for the test of robustness and stability of a web page to be tested, usually an Interface API (Application Programming Interface) layer is focused, and for a UI (User Interface) layer, only the integrity of a function is concerned, but a targeted robustness test is rarely directly performed on the UI layer.
Disclosure of Invention
In view of the above, it is necessary to provide a method, an apparatus, an electronic device and a medium for testing a web page, which can perform a targeted robustness test on a web page and ensure the stability of a system to be tested and the integrity of functions of the system to be tested.
A web page testing method, the method comprising:
starting a browser by adopting an automatic testing tool, and starting a website to be tested;
acquiring an operation element on a page of the website to be detected and an operation event of the operation element;
selecting an operation element to be detected from the obtained operation elements;
sending the operation element to be tested and the operation event of the operation element to be tested to the page of the website to be tested for testing;
judging whether the page of the website to be detected has error information or not;
and outputting the error information when the page of the website to be detected has the error information.
According to a preferred embodiment of the invention, the operational elements comprise a combination of one or more of the following:
hyperlink elements, input box elements, button elements, drop-down selection box elements, radio button elements, multi-selection box elements;
the operation event of the operation element comprises one or more of the following combinations:
the operation event corresponding to the hyperlink element comprises a click event; and/or
The operation events corresponding to the input box elements comprise an input random text event and an emptying text event; and/or
The operation event corresponding to the button element comprises a click event; and/or
The operation event corresponding to the drop-down selection box element comprises a selection option event; and/or
The operation event corresponding to the radio button element comprises a selected event; and/or
The operation events corresponding to the multiple box elements comprise selected events.
According to a preferred embodiment of the present invention, the selecting an operation element to be tested from the obtained operation elements includes one or more of the following combinations:
acquiring the use times of the acquired operation elements, and determining the operation elements with the use times larger than or equal to the preset times as the operation elements to be detected; and/or
Acquiring the use times of the acquired operation elements, sequencing the use times of the acquired operation elements from high to low, and determining the operation elements with preset digits arranged in front as the operation elements to be detected; and/or
Acquiring the error rate of the acquired operation elements, and determining the operation elements with the error rate larger than or equal to a preset error rate as the operation elements to be detected; and/or
Acquiring the error rate of the acquired operation elements, sequencing the error rates of the acquired operation elements from high to low, and determining the operation elements with the preset digits arranged in front as the operation elements to be detected; and/or
After the selected operation element to be detected is obtained, obtaining the associated operation element of the selected operation element to be detected, and determining the associated operation element as the operation element to be detected; and/or
The method comprises the steps of obtaining a current testing module, obtaining an operation element corresponding to the current testing module from the obtained operation elements, and determining the corresponding operation element as the operation element to be tested, wherein the current testing module corresponds to a class of user groups.
According to the preferred embodiment of the present invention, when the page of the website to be tested has the error information, the method further comprises:
acquiring a log corresponding to the error reporting information;
and performing screenshot on the log through the automatic testing tool to obtain a log screenshot, and storing the log screenshot to a specified position.
According to a preferred embodiment of the invention, the method further comprises:
analyzing the log to obtain error points and the types of the error points;
and sending the error points of each type to corresponding maintenance personnel according to the types of the error points.
According to the preferred embodiment of the present invention, the analyzing the log to obtain the error point includes:
and acquiring error points from the log by using a trained error recognition model.
According to a preferred embodiment of the invention, the method further comprises:
before the error points are obtained from the log by using the trained error recognition model, training the error recognition model;
the training the error recognition model comprises:
configuring training sample data of the error points of different error categories, distributing the training sample data of different categories to different folders, respectively extracting training sample data of a first preset proportion from the different folders to train an error recognition model, increasing the obtaining proportion of the training sample data of different error categories when the accuracy of the generated error recognition model is less than the preset accuracy, and repeating the training process of the error recognition model until the accuracy of the generated error recognition model is greater than or equal to the preset accuracy.
A web page testing apparatus, the apparatus comprising:
the starting unit is used for starting the browser by adopting an automatic testing tool and starting the website to be tested;
the acquisition unit is used for acquiring the operation elements on the page of the website to be detected and the operation events of the operation elements;
the selection unit is used for selecting the operation elements to be detected from the obtained operation elements;
the sending unit is used for sending the operation element to be tested and the operation event of the operation element to be tested to the page of the website to be tested for testing;
the judging unit is used for judging whether the page of the website to be detected has error information or not;
and the output unit is used for outputting the error information when the page of the website to be detected has the error information.
According to a preferred embodiment of the invention, the operational elements comprise a combination of one or more of the following:
hyperlink elements, input box elements, button elements, drop-down selection box elements, radio button elements, multi-selection box elements;
the operation event of the operation element comprises one or more of the following combinations:
the operation event corresponding to the hyperlink element comprises a click event; and/or
The operation events corresponding to the input box elements comprise an input random text event and an emptying text event; and/or
The operation event corresponding to the button element comprises a click event; and/or
The operation event corresponding to the drop-down selection box element comprises a selection option event; and/or
The operation event corresponding to the radio button element comprises a selected event; and/or
The operation events corresponding to the multiple box elements comprise selected events.
According to a preferred embodiment of the present invention, the selecting unit is specifically configured to:
acquiring the use times of the acquired operation elements, and determining the operation elements with the use times larger than or equal to the preset times as the operation elements to be detected; and/or
Acquiring the use times of the acquired operation elements, sequencing the use times of the acquired operation elements from high to low, and determining the operation elements with preset digits arranged in front as the operation elements to be detected; and/or
Acquiring the error rate of the acquired operation elements, and determining the operation elements with the error rate larger than or equal to a preset error rate as the operation elements to be detected; and/or
Acquiring the error rate of the acquired operation elements, sequencing the error rates of the acquired operation elements from high to low, and determining the operation elements with the preset digits arranged in front as the operation elements to be detected; and/or
After the selected operation element to be detected is obtained, obtaining the associated operation element of the selected operation element to be detected, and determining the associated operation element as the operation element to be detected; and/or
The method comprises the steps of obtaining a current testing module, obtaining an operation element corresponding to the current testing module from the obtained operation elements, and determining the corresponding operation element as the operation element to be tested, wherein the current testing module corresponds to a class of user groups.
According to a preferred embodiment of the present invention, the obtaining unit is further configured to obtain a log corresponding to the error information when the page of the website to be tested has the error information;
the device further comprises:
and the screenshot unit is used for screenshot the log through the automatic test tool to obtain a log screenshot and storing the log screenshot to a specified position.
According to a preferred embodiment of the invention, the apparatus further comprises:
the analysis unit is used for analyzing the log to obtain error points and the types of the error points;
and the sending unit is also used for sending the error points of each type to corresponding maintenance personnel according to the types of the error points.
According to a preferred embodiment of the present invention, the analyzing unit analyzes the log to obtain the error point includes:
and acquiring error points from the log by using a trained error recognition model.
According to a preferred embodiment of the invention, the apparatus further comprises:
the training unit is used for training the error recognition model before the trained error recognition model is used for acquiring error points from the log;
the training unit training the error recognition model comprises:
configuring training sample data of the error points of different error categories, distributing the training sample data of different categories to different folders, respectively extracting training sample data of a first preset proportion from the different folders to train an error recognition model, increasing the obtaining proportion of the training sample data of different error categories when the accuracy of the generated error recognition model is less than the preset accuracy, and repeating the training process of the error recognition model until the accuracy of the generated error recognition model is greater than or equal to the preset accuracy.
An electronic device, the electronic device comprising:
a memory storing at least one instruction; and
and the processor executes the instructions stored in the memory to realize the webpage page testing method.
A computer-readable storage medium having stored therein at least one instruction, the at least one instruction being executable by a processor in an electronic device to implement the web page testing method.
According to the technical scheme, the browser is started by adopting an automatic testing tool, and the website to be tested is started; acquiring an operation element on a page of the website to be detected and an operation event of the operation element; selecting an operation element to be detected from the obtained operation elements; sending the operation element to be tested and the operation event of the operation element to be tested to the page of the website to be tested for testing, thereby carrying out targeted robustness test on the webpage and judging whether the page of the website to be tested has error information or not; when the page of the website to be tested has error reporting information, the error reporting information is output, and the test scheme has pertinence, so that other functions of the system to be tested cannot be influenced, and the stability of the system to be tested and the integrity of the functions of the system to be tested are ensured.
Drawings
FIG. 1 is a flowchart illustrating a method for testing a web page according to a preferred embodiment of the present invention.
FIG. 2 is a functional block diagram of the apparatus for testing web pages according to the preferred embodiment of the present invention.
FIG. 3 is a schematic structural diagram of an electronic device implementing a method for testing a web page according to a preferred embodiment of the present invention.
Description of the main elements
Figure BDA0001623817250000061
Figure BDA0001623817250000071
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
FIG. 1 is a flowchart illustrating a method for testing a web page according to a preferred embodiment of the present invention. The order of the steps in the flow chart may be changed and some steps may be omitted according to different needs.
The webpage testing method is applied to one or more electronic devices, wherein the electronic devices are devices capable of automatically performing numerical calculation and/or information processing according to preset or stored instructions, and hardware of the electronic devices includes but is not limited to a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device and the like.
The electronic device may be any electronic product capable of performing human-computer interaction with a user, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an interactive Internet Protocol Television (IPTV), an intelligent wearable device, and the like.
The electronic device may also include a network device and/or a user device. The network device includes, but is not limited to, a single network server, a server group consisting of a plurality of network servers, or a Cloud Computing (Cloud Computing) based Cloud consisting of a large number of hosts or network servers.
The Network where the electronic device is located includes, but is not limited to, the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
And S10, the electronic equipment starts the browser by adopting the automatic test tool and starts the website to be tested.
Specifically, the computer software automated testing technology, Selenium WebDriver, has a strong visual automatic interaction function, and simulates interaction between a human and a webpage through programming, so that dynamic data loading is triggered, and dynamically generated data is acquired. That is, the Selenium WebDriver technology can truly simulate the operation performed by a user on a webpage, for example, when functions such as "view more", "automatically log in", "click link", "fill form", "scroll mouse", "mouse drag", "scroll down after page loading is completed", "click page turning", "screenshot saving" and the like are clicked, the Ajax technology is used to request more data from a server in real time, and then the JavaScript script is used to dynamically generate content and load and display the content.
In this embodiment, after calling Selenium, the user opens the browser through the Selenium tool, inputs a link (URL) of the website of the data to be tested in the browser, and the Selenium Web page tool calls the get () method of WebDriver to open the Web page of the website of the data to be tested, which is input by the user.
For example: the electronic equipment can open a webpage corresponding to the XX website through a program language driver.get ("http:// www.XX"), clear input box data can be cleared through the program language el.clear (), click-back buttons can be simulated through the program language el.send _ keys (keys.return), a browser drive can be closed through the program language driver.close (), and the like.
In this embodiment, WebDriver directly controls the browser through native browser support or browser extensions. And Webdriver is developed for each browser, and the close integration with the browser can support the creation of higher-level tests, so that the limitation caused by a JavaScript security model is avoided.
S11, the electronic equipment acquires the operation element on the page of the website to be tested and the operation event of the operation element.
In the present embodiment, the operation element includes, but is not limited to, one or more of the following:
hyperlink elements, input box elements, button elements, drop-down selection box elements, radio button elements, multiple selection box elements, and the like.
Further, the operation event corresponding to the operation element includes, but is not limited to, one or more of the following combinations:
(1) the operation event corresponding to the hyperlink element comprises a click event.
For example: when the electronic equipment acquires that an operation element on a page of a website to be detected is a hyperlink element, the electronic equipment acquires that an operation event corresponding to the hyperlink element is a click event, that is, when the electronic equipment acquires a signal that a user clicks the hyperlink element, the electronic equipment executes a task corresponding to the hyperlink so as to link to other webpages or link to a specified position on the page of the website to be detected.
(2) The operation events corresponding to the input box elements comprise an event of inputting random text and an event of emptying text.
For example: when the operation element on the page of the website to be detected, which is obtained by the electronic device, is an input box element, and the operation event corresponding to the input box element is an event for inputting a random text or an event for emptying a text, the electronic device may input a text or empty the text in the input box element.
(3) The operation event corresponding to the button element comprises a click event.
For example: when the electronic device obtains that an operation element on a page of a to-be-detected website is a button element, the electronic device obtains that an operation event corresponding to the button element is a click event, that is, when the electronic device obtains a signal that a user clicks the button element, the electronic device executes a task corresponding to the button element, for example: start running, pause running, stop running, etc.
(4) The operation event corresponding to the drop-down selection box element comprises a selection of a certain option event.
For example: when the operation element on the page of the website to be tested, which is obtained by the electronic device, is a pull-down selection frame element (for example, the pull-down selection frame element includes an option a, an option B and an option C), the operation event corresponding to the pull-down selection frame element obtained by the electronic device is a selection of a certain option event, that is, when the electronic device obtains that the option a in the pull-down selection frame element is selected by a user, the electronic device displays the option a on the page of the website to be tested as the selection of the user.
(5) The operation event corresponding to the radio button element comprises a selected event.
For example: when the electronic device obtains that an operation element on a page of a to-be-detected website is a radio button element (for example, the radio button element includes an option A, an option B and an option C), the electronic device obtains that an operation event corresponding to the radio button element is a selection event, that is, when the electronic device obtains that a user selects the option A in the radio button element, the electronic device displays the option A on the page of the to-be-detected website as the selection of the user.
(6) The operation events corresponding to the multiple box elements comprise selected events.
For example: when the electronic equipment acquires that an operation element on a page of a to-be-detected website is a multi-box element (for example, the multi-box element includes an option A, an option B and an option C), the electronic equipment acquires that an operation event corresponding to the multi-box element is a selection event, that is, when the electronic equipment acquires that a user selects the option A and the option B in the multi-box element, the electronic equipment displays the option A and the option B on the page of the to-be-detected website as selections of the user.
Of course, in other embodiments, the operation element and the operation event of the operation element may have other forms, and the present invention is not limited thereto.
And S12, the electronic equipment selects the operation element to be tested from the acquired operation elements.
Preferably, the electronic device selects an operation element to be tested from the acquired operation elements, including, but not limited to, a combination of one or more of the following:
(1) and the electronic equipment acquires the use times of the acquired operation elements and determines the operation elements with the use times larger than or equal to the preset times as the operation elements to be detected.
For example: after the electronic device obtains the use times of the obtained operation elements, the electronic device may determine the operation elements with the use times greater than or equal to the preset times of 200 times as the operation elements to be tested.
Specifically, the preset times may be set by a user in a user-defined manner according to an actual situation, which is not limited in the present invention.
(2) The electronic equipment obtains the use times of the obtained operation elements, sorts the obtained use times of the operation elements in a sequence from more to less, and determines the operation elements with preset digits arranged in the front as the operation elements to be detected.
For example: and the electronic equipment acquires the use times of the acquired operation elements and sorts the use times of the acquired operation elements in a sequence from more to less, and the electronic equipment determines the operation elements which are arranged 20 bits before the preset digit as the operation elements to be detected.
Specifically, the preset digit may be set by a user in a user-defined manner according to an actual situation, which is not limited in the present invention.
(3) And the electronic equipment acquires the error rate of the acquired operation elements and determines the operation elements with the error rate greater than or equal to a preset error rate as the operation elements to be detected.
For example: after the electronic equipment obtains the error rate of the obtained operation elements, the electronic equipment determines the operation elements with the error rate greater than or equal to 75% of a preset error rate as the operation elements to be tested.
Specifically, the preset error rate may be set by a user in a self-defined manner according to an actual situation, which is not limited in the present invention.
(4) And the electronic equipment acquires the error rate of the acquired operation elements, sorts the acquired error rates of the operation elements in a sequence from high to low, and determines the operation elements with preset digits in the front as the operation elements to be detected.
For example: and the electronic equipment acquires the error rate of the acquired operation elements and sorts the acquired error rate of the operation elements in a sequence from high to low, and the electronic equipment determines the operation elements which are ranked 20 bits before the preset digit as the operation elements to be detected.
Specifically, the preset error rate may be set by a user in a self-defined manner according to an actual situation, which is not limited in the present invention.
(5) After the selected operation element to be tested is obtained, the electronic equipment obtains the associated operation element of the selected operation element to be tested, and determines the associated operation element as the operation element to be tested.
For example: after the selected operation element X to be detected is obtained, the electronic equipment obtains Y and Z of the operation element X to be detected, and the electronic equipment simultaneously determines the Y and the Z as the operation element to be detected.
(6) The electronic equipment acquires a current test module, the current test module corresponds to a class of user groups, the electronic equipment acquires operation elements corresponding to the current test module from the acquired operation elements, and determines the corresponding operation elements as the operation elements to be tested.
Specifically, the website to be tested has a plurality of modules, each of which corresponds to a different user group, for example, a financial website has a personal user module for personal use and an enterprise user module for enterprise use. At the time of testing, only one module may be tested.
For example: and if the electronic equipment acquires that the current test module is W, acquiring the operation element corresponding to W from the acquired operation elements, and determining the corresponding operation element as the operation element to be tested by the electronic equipment.
It can be understood that, since a large number of operation elements can be included on one page, but some operation elements are hardly used by the user, the operation element with a high use frequency can be screened out as the operation element to be tested by the above-mentioned manners (1) - (2); because some operation elements have low error rate or are not error, the operation elements with higher error rate can be screened out as the operation elements to be tested by the modes (3) to (4); because some operation elements are correlated, after the operation event of one operation element is executed, the operation event of the correlated operation element is continuously executed, so that the correlated operation event can be directly determined as the operation element to be tested by the method (5), and a complex screening process is avoided; and because only part of the operation elements on one page need to be correspondingly tested in one test module, the operation event corresponding to the current test module can be directly called as the operation element to be tested by the mode (6).
Therefore, the test efficiency can be prevented from being influenced by redundant test work, and the test cost can be saved.
And S13, the electronic equipment sends the operation element to be tested and the operation event of the operation element to be tested to the page of the website to be tested for testing.
By the above embodiment, the electronic device can test the page of the website to be tested according to the operation element to be tested and the operation event of the operation element to be tested, and the test method is not limited.
For example: the electronic equipment can send the selected hyperlink element of the operation element to be tested and the operation event click event corresponding to the hyperlink element to the page of the website to be tested for testing.
And S14, the electronic equipment judges whether the page of the website to be detected has error information.
In this embodiment, when the page of the website to be tested has an error, the electronic device sends an error report message.
For example: when the hyperlink element is clicked, if the hyperlink element is not linked to other webpages or is linked to the specified position on the page of the website to be detected, it is indicated that an error occurs in the position of the hyperlink element in the page of the website to be detected, and the electronic equipment sends error reporting information.
Specifically, the error information may be displayed on the page in a form of a prompt box, or may be displayed on the page with a preset mark, which is not limited in the present invention.
And S15, when the page of the website to be detected has error information, the electronic equipment outputs the error information.
Preferably, when the page of the website to be tested has error information, the method further includes:
and the electronic equipment acquires the log corresponding to the error reporting information, captures the log through the automatic testing tool to obtain a log screenshot, and stores the log screenshot to a specified position.
Specifically, a driver of the Selenium tool instructs a browser to execute a command, and finally, the browser performs screenshot saving operation in a kernel, wherein the final effect is completely the same as the effect of a user capturing and saving a picture on a page by using a mouse.
Furthermore, after the electronic device stores the log screenshot to a designated location (such as a designated folder), the electronic device can also name the log screenshot according to the content or time of the log screenshot, so as to facilitate subsequent query of the log screenshot.
Preferably, the electronic device analyzes the log to obtain error points and types of the error points, and sends the error points of each type to corresponding maintenance personnel according to the types of the error points.
Preferably, the analyzing, by the electronic device, the log to obtain the error point includes:
and the electronic equipment acquires error points from the log by using a trained error recognition model.
In this embodiment, the training, by the electronic device, the error recognition model includes:
and the electronic equipment configures the error point training sample data of different error categories and distributes the training sample data of different categories to different folders. For example, distribution of training sample data of a first category into a first folder; distributing the training sample data of the second category to a second folder; distributing the training sample data of the third category to a third folder; the training sample data of the fourth category is distributed into a fourth folder. The electronic equipment extracts a first preset proportion from different folders, for example, 70% of training sample data is used as training data to train the error recognition model, and the electronic equipment extracts a second preset proportion, for example, 30% of training sample data, from different folders to be used as test data to verify the accuracy of the generated error recognition model.
If the generated error recognition model accuracy is less than a preset accuracy, for example, 99%, the electronic device increases the number of acquired training sample data of different types, and repeats the above generation process of the error recognition model until the generated error recognition model accuracy is greater than or equal to the preset accuracy, for example, 99%.
Through the embodiment, the error information of the corresponding category can be sent to the corresponding maintainer, so that the pertinence is achieved, the maintenance efficiency is improved, and the time loss caused by the matching of the maintainers is saved.
For example: and when the error type is determined to be H, the electronic equipment acquires a maintainer I corresponding to H, and the electronic equipment sends error information to the maintainer I so that the maintainer I can maintain immediately.
Specifically, the electronic device may send each type of error information to a corresponding maintenance person in a short message or email manner, which is not limited in the present invention.
In summary, the invention can start the browser by using the automatic test tool and start the website to be tested; acquiring an operation element on a page of the website to be detected and an operation event of the operation element; selecting an operation element to be detected from the obtained operation elements; sending the operation element to be tested and the operation event of the operation element to be tested to the page of the website to be tested for testing, thereby carrying out targeted robustness test on the webpage and judging whether the page of the website to be tested has error information or not; when the page of the website to be tested has error reporting information, the error reporting information is output, and the test scheme has pertinence, so that other functions of the system to be tested cannot be influenced, and the stability of the system to be tested and the integrity of the functions of the system to be tested are ensured.
FIG. 2 is a functional block diagram of the apparatus for testing web pages according to the preferred embodiment of the present invention. The webpage testing device 11 includes a starting unit 110, an obtaining unit 111, a selecting unit 112, a sending unit 113, a judging unit 114, an output unit 115, a screenshot unit 116, an analyzing unit 117, and a training unit 118. The module/unit referred to in the present invention refers to a series of computer program segments that can be executed by the processor 13 and that can perform a fixed function, and that are stored in the memory 12. In the present embodiment, the functions of the modules/units will be described in detail in the following embodiments.
The start unit 110 starts the browser using the automated testing tool and starts the website to be tested.
Specifically, the computer software automated testing technology, Selenium WebDriver, has a strong visual automatic interaction function, and simulates interaction between a human and a webpage through programming, so that dynamic data loading is triggered, and dynamically generated data is acquired. That is, the Selenium WebDriver technology can truly simulate the operation performed by a user on a webpage, for example, when functions such as "view more", "automatically log in", "click link", "fill form", "scroll mouse", "mouse drag", "scroll down after page loading is completed", "click page turning", "screenshot saving" and the like are clicked, the Ajax technology is used to request more data from a server in real time, and then the JavaScript script is used to dynamically generate content and load and display the content.
In this embodiment, after calling Selenium, the user opens the browser through the Selenium tool, inputs a link (URL) of the website of the data to be tested in the browser, and the Selenium Web page tool calls the get () method of WebDriver to open the Web page of the website of the data to be tested, which is input by the user.
For example: the start unit 110 may open a web page corresponding to the XX website through a program language driver.get ("http:// www.XX"), clear input box data through a program language el.clear (), simulate clicking a return button through a program language el.send _ keys (keys.return), close a browser driver through a program language driver.close (), and the like.
In this embodiment, WebDriver directly controls the browser through native browser support or browser extensions. And Webdriver is developed for each browser, and the close integration with the browser can support the creation of higher-level tests, so that the limitation caused by a JavaScript security model is avoided.
The obtaining unit 111 obtains the operation element on the page of the website to be tested and the operation event of the operation element.
In the present embodiment, the operation element includes, but is not limited to, one or more of the following:
hyperlink elements, input box elements, button elements, drop-down selection box elements, radio button elements, multiple selection box elements, and the like.
Further, the operation event corresponding to the operation element includes, but is not limited to, one or more of the following combinations:
(1) the operation event corresponding to the hyperlink element comprises a click event.
For example: when the obtaining unit 111 obtains that an operation element on a page of a website to be tested is a hyperlink element, the obtaining unit 111 obtains that an operation event corresponding to the hyperlink element is a click event, that is, when the obtaining unit 111 obtains a signal that a user clicks the hyperlink element, the electronic device executes a task corresponding to the hyperlink, so as to link to another webpage or a designated position on the page of the website to be tested.
(2) The operation events corresponding to the input box elements comprise an event of inputting random text and an event of emptying text.
For example: when the obtaining unit 111 obtains that an operation element on a page of a to-be-detected website is an input box element, and the obtaining unit 111 obtains that an operation event corresponding to the input box element is an event of inputting a random text or an event of emptying a text, the electronic device may input a text or an emptying text in the input box element.
(3) The operation event corresponding to the button element comprises a click event.
For example: when the obtaining unit 111 obtains that an operation element on a page of a to-be-detected web address is a button element, the obtaining unit 111 obtains that an operation event corresponding to the button element is a click event, that is, when the obtaining unit 111 obtains a signal that a user clicks the button element, the electronic device executes a task corresponding to the button element, for example: start running, pause running, stop running, etc.
(4) The operation event corresponding to the drop-down selection box element comprises a selection of a certain option event.
For example: when the obtaining unit 111 obtains that an operation element on a page of a to-be-detected website is a pull-down selection box element (for example, the pull-down selection box element includes an option a, an option B, and an option C), the obtaining unit 111 obtains that an operation event corresponding to the pull-down selection box element is a selection of a certain option event, that is, after the obtaining unit 111 obtains that a user selects an option a in the pull-down selection box element, the electronic device displays the option a on the page of the to-be-detected website as a selection of the user.
(5) The operation event corresponding to the radio button element comprises a selected event.
For example: when the obtaining unit 111 obtains that the operation element on the page of the website to be tested is a radio button element (for example, the radio button element includes an option a, an option B, and an option C), the obtaining unit 111 obtains that the operation event corresponding to the radio button element is a selection event, that is, when the obtaining unit 111 obtains that the user selects the option a in the radio button element, the electronic device displays the option a on the page of the website to be tested as the selection of the user.
(6) The operation events corresponding to the multiple box elements comprise selected events.
For example: when the obtaining unit 111 obtains that an operation element on a page of a to-be-detected website is a multi-box element (for example, the multi-box element includes an option a, an option B, and an option C), the obtaining unit 111 obtains that an operation event corresponding to the multi-box element is a selection event, that is, when the obtaining unit 111 obtains that a user selects the option a and the option B in the multi-box element, the electronic device displays the option a and the option B on the page of the to-be-detected website as selections of the user.
Of course, in other embodiments, the operation element and the operation event of the operation element may have other forms, and the present invention is not limited thereto.
The selecting unit 112 selects an operation element to be tested from the acquired operation elements.
Preferably, the selecting unit 112 selects the operation element to be tested from the obtained operation elements, including, but not limited to, one or more of the following combinations:
(1) the selecting unit 112 obtains the number of times of use of the obtained operation element, and determines the operation element of which the number of times of use is greater than or equal to a preset number of times as the operation element to be tested.
For example: after the selecting unit 112 obtains the usage times of the obtained operation elements, the selecting unit 112 may determine the operation elements whose usage times are greater than or equal to the preset times of 200 times as the operation elements to be tested.
Specifically, the preset times may be set by a user in a user-defined manner according to an actual situation, which is not limited in the present invention.
(2) The selecting unit 112 obtains the use times of the obtained operation elements, sorts the use times of the obtained operation elements in a descending order, and determines the operation elements with the preset digits in the front as the operation elements to be detected.
For example: the selecting unit 112 obtains the use times of the obtained operation elements, and sorts the use times of the obtained operation elements in a descending order, and the selecting unit 112 determines the operation element that is ranked 20 bits before the preset digit as the operation element to be detected.
Specifically, the preset digit may be set by a user in a user-defined manner according to an actual situation, which is not limited in the present invention.
(3) The selecting unit 112 obtains an error rate of the obtained operation element, and determines the operation element with the error rate greater than or equal to a preset error rate as the operation element to be tested.
For example: after the selecting unit 112 obtains the error rate of the obtained operation element, the selecting unit 112 determines the operation element with the error rate greater than or equal to 75% of the preset error rate as the operation element to be tested.
Specifically, the preset error rate may be set by a user in a self-defined manner according to an actual situation, which is not limited in the present invention.
(4) The selecting unit 112 obtains the error rates of the obtained operation elements, sorts the error rates of the obtained operation elements in a descending order, and determines the operation element with a preset number of bits arranged in front as the operation element to be tested.
For example: the selecting unit 112 obtains the error rates of the obtained operation elements, and sorts the error rates of the obtained operation elements in a descending order, and the selecting unit 112 determines the operation element ranked 20 bits before the preset digit as the operation element to be detected.
Specifically, the preset error rate may be set by a user in a self-defined manner according to an actual situation, which is not limited in the present invention.
(5) After the selected operation element to be tested is obtained, the selection unit 112 obtains an associated operation element of the selected operation element to be tested, and determines the associated operation element as the operation element to be tested.
For example: after the selected operation element X to be detected is obtained, the selection unit 112 obtains the operation elements associated with the operation element X to be detected as Y and Z, and the selection unit 112 determines Y and Z as the operation element to be detected at the same time.
(6) The selecting unit 112 obtains a current test module, where the current test module corresponds to a class of user groups, and the selecting unit 112 obtains an operation element corresponding to the current test module from the obtained operation elements, and determines the corresponding operation element as the operation element to be tested.
Specifically, the website to be tested has a plurality of modules, each of which corresponds to a different user group, for example, a financial website has a personal user module for personal use and an enterprise user module for enterprise use. At the time of testing, only one module may be tested.
For example: if the selecting unit 112 obtains that the current test module is W, and then obtains the operation element corresponding to W from the obtained operation elements, the selecting unit 112 determines the corresponding operation element as the operation element to be tested.
It can be understood that, since a large number of operation elements can be included on one page, but some operation elements are hardly used by the user, the operation element with a high use frequency can be screened out as the operation element to be tested by the above-mentioned manners (1) - (2); because some operation elements have low error rate or are not error, the operation elements with higher error rate can be screened out as the operation elements to be tested by the modes (3) to (4); because some operation elements are correlated, after the operation event of one operation element is executed, the operation event of the correlated operation element is continuously executed, so that the correlated operation event can be directly determined as the operation element to be tested by the method (5), and a complex screening process is avoided; and because only part of the operation elements on one page need to be correspondingly tested in one test module, the operation event corresponding to the current test module can be directly called as the operation element to be tested by the mode (6).
Therefore, the test efficiency can be prevented from being influenced by redundant test work, and the test cost can be saved.
The sending unit 113 sends the operation element to be tested and the operation event of the operation element to be tested to the page of the website to be tested for testing.
By the above embodiment, the electronic device can test the page of the website to be tested according to the operation element to be tested and the operation event of the operation element to be tested, and the test method is not limited.
For example: the sending unit 113 may send the selected hyperlink element of the operation element to be tested and the operation event click event corresponding to the hyperlink element to the page of the website to be tested for testing.
The determining unit 114 determines whether the page of the website to be tested has error information.
In this embodiment, when the page of the website to be tested has an error, the determining unit 114 sends an error message.
For example: when the hyperlink element is clicked, if the hyperlink element is not linked to another web page or is linked to the designated position on the page of the website to be detected, it indicates that an error occurs in the position of the hyperlink element in the page of the website to be detected, and the determining unit 114 sends an error report message.
Specifically, the error information may be displayed on the page in a form of a prompt box, or may be displayed on the page with a preset mark, which is not limited in the present invention.
When the page of the website to be tested has error information, the output unit 115 outputs the error information.
Preferably, when the page of the website to be tested has error information, the method further includes:
the obtaining unit 111 obtains a log corresponding to the error information, the screenshot unit 116 captures the log through the automatic testing tool to obtain a log screenshot, and the screenshot unit 116 stores the log screenshot to a specified location.
Specifically, a driver of the Selenium tool instructs a browser to execute a command, and finally, the browser performs screenshot saving operation in a kernel, wherein the final effect is completely the same as the effect of a user capturing and saving a picture on a page by using a mouse.
Further, after the screenshot unit 116 stores the log screenshot to a designated location (such as a designated folder), the screenshot unit may also name the log screenshot according to the content or time of the log screenshot, so as to facilitate subsequent query of the log screenshot.
Preferably, the analysis unit 117 analyzes the log to obtain error points and types of the error points, and the transmission unit 113 transmits the error points of each type to the corresponding maintenance staff according to the types of the error points.
Preferably, the parsing unit 117 parses the log to obtain the error point includes:
the parsing unit 117 obtains error points from the log by using a trained error recognition model.
In this embodiment, the training unit 118 training the error recognition model includes:
the training unit 118 configures the error point training sample data of different error categories, and distributes the training sample data of different categories to different folders. For example, distribution of training sample data of a first category into a first folder; distributing the training sample data of the second category to a second folder; distributing the training sample data of the third category to a third folder; the training sample data of the fourth category is distributed into a fourth folder. The training unit 118 extracts a first preset proportion, for example, 70% of training sample data, from different folders to perform training of the error recognition model, and the training unit 118 extracts a second preset proportion, for example, 30% of training sample data, from different folders to perform test data to perform accuracy verification on the generated error recognition model.
If the generated error recognition model accuracy is less than a preset accuracy, for example, 99%, the training unit 118 increases the number of acquired training sample data of the different types, and repeats the above generation process of the error recognition model until the generated error recognition model accuracy is greater than or equal to the preset accuracy, for example, 99%.
The transmitting unit 113 transmits the error points of each type to the corresponding maintenance staff according to the types of the error points.
Through the embodiment, the error information of the corresponding category can be sent to the corresponding maintainer, so that the pertinence is achieved, the maintenance efficiency is improved, and the time loss caused by the matching of the maintainers is saved.
For example: when the error type is determined to be H, the sending unit 113 obtains a maintainer I corresponding to H, and the sending unit 113 sends error information to the maintainer I so that the maintainer I can perform maintenance immediately.
Specifically, the sending unit 113 may send each type of error information to the corresponding maintenance personnel in a manner of short message or mail, and the invention is not limited thereto.
In summary, the invention can start the browser by using the automatic test tool and start the website to be tested; acquiring an operation element on a page of the website to be detected and an operation event of the operation element; selecting an operation element to be detected from the obtained operation elements; sending the operation element to be tested and the operation event of the operation element to be tested to the page of the website to be tested for testing, thereby carrying out targeted robustness test on the webpage and judging whether the page of the website to be tested has error information or not; when the page of the website to be tested has error reporting information, the error reporting information is output, and the test scheme has pertinence, so that other functions of the system to be tested cannot be influenced, and the stability of the system to be tested and the integrity of the functions of the system to be tested are ensured.
Fig. 3 is a schematic structural diagram of an electronic device implementing a web page testing method according to a preferred embodiment of the present invention.
The electronic device 1 is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and its hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The electronic device 1 may also be, but not limited to, any electronic product that can perform human-computer interaction with a user through a keyboard, a mouse, a remote controller, a touch panel, or a voice control device, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an Internet Protocol Television (IPTV), an intelligent wearable device, and the like.
The electronic device 1 may also be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices.
The Network where the electronic device 1 is located includes, but is not limited to, the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and a computer program, such as a web page test program, stored in the memory 12 and executable on the processor 13.
It will be appreciated by a person skilled in the art that the schematic diagram is only an example of the electronic device 1 and does not constitute a limitation of the electronic device 1, and that it may comprise more or less components than shown, or some components may be combined, or different components, e.g. the electronic device 1 may further comprise an input output device, a network access device, a bus, etc.
The Processor 13 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The processor 13 is an operation core and a control center of the electronic device 1, and is connected to each part of the whole electronic device 1 by various interfaces and lines, and executes an operating system of the electronic device 1 and various installed application programs, program codes, and the like.
The processor 13 executes an operating system of the electronic device 1 and various installed application programs. The processor 13 executes the application program to implement the steps in the above-mentioned embodiments of the web page testing method, such as steps S10, S11, S12, S13, S14 and S15 shown in fig. 1.
Alternatively, the processor 13, when executing the computer program, implements the functions of the modules/units in the above device embodiments, for example: starting a browser by adopting an automatic testing tool, and starting a website to be tested; acquiring an operation element on a page of the website to be detected and an operation event of the operation element; selecting an operation element to be detected from the obtained operation elements; sending the operation element to be tested and the operation event of the operation element to be tested to the page of the website to be tested for testing; judging whether the page of the website to be detected has error information or not; and outputting the error information when the page of the website to be detected has the error information.
Illustratively, the computer program may be divided into one or more modules/units, which are stored in the memory 12 and executed by the processor 13 to accomplish the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program in the electronic device 1. For example, the computer program may be divided into a starting unit 110, an obtaining unit 111, a selecting unit 112, a sending unit 113, a judging unit 114, an output unit 115, a screenshot unit 116, an analyzing unit 117, and a training unit 118.
The memory 12 can be used for storing the computer programs and/or modules, and the processor 13 implements various functions of the electronic device 1 by running or executing the computer programs and/or modules stored in the memory 12 and calling data stored in the memory 12. The memory 12 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 12 may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
The memory 12 may be an external memory and/or an internal memory of the electronic device 1. Further, the Memory 12 may be a circuit having a Memory function without any physical form In the integrated circuit, such as a RAM (Random-Access Memory), a FIFO (First In First Out), and the like. Alternatively, the memory 12 may be a memory in a physical form, such as a memory stick, a TF Card (Trans-flash Card), or the like.
The integrated modules/units of the electronic device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented.
Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
With reference to fig. 1, the memory 12 of the electronic device 1 stores a plurality of instructions to implement a web page test method, and the processor 13 can execute the plurality of instructions to implement: starting a browser by adopting an automatic testing tool, and starting a website to be tested; acquiring an operation element on a page of the website to be detected and an operation event of the operation element; selecting an operation element to be detected from the obtained operation elements; sending the operation element to be tested and the operation event of the operation element to be tested to the page of the website to be tested for testing; judging whether the page of the website to be detected has error information or not; and outputting the error information when the page of the website to be detected has the error information.
According to a preferred embodiment of the invention, the operational elements comprise a combination of one or more of the following:
hyperlink elements, input box elements, button elements, drop-down selection box elements, radio button elements, multi-selection box elements;
the operation event of the operation element comprises one or more of the following combinations:
the operation event corresponding to the hyperlink element comprises a click event; and/or
The operation events corresponding to the input box elements comprise an input random text event and an emptying text event; and/or
The operation event corresponding to the button element comprises a click event; and/or
The operation event corresponding to the drop-down selection box element comprises a selection option event; and/or
The operation event corresponding to the radio button element comprises a selected event; and/or
The operation events corresponding to the multiple box elements comprise selected events.
According to a preferred embodiment of the present invention, the processor 13 further executes a plurality of instructions including:
acquiring the use times of the acquired operation elements, and determining the operation elements with the use times larger than or equal to the preset times as the operation elements to be detected; and/or
Acquiring the use times of the acquired operation elements, sequencing the use times of the acquired operation elements from high to low, and determining the operation elements with preset digits arranged in front as the operation elements to be detected; and/or
Acquiring the error rate of the acquired operation elements, and determining the operation elements with the error rate larger than or equal to a preset error rate as the operation elements to be detected; and/or
Acquiring the error rate of the acquired operation elements, sequencing the error rates of the acquired operation elements from high to low, and determining the operation elements with the preset digits arranged in front as the operation elements to be detected; and/or
After the selected operation element to be detected is obtained, obtaining the associated operation element of the selected operation element to be detected, and determining the associated operation element as the operation element to be detected; and/or
The method comprises the steps of obtaining a current testing module, obtaining an operation element corresponding to the current testing module from the obtained operation elements, and determining the corresponding operation element as the operation element to be tested, wherein the current testing module corresponds to a class of user groups.
According to a preferred embodiment of the present invention, the processor 13 further executes a plurality of instructions including:
acquiring a log corresponding to the error reporting information;
and performing screenshot on the log through the automatic testing tool to obtain a log screenshot, and storing the log screenshot to a specified position.
According to a preferred embodiment of the present invention, the processor 13 further executes a plurality of instructions including:
analyzing the log to obtain error points and the types of the error points;
and sending the error points of each type to corresponding maintenance personnel according to the types of the error points.
According to a preferred embodiment of the present invention, the processor 13 further executes a plurality of instructions including:
and acquiring error points from the log by using a trained error recognition model.
According to a preferred embodiment of the present invention, the processor 13 further executes a plurality of instructions including:
before the error points are obtained from the log by using the trained error recognition model, training the error recognition model;
the training the error recognition model comprises:
configuring training sample data of the error points of different error categories, distributing the training sample data of different categories to different folders, respectively extracting training sample data of a first preset proportion from the different folders to train an error recognition model, increasing the obtaining proportion of the training sample data of different error categories when the accuracy of the generated error recognition model is less than the preset accuracy, and repeating the training process of the error recognition model until the accuracy of the generated error recognition model is greater than or equal to the preset accuracy.
Specifically, the processor 13 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the instruction, which is not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, 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 modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules 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 module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (6)

1. A method for testing a web page, the method comprising:
starting a browser by adopting an automatic testing tool, and starting a website to be tested;
acquiring an operation element on a page of the website to be detected and an operation event of the operation element;
selecting an operation element to be detected from the obtained operation elements, wherein after the selected operation element to be detected is obtained, a related operation element of the selected operation element to be detected is obtained, and the related operation element is determined as the operation element to be detected; and/or acquiring a current test module, acquiring an operation element corresponding to the current test module from the acquired operation elements, and determining the corresponding operation element as the operation element to be tested, wherein the current test module corresponds to a class of user groups;
sending the operation element to be tested and the operation event of the operation element to be tested to the page of the website to be tested for testing;
judging whether the page of the website to be detected has error information or not;
when the page of the website to be tested has error reporting information, outputting the error reporting information and acquiring a log corresponding to the error reporting information; analyzing the log to obtain error points and categories of the error points, wherein the error points are obtained from the log by using a trained error recognition model, and the training of the error recognition model comprises the following steps: configuring training sample data of error points of different error categories, distributing the training sample data of different categories to different folders, respectively extracting training sample data of a first preset proportion from the different folders to train an error recognition model, increasing the obtaining proportion of the training sample data of different error categories when the accuracy rate of the generated error recognition model is less than the preset accuracy rate, and repeating the training process of the error recognition model until the accuracy rate of the generated error recognition model is greater than or equal to the preset accuracy rate; sending the error points of each type to corresponding maintenance personnel according to the types of the error points; or the browser is instructed to perform screenshot in the kernel through a driver of the automatic testing tool to obtain a log screenshot, and the log screenshot is stored to a specified position.
2. A web page testing method according to claim 1, wherein the operation elements comprise one or more of the following in combination:
hyperlink elements, input box elements, button elements, drop-down selection box elements, radio button elements, multi-selection box elements;
the operation event of the operation element comprises one or more of the following combinations:
the operation event corresponding to the hyperlink element comprises a click event; and/or
The operation events corresponding to the input box elements comprise an input random text event and an emptying text event; and/or
The operation event corresponding to the button element comprises a click event; and/or
The operation event corresponding to the drop-down selection box element comprises a selection option event; and/or
The operation event corresponding to the radio button element comprises a selected event; and/or
The operation events corresponding to the multiple box elements comprise selected events.
3. The method for testing web pages according to claim 1, wherein the selection of the operation element to be tested from the obtained operation elements comprises one or more of the following combinations:
acquiring the use times of the acquired operation elements, and determining the operation elements with the use times larger than or equal to the preset times as the operation elements to be detected; and/or
Acquiring the use times of the acquired operation elements, sequencing the use times of the acquired operation elements from high to low, and determining the operation elements with preset digits arranged in front as the operation elements to be detected; and/or
Acquiring the error rate of the acquired operation elements, and determining the operation elements with the error rate larger than or equal to a preset error rate as the operation elements to be detected; and/or
And acquiring the error rate of the acquired operation elements, sequencing the acquired error rates of the operation elements from high to low, and determining the operation elements with the preset digits in the front as the operation elements to be detected.
4. A web page testing apparatus, the apparatus comprising:
the starting unit is used for starting the browser by adopting an automatic testing tool and starting the website to be tested;
the acquisition unit is used for acquiring the operation elements on the page of the website to be detected and the operation events of the operation elements;
the selecting unit is used for selecting an operation element to be detected from the obtained operation elements, wherein after the selected operation element to be detected is obtained, the associated operation element of the selected operation element to be detected is obtained, and the associated operation element is determined as the operation element to be detected; and/or acquiring a current test module, acquiring an operation element corresponding to the current test module from the acquired operation elements, and determining the corresponding operation element as the operation element to be tested, wherein the current test module corresponds to a class of user groups;
the sending unit is used for sending the operation element to be tested and the operation event of the operation element to be tested to the page of the website to be tested for testing;
the judging unit is used for judging whether the page of the website to be detected has error information or not;
the output unit is used for outputting the error reporting information when the page of the website to be tested has the error reporting information, and acquiring a log corresponding to the error reporting information; analyzing the log to obtain error points and categories of the error points, wherein the error points are obtained from the log by using a trained error recognition model, and the training of the error recognition model comprises the following steps: configuring training sample data of error points of different error categories, distributing the training sample data of different categories to different folders, respectively extracting training sample data of a first preset proportion from the different folders to train an error recognition model, increasing the obtaining proportion of the training sample data of different error categories when the accuracy rate of the generated error recognition model is less than the preset accuracy rate, and repeating the training process of the error recognition model until the accuracy rate of the generated error recognition model is greater than or equal to the preset accuracy rate; sending the error points of each type to corresponding maintenance personnel according to the types of the error points; or the browser is instructed to perform screenshot in the kernel through a driver of the automatic testing tool to obtain a log screenshot, and the log screenshot is stored to a specified position.
5. An electronic device, characterized in that the electronic device comprises:
a memory storing at least one instruction; and
a processor executing instructions stored in the memory to implement the web page testing method of any one of claims 1 to 3.
6. A computer-readable storage medium characterized by: the computer-readable storage medium has stored therein at least one instruction that is executed by a processor in an electronic device to implement the web page testing method of any one of claims 1 to 3.
CN201810316068.9A 2018-04-10 2018-04-10 Webpage testing method and device, electronic equipment and medium Active CN108628741B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810316068.9A CN108628741B (en) 2018-04-10 2018-04-10 Webpage testing method and device, electronic equipment and medium
PCT/CN2018/099282 WO2019196274A1 (en) 2018-04-10 2018-08-08 Web page testing method and apparatus, electronic device, and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810316068.9A CN108628741B (en) 2018-04-10 2018-04-10 Webpage testing method and device, electronic equipment and medium

Publications (2)

Publication Number Publication Date
CN108628741A CN108628741A (en) 2018-10-09
CN108628741B true CN108628741B (en) 2021-10-01

Family

ID=63705027

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810316068.9A Active CN108628741B (en) 2018-04-10 2018-04-10 Webpage testing method and device, electronic equipment and medium

Country Status (2)

Country Link
CN (1) CN108628741B (en)
WO (1) WO2019196274A1 (en)

Families Citing this family (38)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109542763A (en) * 2018-10-16 2019-03-29 深圳壹账通智能科技有限公司 Page monitoring method, device, computer equipment and storage medium
CN109783168B (en) * 2018-12-13 2023-07-18 平安科技(深圳)有限公司 Method, device, medium and electronic equipment for personalized selection of user interface element
CN109828900A (en) * 2018-12-14 2019-05-31 深圳壹账通智能科技有限公司 Test script automatic generation method, device, electronic equipment and storage medium
CN109710528B (en) * 2018-12-25 2022-03-01 中国人民财产保险股份有限公司 Test script generation method, device, equipment and medium
CN111694725A (en) * 2019-03-15 2020-09-22 北京奇虎科技有限公司 Method and device for testing stability of web page
CN111949510B (en) * 2019-05-17 2024-05-14 百度在线网络技术(北京)有限公司 Test processing method, device, electronic equipment and readable storage medium
CN110287108A (en) * 2019-05-31 2019-09-27 北京随信云链科技有限公司 A kind of page test method calculates equipment and storage medium
CN112152823B (en) * 2019-06-26 2022-09-02 北京易真学思教育科技有限公司 Website operation error monitoring method and device and computer storage medium
CN112347244B (en) * 2019-08-08 2023-07-25 四川大学 Yellow-based and gambling-based website detection method based on mixed feature analysis
CN112579948B (en) * 2019-09-29 2024-06-21 北京国双科技有限公司 Webpage screenshot method and device, storage medium and electronic equipment
CN111061526B (en) * 2019-10-12 2023-12-01 天航长鹰(江苏)科技有限公司 Automatic test method, device, computer equipment and storage medium
CN110781089B (en) * 2019-10-31 2022-08-19 睿云联(厦门)网络通讯技术有限公司 Method and device for automatically testing UI of equipment, electronic equipment and medium
CN111104308A (en) * 2019-11-12 2020-05-05 贝壳技术有限公司 Display page testing method and device, storage medium and electronic equipment
CN111026648A (en) * 2019-11-21 2020-04-17 汉海信息技术(上海)有限公司 Application program page testing method and device, electronic equipment and storage medium
CN111045934A (en) * 2019-11-29 2020-04-21 北京三快在线科技有限公司 Page analysis method, device, client, storage medium and electronic equipment
CN110888709A (en) * 2019-12-04 2020-03-17 中山市凯能集团有限公司 Intelligent operation method and device of monitoring screen, computer equipment and storage medium
CN111159028B (en) * 2019-12-23 2023-08-01 望海康信(北京)科技股份公司 Webpage testing method and device
CN111258904A (en) * 2020-01-16 2020-06-09 恩亿科(北京)数据科技有限公司 Webpage element testing method and related device
CN111488539B (en) * 2020-04-08 2023-04-21 中国银行股份有限公司 Page adjustment method and device
CN114077537B (en) * 2020-08-14 2024-08-30 福建天泉教育科技有限公司 Optimization method and system for UI (user interface) automatic test framework
CN111983429B (en) * 2020-08-19 2023-07-18 Oppo广东移动通信有限公司 Chip verification system, chip verification method, terminal and storage medium
CN112649717B (en) * 2020-09-15 2024-07-26 深圳市几米物联有限公司 Test method, device, terminal equipment and storage medium
CN112231214B (en) * 2020-10-16 2023-09-26 百度国际科技(深圳)有限公司 Page test method, device, electronic equipment and medium
CN112256984B (en) * 2020-10-22 2022-09-30 上海万物新生环保科技集团有限公司 Method and device for acquiring interface background screenshot corresponding to webpage
CN112631704A (en) * 2020-12-26 2021-04-09 深圳集智数字科技有限公司 Interface element identification method and device, storage medium and electronic equipment
CN112671615B (en) * 2020-12-29 2023-07-07 中国平安财产保险股份有限公司 Method, system and storage medium for collecting front-end user operation behavior data
CN113760721A (en) * 2021-01-13 2021-12-07 北京沃东天骏信息技术有限公司 Page testing method and device
CN113342637A (en) * 2021-05-08 2021-09-03 深圳奥哲网络科技有限公司 Application testing method, system, equipment and storage medium based on metadata
CN113238958A (en) * 2021-06-01 2021-08-10 广东好太太智能家居有限公司 Automatic testing method and device for big data visualization platform and electronic equipment
CN113220596B (en) * 2021-06-17 2024-04-30 中国农业银行股份有限公司 Application testing method, device, equipment, storage medium and program product
CN113254018B (en) * 2021-07-14 2021-11-02 广州易方信息科技股份有限公司 Automatic operation method and device for webpage view
CN113791968A (en) * 2021-08-10 2021-12-14 武汉光庭信息技术股份有限公司 UI automation test method, system, electronic equipment and storage medium
CN113656319A (en) * 2021-08-25 2021-11-16 广东三维家信息科技有限公司 Regression testing method and device, electronic equipment and storage medium
CN114968687B (en) * 2022-06-09 2024-07-02 腾讯科技(深圳)有限公司 Traversal test method, apparatus, electronic device, program product, and storage medium
CN115277396B (en) * 2022-08-04 2024-03-26 北京智慧星光信息技术有限公司 Message driving method and system for simulating browser operation
CN115426277A (en) * 2022-08-30 2022-12-02 杭州安恒信息技术股份有限公司 Quality safety detection method, device, equipment and readable storage medium
CN115202762B (en) * 2022-09-13 2023-03-10 北京达佳互联信息技术有限公司 Application program control method and device, electronic equipment and storage medium
CN117370203B (en) * 2023-10-27 2024-07-02 华润数字科技有限公司 Automatic test method, system, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102768641A (en) * 2012-06-15 2012-11-07 深圳中兴网信科技有限公司 Webpage testing factor selecting device and webpage testing factor selecting method
CN103678120A (en) * 2013-11-12 2014-03-26 北京京东尚科信息技术有限公司 Automatic web-application testing method based on modeling
CN104461855A (en) * 2013-09-22 2015-03-25 腾讯科技(北京)有限公司 Automatic Web testing method, system and device
CN105653444A (en) * 2015-12-23 2016-06-08 北京大学 Internet log data-based software defect failure recognition method and system
CN107665165A (en) * 2016-07-27 2018-02-06 中兴通讯股份有限公司 Ambient noise generation method and device, method for testing pressure and device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521121B (en) * 2011-11-18 2015-04-08 华为技术有限公司 Page testing method and page testing device
US20140351796A1 (en) * 2013-05-24 2014-11-27 Microsoft Corporation Accessibility compliance testing using code injection
US9336126B1 (en) * 2014-06-24 2016-05-10 Amazon Technologies, Inc. Client-side event logging for heterogeneous client environments
CN105677615B (en) * 2016-01-04 2018-11-23 北京邮电大学 A kind of distributed machines learning method based on weka interface
CN107203464B (en) * 2016-03-17 2020-09-08 阿里巴巴集团控股有限公司 Method and device for positioning service problem
CN105843734B (en) * 2016-03-18 2019-03-15 厦门美图移动科技有限公司 A kind of automated testing method, device and calculate equipment
CN106126413B (en) * 2016-06-16 2019-02-19 南通大学 The Software Defects Predict Methods of packaging type feature selecting based on the study of class imbalance and genetic algorithm

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102768641A (en) * 2012-06-15 2012-11-07 深圳中兴网信科技有限公司 Webpage testing factor selecting device and webpage testing factor selecting method
CN104461855A (en) * 2013-09-22 2015-03-25 腾讯科技(北京)有限公司 Automatic Web testing method, system and device
WO2015039566A1 (en) * 2013-09-22 2015-03-26 Tencent Technology (Shenzhen) Company Limited Method and system for facilitating automated web page testing
CN103678120A (en) * 2013-11-12 2014-03-26 北京京东尚科信息技术有限公司 Automatic web-application testing method based on modeling
CN105653444A (en) * 2015-12-23 2016-06-08 北京大学 Internet log data-based software defect failure recognition method and system
CN107665165A (en) * 2016-07-27 2018-02-06 中兴通讯股份有限公司 Ambient noise generation method and device, method for testing pressure and device

Also Published As

Publication number Publication date
WO2019196274A1 (en) 2019-10-17
CN108628741A (en) 2018-10-09

Similar Documents

Publication Publication Date Title
CN108628741B (en) Webpage testing method and device, electronic equipment and medium
CN108595583B (en) Dynamic graph page data crawling method, device, terminal and storage medium
CN108959068B (en) Software interface testing method, device and storage medium
WO2021109928A1 (en) Creation method, usage method and apparatus for machine learning scheme template
US9003423B1 (en) Dynamic browser compatibility checker
CN108830383B (en) Method and system for displaying machine learning modeling process
CN101193007A (en) Testing method, scenario testing method and corresponding device for URL command
CN109815119B (en) APP link channel testing method and device
CN111401041A (en) Problem prediction method and device, electronic equipment and storage medium
CN109828906B (en) UI (user interface) automatic testing method and device, electronic equipment and storage medium
CN107193743A (en) One kind application assessment method, device, computer equipment and storage medium
CN108898229B (en) Method and system for constructing machine learning modeling process
CN109472007B (en) Automatic question creating method and device for medical questionnaire, electronic equipment and storage medium
CN109634579A (en) Code generating method, device, computer installation and storage medium
CN110825731A (en) Data storage method and device, electronic equipment and storage medium
CN103970832A (en) Method and device for recognizing spam
CN114356747A (en) Display content testing method, device, equipment, storage medium and program product
JP2020095679A (en) Information processing device, program, and system
US9104573B1 (en) Providing relevant diagnostic information using ontology rules
CN112965711A (en) Job test method and apparatus, electronic device, and storage medium
CN112667517A (en) Method, device, equipment and storage medium for acquiring automatic test script
CN109949090B (en) Client recommendation method and device, electronic equipment and medium
JP6508327B2 (en) Text visualization system, text visualization method, and program
CN116661936A (en) Page data processing method and device, computer equipment and storage medium
CN109753284B (en) Interface creating method, device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant