Web application test method and device, equipment and storage medium

Through the execution of timed testing tasks and test cases, potential exceptions of web applications are detected and maintenance terminals are notified in a timely manner, which solves the problems of maintenance lag and low operation and maintenance efficiency in the existing technology, and achieves more efficient web application operation and maintenance.

CN119557205APending Publication Date: 2025-03-04ANHUI SANQI JIYU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411431937.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-14
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

In the prior art, the service quality assurance of web applications depends on the error capture mechanism, and it is impossible to predict the error problems of web applications in advance, resulting in lagging staff maintenance and low operation and maintenance efficiency.

Method used

Through the timed test task, the web application is called, the test cases of each page are executed, the test report is generated, the page is determined whether there are abnormalities, and the maintenance terminal is promptly notified to repair it.

Benefits of technology

It realizes detection of potential exceptions before errors occur in a web application, shortens the time from discovery to repair, and improves the operation and maintenance efficiency of web applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557205A_ABST
    Figure CN119557205A_ABST
Patent Text Reader

Abstract

The invention discloses a Web application testing method and device, equipment and a storage medium, and relates to the technical field of computers. The method comprises the following steps: creating a timed test task of each page according to the priority of each page in a Web application, wherein the priority of the page is inversely proportional to the test period of the timed test task; creating a first test case of each control according to the control type of each control in the page; when the test time of the timed test task arrives, generating a second test case of the corresponding page according to the first test case of each control in the corresponding page of the timed test task, executing the second test case and generating a test report of the corresponding page; according to the method, the abnormal information of the corresponding page is determined according to the test report of the page, and the alarm notification is sent to the maintenance terminal according to the abnormal information of the page, so that the potential abnormality of the Web application is detected before the Web application has no error, and the time from discovery to repair of the abnormality of the Web application is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a Web application testing method, device, equipment and storage medium. Background Art

[0002] Web applications, or web-based applications, are applications accessed through a browser. Users can access web applications simply through a browser without installing specific software, which enables web applications to run on a variety of operating systems and devices, including desktop computers, laptops, tablets, and smartphones.

[0003] In the prior art, in order to ensure the service quality of Web applications, pages and logs can be monitored through an error capture mechanism, and when errors are found in pages or logs, staff are notified to maintain the Web applications. Although the error capture mechanism can detect problems to a certain extent, it can only capture them passively after the errors occur, and cannot predict the errors that will occur in Web applications in advance, resulting in delayed maintenance of Web applications by staff and low operation and maintenance efficiency of Web applications. Summary of the invention

[0004] The present application provides a Web application testing method, apparatus, device and storage medium, which are used to call a Web application through a scheduled test task to execute test cases of each page regularly to obtain a test report of each page, and determine whether each page has an exception according to the test report of each page, thereby realizing the detection of potential exceptions of the Web application before an error occurs in the Web application, so that the staff can repair the exceptions of the Web application in time, shortening the time from the discovery to the repair of the exceptions of the Web application, solving the problem of the staff's relatively lagging maintenance of the Web application in the prior art, and improving the operation and maintenance efficiency of the Web application.

[0005] In a first aspect, the present application provides a Web application testing method, comprising:

[0006] Creating a scheduled test task for each page according to the priority of each page in the Web application, wherein the priority of the page is inversely proportional to the test period of the scheduled test task;

[0007] Creating a first test case for each control in the page according to the control type of each control;

[0008] When the test time of the scheduled test task is reached, generating a second test case for the corresponding page according to the first test case of each control in the corresponding page of the scheduled test task, executing the second test case and generating a test report for the corresponding page;

[0009] Determine abnormal information of a corresponding page according to the test report of the page, and send an alarm notification to a maintenance terminal according to the abnormal information of the page.

[0010] In a second aspect, the present application provides a Web application testing device, comprising:

[0011] A test task creation module is configured to create a scheduled test task for each page in the Web application according to the priority of each page, wherein the priority of the page is inversely proportional to the test period of the scheduled test task;

[0012] A test case creation module, configured to create a first test case for each control in the page according to the control type of each control;

[0013] The page test module is configured to generate a second test case for the corresponding page according to the first test case of each control in the page corresponding to the scheduled test task when the test time of the scheduled test task is reached, execute the second test case and generate a test report for the corresponding page;

[0014] The abnormal alarm module is configured to determine abnormal information of the corresponding page according to the test report of the page, and send an alarm notification to the maintenance terminal according to the abnormal information of the page.

[0015] In a third aspect, the present application provides a Web application testing device, including:

[0016] one or more processors;

[0017] The memory stores one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the Web application testing method as described in the first aspect.

[0018] In a fourth aspect, the present application provides a storage medium comprising computer executable instructions, wherein the computer executable instructions are used to execute the Web application testing method as described in the first aspect when executed by a computer processor.

[0019] In this application, corresponding scheduled test tasks can be created in advance for each page of the Web application. The test cycle of the scheduled test task of the page is inversely proportional to its priority, so that important pages can be tested regularly at a high frequency to see if there are any abnormalities, so as to detect abnormal problems of important pages in time and maintain important pages, give priority to ensuring the reliable operation of important pages, and improve the operation quality of Web applications. And, non-important pages can be tested regularly at a low frequency to see if there are any abnormalities, so as to reduce the operating resources occupied by the test and ensure the stable operation of the Web application. Create a corresponding first test case for each control in each page in advance, so that when the test time of the scheduled test task of the page is reached, a second test case for the corresponding page is generated according to the first test case of each control in the page, and the second test case is executed by the Web application and a test report for the corresponding page is generated, so as to realize real-time testing of each page in the Web application. Based on the test report, analyze the abnormal problems existing in the page, and send alarm notifications to maintenance personnel according to the abnormal problems so that maintenance personnel can promptly repair the abnormal problems on the page. Real-time monitoring and real-time alarms of abnormal problems on the page are realized so that the staff can promptly repair the abnormalities of the Web application, shortening the time from discovery to repair of the abnormalities of the Web application and improving the operation and maintenance efficiency of the Web application. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a flow chart of a Web application testing method provided in an embodiment of the present application;

[0021] Figure 2 is a flow chart for determining the priority of a page provided in an embodiment of the present application;

[0022] Figure 3 This is a flowchart of creating a scheduled test task provided by an embodiment of the present application;

[0023] Figure 4 is a flowchart of creating a first test case provided by an embodiment of the present application;

[0024] Figure 5 is a flowchart of generating a second test case provided by an embodiment of the present application;

[0025] Figure 6 It is a schematic diagram of the communication process of the server provided in the embodiment of the present application;

[0026] Figure 7 This is a flowchart of sending an alarm notification according to a test report provided by an embodiment of the present application;

[0027] Figure 8 It is a structural diagram of a Web application testing device provided in an embodiment of the present application;

[0028] Fig. 9It is a structural diagram of a Web application testing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.

[0030] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0031] In the more common existing implementation methods, the guarantee of the running quality of Web applications mainly depends on the error capture mechanism, which is to monitor the pages and logs, and notify the maintenance personnel to maintain the Web applications when errors are found in the pages or logs. Although the error capture mechanism can detect errors that occur during the page loading process of the Web application to a certain extent, it can only capture them passively after the page error occurs, that is, the time node of its error detection is relatively lagging. By the time the maintenance personnel correct the page error, the user may have been affected by the error and give up using the Web application or reduce the frequency of using the Web application, resulting in serious user loss of the Web application. Therefore, the error capture mechanism cannot predict the error problems that will occur in the Web application in advance, resulting in the staff's maintenance of the Web application being relatively lagging, and the operation and maintenance efficiency of the Web application is low.

[0032] To solve the above problems, this embodiment provides a Web application testing method, which calls the Web application through a scheduled test task to execute the test cases of each page regularly to obtain the test report of each page, and determines whether each page has an exception according to the test report of each page, thereby realizing the detection of potential exceptions of the Web application before an error occurs in the Web application, so that the staff can repair the exceptions of the Web application in time, shortening the time from the discovery to the repair of the exception of the Web application, and improving the operation and maintenance efficiency of the Web application.

[0033] The Web application testing method provided in this embodiment can be executed by a Web application testing device, which can be implemented by software and / or hardware, and can be composed of two or more physical entities or one physical entity. For example, the Web application testing device can be a server of a Web application.

[0034] The web application testing device is installed with at least one type of operating system, wherein the operating system includes but is not limited to Android system, Linux system and Windows system. The web application testing device can install at least one application based on the operating system, and the application can be an application that comes with the operating system or an application downloaded from a third-party device or server. In this embodiment, the web application testing device has at least an application that can execute the web application testing method.

[0035] For ease of understanding, this embodiment is described by taking a server as an example of a subject that executes the Web application testing method.

[0036] Figure 1 A flowchart of a Web application testing method provided by an embodiment of the present application is given. Figure 1 , the Web application testing method specifically includes:

[0037] S110 . Creating a scheduled test task for each page according to the priority of each page in the Web application, wherein the priority of the page is inversely proportional to the test period of the scheduled test task.

[0038] In this embodiment, the scheduled test task of the page is a task executed when the page is tested in real time. This embodiment obtains the priority of each page in advance, determines the test cycle of the page according to the priority of the page, and creates a corresponding scheduled test task for the page according to the test cycle of the page, so that the scheduled test task of the page is executed after each interval of the test cycle, thereby realizing regular testing of the page and regularly troubleshooting abnormal problems existing in the page.

[0039] The priority of a page can represent the importance of the page to the Web application, that is, the higher the priority of the page, the more important the page is, and the more important the normal loading of the page is to the running quality of the Web application. Generally speaking, pages that provide core functions or basic functions in Web applications are important pages. Users visit important pages more frequently and have higher requirements for the loading of important pages. Therefore, the normal loading of important pages is one of the important indicators to ensure the running quality of Web applications.

[0040] In this regard, this embodiment sets the mapping relationship between the priority of the page and the test cycle of the scheduled test task to an inverse mapping relationship, that is, the higher the priority of the page, the shorter the test cycle of the corresponding scheduled test task, the higher the execution frequency of the scheduled test task of the page, and the higher the abnormal detection frequency of the page. In this case, the server will execute the scheduled test tasks of important pages at a high frequency, detect abnormal problems of important pages at a high frequency, and promptly discover abnormal problems of important pages, so that the staff can promptly repair the abnormal problems of important pages, without waiting for the user to use the important page when an error occurs before repairing the abnormality, which greatly optimizes the user's experience of using the Web application and ensures the running quality of the Web application. At the same time, the server executes the scheduled test tasks of non-important pages at a low frequency, detects abnormal problems of non-important pages at a low frequency, reduces the running resources occupied by the test, and ensures the stable operation of the Web application. This embodiment configures the test cycle of the scheduled test tasks of the page by the priority of the page, gives priority to ensuring the reliable operation of important pages, and improves the running quality of the Web application.

[0041] In one embodiment, the priority of a page can be customized by the staff according to the importance of the page. For example, when the Web application is an e-commerce application, the home page, product details page, shopping cart page, and settlement page are important pages of the e-commerce application, and the staff configures these pages with a higher priority than other pages. Accordingly, when creating scheduled test tasks for each page, the test cycle of the scheduled test tasks for the home page, product details page, shopping cart page, and settlement page is configured to be shorter than the test cycle of the scheduled test tasks for other pages, so that the subsequent server can detect abnormal problems of the home page, product details page, shopping cart page, and settlement page at a high frequency, and notify the staff to perform timely maintenance when abnormal problems are found on these pages, so as to avoid errors in the loading of the home page, product details page, shopping cart page, and settlement page of the e-commerce application, and optimize the user's shopping experience.

[0042] In another embodiment, the priority of the page can be automatically configured by the server. For example, the server can determine the maintenance frequency or error frequency of the page based on the historical maintenance data or historical error data of each page, and the maintenance frequency or error frequency of the page determines the priority of the page. Among them, the priority of the page is proportional to the maintenance frequency or error frequency of the page, that is, the higher the frequency of page errors or maintenance, the higher the test frequency of the page, so as to timely detect abnormal problems of pages prone to errors, avoid users frequently encountering pages with errors, and improve the operating reliability of Web applications.

[0043] Optionally, the server can also determine the page access situation based on the access records of each page, and determine the page priority based on the page access situation, so as to give priority to ensuring the reliable operation of the pages frequently visited by users and improve the operation quality of the Web application. Specifically, Figure 2 is a flow chart of determining the priority of a page provided by an embodiment of the present application. Figure 2 As shown, the step of determining the priority of the page specifically includes S1101-S1103:

[0044] S1101. Determine the number of visits and the duration of visits to each page in the Web application according to the log records of the Web application.

[0045] For example, the log of the Web application records the records of users visiting various pages. The records of users visiting various pages can be queried through the log records, and the number of visits to each page and the total accumulated visit duration can be counted.

[0046] S1102: Perform a weighted summation on the number of page visits and the visit duration to obtain the visit weight of the corresponding page.

[0047] Exemplarily, a higher number of visits indicates that the user visits the page more frequently, a longer visit duration indicates that the user browses the page for a longer time, and a greater frequency of visits or browsing duration indicates that the user is more interested in the page. Therefore, the page's visit weight can be obtained by multiplying the number of page visits by the corresponding weight coefficient plus the page's visit duration by the corresponding weight coefficient. The weight coefficients of the number of visits and the visit duration can be set according to actual needs, and the weight coefficient is a positive number. The page's access weight is positively correlated with the number of visits and the visit duration, that is, the greater the number of visits and / or the visit duration, the greater the access weight. The page's access weight can be used to characterize the user's interest in the page, that is, the greater the page's access weight, the greater the user's interest in the page.

[0048] S1103: Determine the priority of the page according to the access weight of the page.

[0049] Exemplarily, the access weight of a page can be determined as the priority of the page, or the corresponding page can be assigned a priority from high to low according to the order of the access weight from large to small, that is, the access weight is proportional to the priority, and the higher the access weight, the higher the priority of the page. In this case, the test cycle of the scheduled test task corresponding to the page with a higher access weight is smaller, the detection frequency is higher, and the server detects the page of interest to the user at a high frequency, giving priority to ensuring the reliable operation of the page of interest to the user.

[0050] This embodiment queries the number of visits and visit duration of each page through log records, and the access weight determined by the visit duration and number of visits represents the user's interest in the page, so as to determine the priority of the page according to the access weight, so that the server can detect the pages of interest to the user at a high frequency, and give priority to ensuring the reliable operation of the pages of interest to the user.

[0051] In one embodiment, the server may allocate corresponding test cycles to each page in order from high to low priority, and the test cycles of each page gradually increase in the allocation order. For example, the server allocates a test cycle of T to the page with the highest priority, a test cycle of 2T or T+ΔT to the page with the second highest priority, and then a test cycle of nT or T+ΔT*(n-1) to the subsequent pages, where n is the allocation sequence number of the page.

[0052] In another embodiment, when the abnormality of some pages will not affect the normal operation of users, or when there is almost no abnormality, in order to reduce the test operation load of the server, the real-time test of these pages can be omitted, that is, no scheduled test tasks are created for these pages, and corresponding scheduled test tasks are created according to the priority of other pages. Figure 3 This is a flowchart of creating a timed test task provided by an embodiment of the present application. Figure 3 As shown, the steps of creating a scheduled test task specifically include S1104-S1106:

[0053] S1104: Filter out a plurality of pages to be tested from the pages of the Web application according to the page type of the pages of the Web application.

[0054] For example, page types that will not have abnormal problems and will not affect the use if they occur are pre-sorted, such as static content pages, simple information display pages, auxiliary pages, static file pages, and other pages that simply display information or provide simple contact and download functions, and a page type set is generated based on these page types. The page type of each page in the Web application is matched with the preset page type set, and the pages that do not match the page type set are determined as pages to be tested, that is, pages that will have abnormal problems that will affect the use of users are determined as pages to be tested, so as to prevent the abnormal problems of these pages from affecting the normal use of users and ensure the user experience.

[0055] S1105 , sort the multiple pages to be tested in descending order based on the corresponding priorities, obtain a first preset number of pages to be tested that are ranked high as first pages to be tested, and obtain the remaining pages to be tested as second pages to be tested.

[0056] Among them, the first page to be tested is a page where the server detects abnormalities at a high frequency, and the second page to be tested is a page where the server detects abnormalities at a low frequency. The first preset number can be set according to the operating performance of the server. When the server executes the first preset number of scheduled test tasks at a high frequency, it will not affect the normal operation of the Web application, that is, the first preset number can be regarded as the maximum number of scheduled test tasks executed by the server at a high frequency when the server takes into account the operation and testing of the Web application at the same time. Once the number of scheduled test tasks executed by the server at a high frequency is greater than the first preset number, its operating stability will be greatly affected, thereby affecting the normal operation of the Web application.

[0057] In this regard, the present embodiment aims to sort multiple pages to be tested from large to small according to corresponding priorities, and use a first preset number of pages to be tested that are ranked first as first pages to be tested, and use the remaining pages to be tested as second pages to be tested, so that the subsequent server can execute the scheduled test task of the first pages to be tested at a high frequency and the server can execute the scheduled test task of the second pages to be tested at a low frequency, thereby fully utilizing the server's operating resources without causing overload operation of the server, ensuring the operating stability of the server, and thus ensuring the reliable operation of the Web application.

[0058] It should be noted that when there are a large number of pages to be tested, the test computing load of the server will increase, resulting in the server being overloaded when executing the first preset number of scheduled test tasks at a high frequency. In this regard, when the number of pages to be tested is greater than the preset number threshold, the first preset number can be lowered to reduce the number of pages that the server detects at a high frequency, thereby preventing the server from over-emphasizing the testing of pages and ignoring the normal operation of the Web application, and giving priority to ensuring the reliable operation of the Web application.

[0059] S1106. Create a scheduled test task for the first page to be tested based on a first preset test cycle, and create a scheduled test task for the second page to be tested based on a second preset test cycle, wherein the first preset test cycle is shorter than the second preset test cycle.

[0060] Among them, the first preset test cycle is a detection cycle of a pre-set high-frequency detection page, and the first preset test cycle is configured as a test cycle of the scheduled test task of the first page to be tested, so as to create a scheduled test task of the first page to be tested according to the first preset test cycle, so that the subsequent server executes the scheduled test task of the first page to be tested at intervals of the first preset test cycle to detect abnormal problems in the first page to be tested.

[0061] The second preset test cycle is a detection cycle for a pre-set low-frequency detection page. The second preset test cycle is configured as a test cycle for the scheduled test task of the second page to be tested, thereby creating a scheduled test task for the second page to be tested according to the second preset test cycle, so that the subsequent server executes the scheduled test task of the second page to be tested at intervals of the second preset test cycle to detect abnormal problems in the second page to be tested.

[0062] Since the second preset test cycle is greater than the first preset test cycle, the frequency at which the server executes the scheduled test task of the first page to be tested is higher than the frequency at which it executes the scheduled test task of the second page to be tested. The higher the server's ability to detect anomalies in the first page to be tested, the better the operation and maintenance efficiency of the first page to be tested, thereby giving priority to ensuring the reliable operation of high-priority pages.

[0063] Optionally, when the number of pages to be tested is greater than a preset number threshold, the second preset test cycle is lowered or increased, thereby reducing the test operation load of the server, avoiding the server from over-emphasizing page testing and ignoring the normal operation of the Web application, and giving priority to ensuring the reliable operation of the Web application.

[0064] This embodiment selects pages to be tested by page type, reduces the number of pages tested by the server, and reduces the test operation load of the server. A first preset number of pages to be tested with a higher priority are determined as the first pages to be tested, and the remaining pages to be tested are determined as the second pages to be tested. Timed test tasks for the first pages to be tested and the second pages to be tested are created based on the first preset test cycle and the second preset test cycle, respectively, so as to fully utilize the operation resources of the server without causing overload operation of the server, ensure the operation stability of the server, and thus ensure the reliable operation of the Web application.

[0065] S120: Create a first test case for each control in the page according to the control type of each control.

[0066] The first test case is a test case for testing whether the function of the corresponding control is normal. Exemplarily, after creating a scheduled test task for a page, a first test case for the control can be created according to the control type of the page, so that the first test case can be executed when the scheduled test task of the page is subsequently executed to detect whether the function of the corresponding control of the page is normal.

[0067] In one embodiment, when creating the first test case for each control in the page, a corresponding first test case may be created for each control.

[0068] In another embodiment, the controls to be tested may be screened out from the various controls on the page, and a corresponding first test case may be created for the controls to be tested. Figure 4 : is a flowchart of creating a first test case provided by an embodiment of the present application. Figure 4 As shown, the steps of creating the first test case specifically include S1201-S1204:

[0069] S1201. Filter out a plurality of controls to be tested from the controls on the page according to the control types of the controls on the page.

[0070] It is understandable that Web applications will undergo a series of rigorous tests before they are officially launched. Some controls in the page, such as non-interactive or low-interactive controls, standardized and widely used controls, and controls with basic functions and simple implementations, will hardly have problems during the official operation after being tested before they are officially launched. Therefore, the server may not test these controls during the real-time test process to reduce the test operation load of the server. Specifically, control types that will hardly have problems after being tested before they are officially launched can be collected in advance, and these control types can be integrated into a control type set. The server matches the control type of each control in the page with the preset control type set, and identifies the unmatched controls as controls to be tested, so that controls that are prone to abnormalities can be tested during the real-time test process, and controls with functional abnormalities can be detected in a timely manner.

[0071] S1202: Create a first test case corresponding to the control to be tested according to the control type of the control to be tested.

[0072] Exemplarily, the key functions of the control to be tested are determined according to the control type of the control to be tested, and the first test case of the control to be tested is created according to its key functions. For example, when the control to be tested is a button-type control, its functions include style display, click effect display, response speed, and trigger action, etc. The key functions are its click effect display and trigger action. Therefore, the first test case of the button-type control can be created based on these two key functions to test whether the key functions of the control to be tested are normal through the first test case. After the test before the official launch, other functions will hardly have abnormalities, so other functions can be tested in real time to reduce the test operation load of the server.

[0073] S1203: Determine test weights of first test cases corresponding to the multiple controls to be tested according to the historical trigger times of the multiple controls to be tested.

[0074] Exemplarily, the trigger records of each control in each page are collected through a third-party statistical tool, and the historical trigger times of each control to be tested are counted according to the trigger records. The historical trigger times of the control to be tested are proportional to the test weight of the corresponding first test case, that is, the larger the historical trigger times, the higher the test weight of the first test case of the control to be tested. The historical trigger times can represent the frequency of users using the corresponding control to be tested, and the test weight can represent the probability of the corresponding first test case being executed, that is, the more frequently the user uses the control, the higher the probability of being tested in real time, and priority is given to ensuring that the functions of the controls that are frequently used by users are normal.

[0075] Optionally, the historical trigger times of each control to be tested are accumulated to obtain a total trigger time, and the ratio of the historical trigger time of the control to be tested to the total trigger time is determined as the test weight of the first test case of the control to be tested.

[0076] S1204: Sort the multiple first test cases based on the corresponding test weights to generate a test case list for the page.

[0077] Exemplarily, multiple first test cases are sorted in descending order according to the test weight, and the sorted multiple first test cases are integrated into a test case list, so that when the server executes the scheduled test task of the page, multiple first test cases are randomly selected from the test case list corresponding to the page to test the corresponding controls. The higher the test weight, the higher the first test case is sorted in the test case list, and the greater the probability of it being selected.

[0078] This embodiment screens out controls that can be tested during the real-time test by control type, thereby generating the first test case for these controls, reducing the number of controls tested during the real-time test of the server and reducing the test operation load of the server. The test weight corresponding to the first test case is determined according to the historical triggering times of the control to be tested, and a test case list is generated based on the test weight of the first test case, which increases the probability of testing the controls to be tested that are frequently used, and gives priority to ensuring that the functions of the controls that are frequently used by users are normal. Although the probability of testing the controls to be tested that are frequently used is increased, the first test case is still randomly selected to avoid repeated real-time testing of the same control to be tested, thereby ensuring the comprehensiveness of the page test.

[0079] It should be noted that steps S110-S120 can be regarded as the preliminary preparation process, that is, after executing steps S110-S120, the real-time testing process of the server can be entered. During the real-time testing process, there is no need to execute steps S110-S120 again, but S130-S140 is executed in a loop.

[0080] S130. When the test time of the scheduled test task is reached, generate a second test case for the corresponding page according to the first test case of each control in the page corresponding to the scheduled test task, execute the second test case and generate a test report for the corresponding page.

[0081] Exemplarily, when creating a scheduled test task, the initial test time of the scheduled test task can be configured, and the test time of the scheduled test task is determined according to the initial test time and the test cycle. The test time is the time when the server executes the scheduled test task. When the current time reaches the test time of the scheduled test task, the server executes the scheduled test task to generate a second test case for the test page according to the first test case of each control in the page corresponding to the scheduled test task. Optionally, the server can use the scheduled task function in the Egg.js framework to regularly execute real-time test tasks of the page.

[0082] In one embodiment, the first test cases of all controls on the page may be combined to obtain the second test case of the page.

[0083] In another embodiment, a certain number of first test cases can be randomly selected from the first test cases of all controls on the page to obtain the second test case of the page. Figure 5 : is a flowchart of generating a second test case provided by an embodiment of the present application. Figure 5 As shown, the step of generating the second test case specifically includes S1301-S1302:

[0084] S1301. Determine a total test weight according to the test weights of each first test case in the test case list, and generate multiple random numbers according to the total test weight.

[0085] Exemplarily, the test weights of the first test cases in the test case list are accumulated to obtain the total test weights of the first test cases, and a plurality of numbers are randomly selected from zero to the total test weight as random numbers. The number of random numbers can be a preset number, or can be determined according to the current operating load of the server. For example, when the operating load of the server is high, the number of random numbers is small, and when the operating load of the server is low, the number of random numbers is large.

[0086] S1302: When the cumulative value of the test weights of the first test case and the preceding plurality of first test cases in the test case list is greater than or equal to any random number, generate a second test case for the corresponding page according to the first test case.

[0087] Exemplarily, the test case list is traversed, and the test weights of the jth first test case and the first test cases in the preceding order, that is, the first test cases from the 1st to the j-1th, are added to obtain the cumulative value of the test weights of the jth first test case and the first test cases in the preceding order. When the cumulative value of the test weight corresponding to the jth first test case is greater than or equal to the random number, the first test case is determined as the target test case for generating the second test case. After obtaining the target test cases corresponding to the multiple random numbers, the multiple target test cases are combined to obtain the second test case of the page. It can be understood that when the test weight of the first test case is larger, the probability of it being randomly selected is greater, so the probability of the control with higher frequency of use being tested in real time is greater, and the function of the control with high frequency of use by users is prioritized to ensure that it is normal. Moreover, although the probability of being tested for the control with high frequency of use is increased, the first test case is still randomly selected, avoiding repeated real-time testing of the same control to be tested, and ensuring the comprehensiveness of the page test.

[0088] In one embodiment, the server can use an automated testing tool such as Selenium or Cypress to perform real-time testing on the page, but Selenium has a high configuration complexity and its testing performance is not as good as Cypress.

[0089] Optionally, the server performs real-time testing on the page through Cypress. The specific implementation process is: calling Cypress to execute the second test case; and Cypress generates a test report in XML format according to the execution result of the second test case. Figure 6 Schematic diagram of the communication process of the server provided in the embodiment of the present application. Figure 6As shown, the server monitors in real time whether the current time is the test time of the scheduled test task. When the test time is reached, the server generates a second test case according to the first test case of each control in the page corresponding to the scheduled test task, calls the Cypress interface to pass the second test case as a parameter to Cypress, and Cypress executes the second test case to obtain the execution result. Cypress saves the execution result as a test report in XML format and returns the test report to the server through the interface. The server parses the test report to determine the abnormal information in the page.

[0090] S140: Determine abnormal information of the corresponding page according to the test report of the page, and send an alarm notification to the maintenance terminal according to the abnormal information of the page.

[0091] refer to Figure 6 The server parses the test report to determine the abnormal information of the page, generates an alarm notification according to the abnormal information, and sends the alarm notification to a preset maintenance terminal so that the maintenance personnel of the maintenance terminal can timely maintain the abnormal page after receiving the alarm notification. The test report includes the status (pass and fail), name, execution time and error information of multiple first test cases corresponding to the second test user. The first test case that failed to execute can be determined according to the status of the first test case, and then the error information of the first test case that failed to execute can be obtained. According to the first test case that failed to execute, the corresponding control is determined to be an abnormal control, and the abnormal type of the control is determined according to the error information of the first test case. The page identifier, the abnormal control identifier and the abnormal type of the abnormal control generate the abnormal information of the page, and the abnormal information is edited into an alarm notification so that the maintenance personnel can confirm which controls in which page have abnormalities and the abnormal types according to the alarm notification, so as to quickly maintain the abnormal controls, avoid errors when users use the controls in the future, and improve the operation reliability of the Web application.

[0092] Optional, Figure 7 1 is a flowchart of sending an alarm notification according to a test report provided by an embodiment of the present application. Figure 7 As shown, the step of sending an alarm notification according to the test report specifically includes S1401-S1404:

[0093] S1401. Analyze the test report to determine whether the corresponding page passes the test.

[0094] Exemplarily, the test report records the status (pass or fail) of the second test case, and the status information of the second test case in the test report can be parsed to determine whether the page passes the test. When the page passes the test, no alarm notification is sent to the maintenance terminal.

[0095] S1402: When the page fails the test, determine the abnormal controls in the page and the corresponding abnormal types according to the test report.

[0096] Exemplarily, when the page fails the test, the abnormal control is determined according to the status of each first test case recorded in the test report, and the abnormal type of the abnormal control is determined according to the error information of the failed first test case recorded in the test report.

[0097] S1403. Generate an alarm notification according to the abnormal control and the corresponding abnormal type.

[0098] Exemplarily, an alarm notification is generated according to the page identifier, the abnormal control identifier, and the abnormal type.

[0099] S1404. Send the alarm notification to the maintenance terminal via email, SMS or enterprise WeChat.

[0100] Exemplarily, the urgency of the alarm notification can be determined according to the priority of the page and / or the priority of the abnormal control. When the urgency is high, select email, SMS and enterprise WeChat to send the alarm notification to the maintenance terminal to ensure that the alarm notification can be sent to the maintenance terminal in time, thereby improving the maintenance efficiency of high-priority pages or high-priority controls. When the urgency is high, select one of email, SMS and enterprise WeChat to send the alarm notification to the maintenance terminal to reduce communication costs.

[0101] In summary, the Web application testing method provided by the embodiment of the present application creates corresponding scheduled test tasks for each page of the Web application in advance, and the test cycle of the scheduled test task of the page is inversely proportional to its priority, so as to test whether important pages have abnormalities at a high frequency, detect abnormal problems of important pages in time and maintain important pages, give priority to ensuring the reliable operation of important pages, and improve the operation quality of Web applications. And, test whether non-important pages have abnormalities at a low frequency to reduce the operating resources occupied by the test and ensure the stable operation of the Web application. Create a corresponding first test case for each control in each page in advance, so that when the test time of the scheduled test task of the page is reached, the second test case of the corresponding page is generated according to the first test case of each control in the page, and the second test case is executed by the Web application and a test report of the corresponding page is generated, so as to realize real-time testing of each page in the Web application. Based on the test report, analyze the abnormal problems existing in the page, and send alarm notifications to maintenance personnel according to the abnormal problems so that maintenance personnel can promptly repair the abnormal problems on the page. Real-time monitoring and real-time alarms of abnormal problems on the page are realized so that the staff can promptly repair the abnormalities of the Web application, shortening the time from discovery to repair of the abnormalities of the Web application and improving the operation and maintenance efficiency of the Web application.

[0102] Based on the above embodiments, Figure 8 A schematic diagram of the structure of a Web application testing device provided in an embodiment of the present application. Figure 8 The Web application testing device provided in this embodiment specifically includes: a test task creation module 21, a test case creation module 22, a page test module 23 and an abnormal alarm module 24.

[0103] The test task creation module 21 is configured to create a scheduled test task for each page according to the priority of each page in the Web application, wherein the priority of the page is inversely proportional to the test period of the scheduled test task;

[0104] A test case creation module 22, configured to create a first test case for each control according to the control type of each control in the page;

[0105] The page test module 23 is configured to generate a second test case for the corresponding page according to the first test case of each control in the page corresponding to the scheduled test task when the test time of the scheduled test task is reached, execute the second test case and generate a test report for the corresponding page;

[0106] The abnormal alarm module 24 is configured to determine abnormal information of the corresponding page according to the test report of the page, and send an alarm notification to the maintenance terminal according to the abnormal information of the page.

[0107] On the basis of the above-mentioned embodiment, the test task creation module 21 includes: a page screening unit, configured to screen out a plurality of pages to be tested from the various pages of the Web application according to the page type of each page in the Web application; a page classification unit, configured to sort the plurality of pages to be tested in descending order based on the corresponding priority, obtain a first preset number of pages to be tested with the highest sorting as the first pages to be tested, and obtain the remaining pages to be tested as the second pages to be tested; a test task creation unit, configured to create a timed test task for the first page to be tested based on a first preset test cycle, and to create a timed test task for the second page to be tested based on a second preset test cycle, wherein the first preset test cycle is less than the second preset test cycle.

[0108] On the basis of the above-mentioned embodiment, the test task creation module 21 includes: an access data acquisition unit, which is configured to determine the number of visits and access duration of each page in the Web application according to the log records of the Web application before creating a scheduled test task for each page in the Web application according to the priority of each page; an access weight determination unit, which is configured to perform a weighted summation of the number of visits and access duration of the page to obtain the access weight of the corresponding page; and a page priority determination unit, which is configured to determine the priority of the page according to the access weight of the page.

[0109] Based on the above embodiment, the test case creation module 22 includes: a control screening unit, configured to screen out multiple controls to be tested from the various controls on the page according to the control types of the various controls in the page; a first test case creation unit, configured to create a first test case corresponding to the control to be tested according to the control type of the control to be tested; a test weight determination unit, configured to determine the test weight of the first test case corresponding to the multiple controls to be tested according to the historical trigger times of the multiple controls to be tested; and a test case list generation unit, configured to sort the multiple first test cases based on the corresponding test weights to generate a test case list for the page.

[0110] Based on the above embodiment, the page testing module 23 includes: a random number generation unit, configured to determine the total test weight according to the test weights of each first test case in the test case list, and generate multiple random numbers according to the total test weight; a second test case generation unit, configured to generate a second test case for the corresponding page according to the first test case when the cumulative value of the test weights of the first test case and the preceding multiple first test cases in the test case list is greater than or equal to any random number.

[0111] Based on the above embodiment, the page test module 23 includes: a test case execution unit configured to call Cypress to execute the second test case; and a test report generation unit configured to generate a test report in XML format according to the execution result of the second test case by Cypress.

[0112] Based on the above embodiment, the abnormal alarm module 24 includes: a test report parsing unit, configured to parse the test report to determine whether the corresponding page passes the test; an abnormal information determination unit, configured to determine the abnormal controls in the page and the corresponding abnormal type according to the test report when the page fails the test; an alarm notification generation unit, configured to generate an alarm notification according to the abnormal controls and the corresponding abnormal type; an alarm notification sending unit, configured to send the alarm notification to the maintenance terminal via email, SMS or enterprise WeChat.

[0113] As mentioned above, the Web application testing device provided by the embodiment of the present application creates corresponding scheduled test tasks for each page of the Web application in advance, and the test cycle of the scheduled test task of the page is inversely proportional to its priority, so as to test whether important pages have abnormalities at a high frequency, detect abnormal problems of important pages in time and maintain important pages, give priority to ensuring the reliable operation of important pages, and improve the operation quality of Web applications. And, test whether non-important pages have abnormalities at a low frequency to reduce the operating resources occupied by the test and ensure the stable operation of the Web application. Create a corresponding first test case for each control in each page in advance, so that when the test time of the scheduled test task of the page is reached, the second test case of the corresponding page is generated according to the first test case of each control in the page, and the second test case is executed by the Web application and a test report of the corresponding page is generated, so as to realize real-time testing of each page in the Web application. Based on the test report, analyze the abnormal problems existing in the page, and send alarm notifications to maintenance personnel according to the abnormal problems so that maintenance personnel can promptly repair the abnormal problems on the page. Real-time monitoring and real-time alarms of abnormal problems on the page are realized so that the staff can promptly repair the abnormalities of the Web application, shortening the time from discovery to repair of the abnormalities of the Web application and improving the operation and maintenance efficiency of the Web application.

[0114] The Web application testing device provided in the embodiment of the present application can be used to execute the Web application testing method provided in the above embodiment, and has corresponding functions and beneficial effects.

[0115] Fig. 9 This is a schematic diagram of the structure of a Web application testing device provided in an embodiment of the present application, with reference to Fig. 9 The Web application testing device includes: a processor 31, a memory 32, a communication device 33, an input device 34, and an output device 35. The number of processors 31 in the Web application testing device can be one or more, and the number of memories 32 in the Web application testing device can be one or more. The processor 31, the memory 32, the communication device 33, the input device 34, and the output device 35 of the Web application testing device can be connected through a bus or other methods.

[0116] The memory 32, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the Web application testing method of any embodiment of the present application (for example, the test task creation module 21, the test case creation module 22, the page test module 23 and the abnormal alarm module 24 in the Web application testing device). The memory 32 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function; the storage data area may store data created according to the use of the device, etc. In addition, the memory 32 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0117] The communication device 33 is used for data transmission.

[0118] The processor 31 executes the software programs, instructions and modules stored in the memory 32 to execute various functional applications and data processing of the device, that is, to implement the above-mentioned Web application testing method.

[0119] The input device 34 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 35 may include a display device such as a display screen.

[0120] The Web application testing device provided above can be used to execute the Web application testing method provided in the above embodiment, and has corresponding functions and beneficial effects.

[0121] The embodiment of the present application also provides a storage medium containing computer executable instructions. When the computer executable instructions are executed by a computer processor, they are used to execute a Web application testing method. The Web application testing method includes: creating a scheduled test task for each page in the Web application according to the priority of each page, wherein the priority of the page is inversely proportional to the test period of the scheduled test task; creating a first test case for each control in the page according to the control type of each control; when the test time of the scheduled test task is reached, generating a second test case for the corresponding page according to the first test case for each control in the corresponding page of the scheduled test task, executing the second test case and generating a test report for the corresponding page; determining abnormal information of the corresponding page according to the test report of the page, and sending an alarm notification to a maintenance terminal according to the abnormal information of the page.

[0122] Storage medium - any of various types of memory devices or storage devices. The term "storage medium" is intended to include: installation media, such as CD-ROM, floppy disk or tape device; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. In addition, the storage medium may be located in the first computer system in which the program is executed, or may be located in a different second computer system, which is connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media residing in different locations (for example, in different computer systems connected by a network). The storage medium may store program instructions (for example, embodied as a computer program) that can be executed by one or more processors.

[0123] Of course, the computer executable instructions of a storage medium including computer executable instructions provided in an embodiment of the present application are not limited to the above Web application testing method, and can also execute related operations in the Web application testing method provided in any embodiment of the present application.

[0124] The Web application testing apparatus, storage medium, and Web application testing device provided in the above embodiments can execute the Web application testing method provided in any embodiment of the present application. For technical details not described in detail in the above embodiments, please refer to the Web application testing method provided in any embodiment of the present application.

[0125] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the protection scope of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.

Claims

1. A Web application testing method, characterized in that: include: Creating a scheduled test task for each page according to the priority of each page in the Web application, wherein the priority of the page is inversely proportional to the test period of the scheduled test task; Creating a first test case for each control in the page according to the control type of each control; When the test time of the scheduled test task is reached, generating a second test case for the corresponding page according to the first test case of each control in the corresponding page of the scheduled test task, executing the second test case and generating a test report for the corresponding page; Determine abnormal information of a corresponding page according to the test report of the page, and send an alarm notification to a maintenance terminal according to the abnormal information of the page.

2. The Web application testing method according to claim 1, characterized in that: The step of creating a timed test task for each page according to the priority of each page in the Web application includes: According to the page type of each page in the Web application, a plurality of pages to be tested are screened out from each page of the Web application; Sorting the plurality of pages to be tested in descending order based on corresponding priorities, acquiring a first preset number of pages to be tested that are ranked first as first pages to be tested, and acquiring the remaining pages to be tested as second pages to be tested; A timed test task for the first page to be tested is created based on a first preset test cycle, and a timed test task for the second page to be tested is created based on a second preset test cycle, wherein the first preset test cycle is shorter than the second preset test cycle.

3. The Web application testing method according to claim 1, characterized in that: Before creating the scheduled test tasks of each page according to the priority of each page in the Web application, the method further includes: Determine the number of visits and the duration of visits to each page in the Web application according to the log records of the Web application; Performing a weighted summation on the number of visits and the visit duration of the page to obtain the visit weight of the corresponding page; The priority of the page is determined according to the access weight of the page.

4. The Web application testing method according to claim 1, characterized in that: The step of creating a first test case for each control in the page according to the control type of each control includes: According to the control type of each control in the page, a plurality of controls to be tested are screened out from each control in the page; Creating a first test case corresponding to the control to be tested according to the control type of the control to be tested; Determine the test weight of the first test case corresponding to the multiple controls to be tested according to the historical trigger times of the multiple controls to be tested; The plurality of first test cases are sorted based on corresponding test weights to generate a test case list for the page.

5. The Web application testing method according to claim 4, characterized in that: The generating a second test case for a corresponding page according to the first test case for each control in the corresponding page of the scheduled test task comprises: Determine a total test weight according to the test weights of each first test case in the test case list, and generate multiple random numbers according to the total test weight; When the cumulative value of the test weights of the first test case and a plurality of preceding first test cases in the test case list is greater than or equal to any of the random numbers, a second test case for the corresponding page is generated according to the first test case.

6. The Web application testing method according to claim 1, characterized in that: The executing the second test case and generating a test report of the corresponding page includes: Calling Cypress to execute the second test case; The Cypress generates a test report in XML format according to the execution result of the second test case.

7. The Web application testing method according to claim 1, characterized in that: The determining the abnormal information of the corresponding page according to the test report of the page, and sending an alarm notification to the maintenance terminal according to the abnormal information of the page, comprises: Parsing the test report to determine whether the corresponding page passes the test; If the page fails the test, determining abnormal controls in the page and corresponding abnormal types according to the test report; Generate an alarm notification according to the abnormal control and the corresponding abnormal type; The alarm notification is sent to the maintenance terminal via email, SMS or enterprise WeChat.

8. A Web application testing device, characterized in that: include: A test task creation module is configured to create a scheduled test task for each page in the Web application according to the priority of each page, wherein the priority of the page is inversely proportional to the test period of the scheduled test task; A test case creation module, configured to create a first test case for each control in the page according to the control type of each control; The page test module is configured to generate a second test case for the corresponding page according to the first test case of each control in the page corresponding to the scheduled test task when the test time of the scheduled test task is reached, execute the second test case and generate a test report for the corresponding page; The abnormal alarm module is configured to determine abnormal information of the corresponding page according to the test report of the page, and send an alarm notification to the maintenance terminal according to the abnormal information of the page.

9. A Web application testing device, characterized in that: include: one or more processors; The memory stores one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the Web application testing method according to any one of claims 1 to 7.

10. A storage medium containing computer executable instructions, characterized in that: The computer executable instructions are used to execute the Web application testing method according to any one of claims 1 to 7 when executed by a computer processor.