Page testing method, device, equipment and storage medium

By analyzing the dependency tree of the page, determining the pages that need to be updated, solving the problem of how to accurately update and change the module when multiple pages reuse the same module, and achieving efficient page testing and development.

CN119759768APending Publication Date: 2025-04-0458 CHANG LIFE (BEIJING) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411814207.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

During the page development process, how to accurately determine the page that needs to be updated with the changed module, especially when multiple pages reuse the same module at the same time.

Method used

Determine the target method containing the original code by obtaining the change code of the target page in the alternative page and its original code. Then, based on the first dependency tree between the method and the module and the second dependency tree between the module and the page, a plurality of pages to be tested containing the target module are gradually determined. Finally, the change code is updated to these pages to be tested for testing.

Benefits of technology

The page range affected by code changes is achieved accurately determines the scope of the page that is affected by code changes, thereby ensuring the correct update and testing of the changed modules in multiple pages, improving development efficiency and quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759768A_ABST
    Figure CN119759768A_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a page testing method, device, equipment and storage medium, the method comprising: obtaining the change code of the target page in the candidate page and the original code before the change code is changed. Then, the target method containing the original code is determined. Then, according to the first dependency tree between the method and the module, the target module containing the target method is determined from the candidate module. After that, according to the second dependency tree between the module and the page, multiple pages to be tested containing the target module can be determined from the candidate page. Finally, the change code is updated to multiple pages to be tested to test the multiple pages to be tested. That is, after the code is changed, according to the dependency between the code and the method, the dependency between the method and the module, and the dependency between the module and the page, the pages that need code update and testing are gradually found. This finer hierarchical search process can accurately determine the pages to be tested.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] At present, in the process of page development, in order to improve development efficiency, a modular development method is usually adopted to encapsulate common functions and page elements into independent modules.

[0003] In actual applications, a page may include multiple modules, and any module may be reused by multiple pages at the same time. And as user needs continue to change, developers can change any module and update the changed module to the page to obtain the page to be tested. Finally, by testing the page to be tested, it is determined based on the test results whether there is a problem in applying the changed module to the page to be tested. However, when the changed module is reused by multiple pages at the same time, it is obviously necessary to accurately determine which pages the changed module needs to be updated to.

[0004] Based on the above description, how to accurately determine the page to be tested becomes a technical problem that needs to be solved urgently. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a page testing method, apparatus, device and storage medium to accurately determine a page that needs to be tested.

[0006] In a first aspect, an embodiment of the present invention provides a page testing method, comprising:

[0007] Obtaining a change code of a target page in the candidate pages and an original code corresponding to the change code;

[0008] Determining a target method containing the original code;

[0009] Determine, from the candidate modules, a target module containing the target method according to a first dependency tree between methods and modules, wherein the first dependency tree includes a first root node corresponding to the candidate module and a first child node corresponding to the method in the candidate module;

[0010] Determine, from the candidate pages, a plurality of pages to be tested that include the target module according to a second dependency tree between modules and pages, wherein the second dependency tree includes a second root node corresponding to the candidate page and a second child node corresponding to the candidate module;

[0011] The changed code is updated to the multiple pages to be tested to test the multiple pages to be tested.

[0012] In a second aspect, an embodiment of the present invention provides a page testing device, including:

[0013] An acquisition module, used for acquiring a change code of a target page in the candidate pages and an original code before the change code is changed;

[0014] A determination module is used to determine a target method containing the original code; determine a target module containing the target method from candidate modules according to a first dependency tree between methods and modules, wherein the first dependency tree includes a first root node corresponding to the candidate module and a first child node corresponding to the method in the candidate module; determine multiple pages containing the target module from the candidate pages according to a second dependency tree between modules and pages, wherein the second dependency tree includes a second root node corresponding to the candidate page and a second child node corresponding to the candidate module;

[0015] The testing module is used to update the changed code to the multiple pages to test the multiple pages.

[0016] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the page test method in the first aspect. The electronic device may also include a communication interface for communicating with other devices or communication systems.

[0017] In a fourth aspect, an embodiment of the present invention provides a non-temporary machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor can at least implement the page testing method as described in the first aspect above.

[0018] In the page testing method provided by the embodiment of the present invention, the change code of the target page in the candidate page and the original code corresponding to the change code are obtained. Then, the target method containing the original code can be determined. Then, the target module containing the target method can be determined from the candidate modules according to the first dependency tree between the method and the module. After that, multiple pages to be tested containing the target module can be determined from the candidate pages according to the second dependency tree between the module and the page. Finally, the change code is updated to the multiple pages to be tested to test the multiple pages to be tested.

[0019] It can be seen that in the above scheme, after the code is changed, the pages that need code update and testing are gradually found based on the dependency relationship between code and method, the dependency relationship between method and module, and the dependency relationship between module and page. This fine-grained hierarchical search process can accurately determine the page range affected by the code change, that is, it can accurately determine the page to be tested. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1 A flow chart of a page testing method provided by an embodiment of the present invention;

[0022] Figure 2 A schematic diagram of the structure of a second dependency tree provided by an embodiment of the present invention;

[0023] Figure 3 A schematic diagram of the structure of a first dependency tree provided by an embodiment of the present invention;

[0024] Figure 4 A flowchart of another page testing method provided by an embodiment of the present invention;

[0025] Figure 5 A schematic diagram of the working process of a page testing method provided by an embodiment of the present invention;

[0026] Figure 6 A schematic diagram of the structure of a page testing device provided by an embodiment of the present invention;

[0027] Figure 7 For Figure 6 A schematic structural diagram of an electronic device corresponding to the page testing device provided in the illustrated embodiment. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the inclusion of at least one.

[0030] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0031] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to identifying", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is identified" may be interpreted as "when determining" or "in response to determining" or "when identifying (stated condition or event)" or "in response to identifying (stated condition or event)", depending on the context.

[0032] It should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.

[0033] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0034] Before describing in detail the page testing methods provided by the embodiments of the present invention, an application scenario of the page testing may be described schematically:

[0035] As introduced in the background technology, in the process of page development, in order to improve development efficiency, a modular development method is usually adopted to encapsulate common functions and page elements into independent modules. In actual applications, a page may include multiple modules, and any module may be reused by multiple pages at the same time.

[0036] However, as user needs continue to change, developers can change any module. At this time, when the changed module is reused by multiple pages at the same time, if it is not possible to accurately determine which pages need to be updated with the changed module, that is, it is not possible to accurately determine the pages to be tested that are affected by the change, it may cause problems in the subsequent use of the pages to be tested. In order to improve the above problems, the page testing method provided by the following embodiments of the present invention can be used.

[0037] Based on the above description, some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0038] Figure 1 The following is a flow chart of a page testing method provided by an embodiment of the present invention. The page testing method provided by an embodiment of the present invention can be executed by a testing device. It can be understood that the testing device can be implemented as software, or a combination of software and hardware. Figure 1 As shown, the method comprises the following steps:

[0039] 101, obtaining the change code of the target page in the candidate pages and the original code corresponding to the change code.

[0040] 102, determine the target method containing the original code.

[0041] 103. Determine a target module including a target method from candidate modules according to a first dependency tree between methods and modules, wherein the first dependency tree includes a first root node corresponding to the candidate module and a first child node corresponding to the method in the candidate module.

[0042] 104. Determine multiple pages to be tested that include the target module from the candidate pages according to a second dependency tree between the module and the page, wherein the second dependency tree includes a second root node corresponding to the candidate page and a second child node corresponding to the candidate module.

[0043] 105 , updating the changed code to the multiple pages to be tested, so as to test the multiple pages to be tested.

[0044] The test device can obtain the change code of the target page in the candidate page and the original code corresponding to the change code. The target page can be any page in the candidate page. Optionally, the candidate page can include a page provided by the client, such as a browser page or an application (Application, APP for short) page, etc.

[0045] The changed code can be understood as the code that has changed in the target page, and the original code can be understood as the code corresponding to the changed code before the change. Optionally, the changed code and the original code can be pre-stored in a code set. The test device can directly obtain the changed code and the original code corresponding to the changed code from the code set.

[0046] Then, the test device can determine the target method containing the original code. In actual applications, the original code may include a preset number of lines of code in the target page, such as several lines of code. And these lines of code may be included in the target method, that is, there is a dependency relationship between the original code and the target method.

[0047] As for determining the target method, optionally, the testing device may input the original code and the target page into the neural network model so that the neural network model outputs the target method corresponding to the original code.

[0048] Optionally, the neural network model may include a Generative Pre-training Transformer (GPT) model with strong semantic understanding ability, or a Bidirectional Encoder Representation from Transformers (Bert) model, etc.

[0049] After determining the target method, the test device can further determine the target module containing the target method from the candidate modules according to the first dependency tree between the method and the module. The first dependency tree includes a first root node corresponding to the candidate module and a first child node corresponding to the method in the candidate module, that is, the first dependency tree can reflect the dependency between the candidate module and the method in the candidate module. The construction process of the first dependency tree can be specifically referred to the description in the following embodiment.

[0050] Specifically, the test device can first obtain the dependency relationship between the candidate module and the method in the candidate module according to the first dependency tree. Further, according to this dependency relationship, the first child node containing the target method and the first root node connected to the first child node can be found, and the module contained in the first root node is the target module containing the target method.

[0051] It should be noted that, in practice, the candidate page may generally include multiple candidate modules, and any candidate module may include multiple methods. Then, the first dependency tree may include multiple first root nodes corresponding to different candidate modules, and multiple first child nodes corresponding to different methods, and there is an association relationship between the first root node and the first child node.

[0052] Afterwards, the test device can also determine multiple pages to be tested that include the target module from the candidate pages based on the second dependency tree between the module and the page. Among them, the second dependency tree includes a second root node corresponding to the candidate page, and a second child node corresponding to the candidate module, that is, the second dependency tree can reflect the dependency relationship between the candidate module and the candidate page. Multiple pages to be tested can be understood as multiple pages that reuse the target module in the candidate page, that is, multiple pages that need to be tested that are affected by code changes. The construction process of the second dependency tree can be specifically referred to the description in the following embodiment.

[0053] Specifically, the test device can first obtain the dependency relationship between the candidate module and the candidate page according to the second dependency tree. Further, according to the dependency relationship, the second child node containing the target module and multiple second root nodes connected to the second child node can be found, and the pages to be tested contained in each of the multiple second root nodes constitute multiple pages to be tested containing the target module.

[0054] The multiple pages to be tested can be understood as multiple pages that need to be tested and reuse the target module in the candidate pages, that is, multiple pages that are determined to be affected by the code change.

[0055] Finally, the testing device can update the changed code to the multiple pages to be tested in sequence, that is, change the corresponding code in the target module and the target method reused by the multiple pages to be tested, and test the multiple pages to be tested after the code change to determine whether the multiple pages to be tested can work normally.

[0056] In this embodiment, after the code is changed, the solution is to gradually find the pages that need code update and testing based on the dependency relationship between code and method, the dependency relationship between method and module, and the dependency relationship between module and page. This fine-scale hierarchical search process can accurately determine the page range affected by the code change, that is, it can accurately determine the page to be tested.

[0057] Figure 1The changed code and the original code corresponding to the changed code have been mentioned in the illustrated embodiment. Optionally, the test device can respond to the user's test request to first obtain a first code corresponding to the target page before the code change and a second code corresponding to the target page after the code change.

[0058] Then, the first code and the second code may be compared to obtain the change code of the target page. Then, the original code corresponding to the change code may be determined from the first code according to the position of the change code in the target page.

[0059] For determining the changed code, optionally, the test device can use the diff algorithm in its own built-in distributed version control tool (Git) to compare the first code and the second code to determine the changed code of the target page. Optionally, the range of the changed code can be a line-level change range.

[0060] Afterwards, the test device can determine the target method containing the original code based on the determined original code. An optional method can be as follows Figure 1 The target method mentioned in the illustrated embodiment is determined by using a neural network model.

[0061] Alternatively, the test device may first determine the target location of the original code in the target page. Then, based on the target location and the method identifier, the target method containing the original code in the target page may be further determined. The method identifier may include at least one of a method name, a method comment, a method import statement, and a method return type.

[0062] For example, if the diff algorithm determines that the code on line 40 in the target page has changed, the code on line 40 in the first code can be determined as the original code. Furthermore, the test device can determine which method the code on line 40 in the first code belongs to based on the method annotation, for example, the code on lines 35 to 45 including line 40 can be determined as the target method.

[0063] In this embodiment, the testing device can use the Git tool to accurately determine the changed code and the original code corresponding to the changed code. Furthermore, through the target position and method identifier of the original code in the target page, the target method containing the original code can be accurately determined.

[0064] In addition, the contents not described in detail in this embodiment and the technical effects that can be achieved can all be found in the relevant descriptions in the above embodiments, and will not be repeated here.

[0065] The following describes how to build the first dependency tree and the second dependency tree:

[0066] For the construction of the second dependency tree, the test device may first respond to the call of the resolution start hook function (such as the beforeResolve hook function) and use its own built-in static module packager (Webpack) to parse the alternative page to obtain the dependency relationship between the alternative page and the alternative module.

[0067] In an optional manner, the test device can directly create a second dependency tree according to the dependency between the candidate page and the candidate module. In this case, the second dependency tree includes a second root node corresponding to the candidate page and a second child node corresponding to the candidate module.

[0068] In another optional way, the test device can first create an initial dependency tree based on the dependency between the alternative page and the alternative module. Then, the test device can determine the target module reused by multiple pages to be tested in the alternative page from the alternative module. Afterwards, optionally, the test device can modify the initial dependency tree based on the target module, such as deleting the dependency between other modules other than the target module and the alternative page to obtain a second dependency tree. Optionally, the test device can also regenerate the dependency tree based on the dependency between the target module and multiple pages to be tested, that is, obtain a second dependency tree. In this case, the second dependency tree includes a second root node corresponding to multiple pages to be tested, and a second child node corresponding to the target module.

[0069] For example, assuming that the target module includes a first module and a second module, and the plurality of pages to be tested include a first page, a second page, and a third page, the structural diagram of the second dependency tree can be combined with Figure 2 Understand. Figure 2 As shown, the first module and the second module are reused in the first page, the second page, and the third page. The second dependency tree includes a second root node corresponding to the first page, a second root node corresponding to the second page, a second root node corresponding to the third page, a second child node corresponding to the first module, and a second child node corresponding to the second module.

[0070] It should be noted that in practice, the test device usually parses multiple candidate pages separately according to the page level, that is, it first parses one candidate page, and then parses other candidate pages in sequence. And after all candidate pages are parsed, the test device can also respond to the call of the page parsing completion hook function (such as the afterResolve hook function) to summarize the dependency relationship between all candidate pages and candidate modules.

[0071] In this embodiment, with the help of the parsing ability of the static module packager, the dependency relationship between the candidate pages and the candidate modules can be accurately determined, and then the dependency relationship between the target module and multiple pages to be tested can be accurately determined, thereby ensuring the accuracy of the construction of the second dependency tree.

[0072] For the construction of the first dependency tree, the test device may first use its own built-in babel compiler to perform syntax analysis on the candidate modules to obtain the dependency relationships between the candidate modules and the methods in the candidate modules.

[0073] In an optional manner, the test device can directly create a first dependency tree based on the dependency between the candidate modules and the methods in the candidate modules. In this case, the first dependency tree includes a first root node corresponding to the candidate module and a first child node corresponding to the method in the candidate module. It should be noted that in this case, the first dependency tree and the second dependency tree can be created simultaneously or separately.

[0074] Alternatively, the test device may construct the first dependency tree after constructing the second dependency tree. Specifically, the test device may perform grammatical analysis on a target module that is reused by multiple pages to be tested in the candidate pages to obtain a grammatical analysis tree. Then, the test device may determine the target method included in the target module based on the grammatical analysis tree. Afterwards, the first dependency tree may be constructed based on the dependency between the target module and the target method. In this case, the first dependency tree includes a first root node corresponding to the target module and a first child node corresponding to the target method.

[0075] Optionally, the target module may include multiple ones. Then the test device may parse the multiple target modules respectively according to the module level, that is, parse one target module first, and then parse other target modules in sequence. And after all target modules are parsed, the test device may also respond to the call of the module parsing completion hook function (such as the finishModules hook function) to summarize the dependency relationship between all target modules and the target method.

[0076] For example, assuming that the target modules reused by the first to third pages specifically include the first module and the second module, the first module includes the first method and the second method, and the second module includes the third method and the fourth method. Then the structural diagram of the first dependency tree can be combined with Figure 3 Understand. Figure 3As shown, the first dependency tree includes a first root node corresponding to the first module, a first root node corresponding to the second module, a first subnode corresponding to the first method, a first subnode corresponding to the second method, a first subnode corresponding to the third method, and a first subnode corresponding to the fourth method. And the first subnode corresponding to the first method and the first subnode corresponding to the second method are both connected to the first root node corresponding to the first module. The first subnode corresponding to the third method and the first subnode corresponding to the fourth method are both connected to the first root node corresponding to the second module.

[0077] In this embodiment, with the help of the parsing ability of the babel compiler, the dependency relationship between the candidate modules and the methods in the candidate modules can be accurately determined, and then the dependency relationship between the target module and the target method can be accurately determined, thereby ensuring the accuracy of the construction of the first dependency tree.

[0078] Figure 4 A flowchart of another page testing method provided by an embodiment of the present invention. Figure 4 As shown, the method may include the following steps:

[0079] 401, obtain the change code of the target page in the candidate page and the original code corresponding to the change code.

[0080] 402, determine the target method containing the original code.

[0081] 403. Determine a target module including a target method from candidate modules according to a first dependency tree between methods and modules, wherein the first dependency tree includes a first root node corresponding to the candidate module and a first child node corresponding to the method in the candidate module.

[0082] 404, determining multiple pages to be tested including the target module from the candidate pages according to a second dependency tree between the module and the page, the second dependency tree including a second root node corresponding to the candidate page and a second child node corresponding to the candidate module.

[0083] 405, update the changed code to multiple pages to be tested.

[0084] 406 , obtaining a path set including path information corresponding to each candidate page.

[0085] 407 : Based on the identifiers corresponding to the multiple pages to be tested, determine the path information corresponding to the multiple pages to be tested from the path set.

[0086] 408 , based on the path information corresponding to the multiple pages to be tested, generate uniform resource locators for the multiple pages to be tested, so as to test the multiple pages to be tested using the uniform resource locators.

[0087] The specific implementation process of the above steps 401 to 404 can be found in Figure 1 The specific description of the illustrated embodiments will not be repeated here.

[0088] After obtaining multiple pages to be tested, the test device can obtain a path set including path information corresponding to each candidate page. The multiple pages to be tested are included in the candidate page. The path information corresponding to each candidate page includes complete path information from the root directory to the candidate page.

[0089] Optionally, the path set can be obtained in advance. Specifically, the test device can find the path information corresponding to each candidate page in advance from the code corresponding to the candidate page before the change, and store the path information corresponding to each candidate page in the path set.

[0090] Then, the test device can determine the path information corresponding to the multiple pages to be tested from the path set based on the identifiers corresponding to the multiple pages to be tested. Specifically, the test device can match the identifiers corresponding to the multiple pages to be tested with the identifiers corresponding to the candidate pages in the path set to determine the path information corresponding to the identifiers of the multiple pages to be tested.

[0091] Afterwards, the testing device may generate a Uniform Resource Locator (URL) for the multiple pages to be tested based on the path information corresponding to the multiple pages to be tested, so as to test the multiple pages to be tested using the URL.

[0092] For the generation of URL, optionally, the test device can first obtain a basic URL. The basic URL may specifically include a protocol, a domain name (or an Internet Protocol address), and an optional port number. Among them, the protocol may include a hypertext transfer protocol (HyperText Transfer Protocol, referred to as http) or a secure hypertext transfer protocol (HyperText Transfer Protocol Secure, referred to as https). Afterwards, the test device can splice the path information of any page to be tested with the basic URL to generate a complete URL. By analogy, the test device can generate complete URLs for multiple pages to be tested. Finally, the test device can access multiple pages to be tested based on the URLs of multiple pages to be tested, and test these multiple pages to be tested.

[0093] In this embodiment, based on the path information corresponding to the multiple pages to be tested determined from the path set, a uniform resource locator is generated for the multiple pages to be tested. Since the uniform resource locator can be directly accessed, the test device can use the uniform resource locator to quickly test the multiple pages to be tested, thereby improving the test efficiency.

[0094] For ease of understanding, you can combine Figure 5 The specific implementation process of the page testing method provided above is exemplified as follows:

[0095] The testing device may first obtain the change code of the target page in the candidate page and the original code corresponding to the change code, and then determine the first method including the original code according to the method identifier and the target position of the original code in the target page.

[0096] Then, the test equipment can be based on Figure 3 The first dependency tree between methods and modules is shown, and the first module including the first method is determined from the candidate modules.

[0097] Afterwards, the test equipment can be Figure 2 The second dependency tree between the modules and pages shown in the figure determines the first page, the second page and the third page containing the first module from the candidate pages. The first page to the third page are the pages to be tested.

[0098] After obtaining the three pages to be tested, the test device can update the change code to the three pages to be tested respectively. The test device can also obtain a path set containing the path information corresponding to each candidate page, and based on the identifiers corresponding to each of the three pages to be tested, determine the path information corresponding to each of the third pages to be tested from the path set.

[0099] Finally, the testing device may generate uniform resource locators for the first page, the second page, and the third page respectively based on the path information corresponding to the three pages to be tested, so as to test the three pages to be tested using the uniform resource locators.

[0100] In addition, the contents not described in detail in this embodiment and the technical effects that can be achieved can all be found in the relevant descriptions in the above embodiments, and will not be repeated here.

[0101] The following will describe in detail the page test device of one or more embodiments of the present invention. Those skilled in the art will appreciate that these page test devices can be configured using commercially available hardware components through the steps taught in this solution.

[0102] Figure 6A schematic diagram of a page testing device provided by an embodiment of the present invention is shown in FIG. Figure 6 As shown, the device comprises:

[0103] The acquisition module 11 is used to acquire the change code of the target page in the candidate pages and the original code corresponding to the change code.

[0104] A determination module 12 is used to determine a target method containing the original code; determine a target module containing the target method from candidate modules according to a first dependency tree between methods and modules, wherein the first dependency tree includes a first root node corresponding to the candidate module and a first child node corresponding to the method in the candidate module; determine a plurality of pages to be tested containing the target module from the candidate pages according to a second dependency tree between modules and pages, wherein the second dependency tree includes a second root node corresponding to the candidate page and a second child node corresponding to the candidate module.

[0105] The testing module 13 is used to update the changed code to the multiple pages to be tested, so as to test the multiple pages to be tested.

[0106] The candidate pages include pages provided by the client.

[0107] Optionally, the determination module 12 is used to determine a target position of the original code in the target page; and determine a target method in the target page that contains the original code according to the target position and the method identifier.

[0108] Optionally, the device also includes a dependency tree construction module 14, which is used to create an initial dependency tree based on the dependency between the alternative page and the alternative module; determine a target module from the alternative module that is reused by multiple pages to be tested in the alternative page; and modify the initial dependency tree based on the target module to obtain a second dependency tree.

[0109] Optionally, the dependency tree construction module 14 is further used to perform syntax analysis on the target modules respectively to obtain a syntax analysis tree; determine the target method included in the target module according to the syntax analysis tree; and construct the first dependency tree according to the dependency relationship between the target module and the target method.

[0110] Optionally, the acquisition module 11 is used to respond to a user's test request, obtain the first code and the second code corresponding to the target page before and after the code change; compare the first code and the second code to obtain the changed code of the target page; and determine the original code corresponding to the changed code from the first code according to the position of the changed code in the target page.

[0111] Optionally, the testing module 13 is used to obtain a path set containing path information corresponding to each of the alternative pages; based on the identifiers corresponding to the multiple pages to be tested, determine the path information corresponding to the multiple pages to be tested from the path set; based on the path information corresponding to the multiple pages to be tested, generate a uniform resource locator for the multiple pages to be tested, so as to test the multiple pages to be tested using the uniform resource locator.

[0112] Figure 6 The device shown can perform Figures 1 to 5 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figures 1 to 5 The implementation process and technical effects of this technical solution refer to Figures 1 to 5 The description in the illustrated embodiment will not be repeated here.

[0113] In a possible design, the structure of the page testing device can be implemented as an electronic device, such as Figure 7 As shown, the electronic device may include: a processor 21 and a memory 22. The memory 22 is used to store the electronic device to perform the above Figures 1 to 5 The program of the page testing method provided in the illustrated embodiment, the processor 21 is configured to execute the program stored in the memory 22 .

[0114] The program includes one or more computer instructions, wherein the one or more computer instructions can implement the following steps when executed by the processor 21:

[0115] Obtaining a change code of a target page in the candidate pages and an original code corresponding to the change code;

[0116] Determining a target method containing the original code;

[0117] Determine, from the candidate modules, a target module containing the target method according to a first dependency tree between methods and modules, wherein the first dependency tree includes a first root node corresponding to the candidate module and a first child node corresponding to the method in the candidate module;

[0118] Determine, from the candidate pages, a plurality of pages to be tested that include the target module according to a second dependency tree between modules and pages, wherein the second dependency tree includes a second root node corresponding to the candidate page and a second child node corresponding to the candidate module;

[0119] The changed code is updated to the multiple pages to be tested to test the multiple pages to be tested.

[0120] Optionally, the processor 21 is further configured to execute the aforementioned Figures 1 to 5 All or part of the steps in the illustrated embodiments.

[0121] The structure of the electronic device may further include a communication interface 23 for the electronic device to communicate with other devices or a communication network.

[0122] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium for storing computer software instructions used by the above electronic device, which includes instructions for executing the above Figure 1 to Figure 5 The procedures involved in the page testing method shown.

[0123] In addition, an embodiment of the present invention provides a computer program product. The computer program product includes a computer program or an instruction. When the computer program or the instruction is executed by a processor, the processor is enabled to implement the above Figure 1 to Figure 5 The steps or functions of the page test method shown.

[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A page testing method, characterized in that: include: Obtaining a change code of a target page in the candidate pages and an original code corresponding to the change code; Determining a target method containing the original code; Determine, from the candidate modules, a target module containing the target method according to a first dependency tree between methods and modules, wherein the first dependency tree includes a first root node corresponding to the candidate module and a first child node corresponding to the method in the candidate module; Determine, from the candidate pages, a plurality of pages to be tested that include the target module according to a second dependency tree between modules and pages, wherein the second dependency tree includes a second root node corresponding to the candidate page and a second child node corresponding to the candidate module; The changed code is updated to the multiple pages to be tested to test the multiple pages to be tested.

2. The method according to claim 1, characterized in that The method of determining a target including the original code comprises: Determining a target location of the original code in the target page; According to the target location and the method identifier, a target method containing the original code in the target page is determined.

3. The method according to claim 1, characterized in that The method further comprises: Creating an initial dependency tree according to the dependency relationship between the candidate pages and the candidate modules; Determine, from the candidate modules, a target module that is reused by a plurality of to-be-tested pages in the candidate pages; According to the target module, the initial dependency tree is modified to obtain a second dependency tree.

4. The method according to claim 3, characterized in that After obtaining the second dependency tree, the method further includes: Performing grammatical analysis on the target modules respectively to obtain grammatical analysis trees; Determine the target method included in the target module according to the syntax analysis tree; The first dependency tree is constructed according to the dependency relationship between the target module and the target method.

5. The method according to claim 4, characterized in that The candidate pages include pages provided by the client.

6. The method according to claim 1, characterized in that The obtaining of the change code of the target page in the candidate pages and the original code corresponding to the change code includes: In response to a test request from a user, obtaining a first code and a second code corresponding to the target page before and after the code is changed; Comparing the first code with the second code to obtain a changed code of the target page; According to the position of the changed code in the target page, the original code corresponding to the changed code is determined from the first code.

7. The method according to claim 1, characterized in that The updating of the changed code to the multiple pages to be tested to test the multiple pages to be tested includes: Obtain a path set including path information corresponding to each of the candidate pages; Based on the identifiers corresponding to the multiple pages to be tested, determining path information corresponding to the multiple pages to be tested from the path set; Based on the path information corresponding to the multiple pages to be tested, a uniform resource locator is generated for the multiple pages to be tested, so as to test the multiple pages to be tested by using the uniform resource locator.

8. A page testing device, characterized in that: include: An acquisition module, used to acquire a change code of a target page in the candidate pages and an original code corresponding to the change code; A determination module, used for determining a target method including the original code; Determine, from the candidate modules, a target module containing the target method according to a first dependency tree between methods and modules, wherein the first dependency tree includes a first root node corresponding to the candidate module and a first child node corresponding to the method in the candidate module; Determine, from the candidate pages, a plurality of pages to be tested that include the target module according to a second dependency tree between modules and pages, wherein the second dependency tree includes a second root node corresponding to the candidate page and a second child node corresponding to the candidate module; The testing module is used to update the changed code to the multiple pages to be tested so as to test the multiple pages to be tested.

9. An electronic device, characterized in that: include: A memory and a processor; wherein the memory stores executable codes, and when the executable codes are executed by the processor, the processor executes the method for determining a page to be tested as claimed in any one of claims 1 to 8.

10. A non-transitory machine-readable storage medium, characterized in that: The non-transitory machine-readable storage medium stores executable codes, and when the executable codes are executed by a processor of an electronic device, the processor is caused to execute the method for determining a page to be tested according to any one of claims 1 to 8.