Image noise reduction method and device for assisting automatic test
By partitioning and independent partitioning of multiple screenshots of the test page, the problems of noise interference and detailed information loss in automated tests are solved, and the accuracy and efficiency of the test are improved.
Patent Information
- Application Number
- CN202510452193.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-08-12
AI Technical Summary
In automated testing, when the prior art performs picture assertion, the noise reduction processing of benchmark page screenshots and test page screenshots can easily lead to noise interference, affecting accuracy, or the noise reduction processing can lead to loss of detailed information, making it difficult to improve the accuracy of picture assertions.
By collecting multiple screenshot image data of the page to be tested, dividing the page into multiple partitions according to the page structure data, identifying the changed pixel points, and denoising the independent partitions, obtaining the noise-reducing image data for automated testing.
Improves the accuracy and efficiency of page automation testing, and is suitable for testing and optimization scenarios of various dynamic web pages and applications.
Smart Images

Figure CN120471791A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of image processing technology, and in particular, to an image denoising method and apparatus for assisting automated testing. Background Art
[0002] Image assertions are a crucial verification method in automated testing scenarios. They are primarily used to verify that the functionality of the page displayed to the user meets expectations. For example, they can verify that the layout, fonts, colors, buttons, text boxes, and other elements of the page displayed to the user meet expectations. Another example is verifying that the page displayed to the user is fully loaded.
[0003] Typically, when using image assertions to test the front-end page displayed by the device under test, the tester can use the front-end automated testing platform to generate an automated test case for the front-end page and a functional test script corresponding to the automated test case. The device under test can then be tested using the functional test script corresponding to the automated test case, obtaining a screenshot of the front-end page displayed by the device under test after the first run of the script corresponding to the automated test case, which serves as the baseline page screenshot. Furthermore, in subsequent automated test runs, a screenshot of the front-end page displayed by the device under test after the script corresponding to the automated test case is run again can be obtained as the test page screenshot. Furthermore, an image CV algorithm can be used to extract page features from the baseline page screenshot and page features from the test page screenshot, respectively. These features are then compared to determine whether there are significant image regions that are inconsistent between the test page screenshot and the baseline page screenshot. Ultimately, based on the comparison results, it can be determined whether the page functionality of the front-end page tested by the automated test case is abnormal.
[0004] However, when comparing the baseline and test page screenshots, if noise reduction is not performed on them, the accuracy of the image assertion may be reduced due to the presence of a large amount of noise. If noise reduction is performed on the baseline and test page screenshots, details or edge information may be lost, further reducing the accuracy of the image assertion.
[0005] Therefore, how to improve the accuracy of automated testing using image assertion methods is an urgent problem to be solved. Summary of the Invention
[0006] In view of this, one or more embodiments of this specification provide the following technical solutions:
[0007] According to a first aspect of one or more embodiments of this specification, a method for image denoising for assisting automated testing is proposed, comprising:
[0008] Collect multiple screenshot image data of the page to be tested as target image data;
[0009] Comparing the target image data to determine the changed pixel points included in the page to be tested; the changed pixel points have different corresponding pixel values in at least two target image data;
[0010] selecting an independent variable partition from each partition according to the position distribution of the changed pixel points in each partition; each partition is obtained by dividing the page to be tested according to the page structure data of the page to be tested; and the image data corresponding to each independent variable partition in each target image data is not fixed;
[0011] Noise reduction processing is performed on image data corresponding to the independent variable partition in the target image data to obtain noise-reduced image data for use in automated testing.
[0012] According to a second aspect of one or more embodiments of this specification, an image denoising device for assisting automated testing is provided, comprising:
[0013] The acquisition module is used to acquire multiple screenshot image data of the page to be tested as target image data;
[0014] a comparison module, configured to compare the target image data to determine changed pixels contained in the page to be tested; the changed pixels have different corresponding pixel values in at least two target image data;
[0015] a selection module configured to select an independent variable partition from each partition based on the position distribution of the changed pixel points in each partition; each partition is obtained by dividing the page to be tested according to the page structure data of the page to be tested; and the image data corresponding to the independent variable partition in each target image data is not fixed;
[0016] The processing module is used to perform noise reduction processing on the image data corresponding to the independent variable partition in the target image data to obtain noise-reduced image data for use in automated testing.
[0017] According to a third aspect of one or more embodiments of this specification, an electronic device is proposed, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor implements the steps of the image denoising method for assisting automated testing as described above by running the executable instructions.
[0018] According to a fourth aspect of one or more embodiments of this specification, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the steps of the image denoising method for assisting automated testing as described above are implemented.
[0019] According to a fifth aspect of one or more embodiments of this specification, a computer program product is proposed, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned image denoising method for assisting automated testing.
[0020] It can be seen from the above embodiments that this specification collects multiple screenshot image data of the page to be tested as each target image data, and compares the collected target image data to determine the changed pixel points contained in the page to be tested, where the changed pixel points have different corresponding pixel values in at least two target image data, and then selects an independent variable partition from each partition based on the position distribution of the changed pixel points in each partition, wherein each partition is obtained by dividing the page to be tested according to the page structure data of the page to be tested, and the image data corresponding to the independent variable partition in each target image data is not fixed, and finally, the image data corresponding to the independent variable partition in the target image data is denoised to obtain the denoised image data for use in automated testing.
[0021] In this method, multiple screenshot image data of the same page at different time points or states can be obtained, and then the multiple screenshot image data can be compared and analyzed to identify the changed pixels. By determining the position distribution of each changed pixel in each partition obtained by pre-dividing the page according to the results of the page structure data analysis, the independent variable partition in each partition is determined, and the corresponding pixels of the independent variable partition in the screenshot image data can be removed to obtain the de-noised screenshot image data. Automated testing can then be performed based on the de-noised screenshot image data to improve the accuracy of page automated testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 This is a flowchart of an image noise reduction method for assisting automated testing provided by an exemplary embodiment.
[0023] Figure 2 This is a schematic diagram of the image assertion process provided in this manual.
[0024] Figure 3 FIG. 1 is a schematic diagram of masked candidate image data provided in an exemplary embodiment.
[0025] Figure 4 FIG. 1 is a schematic diagram of partitions included in a page to be tested provided in an exemplary embodiment.
[0026] Figure 5 This is a schematic diagram of changing pixels provided in this manual.
[0027] Figure 6 It is a structural diagram of a device provided by an exemplary embodiment.
[0028] Figure 7 A block diagram of an image noise reduction device for assisting automated testing provided by an exemplary embodiment. DETAILED DESCRIPTION
[0029] To make the objectives, technical solutions, and advantages of this specification more clear, the following will clearly and completely describe the technical solutions of this specification in conjunction with the specific embodiments of this specification and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this specification.
[0030] 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 this manual 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 relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0031] Typically, when performing image assertions in automated testing scenarios, it's necessary to perform feature analysis on the page image based on computer vision (CV) algorithms (such as edge detection, feature extraction, and template matching), and manually set an interception threshold to filter out noise. For example, algorithms such as SIFT and HOG are used to extract key image features, combined with binarization or filtering to reduce noise interference. Ultimately, the consistency between the baseline and test page screenshots is determined by comparing feature similarity against a preset threshold.
[0032] However, the following problems often arise during the noise filtering process: 1. It can easily lead to blurred image edges or loss of detail information, especially for small targets or areas with complex textures, which reduces the detection accuracy. 2. Threshold setting is highly dependent on manual experience and requires frequent adjustments to adapt to different scenarios. It is prone to misjudgment or missed detection due to environmental changes (such as lighting and resolution differences), and it is difficult to cover dynamic noise patterns. 3. The distribution of noise pixels needs to be manually reviewed and the threshold needs to be corrected regularly, which is inefficient and subject to subjective bias, making it difficult to meet the needs of automated detection.
[0033] Based on this, this specification provides an image denoising method for assisting automated testing. The technical solutions provided by each embodiment of this specification are described in detail below with reference to the accompanying drawings.
[0034] Figure 1 This is a flowchart of an image noise reduction method for assisting automated testing provided by an exemplary embodiment, including:
[0035] S100: Collect multiple screenshot image data of the page to be tested as target image data. And,
[0036] In this specification, when testing a front-end page displayed by a device under test, the service platform can use the front-end page to be tested as the page under test. Furthermore, the front-end automated testing platform can generate automated test cases for the page under test and generate functional test scripts corresponding to the automated test cases. The page under test displayed by the device under test can then be tested using the functional test scripts corresponding to the automated test cases.
[0037] Prior to this, in order to improve the accuracy of automated testing using the image assertion method, the business platform also needed to identify the independent variable partitions contained in the page to be tested, so as to eliminate the influence of the independent variable partitions during the image assertion process and thus ensure the accuracy of the image assertion results. Figure 2 shown.
[0038] Figure 2 This is a schematic diagram of the image assertion process provided in this manual.
[0039] Combine Figure 2 As can be seen, the business platform can use the captured screenshots of the page to be tested as target image data. Furthermore, the page to be tested can be divided into partitions based on its page structure data. This allows for analysis based on the target image data and the partitions contained within the page to determine the independent variable partitions contained within the page to be tested. Furthermore, during the image assertion process, image noise reduction can be performed on the image data corresponding to the independent variable partitions contained within the target image data.
[0040] The target image data mentioned above may be a plurality of screenshot image data of the page to be tested displayed by the device to be tested at different times, collected by the service platform when the device to be tested is in a static state.
[0041] In the above content, different sections of the page under test contain different page components. Page components here refer to modules with specific functions or visual expressions contained in the page under test, such as navigation bars, sidebars, carousels, forms, footers, buttons, text input boxes, etc.
[0042] It should be noted that, in actual application scenarios, the target image data acquired by the business platform may contain sensitive information and image data that may affect the result of determining the independent variable partition.
[0043] Therefore, in order to improve the accuracy of automated testing, the business platform can also use the collected multiple screenshot image data of the page to be tested as alternative image data, and then pre-process each alternative image data to extract the data to be shielded contained in the alternative image data, and obtain the target image data based on the data to be shielded contained in each alternative image data.
[0044] Specifically, the service platform can perform image recognition on each candidate image data to extract the text data contained in the candidate image data. The service platform can then detect the text data contained in the candidate image data to determine the text data to be blocked in each text data. The text data to be blocked here contains at least some sensitive information, which can include personal privacy information of the user, unauthorized image data, etc.
[0045] Furthermore, the business platform can determine the area where the above-mentioned text data to be shielded is located in the alternative image data as the text area to be shielded, and can use all the pixels contained in the text area to be shielded as the pixels corresponding to the text data to be shielded, and then can adjust the pixel values of the pixels corresponding to the above-mentioned text data to be shielded in the alternative image data to specified values to obtain the masked alternative image data as the target image data, specifically as follows: Figure 3 shown.
[0046] Figure 3 FIG. 1 is a schematic diagram of masked candidate image data provided in an exemplary embodiment.
[0047] Combine Figure 3 It can be seen that when the business platform determines that there is text data to be shielded in the text data included in the alternative image data, it can mask the entire area where the text data to be shielded is located in the alternative image data, thereby obtaining the masked alternative image data.
[0048] In addition, the business platform can also perform image recognition on each candidate image data to determine whether the candidate image data contains image data to be blocked. The image data to be blocked here can include screenshot image data corresponding to the overlay display window displayed on the page to be tested.
[0049] When the business platform determines that the alternative image data contains image data to be shielded based on the image recognition result of the alternative image data, it can generate a control instruction based on the image data to be shielded to control the page to be tested to close the overlay display window and re-acquire the screenshot image data of the page to be tested after closing the overlay display window as the target image data.
[0050] It is worth noting that, in the above content, the business platform divides the page to be tested into partitions according to the page structure data of the page to be tested. The business platform can parse the page structure data of the page to be tested to construct a page structure tree corresponding to the page to be tested.
[0051] The page structure data may be data describing the various page components included in the page to be tested, the hierarchical relationships between the various page components, and the types and properties of the various page components. The page structure data may be data in the HyperText Markup Language (HTML) format.
[0052] There are many ways for the business platform to obtain the page structure data of the page to be tested, for example, obtaining the page structure data of the page to be tested through an automated testing tool (such as Selenium, etc.).
[0053] Another example: obtaining the page structure data of the page to be tested through the browser developer tools.
[0054] In the page structure tree corresponding to the page to be tested, each node is used to represent each page component that constitutes the page to be tested. For any two nodes, if there is a nested relationship between the page components represented by the two nodes, the two nodes can be connected by an edge.
[0055] It should be noted that the business platform can parse the page structure data of the page to be tested to construct a page structure tree corresponding to the page to be tested by using a recursive algorithm to traverse each tag element in the page structure data corresponding to the page to be tested, and for each tag element, determine the page component corresponding to the tag element based on the tag data contained in the tag element. The page structure tree is constructed based on the hierarchical relationship between each tag element and other tag elements, as well as the page component corresponding to each tag element.
[0056] The above-mentioned tag data may refer to data such as: the tag name of the tag element, the attribute data of the tag element, the text data contained in the tag element, the sub-node list contained in the tag element, and the like.
[0057] Furthermore, the business platform can determine the nesting relationship between each page component based on the page structure tree, and then divide the page to be tested into partitions based on the nesting relationship between each page component and the attribute information of each page component (the attribute information here is used to reflect at least one of the functional module to which the page component belongs, the location area to which the page component belongs, and the interaction mode of the page component). Figure 4 shown.
[0058] Figure 4 FIG. 1 is a schematic diagram of partitions included in a page to be tested provided in an exemplary embodiment.
[0059] Combine Figure 4 It can be seen that the business platform can determine the location area to which each page component belongs based on the attribute information of each page component, and then the area where each page component is located can be separately used as a partition included in the page to be tested.
[0060] Of course, the business platform can also determine the functional module to which each page component belongs based on the attribute information of each page component, and then use the area where each page component belonging to the same functional module is located as a partition included in the page to be tested.
[0061] For example, the business platform can use the area containing all navigation button components in the navigation bar as a partition in the page to be tested.
[0062] For another example, the business platform may include all areas containing media components for displaying images in the content area as a partition included in the page to be tested.
[0063] In addition, the business platform can also determine the interaction mode of each page component based on the attribute information of each page component, and then the area where components with similar interactive behaviors are located can be used as a partition included in the page to be tested.
[0064] For example, the business platform can use the area where each text input box component contained in the form area is located as a partition contained in the page to be tested.
[0065] For another example, the business platform may use the area where each button component in the button area is located as a partition included in the page to be tested.
[0066] In this specification, the execution entity for implementing the image noise reduction method for assisting automated testing may refer to a designated device such as a server set up in a business platform, or may refer to a terminal device such as a desktop computer or a laptop computer. For the sake of ease of description, the image noise reduction method for assisting automated testing provided in this specification is described below using the server as the execution entity as an example.
[0067] S104: Compare the target image data to determine the changed pixel points included in the page to be tested; the changed pixel points have different corresponding pixel values in at least two target image data.
[0068] S106: Selecting an independent changing partition from the partitions according to the position distribution of the changed pixel points in the partitions.
[0069] In this specification, after obtaining each target image data, the server can compare each target image data to determine the changed pixel points contained in each target image data. Here, the changed pixel points have different corresponding pixel values in at least two target image data, specifically, Figure 5 shown.
[0070] Figure 5 This is a schematic diagram of changing pixels provided in this manual.
[0071] Combine Figure 5 It can be seen that the server obtains each target image data (such as Figure 5 After that, any target image data can be selected from each target image data, and for each pixel point in the selected target image data, the reference pixel point corresponding to the pixel point can be determined from other target image data. The position of the reference pixel point corresponding to the pixel point in the other target image data is the same as the position of the pixel point in the selected target image data. Then, based on the difference between the pixel value of the pixel point and the pixel value of each reference pixel point corresponding to the pixel point, it can be determined whether the pixel point is a changed pixel point. Figure 5 The area shown in FIG. 1 is used to display the token value and the area shown in FIG. 2 is used to display the token value and the area shown in FIG. 3 is used to display the token value and the area shown in FIG. 4 is used to display the token value and the area shown in FIG. 5 is used to display the token value and the area shown in FIG. 6 is used to display the token value and the area shown in FIG. 7 is used to display the token value and the area shown in FIG. 8 is used to display the token value
[0072] Among them, the server compares each target image data and determines that there may be multiple types of changed pixel points contained in each target image data. For example, the server can also select any target image data from each target image data, and for each other target image data, it can further determine the differential image between the selected target image data and the other target image data, binarize the differential image to obtain a binary differential image, and determine the changed pixel points contained in the selected target image data based on the binarized differential image.
[0073] In the above content, the server may also sequentially use each target image data as the selected target image data.
[0074] Furthermore, after determining the changed pixels contained in each target image data and the partitions corresponding to the page to be tested, the server can select the independent variable partition from each partition according to the position distribution of the changed pixels contained in each target image data in each partition. The image data corresponding to the independent variable partition in each target image data is not fixed, such as Figure 5 The token value displayed in the area used to display the token value at different times may be different, so Figure 5 The area used to display token values is the independent variable partition.
[0075] In actual application scenarios, to improve the accuracy of the determined independent variable partitions, the server may also select partitions from each partition based on the positional distribution of the changed pixels contained in each target image data within each partition as candidate independent variable partitions. Each candidate independent variable partition and each target image data may then be input into a pre-set detection model. The detection model then performs intent analysis on each candidate independent variable partition based on the image data corresponding to each candidate independent variable partition in each target image data, thereby determining the independent variable partition from among the candidate independent variable partitions.
[0076] In addition, the server can also input each candidate independent variable partition and each target image data into a preset detection model, so as to perform intent analysis on each candidate independent variable partition according to the image data corresponding to each candidate independent variable partition in each target image data through the detection model, so as to determine the independent variable partition from each candidate independent variable partition and determine the independent variable type to which each independent variable partition belongs.
[0077] The uncertainty of the changes of independent variable partitions of different independent variable types is different. The server can select different image processing strategies for the independent variable partitions of different independent variable types to perform noise reduction processing to obtain noise-reduced image data.
[0078] S108: performing noise reduction processing on the image data corresponding to the independent variable partition in the target image data to obtain noise-reduced image data for use in automated testing.
[0079] In this specification, after determining each variable partition, the server can perform noise reduction processing on the target image data based on the variable partition to obtain noise-reduced image data for use in automated testing. Of course, the server can also store the variable partition in a database so that when performing automated testing on the page to be tested again in a subsequent automated test, the server can continue to perform noise reduction processing on the captured screenshot image data of the page to be tested based on the variable partition contained in the page to be tested stored in the database for use in automated testing.
[0080] Specifically, there may be three independent variation types corresponding to the independent variation partitions. The following describes in detail the process of performing noise reduction processing on the target image data according to the independent variation partitions of the three independent variation types.
[0081] The first type of independent variation can be completely random. The content of the area belonging to this type of independent variation changes completely randomly, such as the partition where the carousel image is located, the partition where the dynamically generated advertising image is located, etc.
[0082] In this case, if the server determines that the independent variation type of the independent variation partition is completely random, it can select the first type of image processing strategy from the preset image processing strategies as the image processing strategy that matches the independent variation partition. Furthermore, the image data corresponding to the independent variation partition in the target image data can be filtered out according to the first type of image processing strategy to obtain noise-reduced image data.
[0083] The second type of independent variation can be partially predictable. The content of the area belonging to this type of independent variation will change, but the way of change has a certain pattern or range. For example, the partition where the random verification code is located, the partition where the news headline is located, the partition where the date and time are located, etc. The text content in these partitions will be continuously updated, but the font, font size, format and position of the text content are usually unchanged.
[0084] At this time, when the server determines that the independent variable type to which the independent variable partition belongs is a partially predictable independent variable, the second type of image processing strategy among the preset image processing strategies can be used as the selected image processing strategy that matches the independent variable partition, and then the image data corresponding to the independent variable partition in the target image data can be blurred according to the second type of image processing strategy to obtain the denoised image data.
[0085] The third type of independent variable can be relatively stable. The content of the area belonging to this type of independent variable will undergo slight changes in details, such as the section where the footer is located, the section where the form is located, etc. The position and style of the copyright information, links, input boxes and placeholders contained in these sections are usually fixed, but there may be minor adjustments in details.
[0086] When the server determines that the independent variable partition belongs to a relatively stable independent variable type, it selects the third type of image processing strategy from among the preset image processing strategies as the image processing strategy that matches the independent variable partition. The server then determines a trustworthy region from the independent variable partition based on the third type of image processing strategy, and performs noise reduction processing on the image data corresponding to the independent variable partition in the target image data based on the trustworthy region, thereby obtaining noise-reduced image data.
[0087] In the above description, the difference between the image data corresponding to the credible region in different target image data is less than a preset threshold. The difference between the image data corresponding to the credible region in different target image data can refer to pixel value difference, color histogram difference, local feature point difference, etc.
[0088] As can be seen from the above content, the server can obtain multiple screenshot image data of the same page at different time points or states, and then divide the page into multiple partitions by parsing the page structure data of the page. Then, the multiple screenshot image data can be compared and analyzed to identify the changed pixels. By determining the position distribution of each changed pixel in each partition and judging the independent variable partition in each partition, the pixel points corresponding to the independent variable partition in the screenshot image data can be removed to obtain the denoised screenshot image data, and then automated testing can be performed based on the denoised screenshot image data to improve the efficiency and accuracy of page automated testing and visual comparison, which is suitable for testing and optimization scenarios of various dynamic web pages and applications.
[0089] Figure 6 This is a schematic structural diagram of a device provided by an exemplary embodiment. Figure 6 At the hardware level, the device includes a processor 602, an internal bus 604, a network interface 606, a memory 608, and a non-volatile memory 610. Of course, it may also include hardware required for other functions. One or more embodiments of this specification can be implemented based on software, such as the processor 602 reading the corresponding computer program from the non-volatile memory 610 into the memory 608 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0090] Please refer to Figure 7 , the image noise reduction device for assisting automated testing can be applied to Figure 7 The device shown in the figure is used to implement the technical solution of this specification. The image noise reduction device for assisting automated testing may include:
[0091] The acquisition module 701 is used to acquire multiple screenshot image data of the page to be tested as target image data;
[0092] The comparison module 702 is configured to compare the target image data to determine the changed pixel points included in the page to be tested; the changed pixel points have different corresponding pixel values in at least two target image data;
[0093] A selection module 703 is configured to select an independent variable partition from each partition based on the position distribution of the changed pixel points in each partition; each partition is obtained by dividing the page to be tested according to the page structure data of the page to be tested; and the image data corresponding to the independent variable partition in each target image data is not fixed;
[0094] The processing module 704 is configured to perform noise reduction processing on the image data corresponding to the independent variable partition in the target image data to obtain noise-reduced image data for use in automated testing.
[0095] Optionally, the acquisition module 701 is specifically used to acquire multiple screenshot image data of the page to be tested as various alternative image data; for each alternative image data, pre-process the alternative image data to extract the data to be shielded contained in the alternative image data; and obtain each target image data based on the data to be shielded contained in each alternative image data.
[0096] Optionally, the data to be shielded includes: text data to be shielded, the text data to be shielded containing at least part of sensitive information;
[0097] The acquisition module 701 is specifically configured to, for each candidate image data, adjust the pixel value of the pixel corresponding to the text data to be shielded to a specified value if the data to be shielded contained in the candidate image data is the text data to be shielded, so as to obtain the target image data.
[0098] Optionally, the data to be shielded includes: image data to be shielded, the image data to be shielded includes screenshot image data corresponding to the superimposed display window displayed in the page to be tested;
[0099] The acquisition module 701 is specifically used to, for each alternative image data, if the data to be shielded contained in the alternative image data is the image data to be shielded, generate a control instruction based on the image data to be shielded to control the page to be tested to close the overlay display window and re-acquire the screenshot image data of the page to be tested as the target image data.
[0100] Optionally, the apparatus further includes: a division module 705;
[0101] The partitioning module 705 is specifically used to parse the page structure data of the page to be tested to construct a page structure tree corresponding to the page to be tested; in the page structure tree, each node is used to represent each page component that constitutes the page to be tested; based on the page structure tree, the nesting relationship between each page component is determined; based on the nesting relationship and the attribute information of each page component, the page to be tested is divided into partitions; the attribute information is used to reflect at least one of the functional module to which the page component belongs, the location area to which the page component belongs, and the interaction mode of the page component.
[0102] Optionally, the selection module 703 is specifically used to select each candidate independent variable partition from the each partition according to the position distribution of the changed pixel points in the each partition; input the each candidate independent variable partition and the each target image data into a preset detection model, so as to determine the independent variable partition from the each candidate independent variable partition through the detection model.
[0103] Optionally, the selection module 703 is specifically used to input the candidate independent variable partitions and the target image data into a preset detection model, so as to perform intent analysis on each candidate independent variable partition through the detection model, so as to determine the independent variable partition from the candidate independent variable partitions, and determine the independent variable type to which the independent variable partition belongs; wherein, the uncertainty of the change of independent variable partitions of different independent variable types is different.
[0104] Optionally, the processing module 704 is specifically used to select an image processing strategy that matches the independent variable partition from the preset image processing strategies according to the independent variable type to which the independent variable partition belongs, and perform noise reduction processing on the image data corresponding to the independent variable partition in the target image data to obtain noise-reduced image data.
[0105] Optionally, the processing module 704 is specifically used to, when it is determined that the independent variation type of the independent variation partition is completely random, use the first type of image processing strategy among the preset image processing strategies as the image processing strategy selected to match the independent variation partition; the first type of image processing strategy is used to filter out the image data corresponding to the independent variation partition in the target image data to obtain denoised image data.
[0106] Optionally, the processing module 704 is specifically used to, when it is determined that the independent variable type to which the independent variable partition belongs is a partially predictable independent variable, use the second type of image processing strategy among the preset image processing strategies as the selected image processing strategy that matches the independent variable partition; the second type of image processing strategy is used to blur the image data corresponding to the independent variable partition in the target image data to obtain denoised image data.
[0107] Optionally, the processing module 704 is specifically used to, when it is determined that the independent variable type to which the independent variable partition belongs is a relatively stable independent variable, use the third type of image processing strategy among the preset image processing strategies as the image processing strategy selected to match the independent variable partition; the third type of image processing strategy is used to determine a credible area from the independent variable partition, and perform denoising on the image data corresponding to the independent variable partition in the target image data according to the credible area to obtain denoised image data; the difference between the image data corresponding to the credible area in different target image data is less than a preset threshold.
[0108] Based on the same concept as the above method, this specification also provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor implements the steps of the method described in any of the above embodiments by running the executable instructions.
[0109] Based on the same concept as the above method, this specification also provides a computer-readable storage medium on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method described in any of the above embodiments are implemented.
[0110] Based on the same concept as the above method, this specification also provides a computer program product, including a computer program / instruction, which implements the steps of the method described in any of the above embodiments when executed by a processor.
Claims
1. An image denoising method for assisting automated testing, comprising: Collect multiple screenshot image data of the page to be tested as target image data; Comparing the target image data to determine the changed pixel points included in the page to be tested; the changed pixel points have different corresponding pixel values in at least two target image data; selecting an independent variable partition from each partition according to the position distribution of the changed pixel points in each partition; each partition is obtained by dividing the page to be tested according to the page structure data of the page to be tested; and the image data corresponding to each independent variable partition in each target image data is not fixed; Noise reduction processing is performed on image data corresponding to the independent variable partition in the target image data to obtain noise-reduced image data for use in automated testing.
2. The method according to claim 1, wherein collecting multiple screenshot image data of the page to be tested as each target image data specifically comprises: Collect multiple screenshot image data of the page to be tested as candidate image data; For each candidate image data, preprocessing the candidate image data to extract the data to be shielded contained in the candidate image data; Each target image data is obtained according to the to-be-shielded data contained in each candidate image data.
3. The method according to claim 2, wherein the data to be shielded comprises: Text data to be shielded, wherein the text data to be shielded contains at least part of sensitive information; Obtaining each target image data according to the to-be-shielded data contained in each candidate image data specifically includes: For each candidate image data, if the data to be shielded contained in the candidate image data is the text data to be shielded, the pixel value of the pixel corresponding to the text data to be shielded is adjusted to a specified value to obtain the target image data.
4. The method according to claim 2, wherein the data to be shielded comprises: Image data to be shielded, the image data to be shielded including screenshot image data corresponding to the superimposed display window displayed on the page to be tested; Obtaining each target image data according to the to-be-shielded data contained in each candidate image data specifically includes: For each alternative image data, if the data to be shielded contained in the alternative image data is the image data to be shielded, a control instruction is generated based on the image data to be shielded to control the page to be tested to close the overlay display window and re-acquire the screenshot image data of the page to be tested as the target image data.
5. The method of claim 1, further comprising: Dividing the page to be tested according to its page structure data specifically includes: Parsing the page structure data of the page to be tested to construct a page structure tree corresponding to the page to be tested; in the page structure tree, each node is used to represent each page component constituting the page to be tested; Determine the nesting relationship between the components of each page according to the page structure tree; The page to be tested is divided into partitions according to the nested relationship and the attribute information of each page component; the attribute information is used to reflect at least one of the functional module to which the page component belongs, the location area to which the page component belongs, and the interaction mode of the page component.
6. The method according to claim 1, wherein the step of selecting the self-changing partition from the partitions based on the position distribution of the changed pixels in the partitions comprises: Selecting candidate independent-change partitions from the partitions according to the position distribution of the changed pixel points in the partitions; The candidate independent-variant partitions and the target image data are input into a preset detection model, so as to determine the independent-variant partition from the candidate independent-variant partitions through the detection model.
7. The method according to claim 6, wherein the candidate independent variation partitions and the target image data are input into a preset detection model to determine the independent variation partition from the candidate independent variation partitions using the detection model, specifically comprising: The candidate independent variable partitions and the target image data are input into a preset detection model to perform intent analysis on each candidate independent variable partition through the detection model, so as to determine the independent variable partition from the candidate independent variable partitions and determine the independent variable type to which the independent variable partition belongs; wherein the uncertainty of the independent variable partitions of different independent variable types when changing is different.
8. The method according to claim 7, wherein the denoising process is performed on the image data corresponding to the independent variable partition in the target image data to obtain the denoised image data, specifically comprising: According to the independent variable type to which the independent variable partition belongs, an image processing strategy matching the independent variable partition is selected from various preset image processing strategies, and noise reduction processing is performed on the image data corresponding to the independent variable partition in the target image data to obtain noise-reduced image data.
9. The method according to claim 8, wherein, based on the independent variable type of the independent variable partition, an image processing strategy matching the independent variable partition is selected from preset image processing strategies, specifically comprising: When it is determined that the independent variation type of the independent variation partition is completely random, the first type of image processing strategy among the preset image processing strategies is selected as the image processing strategy that matches the independent variation partition; the first type of image processing strategy is used to filter out the image data corresponding to the independent variation partition in the target image data to obtain denoised image data.
10. The method according to claim 8, wherein, according to the independent variable type of the independent variable partition, an image processing strategy matching the independent variable partition is selected from preset image processing strategies, specifically comprising: When it is determined that the independent variable type to which the independent variable partition belongs is a partially predictable independent variable, the second type of image processing strategy among the preset image processing strategies is selected as the image processing strategy that matches the independent variable partition; the second type of image processing strategy is used to blur the image data corresponding to the independent variable partition in the target image data to obtain denoised image data.
11. The method according to claim 8, wherein, according to the independent variable type to which the independent variable partition belongs, an image processing strategy matching the independent variable partition is selected from preset image processing strategies, specifically comprising: When it is determined that the independent variation type of the independent variation partition is relatively stable, a third type of image processing strategy among the preset image processing strategies is selected as the image processing strategy that matches the independent variation partition; the third type of image processing strategy is used to determine a credible region from the independent variation partition, and perform noise reduction processing on image data corresponding to the independent variation partition in the target image data based on the credible region to obtain noise-reduced image data; The difference between the image data corresponding to the credible region in different target image data is smaller than a preset threshold.
12. An image noise reduction device for assisting automated testing, comprising: The acquisition module is used to acquire multiple screenshot image data of the page to be tested as target image data; a comparison module, configured to compare the target image data to determine changed pixels contained in the page to be tested; the changed pixels have different corresponding pixel values in at least two target image data; a selection module configured to select an independent variable partition from each partition based on the position distribution of the changed pixel points in each partition; each partition is obtained by dividing the page to be tested according to the page structure data of the page to be tested; and the image data corresponding to the independent variable partition in each target image data is not fixed; The processing module is used to perform noise reduction processing on the image data corresponding to the independent variable partition in the target image data to obtain noise-reduced image data for use in automated testing.
13. An electronic device comprising: processor; A memory for storing processor-executable instructions; wherein the processor implements the steps of the method according to any one of claims 1 to 11 by executing the executable instructions.
14. A computer-readable storage medium having computer instructions stored thereon, wherein when the instructions are executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
15. A computer program product comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.