Search

CN-122019376-A - Page self-adaption testing method and device and electronic equipment

CN122019376ACN 122019376 ACN122019376 ACN 122019376ACN-122019376-A

Abstract

The embodiment of the application provides a page self-adaptive test method, a device and electronic equipment, wherein the method monitors current interface data of a dynamic page to be tested in real time, automatically updates page content of the dynamic page to be tested and execution logic and verification logic associated with the interface update content in the test case according to interface update content of the current interface data relative to historical interface data under the condition that the current interface data is different from the historical interface data, namely, automatically adjusts an execution path and verification points in the test case based on the interface update content, ensures that a test flow is matched with the latest data and page state, realizes a dynamic self-adaptive test strategy, overcomes the technical problem of poor adaptability when the interface data and UI layout are frequently changed in the related art, and remarkably improves test quality and test efficiency.

Inventors

  • Huang Zanqun
  • YU YU

Assignees

  • 湖南快乐阳光互动娱乐传媒有限公司

Dates

Publication Date
20260512
Application Date
20260126

Claims (10)

  1. 1. A method for adaptively testing a page, comprising: The method comprises the steps of monitoring current interface data of a dynamic page to be tested, wherein the dynamic page to be tested refers to a page which acquires data in real time through a network request and updates page content; Under the condition that the current interface data is different from the historical interface data, determining interface updating content of the current interface data relative to the historical interface data, and updating page content of the dynamic page to be tested according to the current interface data to obtain the rendered dynamic page to be tested; Updating execution logic and verification logic associated with the updating content of the interface in the test case corresponding to the dynamic page to be tested to obtain the updated test case, and testing the rendered dynamic page to be tested by adopting the updated test case.
  2. 2. The method of claim 1, wherein prior to said monitoring current interface data of the dynamic page under test, the method further comprises: Loading a plurality of pages in a netless environment, and acquiring a first page snapshot after the first loading of the plurality of pages is completed; Loading the plurality of pages in a network environment, and acquiring a second page snapshot rendered by the plurality of pages; Comparing the first page snapshot and the second page snapshot of the plurality of pages, and determining the page meeting the preset condition in the plurality of pages as the dynamic page to be tested, wherein the preset condition refers to the condition that the difference between the first page snapshot and the second page snapshot belonging to the same page is larger than a preset threshold value.
  3. 3. The method according to claim 2, wherein determining a page satisfying a preset condition among the plurality of pages as the dynamic page to be tested includes: Determining a page which meets the following conditions in the plurality of pages as the dynamic page to be tested, wherein the text content variation is larger than a first preset threshold, the picture content variation is larger than a second preset threshold, the control quantity variation is larger than a third preset threshold, and the unique identifier control quantity variation is larger than a fourth preset threshold; the text content variable quantity refers to the variable quantity of the text content in the second page snapshot relative to the text content in the first page snapshot of the same page; the picture content variable quantity refers to the picture content variable quantity in a first page snapshot of the picture content in a second page snapshot relative to the same page, the control quantity variable quantity refers to the control quantity variable quantity in the second page snapshot relative to the control quantity in the first page snapshot of the same page, and the unique identifier control quantity variable quantity refers to the unique identifier control quantity variable quantity in the second page snapshot relative to the unique identifier control quantity in the first page snapshot of the same page.
  4. 4. The method of claim 1, wherein updating the execution logic and the verification logic associated with the interface update content in the test case corresponding to the dynamic page to be tested to obtain the updated test case comprises: Analyzing a target interface and page change content associated with the interface update content based on a preset association relationship, wherein the preset association relationship refers to the association relationship among the interface of the network request of the dynamic page to be tested, response data and page content; Updating a positioning rule for positioning the page change content in the test case according to the page change content, updating execution logic and verification logic associated with the target interface and the page change content in the test case, updating assertion associated with the target interface and the page change content in the verification logic of the test case based on the interface update content, and obtaining the updated test case.
  5. 5. The method of claim 4, wherein after the monitoring the current interface data of the dynamic page under test, the method further comprises: acquiring a plurality of network requests under the dynamic page to be tested, filtering invalid requests in the plurality of network requests, and acquiring response data of the plurality of filtered network requests; Acquiring page update contents corresponding to each network request according to page contents before each network request and page contents after each network request in the plurality of network requests, and establishing a first association relationship between an interface of the network request and the page update contents; analyzing the response data corresponding to each network request to obtain a data field tree of the response data corresponding to each network request; Extracting element features from the page updating content corresponding to each network request, matching the element features in the page updating content corresponding to each network request with a data field tree of response data corresponding to each network request, and generating a second association relation between the page updating content and the response data according to a matching structure; and generating the preset association relation according to the first association relation and the second association relation.
  6. 6. The method of claim 4, wherein updating the positioning rule for positioning the page change content in the test case according to the page change content comprises: and identifying an original positioning rule template for positioning original page contents corresponding to the historical interface data, and replacing a target placeholder matched with the page change contents in the original positioning rule template with the page change contents.
  7. 7. The method of claim 4, wherein the updating execution logic and validation logic associated with the target interface and the page change content in the test case comprises: Generating a verification case corresponding to the newly added interface element and inserting the verification case into the test case when the page change content comprises the newly added interface element, wherein the verification case comprises execution logic and verification logic which are associated with the target interface and aim at the newly added interface element; Determining a sub-case associated with the removed interface element in the test case and marking the sub-case as a discard case, and removing the discard case in the test case, wherein the discard case comprises execution logic and verification logic associated with the target interface and aiming at the removed interface element; And when the page change content comprises the attribute update of the interface element, identifying the original attribute before the interface element update in the test case, and replacing the original attribute in the test case with the target attribute after the interface element update.
  8. 8. The method of claim 4, wherein updating assertions associated with the target interface and the page change content in the verification logic of the test case based on the interface update content comprises: Analyzing the updated content of the interface, extracting fields from the analyzed interface response data to obtain a target field, and updating the expected value of the assertion associated with the target interface and the page change content in the verification logic of the test case to the target field.
  9. 9. A page adaptation test device, comprising: the system comprises a monitoring module, a control module and a control module, wherein the monitoring module is used for monitoring current interface data of a dynamic page to be tested, the dynamic page to be tested refers to a page which acquires data in real time through a network request and updates page content, the current interface data refers to latest response data of the network request of the dynamic page to be tested, and the current interface data comprises page information required by loading the dynamic page to be tested; the page updating module is used for determining the interface updating content of the current interface data relative to the historical interface data under the condition that the current interface data is different from the historical interface data, and updating the page content of the dynamic page to be tested according to the current interface data to obtain the rendered dynamic page to be tested; And the script updating module is used for updating execution logic and verification logic associated with the interface updating content in the test case corresponding to the dynamic page to be tested to obtain the updated test case, and testing the rendered dynamic page to be tested by adopting the updated test case.
  10. 10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method of any one of claims 1 to 8 when the computer program is executed.

Description

Page self-adaption testing method and device and electronic equipment Technical Field The embodiment of the application relates to the field of video playing software, in particular to a page self-adaption testing method, a device and electronic equipment. Background When the UI automatic test method is used for quickly iterating the software version, the test script needs to be frequently modified manually to adapt to new interface definition and UI layout change, and the process is time-consuming and labor-consuming, and is easy to introduce new script errors, so that the test efficiency and the software delivery speed are seriously affected. Disclosure of Invention The embodiment of the application provides a page self-adaptive test method, a page self-adaptive test device and electronic equipment, which are used for at least solving the technical problem of poor adaptability when interface data and UI layout are frequently changed in the related technology. According to an aspect of an embodiment of the present application, there is provided a page adaptation test method, including: The method comprises the steps of monitoring current interface data of a dynamic page to be tested, wherein the dynamic page to be tested refers to a page which acquires data in real time through a network request and updates page content; Under the condition that the current interface data is different from the historical interface data, determining interface updating content of the current interface data relative to the historical interface data, and updating page content of the dynamic page to be tested according to the current interface data to obtain the rendered dynamic page to be tested; Updating execution logic and verification logic associated with the updating content of the interface in the test case corresponding to the dynamic page to be tested to obtain the updated test case, and testing the rendered dynamic page to be tested by adopting the updated test case. According to another aspect of the embodiment of the present application, there is also provided a page adaptive test apparatus, including: the system comprises a monitoring module, a control module and a control module, wherein the monitoring module is used for monitoring current interface data of a dynamic page to be tested, the dynamic page to be tested refers to a page which acquires data in real time through a network request and updates page content, the current interface data refers to latest response data of the network request of the dynamic page to be tested, and the current interface data comprises page information required by loading the dynamic page to be tested; the page updating module is used for determining the interface updating content of the current interface data relative to the historical interface data under the condition that the current interface data is different from the historical interface data, and updating the page content of the dynamic page to be tested according to the current interface data to obtain the rendered dynamic page to be tested; And the script updating module is used for updating execution logic and verification logic associated with the interface updating content in the test case corresponding to the dynamic page to be tested to obtain the updated test case, and testing the rendered dynamic page to be tested by adopting the updated test case. According to a further aspect of embodiments of the present application, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when being executed by a processor. According to yet another aspect of embodiments of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium and executes the computer instructions to cause the computer device to perform the steps of any of the method embodiments described above. According to a further aspect of embodiments of the present application there is also provided an electronic device comprising a memory having a computer program stored therein and a processor arranged to perform the steps of any of the method embodiments described above by means of the computer program. According to the application, the current interface data of the dynamic page to be tested is monitored in real time, under the condition that the current interface data is different from the historical interface data, the page content of the dynamic page to be tested and the execution logic and verification logic associated with the interface update content in the test case are automatically updated according to the interface update content of the current interface data relative to the historical