CN113760721A - Page testing method and device - Google Patents

Page testing method and device Download PDF

Info

Publication number
CN113760721A
CN113760721A CN202110040846.8A CN202110040846A CN113760721A CN 113760721 A CN113760721 A CN 113760721A CN 202110040846 A CN202110040846 A CN 202110040846A CN 113760721 A CN113760721 A CN 113760721A
Authority
CN
China
Prior art keywords
page
test
testing
dimension
project
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110040846.8A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology 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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202110040846.8A priority Critical patent/CN113760721A/en
Publication of CN113760721A publication Critical patent/CN113760721A/en
Pending legal-status Critical Current

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/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/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/3692Test management for test results analysis

Abstract

The invention discloses a page testing method and device, and relates to the technical field of computers. One embodiment of the method comprises: acquiring a resource positioning address to access a page project, traversing a page to be tested in the page project, and calling a document object analysis tool to determine an operable element in the page to be tested; and testing the operable elements according to a preset testing dimension to obtain a testing result of each operable element, wherein the testing result is used as the testing result of the page project. According to the method and the system, under the condition that project service logic is not known, the page function availability of the project is tested once, and the operable elements in each page to be tested are tested to obtain the test result, so that the test result of the project function availability can be quickly obtained.

Description

Page testing method and device
Technical Field
The invention relates to the technical field of computers, in particular to a page testing method and device.
Background
Currently, the HTML5(H5) standard is widely applied to the development of computer projects, and the testing requirement of H5 pages (such as webpage projects developed based on H5) is inevitable; in the prior art, the H5 webpage project is usually tested by writing test scripts for each project after developers and testers know the relevant business logic of the project.
In the process of implementing the invention, the prior art at least has the following problems:
an automatic compiling and running framework can be built to compile an automatic script only by knowing relevant business logic of a project in advance and positioning elements, so that certain limitation is realized; and the compiled script is specially used for a certain project, is difficult to be applied to other projects or projects after page updating, and has poor expansibility.
Disclosure of Invention
In view of this, embodiments of the present invention provide a page testing method and apparatus, which can call a document analysis tool to obtain an operable element in each page to be tested and test the operable element without understanding a project service logic, so as to obtain a test result, so as to implement a test on a webpage project quickly for once function availability.
In order to achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a page testing method, including:
acquiring a resource positioning address to access a page project, traversing a page to be tested in the page project, and calling a document object analysis tool to determine an operable element in the page to be tested;
and testing the operable elements according to a preset testing dimension to obtain a testing result of each operable element, wherein the testing result is used as the testing result of the page project.
Optionally, the traversing the page to be tested in the page item includes:
invoking a traversal depth threshold for testing;
and taking the page with the page depth less than or equal to the traversal depth threshold value in the page project as the page to be tested, and traversing the page to be tested.
Optionally, the testing the operable elements according to a preset testing dimension to obtain a testing result of each operable element includes:
determining test attributes in each test dimension according to the service configuration information of the page project;
and operating the operable elements to obtain operation results, determining attribute test results corresponding to the test attributes according to the operation results, and taking all the attribute test results as the test results of the operable elements.
Optionally, the test dimensions include: communication dimension, content dimension, resource file dimension;
in the case that the test dimension is a communication dimension, the corresponding test attribute comprises at least one of: whether data transmission with a server is normal, whether the operation on the operable element is normally executed, and whether a return result after the operation on the operable element indicates a client error or a server error;
in the case that the test dimension is a content dimension, the corresponding test attribute comprises at least one of: whether the corresponding content after the operation of the operable element contains preset sensitive words or abnormal links and whether the style of the interface meets the preset conditions or not is judged;
in the case that the test dimension is a resource file dimension, the corresponding test attribute includes at least one of: whether the target format file exists, whether abnormal downloading occurs or not and whether grammar error occurs or not.
Optionally, after obtaining the test result of the page item, the method further includes:
summarizing the test results to obtain result values of the page items about the test attributes, and calling an approval condition to judge whether the result values meet the approval condition; and when the page item is satisfied, determining that the approval result of the page item is passed.
Optionally, the aggregating the test results to obtain result values of the page items about the test attributes includes:
according to the summarized test results, obtaining result values of the test attributes by using a result calculation method corresponding to the test attributes;
wherein the result calculation method comprises: calculating the occupation ratio, calculating the frequency and calculating the times.
Optionally, the invoking an approval condition to determine whether each result value satisfies the approval condition includes:
calling a weight algorithm, and calculating according to the result value to obtain a value to be examined and approved of the page project;
and judging whether the value to be examined and approved meets the examination and approval conditions or not based on the examination and approval conditions.
According to still another aspect of the embodiments of the present invention, there is provided a page testing apparatus including:
the acquisition module is used for acquiring a resource positioning address to access a page project, traversing a page to be tested in the page project, and calling a document object analysis tool to determine an operable element in the page to be tested;
and the test module is used for testing the operable elements according to preset test dimensions to obtain test results of the operable elements to serve as the test results of the page items.
Optionally, the step of traversing the page to be tested in the page item by the obtaining module includes:
invoking a traversal depth threshold for testing;
and taking the page with the page depth less than or equal to the traversal depth threshold value in the page project as the page to be tested, and traversing the page to be tested.
Optionally, the testing module tests the operable elements according to a preset testing dimension to obtain a testing result of each operable element, including:
determining test attributes in each test dimension according to the service configuration information of the page project;
and operating the operable elements to obtain operation results, determining attribute test results corresponding to the test attributes according to the operation results, and taking all the attribute test results as the test results of the operable elements.
Optionally, the test dimensions include: communication dimension, content dimension, resource file dimension;
in the case that the test dimension is a communication dimension, the corresponding test attribute comprises at least one of: whether data transmission with a server is normal, whether the operation on the operable element is normally executed, and whether a return result after the operation on the operable element indicates a client error or a server error;
in the case that the test dimension is a content dimension, the corresponding test attribute comprises at least one of: whether the corresponding content after the operation of the operable element contains preset sensitive words or abnormal links and whether the style of the interface meets the preset conditions or not is judged;
in the case that the test dimension is a resource file dimension, the corresponding test attribute includes at least one of: whether the target format file exists, whether abnormal downloading occurs or not and whether grammar error occurs or not.
Optionally, the page testing apparatus further includes: the approval module is used for obtaining the test result of the page project and then is used for:
summarizing the test results to obtain result values of the page items about the test attributes, and calling an approval condition to judge whether the result values meet the approval condition; and when the page item is satisfied, determining that the approval result of the page item is passed.
Optionally, the step of summarizing the test result by the test module to obtain a result value of the page item about each test attribute includes:
according to the summarized test results, obtaining result values of the test attributes by using a result calculation method corresponding to the test attributes;
wherein the result calculation method comprises: calculating the occupation ratio, calculating the frequency and calculating the times.
Optionally, the invoking, by the testing module, an approval condition to determine whether each result value satisfies the approval condition includes:
calling a weight algorithm, and calculating according to the result value to obtain a value to be examined and approved of the page project;
and judging whether the value to be examined and approved meets the examination and approval conditions or not based on the examination and approval conditions.
According to another aspect of the embodiments of the present invention, there is provided an electronic device for testing page items, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the page test method provided by the invention.
According to still another aspect of the embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the page testing method provided by the present invention.
One embodiment of the above invention has the following advantages or benefits: because the technical means of traversing each page to be tested in the accessed page project, determining the operable elements in each page and then testing each element to obtain the test result is adopted, the limitation that project service logic needs to be known first in the prior art is overcome, the technical problem that only a special test script can be written for testing and the expansibility is poor is solved, and further, the page function availability can be tested for the project once firstly under the condition that the project service logic is not known, so that the test result of the project function availability can be quickly obtained.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a page testing method according to a first embodiment of the present invention;
FIG. 2 is a schematic diagram of the main modules of a page test apparatus according to a second embodiment of the present invention;
FIG. 3 is a block diagram of a page testing apparatus according to a third embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 5 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a page testing method according to a first embodiment of the present invention, as shown in fig. 1, including:
step 101, acquiring a resource positioning address to access a page project, traversing a page to be tested in the page project, and calling a document object analysis tool to determine an operable element in the page to be tested;
and 102, testing the operable elements according to a preset testing dimension to obtain a testing result of each operable element to serve as the testing result of the page project.
According to the method, the home page of the page project can be accessed according to the resource location address (URL) corresponding to the page project (such as a webpage project developed based on H5), each page to be tested in the page project is traversed, a document object analysis tool is called to determine the operable elements in the page to be tested (such as a DOM analyzer is used for converting an XML file in the project to obtain the operable elements which can be accessed by JavaScript in each page), and each operable element is tested to obtain the test result of the page project; and then, under the condition that project service logic is not known, the page function availability of the project can be tested once, and the test result of the project function availability can be quickly obtained.
Compared with the mode that developers and testers need to know the relevant business logic of the project first and then compile test scripts for each project and then test the project in the prior art, the method provided by the invention can directly obtain the operable elements in each page to be tested by calling a document analysis tool without knowing the business logic of the project in advance, and test the operable elements based on the preset test dimensionality to obtain the test result about the functional availability.
The preset test dimension can relate to the webpage related problems such as whether the operation calling results of all links of the webpage report errors or not, whether the returned content has sensitive words and illegal links or not, whether js fails to download and report errors or not, whether css files fail to download and report errors or not, whether pictures and video files are not in legal standards or not and the like, and therefore the webpage related problems can be avoided in advance through the method, the test efficiency is improved, and the quality of the webpage items (webpage items) is guaranteed.
And in some embodiments, an approval condition can be set, and the page project (webpage project) is quickly approved based on the test result.
In some embodiments, said traversing a page to be tested in said page project comprises:
invoking a traversal depth threshold for testing;
and taking the page with the page depth less than or equal to the traversal depth threshold value in the page project as the page to be tested, and traversing the page to be tested.
The traversal depth threshold can be set in advance and used for appointing the page range to be tested in the page project, so that the page range to be tested in the test can be flexibly set according to scene requirements or business requirements.
Such as: if the threshold value of the traversal depth can be set to be 3, the three-level pages can be sequentially accessed in the test; the method specifically comprises the following steps: firstly, accessing a primary page1 of a page project according to a URL address, acquiring all operable elements in the primary page1, and sequentially clicking to enter a secondary page2 corresponding to each operable element; and click on all the operable elements in the secondary page2 to enter the tertiary page 3. Because the traversal depth threshold is set to be 3, the test does not continuously access the fourth-level page and the following pages.
In some embodiments, the testing the operable elements according to a preset testing dimension to obtain a testing result of each operable element includes:
determining test attributes in each test dimension according to the service configuration information of the page project; and operating the operable elements to obtain operation results, determining attribute test results corresponding to the test attributes according to the operation results, and taking all the attribute test results as the test results of the operable elements.
In some embodiments, the test dimensions include: communication dimension, content dimension, resource file dimension;
in the case that the test dimension is a communication dimension, the corresponding test attribute comprises at least one of: whether data transmission with a server is normal, whether the operation on the operable element is normally executed, and whether a return result after the operation on the operable element indicates a client error or a server error;
in the case that the test dimension is a content dimension, the corresponding test attribute comprises at least one of: whether the corresponding content after the operation of the operable element contains preset sensitive words or abnormal links and whether the style of the interface meets the preset conditions or not is judged;
in the case that the test dimension is a resource file dimension, the corresponding test attribute includes at least one of: whether the target format file exists, whether abnormal downloading occurs or not and whether grammar error occurs or not.
In practical application, operable functional elements in each level of page can be operated, and then each operation result is obtained; specifically, the test attributes in each test dimension may be determined according to the service configuration information of the page item, and the following content information in the operation result is returned:
for the test of communication dimension, whether the get/post request result is abnormal or not, whether the normal operation result is returned or not about the click event and the slide event or not, whether the code of the page request return result includes 4 beginning (such as 402) or 5 beginning (such as 500) or not can be returned; wherein the code at the beginning of 4 indicates a client error, indicating that the client may have a problem, and the code at the beginning of 5 indicates a server error, indicating that the server may have a problem.
For the test of the content dimension, the result of whether sensitive words exist or not (service layer setting) and illegal linking can be returned, and the result of the mode comparison (such as color similarity, service layer definition similarity lower than a certain value) of the UI (interface design) can be returned.
For the test of the file dimension of the content resource, the target format may be js, css, picture format, video format, etc., and the information to be monitored or recorded in the returned result may include: js file undefined (absence) error, js file download failure, js syntax error; css pattern error, css download failure, css undefined (absence) error; pictures, videos and the like cannot be loaded, and the like.
In some embodiments, after obtaining the test result of the page item, the method may further include: summarizing the test results to obtain result values of the page items about the test attributes, and calling an approval condition to judge whether the result values meet the approval condition; and when the page item is satisfied, determining that the approval result of the page item is passed.
Further, in some embodiments, the aggregating the test results to obtain the result value of the page item with respect to each test attribute includes: according to the summarized test results, obtaining result values of the test attributes by using a result calculation method corresponding to the test attributes; wherein the result calculation method comprises: calculating the occupation ratio, calculating the frequency and calculating the times.
In some embodiments, the invoking an approval condition to determine whether the result values satisfy the approval condition includes: calling a weight algorithm, and calculating according to the result value to obtain a value to be examined and approved of the page project; and judging whether the value to be examined and approved meets the examination and approval conditions or not based on the examination and approval conditions.
For example: for the summary of the communication dimensions, the proportion of returned 'the result of the get/post request is abnormal' in the total times of the get/post request can be summarized; for the summary of the content dimension, the frequency or times of the occurrence of sensitive words and illegal link output can be counted, and the proportion of UI style (color or other defined rules) in the content dimension can be counted; for the summary of the resource file dimensions, the number of various errors occurring therein can be counted.
Regarding the weight calculation, the weight value corresponding to each test dimension in the weight algorithm may be predefined, or more specifically, the weight value of the test attribute in each test dimension may be defined, and then the test result is brought into the weight algorithm to obtain the to-be-examined and approved value through calculation. And then judging whether the value to be examined and approved meets the preset condition to be examined and approved. Such as: the approval condition can comprise an approval threshold, and when the value to be approved is smaller than the approval threshold, the value to be approved can be determined to meet the approval condition, and further the page project can be determined to pass the approval. Alternatively, the above-mentioned pending value may have a more formal presentation manner (for example, subdivided into pending values with different dimensions), and correspondingly, the approval condition may also include different condition settings for the corresponding pending value.
In practical application, the trigger related to the testing method of the invention can be carried out during self-testing, can be carried out during lifting, can also be added into an approval process node, and can quickly obtain the testing result and the approval result of the page project according to the method of the invention.
In addition, after the application system is released, in the time of daily maintenance, the following can be set: the testing method is triggered and the approval result is obtained as long as the online is released, the online fails when the approval is failed, and the online succeeds when the approval is passed.
The test frequency can also be set to realize the periodic execution of the test method of the present invention.
Fig. 2 is a schematic diagram of main blocks of a page testing apparatus 200 according to a third embodiment of the present invention, as shown in fig. 2, including:
an obtaining module 201, configured to obtain a resource location address to access a page item, traverse a page to be tested in the page item, and invoke a document object parsing tool to determine an operable element in the page to be tested;
the testing module 202 is configured to test the operable elements according to a preset testing dimension to obtain a testing result of each operable element, where the testing result is used as a testing result of the page item.
According to the method, the home page of the page project can be accessed according to the resource location address (URL) corresponding to the page project (such as a webpage project developed based on H5), each page to be tested in the page project is traversed, a document object analysis tool is called to determine the operable elements in the page to be tested (such as a DOM analyzer is used for converting an XML file in the project to obtain the operable elements which can be accessed by JavaScript in each page), and each operable element is tested to obtain the test result of the page project; and then, under the condition that project service logic is not known, the page function availability of the project can be tested once, and the test result of the project function availability can be quickly obtained.
Compared with the mode that developers and testers need to know the relevant business logic of the project first and then compile test scripts for each project to test the project in the prior art, the method provided by the invention can directly obtain the operable elements in each page to be tested by calling a document analysis tool without knowing the business logic of the project in advance, and test the operable elements to obtain the test result about the functional availability.
The preset test dimension can relate to the webpage related problems such as whether the operation calling results of all links of the webpage report errors or not, whether the returned content has sensitive words and illegal links or not, whether js fails to download and report errors or not, whether css files fail to download and report errors or not, whether pictures and video files are not in legal standards or not and the like, and therefore the webpage related problems can be avoided in advance through the method, the test efficiency is improved, and the quality of the webpage items (webpage items) is guaranteed.
And in some embodiments, an approval condition can be set, and the page project (webpage project) is quickly approved based on the test result.
In some embodiments, the obtaining module traverses a page to be tested in the page item, including: invoking a traversal depth threshold for testing;
and taking the page with the page depth less than or equal to the traversal depth threshold value in the page project as the page to be tested, and traversing the page to be tested.
Such as: if the threshold value of the traversal depth can be set to be 3, the three-level pages can be sequentially accessed in the test; the method specifically comprises the following steps: firstly, accessing a primary page1 of a page project according to a URL address, acquiring all operable elements in the primary page1, and sequentially clicking to enter a secondary page2 corresponding to each operable element; and click on all the operable elements in the secondary page2 to enter the tertiary page 3. Because the traversal depth threshold is set to be 3, the test does not continuously access the fourth-level page and the following pages.
In some embodiments, the testing module tests the operable elements according to a preset testing dimension to obtain a testing result of each operable element, including:
determining test attributes in each test dimension according to the service configuration information of the page project;
and operating the operable elements to obtain operation results, determining attribute test results corresponding to the test attributes according to the operation results, and taking all the attribute test results as the test results of the operable elements.
In some embodiments, the test dimensions include: communication dimension, content dimension, resource file dimension;
in the case that the test dimension is a communication dimension, the corresponding test attribute comprises at least one of: whether data transmission with a server is normal, whether the operation on the operable element is normally executed, and whether a return result after the operation on the operable element indicates a client error or a server error;
in the case that the test dimension is a content dimension, the corresponding test attribute comprises at least one of: whether the corresponding content after the operation of the operable element contains preset sensitive words or abnormal links and whether the style of the interface meets the preset conditions or not is judged;
in the case that the test dimension is a resource file dimension, the corresponding test attribute includes at least one of: whether the target format file exists, whether abnormal downloading occurs or not and whether grammar error occurs or not.
In practical application, operable functional elements in each level of page can be operated, and then each operation result is obtained; specifically, the test attributes in each test dimension may be determined according to the service configuration information of the page item, and the following content information in the operation result is returned:
for the test of communication dimension, whether the get/post request result is abnormal or not, whether the normal operation result is returned or not about the click event and the slide event or not, whether the code of the page request return result includes 4 beginning (such as 402) or 5 beginning (such as 500) or not can be returned; wherein the code at the beginning of 4 indicates a client error, indicating that the client may have a problem, and the code at the beginning of 5 indicates a server error, indicating that the server may have a problem.
For the test of the content dimension, the result of whether sensitive words exist or not (service layer setting) and illegal linking can be returned, and the result of the mode comparison (such as color similarity, service layer definition similarity lower than a certain value) of the UI (interface design) can be returned.
For the test of the file dimension of the content resource, the target format may be js, css, picture format, video format, etc., and the information to be monitored or recorded in the returned result may include: js file undefined (absence) error, js file download failure, js syntax error; css pattern error, css download failure, css undefined (absence) error; pictures, videos and the like cannot be loaded, and the like.
In some embodiments, the page test apparatus 200 further includes: an approval module 203, after obtaining the test result of the page item, the approval module 203 is configured to:
summarizing the test results to obtain result values of the page items about the test attributes, and calling an approval condition to judge whether the result values meet the approval condition; and when the page item is satisfied, determining that the approval result of the page item is passed.
Further, in some embodiments, the approving module summarizes the test results to obtain the result value of the page item about each test attribute, including:
according to the summarized test results, obtaining result values of the test attributes by using a result calculation method corresponding to the test attributes;
wherein the result calculation method comprises: calculating the occupation ratio, calculating the frequency and calculating the times.
In some embodiments, the invoking an approval condition by the approval module to determine whether the result values satisfy the approval condition includes:
calling a weight algorithm, and calculating according to the result value to obtain a value to be examined and approved of the page project;
and judging whether the value to be examined and approved meets the examination and approval conditions or not based on the examination and approval conditions.
For example: for the summary of the communication dimensions, the proportion of returned 'the result of the get/post request is abnormal' in the total times of the get/post request can be summarized; for the summary of the content dimension, the frequency or times of the occurrence of sensitive words and illegal link output can be counted, and the proportion of UI style (color or other defined rules) in the content dimension can be counted; for the summary of the resource file dimensions, the number of various errors occurring therein can be counted.
Regarding the weight calculation, the weight value corresponding to each test dimension in the weight algorithm may be predefined, or more specifically, the weight value of the test attribute in each test dimension may be defined, and then the test result is brought into the weight algorithm to obtain the to-be-examined and approved value through calculation. And then judging whether the value to be examined and approved meets the preset condition to be examined and approved. Such as: the approval condition can comprise an approval threshold, and when the value to be approved is smaller than the approval threshold, the value to be approved can be determined to meet the approval condition, and further the page project can be determined to pass the approval. Alternatively, the above-mentioned pending value may have a more formal presentation manner (for example, subdivided into pending values with different dimensions), and correspondingly, the approval condition may also include different condition settings for the corresponding pending value.
In practical application, the trigger related to the testing method of the invention can be carried out during self-testing, can be carried out during lifting, can also be added into an approval process node, and can quickly obtain the testing result and the approval result of the page project according to the method of the invention.
In addition, after the application system is released, in the time of daily maintenance, the following can be set: the testing method is triggered and the approval result is obtained as long as the online is released, the online fails when the approval is failed, and the online succeeds when the approval is passed.
The test frequency can also be set to realize the periodic execution of the test method of the present invention.
Fig. 3 is a block diagram of a page testing apparatus according to a fourth embodiment of the present invention, as shown in fig. 3, including:
the trigger execution mechanism module: research and develop self-test, release application, release daily, and execute regularly;
a service layer module: project address, traversal depth, inspection rule (test method), result sending condition (approval condition), weight measurement (weight algorithm);
traversing the test module: HTTP (communication) submodule, content submodule, resource file submodule; wherein the content of the first and second substances,
the HTTP (communication) sub-module includes tests for: get request, post request, click event, slide event, Respone, code;
the content submodule includes tests for: sensitive words, illegal links, UI style;
the resource file submodule comprises the following tests: JS file undefined, JS file download failure, JS grammar error, css style error, css download failure, css undefined, picture, video, Gif picture;
a result output module: error reporting ratio in the test result of the communication sub-module, problem frequency or UI problem ratio in the test result of the content sub-module, and problem frequency in the test result of the resource file sub-module;
a weight scoring module: a weight calculation method for each sub-module in the traversal test can be set;
a quality score module: the sum of the weight scores may be taken as the quality score.
Fig. 4 shows an exemplary system architecture 400 to which the page test method or the page test apparatus of the embodiments of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the server 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 401, 402, 403 to interact with a server 405 over a network 404 to receive or send messages or the like. The terminal devices 401, 402, 403 may have various page items to be tested installed thereon.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 405 may be a server that provides various services. The background management server can respond to the received test request of the page item, execute the test and feed back the test result to the terminal equipment.
It should be noted that the page testing method provided by the embodiment of the present invention is generally executed by the server 405, and accordingly, the page testing apparatus is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks, and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, shown is a block diagram of a computer system 500 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprises an acquisition module, a test module and an approval module. Wherein the names of the modules do not in some cases constitute a limitation of the module itself.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: step 101, acquiring a resource positioning address to access a page project, traversing a page to be tested in the page project, and calling a document object analysis tool to determine an operable element in the page to be tested; and 102, testing the operable elements according to a preset testing dimension to obtain a testing result of each operable element to serve as the testing result of the page project.
According to the technical scheme of the embodiment of the invention, because the technical means of traversing each page to be tested in the accessed page project, determining the operable elements in each page and further testing each element to obtain the test result is adopted, the limitation that project service logic needs to be known first in the prior art is overcome, the technical problem that only a special test script can be written for testing and the expansibility is poor is overcome, and further, the page function availability can be tested for the project once and the test result of the project function availability can be rapidly obtained under the condition that the project service logic is not known.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A page testing method is characterized by comprising the following steps:
acquiring a resource positioning address to access a page project, traversing a page to be tested in the page project, and calling a document object analysis tool to determine an operable element in the page to be tested;
and testing the operable elements according to a preset testing dimension to obtain a testing result of each operable element, wherein the testing result is used as the testing result of the page project.
2. The method of claim 1, wherein said traversing a page to be tested in said page project comprises:
invoking a traversal depth threshold for testing;
and taking the page with the page depth less than or equal to the traversal depth threshold value in the page project as the page to be tested, and traversing the page to be tested.
3. The method according to claim 1, wherein the testing the operable elements according to a preset testing dimension to obtain a testing result of each operable element comprises:
determining test attributes in each test dimension according to the service configuration information of the page project;
and operating the operable elements to obtain operation results, determining attribute test results corresponding to the test attributes according to the operation results, and taking all the attribute test results as the test results of the operable elements.
4. The method of claim 3, wherein the testing dimension comprises: communication dimension, content dimension, resource file dimension;
in the case that the test dimension is a communication dimension, the corresponding test attribute comprises at least one of: whether data transmission with a server is normal, whether the operation on the operable element is normally executed, and whether a return result after the operation on the operable element indicates a client error or a server error;
in the case that the test dimension is a content dimension, the corresponding test attribute comprises at least one of: whether the corresponding content after the operation of the operable element contains preset sensitive words or abnormal links and whether the style of the interface meets the preset conditions or not is judged;
in the case that the test dimension is a resource file dimension, the corresponding test attribute includes at least one of: whether the target format file exists, whether abnormal downloading occurs or not and whether grammar error occurs or not.
5. The method according to any one of claims 3-4, further comprising, after obtaining the test results for the page item:
summarizing the test results to obtain result values of the page items about the test attributes, and calling an approval condition to judge whether the result values meet the approval condition; and when the page item is satisfied, determining that the approval result of the page item is passed.
6. The method of claim 5, wherein said aggregating the test results to obtain result values for the page items for each test attribute comprises:
according to the summarized test results, obtaining result values of the test attributes by using a result calculation method corresponding to the test attributes;
wherein the result calculation method comprises: calculating the occupation ratio, calculating the frequency and calculating the times.
7. The method of claim 5, wherein invoking an approval condition to determine whether the result values satisfy the approval condition comprises:
calling a weight algorithm, and calculating according to the result value to obtain a value to be examined and approved of the page project;
and judging whether the value to be examined and approved meets the examination and approval conditions or not based on the examination and approval conditions.
8. A page testing apparatus, comprising:
the acquisition module is used for acquiring a resource positioning address to access the page project, traversing a page to be tested in the page project, and calling a document object analysis tool to determine an operable element in the page to be tested;
and the test module is used for testing the operable elements according to preset test dimensions to obtain test results of the operable elements to serve as the test results of the page items.
9. A page testing electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202110040846.8A 2021-01-13 2021-01-13 Page testing method and device Pending CN113760721A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110040846.8A CN113760721A (en) 2021-01-13 2021-01-13 Page testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110040846.8A CN113760721A (en) 2021-01-13 2021-01-13 Page testing method and device

Publications (1)

Publication Number Publication Date
CN113760721A true CN113760721A (en) 2021-12-07

Family

ID=78786295

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110040846.8A Pending CN113760721A (en) 2021-01-13 2021-01-13 Page testing method and device

Country Status (1)

Country Link
CN (1) CN113760721A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113986769A (en) * 2021-12-24 2022-01-28 深圳市明源云链互联网科技有限公司 Application testing method, system, device and computer readable storage medium
CN114356788A (en) * 2022-03-21 2022-04-15 大鲲智联(成都)科技有限公司 Application program detection method, device, equipment and medium based on user information

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019196274A1 (en) * 2018-04-10 2019-10-17 平安科技(深圳)有限公司 Web page testing method and apparatus, electronic device, and medium
CN111258904A (en) * 2020-01-16 2020-06-09 恩亿科(北京)数据科技有限公司 Webpage element testing method and related device
CN112131111A (en) * 2020-09-21 2020-12-25 贝壳技术有限公司 Method, device and storage medium for automatically testing page

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019196274A1 (en) * 2018-04-10 2019-10-17 平安科技(深圳)有限公司 Web page testing method and apparatus, electronic device, and medium
CN111258904A (en) * 2020-01-16 2020-06-09 恩亿科(北京)数据科技有限公司 Webpage element testing method and related device
CN112131111A (en) * 2020-09-21 2020-12-25 贝壳技术有限公司 Method, device and storage medium for automatically testing page

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MAURIZIO LEOTTA: "Repairing Selenium Test Cases: An Industrial Case Study about Web Page Element Localization", IEEE, 29 July 2013 (2013-07-29) *
孙立哲;: "轻量级接口自动化测试框架设计与实践", 计算机应用与软件, no. 01, 12 January 2020 (2020-01-12) *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113986769A (en) * 2021-12-24 2022-01-28 深圳市明源云链互联网科技有限公司 Application testing method, system, device and computer readable storage medium
CN114356788A (en) * 2022-03-21 2022-04-15 大鲲智联(成都)科技有限公司 Application program detection method, device, equipment and medium based on user information
CN114356788B (en) * 2022-03-21 2022-05-31 大鲲智联(成都)科技有限公司 Application program detection method, device, equipment and medium based on user information

Similar Documents

Publication Publication Date Title
CN108415832B (en) Interface automation test method, device, equipment and storage medium
US20230281012A1 (en) Systems and methods for automating and monitoring software development operations
US9916168B2 (en) Automated testing of GUI mirroring
US20180011780A1 (en) Web application test script generation to test software functionality
US10339029B2 (en) Automatically detecting internalization (i18n) issues in source code as part of static source code analysis
US8621613B1 (en) Detecting malware in content items
US20090031170A1 (en) System and method to facilitate automatic globalization verification test
CN113760729A (en) Code detection method and device
US9244680B2 (en) Document quality review and testing
CN113760721A (en) Page testing method and device
CN112631590B (en) Component library generation method, device, electronic equipment and computer readable medium
CN112948726A (en) Method, device and system for processing abnormal information
CN117112060A (en) Component library construction method and device, electronic equipment and storage medium
CN113238940A (en) Interface test result comparison method, device, equipment and storage medium
CN111694729A (en) Application testing method and device, electronic equipment and computer readable medium
CN113760706B (en) Webpage debugging method and device
CN112306324B (en) Information processing method, apparatus, device and medium
CN112287097B (en) Method and device for analyzing markup language text, storage medium and electronic equipment
CN115629983A (en) Test case set generation method, device, equipment and medium
CN116775030B (en) Method and device for creating security baseline
CN111104626B (en) Information storage method and device
CN117435464A (en) Software testing method and device, electronic equipment and computer readable storage medium
CN113760706A (en) Webpage debugging method and device
CN117667716A (en) Page testing method and device and electronic equipment
CN113190453A (en) User interface testing method, device, server and 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