A UI page testing method, device, equipment and readable storage medium
Through intelligent UI page testing methods, combined with deep-first traversal and image comparison technology, automated testing of UI pages of enterprise-level web applications has been solved, and the problems of low efficiency of traditional manual testing and high maintenance costs of automated testing have been achieved, and efficient and accurate UI page inspection and problem discovery have been achieved.
Patent Information
- Application Number
- CN202111483181.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-07
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2041-12-07
AI Technical Summary
Traditional manual UI page testing is inefficient, with large errors in the naked eye, and enterprise-level web application interface layout testing takes a long time and has a small range. The existing technology UI interface automation testing only supports static detection, requires manual writing, and has high maintenance costs.
Provide a UI page testing method, which can obtain all UI pages of the system, determine the test mode based on the function points and the number of pages, and use the depth-first traversal algorithm and custom filtering rules for intelligent exploration, combine dom analysis and image comparison, automate the test and generate differential comparison diagrams, support static and dynamic testing modes, and reduce manual intervention.
It realizes efficient and accurate UI page testing, quickly discovers design problems, improves inspection efficiency and accuracy, reduces labor costs, supports flexible testing methods, and unifies front-end development specifications.
Smart Images

Figure CN114218078B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of testing technologies, and in particular, to a UI page testing method, device, equipment and readable storage medium. Background Art
[0002] Traditional manual testing of Web interfaces is inefficient, has large visual errors, and is prone to missed testing. Especially for enterprise-level Web applications, the number of interface layout tests is huge, time-consuming, and the browser types and machine models are diverse and numerous. Therefore, it is no longer possible to rely solely on manual UI automation testing. At the same time, the existing UI interface automation testing only supports static UI detection, and can only fixedly test the layout and differences of a single page. This method also needs to be combined with functional automation testing to be used, and it also requires manpower to write scripts. It has high requirements for testers, high maintenance costs for scripts, and a small test scope. Summary of the Invention
[0003] The purpose of the present invention is to provide a UI page testing method, device, equipment and readable storage medium to improve the above problems.
[0004] To achieve the above purpose, the embodiments of the present application provide the following technical solutions:
[0005] On the one hand, the embodiments of the present application provide a UI page testing method, and the method includes:
[0006] Obtain all UI pages of the system to be tested;
[0007] Determine a test mode based on the function points and the number of UI pages of the system to be tested;
[0008] Test each of the UI pages according to the determined test mode to obtain a test result and a difference comparison chart corresponding to each UI page;
[0009] Integrate the test results corresponding to each UI page to obtain a test report, and collect the difference comparison charts corresponding to each UI page to obtain a difference comparison chart set;
[0010] Display the test report and the difference comparison chart set on a display interface to help testers find problems existing in the UI page design.
[0011] Optionally, the determining a test mode based on the function points and the number of UI pages of the system to be tested includes:
[0012] Obtain all UI pages of the system to be tested in the previous version;
[0013] Obtain the function point difference based on the function points of the tested system in the previous version and the function points of the tested system; obtain the UI page number difference based on the number of UI pages of the tested system in the previous version and the number of UI pages of the tested system.
[0014] Determine the static test mode or dynamic test mode according to the function point difference and the UI page number difference.
[0015] Optionally, the determining the static test mode or dynamic test mode according to the function point difference and the UI page number difference includes:
[0016] Obtain the function point difference threshold and the UI page number difference threshold;
[0017] Analyze the relationship between the function point difference and the function point difference threshold. If the function point difference is greater than the function point difference threshold, select the static test mode; otherwise, select the dynamic test mode.
[0018] Analyze the relationship between the UI page number difference and the UI page number difference threshold. If the UI page number difference is greater than the UI page number difference threshold, select the static test mode; otherwise, select the dynamic test mode.
[0019] Optionally, if the determined test mode is the static test mode, then testing each of the UI pages according to the determined test mode to obtain the test results and difference comparison charts corresponding to each of the UI pages includes:
[0020] Obtain the page scanning rule;
[0021] Scan each of the UI pages according to the page scanning rule and the depth-first traversal algorithm, and take screenshots of the scanned pages to obtain the page screenshots corresponding to each of the UI pages;
[0022] Obtain the test results and difference comparison charts corresponding to each of the UI pages based on the page screenshots corresponding to each of the UI pages.
[0023] Optionally, the obtaining the test results and difference comparison charts corresponding to each of the UI pages based on the page screenshots corresponding to each of the UI pages includes:
[0024] Analyze whether there is a design drawing corresponding to the UI page. If there is such a design drawing, compare the page screenshot corresponding to each UI page with the design drawing corresponding to the UI page to obtain the test result and the difference comparison diagram corresponding to each UI page. If there is no such design drawing, analyze whether there is a benchmark version drawing corresponding to the UI page. If there is such a benchmark version drawing, compare the page screenshot corresponding to each UI page with the benchmark version drawing corresponding to the UI page to obtain the test result and the difference comparison diagram corresponding to each UI page. If there is no such benchmark version drawing, save the UI page of the system under test as the benchmark version drawing.
[0025] Optionally, if the determined test mode is the dynamic test mode, then testing each UI page according to the determined test mode to obtain the test result and the difference comparison diagram corresponding to each UI page includes:
[0026] Obtain the UI pages that need to be tested among all the UI pages of the system under test;
[0027] Scan each UI page that needs to be tested, and take a screenshot of the scanned page to obtain the page screenshot corresponding to each UI page that needs to be tested;
[0028] Analyze whether there is a benchmark version drawing corresponding to the UI page that needs to be tested. If there is such a benchmark version drawing, compare the page screenshot corresponding to each UI page that needs to be tested with the benchmark version drawing to obtain the test result and the difference comparison diagram corresponding to each UI page that needs to be tested. If there is no such benchmark version drawing, save the UI page that needs to be tested as the benchmark version drawing.
[0029] In a second aspect, an embodiment of the present application provides a UI page testing device, and the device includes an acquisition module, a determination module, a testing module, an integration module, and a display module.
[0030] The acquisition module is used to acquire all UI pages of the system under test;
[0031] The determination module is used to determine the test mode based on the function points of the system under test and the number of UI pages;
[0032] The testing module is used to test each UI page according to the determined test mode to obtain the test result and the difference comparison diagram corresponding to each UI page;
[0033] The integration module is used to integrate the test results corresponding to each UI page to obtain a test report, and aggregate the difference comparison diagrams corresponding to each UI page to obtain a difference comparison diagram set;
[0034] The display module is used to display the test report and the difference comparison atlas on the display interface to help testers find problems existing in the UI page design.
[0035] Optionally, the determination module includes:
[0036] The first acquisition unit is used to acquire all UI pages of the system under test in the previous version;
[0037] The calculation unit is used to obtain the function point difference according to the function points of the system under test in the previous version and the function points of the system under test; obtain the UI page quantity difference according to the number of UI pages of the system under test in the previous version and the number of UI pages of the system under test;
[0038] The determination unit is used to determine the static test mode or the dynamic test mode according to the function point difference and the UI page quantity difference.
[0039] Optionally, the determination unit includes:
[0040] The acquisition subunit is used to acquire the function point difference threshold and the UI page quantity difference threshold;
[0041] The first analysis subunit is used to analyze the relationship between the function point difference and the function point difference threshold. If the function point difference is greater than the function point difference threshold, the static test mode is selected; otherwise, the dynamic test mode is selected;
[0042] The second analysis subunit is used to analyze the relationship between the UI page quantity difference and the UI page quantity difference threshold. If the UI page quantity difference is greater than the UI page quantity difference threshold, the static test mode is selected; otherwise, the dynamic test mode is selected.
[0043] Optionally, the test module includes:
[0044] The second acquisition unit is used to acquire the page scanning rule;
[0045] The first screenshot unit is used to scan each UI page according to the page scanning rule and the depth-first traversal algorithm, and take a screenshot of the scanned page to obtain the page screenshot corresponding to each UI page;
[0046] The comparison unit is used to obtain the test result and the difference comparison diagram corresponding to each UI page based on the page screenshot corresponding to each UI page.
[0047] Optionally, the comparison unit includes:
[0048] A third analysis subunit, configured to analyze whether there is a design drawing corresponding to the UI page. If there is such a design drawing, the page screenshot corresponding to each UI page is compared with the design drawing corresponding to the UI page to obtain the test result and the difference comparison diagram corresponding to each UI page. If there is no such design drawing, it analyzes whether there is a benchmark version drawing corresponding to the UI page. If there is such a benchmark version drawing, the page screenshot corresponding to each UI page is compared with the benchmark version drawing corresponding to the UI page to obtain the test result and the difference comparison diagram corresponding to each UI page. If there is no such benchmark version drawing, the UI page of the system under test is saved as the benchmark version drawing.
[0049] Optionally, the test module includes:
[0050] A third acquisition unit, configured to acquire the UI pages to be tested among all the UI pages of the system under test;
[0051] A second screenshot unit, configured to scan each UI page to be tested and take a screenshot of the scanned page to obtain the page screenshot corresponding to each UI page to be tested;
[0052] An analysis unit, configured to analyze whether there is a benchmark version drawing corresponding to the UI page to be tested. If there is such a benchmark version drawing, the page screenshot corresponding to each UI page to be tested is compared with the benchmark version drawing to obtain the test result and the difference comparison diagram corresponding to each UI page to be tested. If there is no such benchmark version drawing, the UI page to be tested is saved as the benchmark version drawing.
[0053] In a third aspect, an embodiment of the present application provides a UI page test device, which includes a memory and a processor. The memory is used to store a computer program; the processor is configured to implement the steps of the above UI page test method when executing the computer program.
[0054] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a computer program is stored, and the computer program implements the steps of the above UI page test method when executed by a processor.
[0055] The beneficial effects of the present invention are as follows:
[0056] 1. Through the depth-first traversal algorithm, the present invention customizes filtering rules to intelligently explore pages and take screenshots. The difference test is implemented by two methods: dom parsing and image comparison, which can accurately compare any differences and mark them. The test results are intelligently analyzed and classified, clearly testing problems such as inconsistent text, inconsistent background, misplaced positions, and garbled codes.
[0057] 2. On the one hand, the present invention can quickly assist the design team in verifying whether the system complies with the design specifications; on the other hand, it can also assist the testers in accurately finding the differences in version changes, facilitating the testers to conduct impact analysis; quickly assist in developing and positioning problems, improve development efficiency, and unify the front-end development specifications.
[0058] Other features and advantages of the present invention will be described in the following specification, and, in part, will become apparent from the specification, or can be understood by implementing the embodiments of the present invention. The objectives and other advantages of the present invention can be achieved and obtained through the structures specifically pointed out in the written specification, claims, and drawings. Brief Description of the Drawings
[0059] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present invention, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other relevant drawings can also be obtained based on these drawings.
[0060] Figure 1 It is a schematic flowchart of the UI page testing method described in the embodiments of the present invention;
[0061] Figure 2 It is a schematic structural diagram of the UI page testing device described in the embodiments of the present invention;
[0062] Figure 3 It is a schematic structural diagram of the UI page testing device described in the embodiments of the present invention. Detailed Description of the Embodiments
[0063] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of them. Usually, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed present invention, but only represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0064] It should be noted that similar reference numerals or letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of the present invention, terms such as "first" and "second" are only used for distinguishing descriptions and cannot be construed as indicating or implying relative importance.
[0065] Embodiment 1
[0066] As Figure 1 shown, this embodiment provides a UI page testing method, which includes steps S1, S2, S3, S4, and S5.
[0067] Step S1: Obtain all UI pages of the system to be tested;
[0068] Step S2: Determine the test mode based on the function points of the system to be tested and the number of UI pages;
[0069] Step S3: Test each of the UI pages according to the determined test mode to obtain the test results and difference comparison diagrams corresponding to each of the UI pages;
[0070] Step S4: Integrate the test results corresponding to each of the UI pages to obtain a test report, and collect the difference comparison diagrams corresponding to each of the UI pages to obtain a difference comparison diagram set;
[0071] Step S5: Display the test report and the difference comparison diagram set on a display interface to help testers find problems existing in the UI page design.
[0072] In this embodiment, all pages of a system can be automatically tested without manual intervention, and at the same time, it also supports UI testing for specified pages or local areas in a specific business process. High-precision page comparison is achieved through the integration of multiple algorithms, intelligent analysis of results, and quick discovery of problems such as garbled codes, inconsistent text, and layout misalignment;
[0073] At the same time, this embodiment improves the inspection efficiency and accuracy by automatically checking the front-end page changes and errors of the system to be tested, reduces manual maintenance, and saves labor costs;
[0074] At the same time, in this embodiment, the test results and the difference comparison diagram set are also displayed. By means of display, testers can obtain the test results and the difference comparison diagram set more quickly and intuitively, and thus solve the problems existing in the UI page design more timely; at the same time, in this embodiment, the test report and the difference comparison diagram set can also be sent to the email of relevant testers. In this way, testers can also find and solve problems faster.
[0075] In a specific implementation manner of the present disclosure, step S2 may further include step S21, step S22, and step S23.
[0076] Step S21: Obtain all UI pages of the system under test in the previous version.
[0077] Step S22: Obtain the function point difference based on the function points of the system under test in the previous version and the function points of the system under test; obtain the UI page quantity difference based on the number of UI pages of the system under test in the previous version and the number of UI pages of the system under test.
[0078] Step S23: Determine the static test mode or the dynamic test mode according to the function point difference and the UI page quantity difference.
[0079] In this embodiment, the static test mode or the dynamic test mode can also be manually selected. In this embodiment, determining the static test mode or the dynamic test mode through the function point difference or the UI page quantity difference can make the selection more objective, reduce the influence of human factors, and improve the accuracy of the test.
[0080] In a specific implementation manner of the present disclosure, step S23 may further include step S231, step S232, and step S233.
[0081] Step S231: Obtain the function point difference threshold and the UI page quantity difference threshold.
[0082] Step S232: Analyze the relationship between the function point difference and the function point difference threshold. If the function point difference is greater than the function point difference threshold, select the static test mode; otherwise, select the dynamic test mode.
[0083] Step S233: Analyze the relationship between the UI page quantity difference and the UI page quantity difference threshold. If the UI page quantity difference is greater than the UI page quantity difference threshold, select the static test mode; otherwise, select the dynamic test mode.
[0084] In this embodiment, the function point difference threshold and the UI page quantity difference threshold can be set differently according to the needs of the user. By this means, the applicability of this method can be enhanced.
[0085] In a specific implementation manner of the present disclosure, step S3 may further include step S31, step S32, and step S33.
[0086] Step S31: Obtain the page scanning rule.
[0087] Step S32: Scan each of the UI pages according to the page scanning rules and the depth-first traversal algorithm, and take screenshots of the scanned pages to obtain the page screenshots corresponding to each of the UI pages;
[0088] Step S33: Obtain the test results and difference comparison diagrams corresponding to each of the UI pages based on the page screenshots corresponding to each of the UI pages.
[0089] In this embodiment, through the depth-first traversal algorithm, custom filtering rules are used to intelligently explore the pages and take screenshots. The difference test is implemented in two ways: dom parsing and image comparison, which can accurately compare any differences and mark them. The test results are intelligently analyzed and classified to clearly test problems such as inconsistent text, inconsistent background, misplaced positions, and garbled codes.
[0090] In a specific implementation manner of the present disclosure, step S33 may further include step S331.
[0091] Step S331: Analyze whether there is a design diagram corresponding to the UI page. If there is such a design diagram, compare the page screenshot corresponding to each of the UI pages with the design diagram corresponding to the UI page to obtain the test results and difference comparison diagrams corresponding to each of the UI pages; if there is no such design diagram, analyze whether there is a reference version diagram corresponding to the UI page. If there is such a reference version diagram, compare the page screenshot corresponding to each of the UI pages with the reference version diagram corresponding to the UI page to obtain the test results and difference comparison diagrams corresponding to each of the UI pages; if there is no such reference version diagram, save the UI page of the system under test as the reference version diagram.
[0092] In this embodiment, by first analyzing whether there is a design diagram and then analyzing whether there is a reference version diagram, a more accurate comparison diagram can be selected, so as to accurately find the UI pages with problems in the current version and improve the accuracy of the test results and difference comparison diagrams.
[0093] In a specific implementation manner of the present disclosure, step S3 may further include step S34, step S35, and step S36.
[0094] Step S34: Obtain the UI pages that need to be tested among all the UI pages of the system under test;
[0095] Step S35: Scan each of the UI pages that need to be tested, and take screenshots of the scanned pages to obtain the page screenshots corresponding to each of the UI pages that need to be tested;
[0096] Step S36: Analyze whether there is a benchmark version diagram corresponding to the UI page to be tested. If there is such a benchmark version diagram, compare the page screenshot corresponding to each UI page to be tested with the benchmark version diagram to obtain the test result and the difference comparison diagram corresponding to each UI page to be tested. If there is no such benchmark version diagram, save the UI page to be tested as the benchmark version diagram.
[0097] In this embodiment, in the dynamic test mode, the pages to be tested can be selected. Through this dynamic test mode, a more flexible test method is provided. The tester can freely select the pages to be tested, and the test is more flexible and more user-friendly.
[0098] Embodiment 2
[0099] As Figure 2 shown, this embodiment provides a UI page testing device, which includes an acquisition module 701, a determination module 702, a test module 703, an integration module 704, and a display module 705.
[0100] The acquisition module 701 is used to acquire all UI pages of the system to be tested;
[0101] The determination module 702 is used to determine the test mode based on the function points of the system to be tested and the number of UI pages;
[0102] The test module 703 is used to test each UI page according to the determined test mode to obtain the test result and the difference comparison diagram corresponding to each UI page;
[0103] The integration module 704 is used to integrate the test results corresponding to each UI page to obtain a test report, and to collect the difference comparison diagrams corresponding to each UI page to obtain a difference comparison diagram set;
[0104] The display module 705 is used to display the test report and the difference comparison diagram set on the display interface to help testers find problems existing in the UI page design.
[0105] In this embodiment, all pages of a system can be automatically tested without manual intervention, and at the same time, it also supports UI testing for specified pages or local areas in a specific business process. High-precision page comparison is achieved through the integration of multiple algorithms, intelligent analysis of results, and quick discovery of problems such as garbled characters, inconsistent text, and layout misalignment;
[0106] At the same time, this embodiment improves the inspection efficiency and accuracy by automatically checking the changes and errors of the front-end pages of the system to be tested, reduces manual maintenance, and saves labor costs;
[0107] Meanwhile, in this embodiment, the test results and the difference comparison atlas are also displayed. By this display method, testers can obtain the test results and the difference comparison atlas more quickly and intuitively, and thus solve the problems existing in the UI page design more timely. Meanwhile, in this embodiment, the test report and the difference comparison atlas can also be sent to the email of relevant testers. By this method, testers can also find and solve problems faster.
[0108] In a specific embodiment of the present disclosure, the determining module 702 further includes a first obtaining unit 7021, a calculating unit 7022, and a determining unit 7023.
[0109] The first obtaining unit 7021 is configured to obtain all UI pages of the system under test in the previous version.
[0110] The calculating unit 7022 is configured to obtain a function point difference according to the function points of the system under test in the previous version and the function points of the system under test; obtain a UI page number difference according to the number of UI pages of the system under test in the previous version and the number of UI pages of the system under test.
[0111] The determining unit 7023 is configured to determine a static test mode or a dynamic test mode according to the function point difference and the UI page number difference.
[0112] In a specific embodiment of the present disclosure, the determining unit 7023 further includes an obtaining subunit 70231, a first analyzing subunit 70232, and a second analyzing subunit 70233.
[0113] The obtaining subunit 70231 is configured to obtain a function point difference threshold and a UI page number difference threshold.
[0114] The first analyzing subunit 70232 is configured to analyze the relationship between the function point difference and the function point difference threshold. If the function point difference is greater than the function point difference threshold, the static test mode is selected; otherwise, the dynamic test mode is selected.
[0115] The second analyzing subunit 70233 is configured to analyze the relationship between the UI page number difference and the UI page number difference threshold. If the UI page number difference is greater than the UI page number difference threshold, the static test mode is selected; otherwise, the dynamic test mode is selected.
[0116] In a specific embodiment of the present disclosure, the testing module 703 further includes a second obtaining unit 7031, a first screenshot unit 7032, and a comparison unit 7033.
[0117] The second acquisition unit 7031 is configured to acquire page scanning rules;
[0118] The first screenshot unit 7032 is configured to scan each of the UI pages according to the page scanning rules and a depth-first traversal algorithm, and take screenshots of the scanned pages to obtain page screenshots corresponding to each of the UI pages;
[0119] The comparison unit 7033 is configured to obtain a test result and a difference comparison diagram corresponding to each of the UI pages based on the page screenshots corresponding to each of the UI pages.
[0120] In a specific implementation manner of the present disclosure, the comparison unit 7033 further includes a third analysis subunit 70331.
[0121] The third analysis subunit 70331 is configured to analyze whether there is a design diagram corresponding to the UI page. If there is such a design diagram, the page screenshots corresponding to each of the UI pages are compared with the design diagram corresponding to the UI page to obtain a test result and a difference comparison diagram corresponding to each of the UI pages; if there is no such design diagram, it is analyzed whether there is a reference version diagram corresponding to the UI page. If there is such a reference version diagram, the page screenshots corresponding to each of the UI pages are compared with the reference version diagram corresponding to the UI page to obtain a test result and a difference comparison diagram corresponding to each of the UI pages; if there is no such reference version diagram, the UI page of the system under test is saved as a reference version diagram.
[0122] In a specific implementation manner of the present disclosure, the test module 703 further includes a third acquisition unit 7034, a second screenshot unit 7035, and an analysis unit 7036.
[0123] The third acquisition unit 7034 is configured to acquire the UI pages that need to be tested among all the UI pages of the system under test;
[0124] The second screenshot unit 7035 is configured to scan each of the UI pages that need to be tested, and take screenshots of the scanned pages to obtain page screenshots corresponding to each of the UI pages that need to be tested;
[0125] The analysis unit 7036 is configured to analyze whether there is a reference version diagram corresponding to the UI page that needs to be tested. If there is such a reference version diagram, the page screenshots corresponding to each of the UI pages that need to be tested are compared with the reference version diagram to obtain a test result and a difference comparison diagram corresponding to each of the UI pages that need to be tested; if there is no such reference version diagram, the UI page that needs to be tested is saved as a reference version diagram.
[0126] It should be noted that for the devices in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated here.
[0127] Embodiment 3
[0128] Corresponding to the above method embodiments, embodiments of the present disclosure also provide a UI page testing device. The UI page testing device described below can be correspondingly referred to the UI page testing method described above.
[0129] Figure 3 is a block diagram of a UI page testing device 800 shown according to an exemplary embodiment. As Figure 3 shown, the UI page testing device 800 may include: a processor 801, a memory 802. The UI page testing device 800 may further include one or more of a multimedia component 803, an input / output (I / O) interface 804, and a communication component 805.
[0130] Among them, the processor 801 is used to control the overall operation of the UI page testing device 800 to complete all or part of the steps in the above UI page testing method. The memory 802 is used to store various types of data to support the operation of the UI page testing device 800. These data may include, for example, instructions for any application or method operating on the UI page testing device 800, as well as application-related data, such as contact data, messages sent and received, pictures, audio, video, and so on. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disc. The multimedia component 803 may include a screen and an audio component. The screen can be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal can be further stored in the memory 802 or sent through the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, and the above other interface modules can be a keyboard, a mouse, buttons, etc. These buttons can be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the UI page testing device 800 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, or 4G, or a combination of one or more of them. Accordingly, the communication component 805 may include: a Wi-Fi module, a Bluetooth module, and an NFC module.
[0131] In an exemplary embodiment, the UI page testing device 800 can be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components, and is used to execute the above UI page testing method.
[0132] In another exemplary embodiment, a computer-readable storage medium including program instructions is further provided. When the program instructions are executed by a processor, the steps of the above UI page testing method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 802 including program instructions, and the above program instructions can be executed by the processor 801 of the UI page testing device 800 to complete the above UI page testing method.
[0133] Embodiment 4
[0134] Corresponding to the above method embodiments, the embodiments of the present disclosure further provide a readable storage medium. A readable storage medium described below can be correspondingly referred to with the UI page testing method described above.
[0135] A readable storage medium stores a computer program. When the computer program is executed by a processor, the steps of the UI page testing method in the above method embodiments are implemented.
[0136] The readable storage medium can specifically be various readable storage media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disc that can store program codes.
[0137] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A UI page testing method, characterized in that, it includes: Obtain all UI pages of the system under test; Determine the test mode based on the function points of the system under test and the number of UI pages; Test each of the UI pages according to the determined test mode to obtain the test results and difference comparison graphs corresponding to each of the UI pages; Integrate the test results corresponding to each of the UI pages to obtain a test report, and collect the difference comparison graphs corresponding to each of the UI pages to obtain a difference comparison graph set; Display the test report and the difference comparison graph set on a display interface to help testers find problems existing in the UI page design; The determining the test mode based on the function points of the system under test and the number of UI pages includes: Obtain all UI pages of the system under test in the previous version; Obtain the function point difference according to the function points of the system under test in the previous version and the function points of the system under test; obtain the UI page number difference according to the number of UI pages of the system under test in the previous version and the number of UI pages of the system under test; Determine a static test mode or a dynamic test mode according to the function point difference and the UI page number difference.
2. The UI page testing method according to claim 1, characterized in that, The determining a static test mode or a dynamic test mode according to the function point difference and the UI page number difference includes: Obtain a function point difference threshold and a UI page number difference threshold; Analyze the relationship between the function point difference and the function point difference threshold. If the function point difference is greater than the function point difference threshold, select the static test mode, otherwise select the dynamic test mode; Analyze the relationship between the UI page number difference and the UI page number difference threshold. If the UI page number difference is greater than the UI page number difference threshold, select the static test mode, otherwise select the dynamic test mode.
3. The UI page testing method according to claim 1, characterized in that, If the determined test mode is a static test mode, then the testing each of the UI pages according to the determined test mode to obtain the test results and difference comparison graphs corresponding to each of the UI pages includes: Obtain a page scanning rule; Scan each of the UI pages according to the page scanning rule and a depth-first traversal algorithm, and take screenshots of the scanned pages to obtain page screenshots corresponding to each of the UI pages; Obtain the test results and difference comparison graphs corresponding to each of the UI pages based on the page screenshots corresponding to each of the UI pages.
4. The UI page testing method according to claim 3, characterized in that, The obtaining the test results and difference comparison graphs corresponding to each of the UI pages based on the page screenshots corresponding to each of the UI pages includes: Analyze whether there is a design drawing corresponding to the UI page. If there is such a design drawing, compare the page screenshot corresponding to each UI page with the design drawing corresponding to the UI page to obtain the test result and the difference comparison diagram corresponding to each UI page. If there is no such design drawing, analyze whether there is a benchmark version drawing corresponding to the UI page. If there is such a benchmark version drawing, compare the page screenshot corresponding to each UI page with the benchmark version drawing corresponding to the UI page to obtain the test result and the difference comparison diagram corresponding to each UI page. If there is no such benchmark version drawing, save the UI page of the system under test as the benchmark version drawing.
5. The UI page testing method according to claim 1, characterized in that if the determined test mode is the dynamic test mode, then testing each UI page according to the determined test mode to obtain the test result and the difference comparison diagram corresponding to each UI page includes: Obtain the UI pages that need to be tested among all the UI pages of the system under test; Scan each UI page that needs to be tested and take a screenshot of the scanned page to obtain the page screenshot corresponding to each UI page that needs to be tested; Analyze whether there is a benchmark version drawing corresponding to the UI page that needs to be tested. If there is such a benchmark version drawing, compare the page screenshot corresponding to each UI page that needs to be tested with the benchmark version drawing to obtain the test result and the difference comparison diagram corresponding to each UI page that needs to be tested. If there is no such benchmark version drawing, save the UI page that needs to be tested as the benchmark version drawing.
6. A UI page testing device, characterized in that comprising: An acquisition module, configured to acquire all UI pages of the system under test; A determination module, configured to determine a test mode based on the function points of the system under test and the number of UI pages; A testing module, configured to test each UI page according to the determined test mode to obtain the test result and the difference comparison diagram corresponding to each UI page; An integration module, configured to integrate the test results corresponding to each UI page to obtain a test report, and aggregate the difference comparison diagrams corresponding to each UI page to obtain a difference comparison diagram set; A display module, configured to display the test report and the difference comparison diagram set on a display interface to help testers find problems existing in the UI page design; The determination module includes: A first acquisition unit, configured to acquire all UI pages of the system under test in the previous version; A calculation unit, configured to obtain a function point difference according to the function points of the system under test in the previous version and the function points of the system under test; obtain a UI page number difference according to the number of UI pages of the system under test in the previous version and the number of UI pages of the system under test; A determination unit, configured to determine a static test mode or a dynamic test mode according to the function point difference and the UI page number difference.
7. The UI page testing device according to claim 6, characterized in that The determination unit includes: An acquisition subunit, configured to acquire a threshold value of the function point difference and a threshold value of the difference in the number of UI pages; A first analysis subunit, configured to analyze the relationship between the function point difference and the threshold value of the function point difference. If the function point difference is greater than the threshold value of the function point difference, a static test mode is selected; otherwise, a dynamic test mode is selected; A second analysis subunit, configured to analyze the relationship between the difference in the number of UI pages and the threshold value of the difference in the number of UI pages. If the difference in the number of UI pages is greater than the threshold value of the difference in the number of UI pages, a static test mode is selected; otherwise, a dynamic test mode is selected.
8. The UI page testing device according to claim 6, wherein, The testing module includes: A second acquisition unit, configured to acquire a page scanning rule; A first screenshot unit, configured to scan each of the UI pages according to the page scanning rule and a depth-first traversal algorithm, and take screenshots of the scanned pages to obtain page screenshots corresponding to each of the UI pages; A comparison unit, configured to obtain a test result and a difference comparison chart corresponding to each of the UI pages based on the page screenshots corresponding to each of the UI pages.
9. The UI page testing device according to claim 8, wherein, The comparison unit includes: A third analysis subunit, configured to analyze whether there is a design drawing corresponding to the UI page. If there is the design drawing, the page screenshots corresponding to each of the UI pages are compared with the design drawing corresponding to the UI page to obtain a test result and a difference comparison chart corresponding to each of the UI pages; if there is no such design drawing, it is analyzed whether there is a benchmark version drawing corresponding to the UI page. If there is the benchmark version drawing, the page screenshots corresponding to each of the UI pages are compared with the benchmark version drawing corresponding to the UI page to obtain a test result and a difference comparison chart corresponding to each of the UI pages; if there is no such benchmark version drawing, the UI page of the system under test is saved as a benchmark version drawing.
10. The UI page testing device according to claim 6, wherein, The testing module includes: A third acquisition unit, configured to acquire the UI pages to be tested among all the UI pages of the system under test; A second screenshot unit, configured to scan each of the UI pages to be tested and take screenshots of the scanned pages to obtain page screenshots corresponding to each of the UI pages to be tested; An analysis unit, configured to analyze whether there is a benchmark version drawing corresponding to the UI page to be tested. If there is the benchmark version drawing, the page screenshots corresponding to each of the UI pages to be tested are compared with the benchmark version drawing to obtain a test result and a difference comparison chart corresponding to each of the UI pages to be tested; if there is no such benchmark version drawing, the UI page to be tested is saved as a benchmark version drawing.
11. A UI page testing device, wherein, It includes: A memory, configured to store a computer program; A processor, configured to implement the steps of the UI page testing method according to any one of claims 1 to 5 when executing the computer program.
12. A readable storage medium, characterized in that: a computer program is stored on the readable storage medium, and when the computer program is executed by a processor, the steps of the UI page testing method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Visual regression testing method, device, terminal device, and readable storage medium
CN109254908A