Automatic test input generation method based on dynamic page splitting

Through an automated test input generation method based on dynamic page splitting, combined with the Cypress framework and GraphQLAPI, the dynamic content elements are monitored and classified in real time, and the test input templates and data are automatically generated, and a natural language processing module is introduced for semantic analysis, which solves the limitations of the dynamic web page automated test input generation method in the existing technology, and realizes efficient, comprehensive and semantic consistent test input generation.

CN119576760AActive Publication Date: 2025-03-07HARBIN AEROSPACE STAR DATA SYST TECH CO LTD

Patent Information

Application Number
CN202411538095.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-03-07
Estimated Expiration
2044-10-31

AI Technical Summary

Technical Problem

In the automated testing of dynamic web pages, the test input data generation method is too dependent on manual operations or static data sets, and cannot dynamically respond to page changes, and lacks in-depth analysis of dynamic content, making it difficult to cover all user operation scenarios and edge cases. Especially in complex web applications supported by multilinguals, the semantic consistency of the page cannot be ensured.

Method used

The automated test input generation method based on dynamic page splitting is adopted, and the DOM structure of dynamic web pages is analyzed through the Cypress framework, and dynamic content elements are monitored and classified in real time. The page components are logically grouped together to form test data dynamically. Test data is automatically generated by GraphQLAPI, and the test input templates and data are automatically applied to dynamic page tests in real time. Natural language processing module is introduced for semantic analysis and verification.

Benefits of technology

It significantly improves the accuracy and comprehensiveness of test input generation, automatically covers various possible user operation scenarios, ensures semantic consistency of pages in complex web applications supported by multilinguals, and reduces the cost of testing maintenance and the workload of manual scripting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119576760A_ABST
    Figure CN119576760A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic test input generation method based on dynamic page splitting, and belongs to the technical field of dynamic webpages. In order to effectively verify the semantic consistency of a page in a complex Web application supported by multiple languages, the method comprises the following steps: acquiring a dynamic webpage to be tested, and analyzing a document object model structure of the dynamic webpage based on a Cypress framework; the monitored dynamic content elements are classified and marked in real time by using the real-time DOM operation capability of Cypress; on the basis of the structural information of the page components, in combination with integration of Cypress and GraphQL API, dynamically obtaining test data from a background, and automatically generating a test input template matched with the current state of the page; the method is applied to dynamic page testing in real time; generating a test report; a natural language processing module is introduced, and text content in the page is analyzed; and optimizing a page splitting strategy, an input generation rule and GraphQL query configuration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of dynamic web pages, and in particular relates to an automatic test input generation method based on dynamic page splitting. Background Art

[0002] With the rapid development of Web technology, dynamic web pages have become a core component of modern Web applications. Dynamic web pages can update page content in real time based on user interactions and changes in background data, providing a more flexible and personalized user experience. However, as the complexity of dynamic web pages increases, how to effectively test these web pages, especially automated testing, has become a major challenge in software quality assurance.

[0003] In the prior art, the testing of dynamic web pages usually relies on manually generated test cases and input data. This manual testing method may be feasible for simple static web pages, but it is not enough for complex web applications that contain a lot of dynamic content. The content and structure of dynamic web pages often change frequently with user operations or changes in background data. Manual testing is not only inefficient, but also difficult to fully cover all possible user operation scenarios. This testing method is prone to missing key edge cases, resulting in insufficient test coverage and accuracy, and unable to fully guarantee the quality of the software.

[0004] Some automated testing tools in the prior art attempt to simulate user operations through scripting, but these tools usually rely on fixed page structures and element identifiers. Once the page structure changes, the script needs to be rewritten or adjusted, increasing maintenance costs. In addition, these tools usually lack the ability to deeply analyze and process dynamic content, and are difficult to cope with the complex interactive logic and changing content layout in dynamic pages.

[0005] In terms of test input generation for dynamic pages, existing technologies often rely on predefined input data sets and cannot dynamically generate test input based on the real-time status of the page. This static test input generation method has obvious limitations when facing complex dynamic web pages and cannot effectively cover all possible user operation paths and data scenarios. Especially for complex Web applications that support multiple languages, existing technologies have difficulty ensuring the semantic consistency of pages in different language environments and cannot fully verify the degree of match between the dynamic behavior of the page and the semantic expectations.

[0006] In addition, when dealing with complex Web applications, existing automated testing tools often lack a deep understanding of the text content of the page and are unable to generate appropriate test inputs and expected results for different languages ​​and semantic changes. This makes it difficult for testing tools to effectively evaluate the semantic performance of the page in a multilingual environment and to ensure the consistency and accuracy of the page in different language versions.

[0007] In summary, the existing technologies have the following defects in the automated testing of dynamic pages: first, the generation method of test input data is too dependent on manual operations or static data sets, and cannot dynamically respond to page changes; second, existing tools lack the ability to deeply analyze dynamic content, and it is difficult to cover all user operation scenarios and edge cases; third, for Web applications that support multiple languages, the existing technologies cannot ensure the semantic consistency of the page and cannot fully verify the dynamic behavior of the page in different language environments. The above defects seriously affect the efficiency and coverage of dynamic web page testing, and a new automated test input generation method is urgently needed to solve these problems. Summary of the invention

[0008] The problem to be solved by the present invention is to effectively verify the semantic consistency of pages in complex Web applications supporting multiple languages, and propose an automatic test input generation method based on dynamic page splitting.

[0009] To achieve the above object, the present invention is implemented through the following technical solutions:

[0010] An automatic test input generation method based on dynamic page splitting comprises the following steps:

[0011] S1. Obtain the dynamic web page to be tested, parse the document object model structure of the dynamic web page based on the Cypress framework, and monitor the dynamic content elements in the page in real time. The dynamic content elements include input fields, buttons, drop-down menus, and pop-up windows dynamically generated by user interaction or background data;

[0012] S2. Using the real-time DOM operation capability of Cypress, the dynamic content elements monitored in step S1 are classified and marked in real time, and different types of dynamic content elements are logically grouped according to the real-time layout and structure information of the page to form a plurality of page components, each of which contains one or more related dynamic content elements;

[0013] S3, based on the structural information of the page components obtained in step S2, combined with the integration of Cypress and GraphQL API, dynamically obtain test data from the background, and automatically generate a test input template that matches the current state of the page, wherein the test input template includes the input type of each dynamic content element in each page component, the corresponding input rule, and the GraphQL query result;

[0014] S4. According to the test input template obtained in step S3, test input data covering various user operation scenarios is automatically generated, and the test input data is obtained through GraphQL query and applied to dynamic page testing in real time;

[0015] S5. Using the fast feedback capability of the Cypress framework, the test input data generated in step S4 is applied to the dynamic web page to be tested in real time, the test is performed by simulating user interaction, and the test results are recorded and analyzed while the page changes, and a test report is generated;

[0016] S6, introducing a natural language processing module to parse the text content in the dynamic web page obtained in step S5, and automatically generating a semantic consistency report that conforms to the semantics based on the parsing result, and optimizing the test input generation method;

[0017] S7. Based on the test report obtained in step S5 and the semantic consistency report obtained in step S6, optimize the page splitting strategy, input generation rules, and GraphQL query configuration.

[0018] Furthermore, the specific implementation method of step S1 includes the following steps:

[0019] S11. Load the URL of the dynamic web page to be tested through the access function of the Cypress framework, and record the initial loading state of the dynamic web page, where the initial loading state includes the DOM structure, CSS style, and JavaScript file of the dynamic web page;

[0020] S12. Based on the DOM structure parsing function of the Cypress framework, real-time monitoring of dynamic content element changes after dynamic web pages are loaded, and definition of monitoring parameter set {P i}, where P i Represents dynamic elements in dynamic web pages, including input fields, buttons, drop-down menus, and pop-up windows;

[0021] S13, after each dynamic web page refresh or interaction, capture and analyze the newly added or changed dynamic content elements in the dynamic web page in real time, and add the captured elements to the parameter set {P i}, and record the captured element attributes and behaviors:

[0022]

[0023] Where Δt represents the time increment, E m (t+Δt) represents the mth dynamic element added or changed at time t+Δt, γ(E m (t+Δt)) is an indicator function, indicating whether the newly added element is added to the parameter set;

[0024] S14. In combination with the event monitoring function of the Cypress framework, user interaction events and background data updates are monitored in real time, and events associated with dynamic content elements are captured, including click events, input events, and data update events. Events associated with dynamic content elements are associated with corresponding dynamic content elements to form an event-element mapping set.

[0025] S15. Analyze the hierarchical relationship and dependency relationship of each dynamic content element through the DOM tree traversal function provided by Cypress, and establish a dynamic web page element tree, where the nodes of the element tree represent dynamic content elements, and the edges represent the parent-child or sibling relationship between the elements;

[0026] S16: Based on the capture and monitoring results, generate an initial record of the dynamic content element changes of the dynamic web page, and store it as an initial record data set D of the dynamic content element changes. init .

[0027] Furthermore, the specific implementation method of step S2 includes the following steps:

[0028] S21, based on parameter set {P i} and the initial record data set D of dynamic content element changes init , using the real-time DOM operation capability of the Cypress framework, the monitored dynamic content elements are classified in real time, and the dynamic content elements are divided into subsets of different categories according to the element type, interaction mode and hierarchical relationship. i,j (t)}, where P i,j (t) represents the i-th dynamic content element belonging to category j at time t;

[0029] S22. Using the initial record data set D init Based on the initial records in the page, the real-time layout information of the page is combined to analyze the position and structure of each category of dynamic content elements, using the position vector Indicates the coordinate information of the element in the page;

[0030] S23, combining the spatial relationship of the page layout and the initial record data set D init The hierarchical structure between the elements recorded in the , logically grouping dynamic content elements within the same category to form multiple page components S k(t);

[0031] S24, for each page component S k (t) Mark and combine with the initial record data set D init The data in the structure records the element types, quantity and relationship with other page components, forming a page structure tree. The nodes of the structure represent page components, and the edges represent the hierarchy or dependency relationship between page components.

[0032] Furthermore, the page structure tree T in step S24 page The generation process of (t) is expressed by the following formula:

[0033]

[0034] Among them, β k Indicates the page component S k The node weight of (t), γ k,l (t) is the page component S k (t) and other page components l (t), f(S k (t),S l (t)) represents the page component S k (t) and S l (t), is defined as:

[0035] f(S k (t),S l (t)) = exp(-λ·d(S k (t),S l (t)))·δ(S k (t),S l (t));

[0036] Among them, λ is the adjustment factor, which controls the decay rate of the relationship function; d(S k (t),S l (t)) represents the page component S k (t) and S l (t), which can be the Euclidean distance, Manhattan distance or other distance metrics selected according to the page layout; δ(S k (t),S l (t)) is the indicator function, indicating the page component S k (t) and S l (t) Whether there is a hierarchy or dependency relationship, δ(S k (t),S l (t))=1 indicates that there is a relationship, δ(Sk (t),S l (t)) = 0 means no relationship;

[0037] The page structure tree T page The nodes and edges of (t) are compared and updated with the records in the initial record data set to make the hierarchical structure of the page components consistent with the initial records. At the same time, the weight coefficient β of the page structure tree is adjusted in real time according to the dynamic changes of the page. k and γ k,l The value of (t) reflects the latest status of the relationship between the components of the page.

[0038] Furthermore, the specific implementation method of step S3 includes the following steps:

[0039] S31, based on the page structure tree T page (t) and the properties of its nodes and edges, combined with the integration of Cypress and GraphQLAPI, dynamically obtain test data that matches the current state of the page from the background, and define the test data set {D test (t)}, where {D test (t)} represents the test data set obtained from the background at time t;

[0040] S32, according to the page structure tree T page Each page component S in (t) k (t) structure information, automatically generate the corresponding test input template T input (t), the test input template includes each dynamic content element P in the page component i,j (t) Input type and corresponding input rules;

[0041] S33. Combine the query results obtained from GraphQLAPI and convert the test data set {D test The data in (t)} is matched with the dynamic content elements in the page components to generate the final test input template T input_final (t).

[0042] Furthermore, the specific implementation method of step S4 includes the following steps:

[0043] S41, based on the final test input template T input_final (t) According to the structure and element attributes of the page components, a test input dataset covering various user operation scenarios is automatically generated. input (t)};

[0044] S42. Combine the real-time query results obtained from the GraphQL API and input the generated test data set {D input(t)} matches the dynamic content elements in the page components, so that the test input data reflects the current state of the page and its possible changes, and defines the operation scenario function f op (t) is used to describe the user operation scenario:

[0045]

[0046] Among them, μ k (t) is the page component S k (t) Weight coefficient in a specific operation scenario, ν i,j (t) is the dynamic content element P i,j (t) Input weight coefficient in the corresponding operation scenario, D input,k (t) indicates the page component S k (t) Related test input data, f op (t) represents the input data function generated at time t for different operation scenarios;

[0047] S43, applying the generated test input data set to dynamic page testing, simulating user interaction operations through the Cypress framework, and monitoring and recording the response of the page in real time;

[0048] S44, according to the page response data collected during the test, the test input data set is adjusted in real time, and the operation scenario function f op (t) Dynamic optimization is performed to adapt the test input data to the changes in the page and cover all edge scenarios and abnormal situations. The updated operation scenario function is expressed as:

[0049] f op_updated (t) = f op (t)+Δf op (t);

[0050] Where Δf op (t) represents the adjustment amount of the operation scenario function based on the test feedback, which is used to reflect the dynamic changes of the page and new test requirements.

[0051] Furthermore, the specific implementation method of step S5 includes the following steps:

[0052] S51. Using the fast feedback capability of the Cypress framework, the test input data set is applied to the dynamic web page to be tested in real time, the test is performed by simulating user interaction operations, and the page response status of each test step is recorded. page (t);

[0053] S52, in the process of dynamic changes of the page, real-time monitoring and recording of each dynamic content element P i,j(t) state changes, updates the state information of the page components and the page structure tree, and defines the page response function f resp (t) is used to describe the response of the page under different input conditions;

[0054] S53, analyzing the page response data collected during the test, identifying abnormal responses and potential problems in the page, and generating a preliminary test report including the page response analysis results of each test step and abnormality detection information;

[0055] S54. Based on the data in the preliminary test report, analyze the dynamic behavior of the page, optimize the test input data set and page response function, and generate a final test report. The final test report includes a summary of the page's response under all test conditions and a comprehensive evaluation of the dynamic page behavior.

[0056] Furthermore, the specific implementation method of step S6 includes the following steps:

[0057] S61, introducing a natural language processing module to perform semantic analysis on the text content in the dynamic page and extract key text elements in the page;

[0058] S62. Based on the semantic analysis capability of the natural language processing module, the extracted key text elements are classified and annotated to generate a text semantic model M. semantic (t);

[0059] S63. Using text semantic model M semantic (t) Generate a test input dataset that conforms to the current semantics of the page {D semantic (t)}, the test input data set is used to test the semantic consistency of dynamic elements related to the text content in the page, so that the input data matches the semantics of the page text content, and the test input function f is defined semantic (t) used to describe the semantic-based input data generation process;

[0060] S64, automatically generating an expected result verification rule set in combination with the generated semantic input data set, where the expected result verification rule set is used to verify the consistency between the page response result and the expected semantics, so that the dynamic behavior of the page is consistent with the semantic expectations in a complex Web application supporting multiple languages;

[0061] S65. During the test, the semantic input data set and the expected result verification rule set are dynamically adjusted according to the real-time response results of the page to generate a final semantic consistency report. The final semantic consistency report is used to evaluate the semantic performance of the page and its consistency in different language environments, and optimize the test input generation method based on the results to optimize the semantic consistency of the dynamic page.

[0062] Beneficial effects of the present invention:

[0063] The present invention discloses an automatic test input generation method based on dynamic page splitting, which utilizes the Cypress framework in combination with the real-time DOM operation capability of the dynamic page to accurately monitor, classify and mark the dynamic content elements in the page, and logically group them according to the real-time layout and structural information of the page to generate multiple page components, and automatically generates a test input template matching the current page state through the structural information of the page components, and dynamically obtains test data consistent with the current state of the page through the integrated GraphQLAPI, so that the test input generation process can respond to changes in the page content in real time, automatically cover various possible user operation scenarios, significantly improve the accuracy and comprehensiveness of test input generation, and avoid the limitations of manual operation and static data sets.

[0064] The method for generating automatic test input based on dynamic page splitting described in the present invention introduces a natural language processing module to perform semantic analysis on the text content in the page, automatically generates test input data that conforms to the semantics, and generates a set of expected result verification rules based on the semantic model, thereby ensuring that in complex Web applications supported by multiple languages, the dynamic behavior of the page is consistent with the semantic expectations in different language environments. It can not only effectively detect the semantic performance of the page in different language versions, but also perform in-depth analysis of the text elements in the page through the semantic model, thereby generating test input data and verification rules that are more consistent with the semantics of the page, and significantly improving the coverage and accuracy of the test.

[0065] The present invention discloses an automated test input generation method based on dynamic page splitting, which utilizes the fast feedback capability of the Cypress framework to record and analyze the response status of the page in real time during the test execution process, and adjust the test input data set and the page response function according to the dynamic changes of the page. Through the analysis and feedback of the preliminary test report, the present invention can dynamically optimize the test input generation process to ensure that the test input data can accurately reflect the latest status and operation scenario of the page. This type of dynamic adjustment mechanism based on real-time feedback effectively improves the flexibility and adaptability of the test, ensures comprehensive coverage and accurate verification during the test process, and avoids the problem of test script failure caused by changes in page structure.

[0066] The present invention discloses an automated test input generation method based on dynamic page splitting. Automated test input generation no longer relies on a fixed page structure and a predefined input data set, but is dynamically generated based on the real-time state of the page. This not only improves the coverage and accuracy of the test input, but also reduces the workload of manually writing and maintaining test scripts. When faced with complex dynamic pages, it can significantly reduce the maintenance cost of the test. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 A flowchart of an automatic test input generation method based on dynamic page splitting according to the present invention;

[0068] Figure 2 A schematic diagram of monitoring and classifying dynamic content elements in an automatic test input generation method based on dynamic page splitting proposed by the present invention;

[0069] Figure 3 A schematic diagram of structural information and logical grouping of page components in an automated test input generation method based on dynamic page splitting proposed by the present invention. DETAILED DESCRIPTION

[0070] In order to make the purpose, technical solution and advantages of the present invention more clear, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention, that is, the specific embodiments described are only part of the embodiments of the present invention, rather than all of the specific embodiments. The components of the specific embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations, and the present invention can also have other embodiments.

[0071] Therefore, the following detailed description of the specific embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected specific embodiments of the present invention. Based on the specific embodiments of the present invention, all other specific embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0072] In order to further understand the content, features and effects of the present invention, the following specific implementation methods are given as examples, and the attached Figure 1 -Attached Figure 3 The detailed instructions are as follows: Specific implementation method one:

[0074] An automatic test input generation method based on dynamic page splitting comprises the following steps:

[0075] S1. Obtain the dynamic web page to be tested, parse the document object model structure of the dynamic web page based on the Cypress framework, and monitor the dynamic content elements in the page in real time. The dynamic content elements include input fields, buttons, drop-down menus, and pop-up windows dynamically generated by user interaction or background data;

[0076] Furthermore, the specific implementation method of step S1 includes the following steps:

[0077] S11. Load the URL of the dynamic web page to be tested through the access function of the Cypress framework, and record the initial loading state of the dynamic web page, where the initial loading state includes the DOM structure, CSS style, and JavaScript file of the dynamic web page;

[0078] S12. Based on the DOM structure parsing function of the Cypress framework, real-time monitoring of dynamic content element changes after dynamic web pages are loaded, and definition of monitoring parameter set {P i}, where P i Represents dynamic elements in dynamic web pages, including input fields, buttons, drop-down menus, and pop-up windows;

[0079] S13, after each dynamic web page refresh or interaction, capture and analyze the newly added or changed dynamic content elements in the dynamic web page in real time, and add the captured elements to the parameter set {P i}, and record the captured element attributes and behaviors:

[0080]

[0081] Where Δt represents the time increment, E m (t+Δt) represents the mth dynamic element added or changed at time t+Δt, γ(E m (t+Δt)) is an indicator function, indicating whether the newly added element is added to the parameter set;

[0082] S14. In combination with the event monitoring function of the Cypress framework, user interaction events and background data updates are monitored in real time, and events associated with dynamic content elements are captured, including click events, input events, and data update events. Events associated with dynamic content elements are associated with corresponding dynamic content elements to form an event-element mapping set.

[0083] S15. Analyze the hierarchical relationship and dependency relationship of each dynamic content element through the DOM tree traversal function provided by Cypress, and establish a dynamic web page element tree, where the nodes of the element tree represent dynamic content elements, and the edges represent the parent-child or sibling relationship between the elements;

[0084] S16: Based on the capture and monitoring results, generate an initial record of the dynamic content element changes of the dynamic web page, and store it as an initial record data set D of the dynamic content element changes. init .

[0085] S2. Using the real-time DOM operation capability of Cypress, the dynamic content elements monitored in step S1 are classified and marked in real time, and different types of dynamic content elements are logically grouped according to the real-time layout and structure information of the page to form a plurality of page components, each of which contains one or more related dynamic content elements;

[0086] Furthermore, the specific implementation method of step S2 includes the following steps:

[0087] S21, based on parameter set {P i} and the initial record data set D of dynamic content element changes init , using the real-time DOM operation capability of the Cypress framework, the monitored dynamic content elements are classified in real time, and the dynamic content elements are divided into subsets of different categories according to the element type, interaction mode and hierarchical relationship. i,j (t)}, where P i,j (t) represents the i-th dynamic content element belonging to category j at time t;

[0088] S22. Using the initial record data set D init Based on the initial records in the page, the real-time layout information of the page is combined to analyze the position and structure of each category of dynamic content elements, using the position vector Indicates the coordinate information of the element in the page;

[0089] S23, combining the spatial relationship of the page layout and the initial record data set D init The hierarchical structure between the elements recorded in the , logically grouping dynamic content elements within the same category to form multiple page components S k (t);

[0090] S24, for each page component S k (t) Mark and combine with the initial record data set D init The data in the structure records the element types, quantity and relationship with other page components, forming a page structure tree. The nodes of the structure represent page components, and the edges represent the hierarchy or dependency relationship between page components.

[0091] Furthermore, the page structure tree T in step S24 page The generation process of (t) is expressed by the following formula:

[0092]

[0093] Among them, β k Indicates the page component S k The node weight of (t), γ k,l(t) is the page component S k (t) and other page components l (t), f(S k (t),S l (t)) represents the page component S k (t) and S l (t), is defined as:

[0094] f(S k (t),S l (t)) = exp(-λ·d(S k (t),S l (t)))·δ(S k (t),S l (t));

[0095] Among them, λ is the adjustment factor, which controls the decay rate of the relationship function; d(S k (t),S l (t)) represents the page component S k (t) and S l (t), which can be the Euclidean distance, Manhattan distance or other distance metrics selected according to the page layout; δ(S k (t),S l (t)) is the indicator function, indicating the page component S k (t) and S l (t) Whether there is a hierarchy or dependency relationship, δ(S k (t),S l (t))=1 indicates that there is a relationship, δ(S k (t),S l (t)) = 0 means no relationship;

[0096] The page structure tree T page The nodes and edges of (t) are compared and updated with the records in the initial record data set to make the hierarchical structure of the page components consistent with the initial records. At the same time, the weight coefficient β of the page structure tree is adjusted in real time according to the dynamic changes of the page. k and γ k,l The value of (t) reflects the latest status of the relationship between the components of the page.

[0097] S3, based on the structural information of the page components obtained in step S2, combined with the integration of Cypress and GraphQL API, dynamically obtain test data from the background, and automatically generate a test input template that matches the current state of the page, wherein the test input template includes the input type of each dynamic content element in each page component, the corresponding input rule, and the GraphQL query result;

[0098] Furthermore, the specific implementation method of step S3 includes the following steps:

[0099] S31, based on the page structure tree T page (t) and the properties of its nodes and edges, combined with the integration of Cypress and GraphQLAPI, dynamically obtain test data that matches the current state of the page from the background, and define the test data set {D test (t)}, where {D test (t)} represents the test data set obtained from the background at time t;

[0100] S32, according to the page structure tree T page Each page component S in (t) k (t) structure information, automatically generate the corresponding test input template T input (t), the test input template includes each dynamic content element P in the page component i,j (t) Input type and corresponding input rules;

[0101] S33. Combine the query results obtained from GraphQLAPI and convert the test data set {D test The data in (t)} is matched with the dynamic content elements in the page components to generate the final test input template T input_final (t).

[0102] S4. According to the test input template obtained in step S3, test input data covering various user operation scenarios is automatically generated, and the test input data is obtained through GraphQL query and applied to dynamic page testing in real time;

[0103] Furthermore, the specific implementation method of step S4 includes the following steps:

[0104] S41, based on the final test input template T input_final (t) According to the structure and element attributes of the page components, a test input dataset covering various user operation scenarios is automatically generated. input (t)};

[0105] S42. Combine the real-time query results obtained from the GraphQL API and input the generated test data set {Dinput (t)} matches the dynamic content elements in the page components, so that the test input data reflects the current state of the page and its possible changes, and defines the operation scenario function f op (t) is used to describe the user operation scenario:

[0106]

[0107] Among them, μ k (t) is the page component S k (t) Weight coefficient in a specific operation scenario, ν i,j (t) is the dynamic content element P i,j (t) Input weight coefficient in the corresponding operation scenario, D input,k (t) indicates the page component S k (t) Related test input data, f op (t) represents the input data function generated at time t for different operation scenarios;

[0108] S43, applying the generated test input data set to dynamic page testing, simulating user interaction operations through the Cypress framework, and monitoring and recording the response of the page in real time;

[0109] S44, according to the page response data collected during the test, the test input data set is adjusted in real time, and the operation scenario function f op (t) Dynamic optimization is performed to adapt the test input data to the changes in the page and cover all edge scenarios and abnormal situations. The updated operation scenario function is expressed as:

[0110] f op_updated (t) = f op (t)+Δf op (t);

[0111] Where Δf op (t) represents the adjustment amount of the operation scenario function based on the test feedback, which is used to reflect the dynamic changes of the page and new test requirements.

[0112] S5. Using the fast feedback capability of the Cypress framework, the test input data generated in step S4 is applied to the dynamic web page to be tested in real time, the test is performed by simulating user interaction, and the test results are recorded and analyzed while the page changes, and a test report is generated;

[0113] Furthermore, the specific implementation method of step S5 includes the following steps:

[0114] S51. Using the fast feedback capability of the Cypress framework, the test input data set is applied to the dynamic web page to be tested in real time, the test is performed by simulating user interaction operations, and the page response status of each test step is recorded. page (t);

[0115] S52, in the process of dynamic changes of the page, real-time monitoring and recording of each dynamic content element P i,j (t) state changes, updates the state information of the page components and the page structure tree, and defines the page response function f resp (t) is used to describe the response of the page under different input conditions;

[0116] S53, analyzing the page response data collected during the test, identifying abnormal responses and potential problems in the page, and generating a preliminary test report including the page response analysis results of each test step and abnormality detection information;

[0117] S54. Based on the data in the preliminary test report, analyze the dynamic behavior of the page, optimize the test input data set and page response function, and generate a final test report. The final test report includes a summary of the page's response under all test conditions and a comprehensive evaluation of the dynamic page behavior.

[0118] S6, introducing a natural language processing module to parse the text content in the dynamic web page obtained in step S5, and automatically generating a semantic consistency report that conforms to the semantics based on the parsing result, and optimizing the test input generation method;

[0119] Furthermore, the specific implementation method of step S6 includes the following steps:

[0120] S61, introducing a natural language processing module to perform semantic analysis on the text content in the dynamic page and extract key text elements in the page;

[0121] S62. Based on the semantic analysis capability of the natural language processing module, the extracted key text elements are classified and annotated to generate a text semantic model M. semantic (t);

[0122] S63. Using text semantic model M semantic (t) Generate a test input dataset that conforms to the current semantics of the page {D semantic (t)}, the test input data set is used to test the semantic consistency of dynamic elements related to the text content in the page, so that the input data matches the semantics of the page text content, and the test input function f is defined semantic (t) used to describe the semantic-based input data generation process;

[0123] S64, automatically generating an expected result verification rule set in combination with the generated semantic input data set, where the expected result verification rule set is used to verify the consistency between the page response result and the expected semantics, so that the dynamic behavior of the page is consistent with the semantic expectations in a complex Web application supporting multiple languages;

[0124] S65. During the test, the semantic input data set and the expected result verification rule set are dynamically adjusted according to the real-time response results of the page to generate a final semantic consistency report. The final semantic consistency report is used to evaluate the semantic performance of the page and its consistency in different language environments, and optimize the test input generation method based on the results to optimize the semantic consistency of the dynamic page.

[0125] S7. Based on the test report obtained in step S5 and the semantic consistency report obtained in step S6, optimize the page splitting strategy, input generation rules, and GraphQL query configuration.

[0126] In summary, this implementation significantly improves the testing efficiency and coverage of dynamic pages through intelligent page splitting, real-time data acquisition and semantic consistency verification, especially in complex Web applications supporting multiple languages, demonstrating excellent performance and reliability.

[0127] This implementation method utilizes the Cypress framework in combination with the real-time DOM operation capability of dynamic pages to accurately monitor, classify and mark the dynamic content elements in the page, and logically group them according to the real-time layout and structural information of the page to generate multiple page components. Through the structural information of the page components, a test input template that matches the current page state is automatically generated, and test data consistent with the current state of the page is dynamically obtained through the integrated GraphQL API, so that the test input generation process can respond to changes in page content in real time, automatically cover various possible user operation scenarios, significantly improve the accuracy and comprehensiveness of test input generation, and avoid the limitations of manual operations and static data sets.

[0128] This implementation introduces a natural language processing module to perform semantic analysis on the text content in the page, automatically generate semantically consistent test input data, and generate a set of expected result verification rules based on the semantic model, ensuring that in complex Web applications that support multiple languages, the dynamic behavior of the page is consistent with the semantic expectations in different language environments. It can not only effectively detect the semantic performance of the page in different language versions, but also perform in-depth analysis of the text elements in the page through the semantic model, thereby generating test input data and verification rules that are more consistent with the page semantics, significantly improving the test coverage and accuracy.

[0129] This embodiment utilizes the fast feedback capability of the Cypress framework to record and analyze the response status of the page in real time during the test execution process, and adjusts the test input data set and page response function according to the dynamic changes of the page. Through the analysis and feedback of the preliminary test report, the present invention can dynamically optimize the test input generation process to ensure that the test input data can accurately reflect the latest status and operation scenario of the page. This type of dynamic adjustment mechanism based on real-time feedback effectively improves the flexibility and adaptability of the test, ensures comprehensive coverage and accurate verification during the test process, and avoids the problem of test script failure caused by changes in page structure.

[0130] Through the method described in this embodiment, automated test input generation no longer relies on a fixed page structure and predefined input data sets, but is dynamically generated based on the real-time status of the page. This not only improves the coverage and accuracy of the test input, but also reduces the workload of manually writing and maintaining test scripts. When faced with complex dynamic pages, it can significantly reduce the maintenance cost of the test.

[0131] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0132] Although the present application has been described above with reference to specific embodiments, various modifications may be made thereto and parts thereof may be replaced with equivalents without departing from the scope of the present application. In particular, as long as there is no structural conflict, the various features in the specific embodiments disclosed in the present application may be used in combination with each other in any manner, and the fact that these combinations are not exhaustively described in this specification is only for the sake of omitting space and saving resources. Therefore, the present application is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.

Claims

1. An automated test input generation method based on dynamic page splitting, characterized in that: The steps include: S1. Obtain the dynamic web page to be tested, parse the document object model structure of the dynamic web page based on the Cypress framework, and monitor the dynamic content elements in the page in real time. The dynamic content elements include input fields, buttons, drop-down menus, and pop-up windows dynamically generated by user interaction or background data; S2. Using the real-time DOM operation capability of Cypress, the dynamic content elements monitored in step S1 are classified and marked in real time, and different types of dynamic content elements are logically grouped according to the real-time layout and structure information of the page to form a plurality of page components, each of which contains one or more related dynamic content elements; S3, based on the structural information of the page components obtained in step S2, combined with the integration of Cypress and GraphQL API, dynamically obtain test data from the background, and automatically generate a test input template that matches the current state of the page, wherein the test input template includes the input type of each dynamic content element in each page component, the corresponding input rule, and the GraphQL query result; S4. According to the test input template obtained in step S3, test input data covering various user operation scenarios is automatically generated, and the test input data is obtained through GraphQL query and applied to dynamic page testing in real time; S5. Using the fast feedback capability of the Cypress framework, the test input data generated in step S4 is applied to the dynamic web page to be tested in real time, the test is performed by simulating user interaction, and the test results are recorded and analyzed while the page changes, and a test report is generated; S6, introducing a natural language processing module to parse the text content in the dynamic web page obtained in step S5, and automatically generating a semantic consistency report that conforms to the semantics based on the parsing result, and optimizing the test input generation method; S7. Based on the test report obtained in step S5 and the semantic consistency report obtained in step S6, optimize the page splitting strategy, input generation rules, and GraphQL query configuration.

2. The method for generating automatic test input based on dynamic page splitting according to claim 1, characterized in that: The specific implementation method of step S1 includes the following steps: S11. Load the URL of the dynamic web page to be tested through the access function of the Cypress framework, and record the initial loading state of the dynamic web page, where the initial loading state includes the DOM structure, CSS style, and JavaScript file of the dynamic web page; S12. Based on the DOM structure parsing function of the Cypress framework, real-time monitoring of dynamic content element changes after dynamic web pages are loaded, and definition of monitoring parameter set {P i }, where P i Represents dynamic elements in dynamic web pages, including input fields, buttons, drop-down menus, and pop-up windows; S13, after each dynamic web page refresh or interaction, capture and analyze the newly added or changed dynamic content elements in the dynamic web page in real time, and add the captured elements to the parameter set {P i }, and record the captured element attributes and behaviors: Where Δt represents the time increment, E m (t+Δt) represents the mth dynamic element added or changed at time t+Δt, γ(E m (t+Δt)) is an indicator function, indicating whether the newly added element is added to the parameter set; S14. In combination with the event monitoring function of the Cypress framework, user interaction events and background data updates are monitored in real time, and events associated with dynamic content elements are captured, including click events, input events, and data update events. Events associated with dynamic content elements are associated with corresponding dynamic content elements to form an event-element mapping set. S15. Analyze the hierarchical relationship and dependency relationship of each dynamic content element through the DOM tree traversal function provided by Cypress, and establish a dynamic web page element tree, where the nodes of the element tree represent dynamic content elements, and the edges represent the parent-child or sibling relationship between the elements; S16: Based on the capture and monitoring results, generate an initial record of the dynamic content element changes of the dynamic web page, and store it as an initial record data set D of the dynamic content element changes. init .

3. The method for generating automatic test input based on dynamic page splitting according to claim 2, characterized in that: The specific implementation method of step S2 includes the following steps: S21, based on parameter set {P i } and the initial record data set D of dynamic content element changes init , using the real-time DOM operation capability of the Cypress framework, the monitored dynamic content elements are classified in real time, and the dynamic content elements are divided into subsets of different categories according to the element type, interaction mode and hierarchical relationship. i,j (t)}, where P i,j (t) represents the i-th dynamic content element belonging to category j at time t; S22. Using the initial record data set D init Based on the initial records in the page, the real-time layout information of the page is combined to analyze the position and structure of each category of dynamic content elements, using the position vector Indicates the coordinate information of the element in the page; S23, combining the spatial relationship of the page layout and the initial record data set D init The hierarchical structure between the elements recorded in the , logically grouping dynamic content elements within the same category to form multiple page components S k (t); S24. For each page component S k (t) Mark and combine with the initial record data set D init The data in the structure records the element types, quantity and relationship with other page components, forming a page structure tree. The nodes of the structure represent page components, and the edges represent the hierarchy or dependency relationship between page components.

4. The method for generating automatic test input based on dynamic page splitting according to claim 3, characterized in that: The page structure tree T in step S24 page The generation process of (t) is expressed by the following formula: Among them, β k Indicates the page component S k The node weight of (t), γ k,l (t) is the page component S k (t) and other page components l (t), f(S k (t),S l (t)) represents the page component S k (t) and S l (t), is defined as: f(S k (t),S l (t))=exp(-λ·d(S k (t),S l (t)))·δ(S k (t),S l (t)); Among them, λ is the adjustment factor, which controls the decay rate of the relationship function; d(S k (t),S l (t)) represents the page component S k (t) and S l (t), which can be the Euclidean distance, Manhattan distance or other distance metrics selected according to the page layout; δ(S k (t),S l (t)) is the indicator function, indicating the page component S k (t) and S l (t) Whether there is a hierarchy or dependency relationship, δ(S k (t),S l (t))=1 indicates that there is a relationship, δ(S k (t),S l (t)) = 0 means no relationship; The page structure tree T page The nodes and edges of (t) are compared and updated with the records in the initial record data set to make the hierarchical structure of the page components consistent with the initial records. At the same time, the weight coefficient β of the page structure tree is adjusted in real time according to the dynamic changes of the page. k and γ k,l The value of (t) reflects the latest status of the relationship between the components of the page.

5. The method for generating automatic test input based on dynamic page splitting according to claim 4, characterized in that: The specific implementation method of step S3 includes the following steps: S31, based on the page structure tree T page (t) and the properties of its nodes and edges, combined with the integration of Cypress and GraphQLAPI, dynamically obtain test data that matches the current state of the page from the background, and define the test data set {D test (t)}, where {D test (t)} represents the test data set obtained from the background at time t; S32, according to the page structure tree T page Each page component S in (t) k (t) structure information, automatically generate the corresponding test input template T input (t), the test input template includes each dynamic content element P in the page component i,j (t) Input type and corresponding input rules; S33. Combine the query results obtained from GraphQLAPI and convert the test data set {D test The data in (t)} is matched with the dynamic content elements in the page components to generate the final test input template T input_final (t).

6. The method for generating automatic test input based on dynamic page splitting according to claim 5, characterized in that: The specific implementation method of step S4 includes the following steps: S41, based on the final test input template T input_final (t) According to the structure and element attributes of the page components, a test input dataset covering various user operation scenarios is automatically generated. input (t)}; S42. Combine the real-time query results obtained from the GraphQL API and input the generated test data set {D input (t matches the dynamic content elements in the page components so that the test input data reflects the current state of the page and its possible changes, and defines the operation scenario function f op (t) is used to describe the user operation scenario: Among them, μ k (t) is the page component S k (t) Weight coefficient in a specific operation scenario, ν i,j (t) is the dynamic content element P i,j (t) Input weight coefficient in the corresponding operation scenario, D input,k (t) indicates the page component S k (t) Related test input data, f op (t) represents the input data function for different operation scenarios generated at time t; S43, applying the generated test input data set to dynamic page testing, simulating user interaction operations through the Cypress framework, and monitoring and recording the response of the page in real time; S44, according to the page response data collected during the test, the test input data set is adjusted in real time, and the operation scenario function f op (t) Dynamic optimization is performed to adapt the test input data to the changes in the page and cover all edge scenarios and abnormal situations. The updated operation scenario function is expressed as: f op_updated (t)=f op (t)+Δf op (t); Where Δf op (t) represents the adjustment amount of the operation scenario function based on the test feedback, which is used to reflect the dynamic changes of the page and new test requirements.

7. The method for generating automatic test input based on dynamic page splitting according to claim 6, characterized in that: The specific implementation method of step S5 includes the following steps: S51. Using the fast feedback capability of the Cypress framework, the test input data set is applied to the dynamic web page to be tested in real time, the test is performed by simulating user interaction operations, and the page response status of each test step is recorded. page (t); S52, in the process of dynamic changes of the page, real-time monitoring and recording of each dynamic content element P i,j (t) state changes, updates the state information of the page components and the page structure tree, and defines the page response function f resp (t) is used to describe the response of the page under different input conditions; S53, analyzing the page response data collected during the test, identifying abnormal responses and potential problems in the page, and generating a preliminary test report including the page response analysis results of each test step and abnormality detection information; S54. Based on the data in the preliminary test report, analyze the dynamic behavior of the page, optimize the test input data set and page response function, and generate a final test report. The final test report includes a summary of the page's response under all test conditions and a comprehensive evaluation of the dynamic page behavior.

8. The method for generating automatic test input based on dynamic page splitting according to claim 7, characterized in that: The specific implementation method of step S6 includes the following steps: S61, introducing a natural language processing module to perform semantic analysis on the text content in the dynamic page and extract key text elements in the page; S62. Based on the semantic analysis capability of the natural language processing module, the extracted key text elements are classified and annotated to generate a text semantic model M. semantic (t); S63. Using text semantic model M semantic (t) Generate a test input dataset that conforms to the current semantics of the page {D semantic (t)}, the test input data set is used to test the semantic consistency of dynamic elements related to the text content in the page, so that the input data matches the semantics of the page text content, and the test input function f is defined semantic (t) used to describe the semantic-based input data generation process; S64, automatically generating an expected result verification rule set in combination with the generated semantic input data set, where the expected result verification rule set is used to verify the consistency between the page response result and the expected semantics, so that the dynamic behavior of the page is consistent with the semantic expectations in a complex Web application supporting multiple languages; S65. During the test, the semantic input data set and the expected result verification rule set are dynamically adjusted according to the real-time response results of the page to generate a final semantic consistency report. The final semantic consistency report is used to evaluate the semantic performance of the page and its consistency in different language environments, and optimize the test input generation method based on the results to optimize the semantic consistency of the dynamic page.

Citation Information

Patent Citations

  • Method and equipment for detecting webpage elements and storage medium

    CN114385514A

  • User interface script file processing method and device and computer equipment

    CN115237806A

  • Test method and device

    CN118363846A

  • Methods, systems, and articles of manufacture for testing web services using a behavior-driven development domain specific language framework

    US10810110B1

Cited By

  • Content rendering method and device and electronic equipment

    CN120469752A

  • LLM-based natural language driven GUI test rehearsal and test script generation method

    CN120973696A