Automatic test method and device for web interface customization and electronic equipment

Through automatic screenshot and comparison technology, using the Python tool library to extract and compare interface elements, the problems of inefficient testing and omissions in the existing technology are solved, and automated and comprehensive customized web interface testing is achieved.

CN119166527APending Publication Date: 2024-12-20WUHAN SIPU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411325663.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-23
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

The existing custom-made testing methods for web interfaces are inefficient and are prone to missed test points. It is difficult to fully cover all interfaces and styles by relying on manual operations.

Method used

Using automatic testing method, screenshots of the web login pages of the source and target devices, use Python tool libraries (such as pytesseract and Pillow) to extract text and menu names in the picture, and compare them with the directory tree file to determine whether the interface is Completely consistent, make sure the test passes.

Benefits of technology

It realizes automated web interface customization testing, improves testing efficiency, reduces manual operations, ensures comprehensiveness and accuracy of testing, and avoids the risk of missing test points.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166527A_ABST
    Figure CN119166527A_ABST
Patent Text Reader

Abstract

The invention provides an automatic test method and device for web interface customization and electronic equipment, and belongs to the technical field of software test.The method comprises the steps that after a web login page of source equipment is logged in, screenshot is conducted on the web login page of the source equipment, and a source picture is obtained; after logging in the web login page of the target equipment, performing screenshot on the web login page of the target equipment to obtain a target picture; and comparing the achievable effects of the source picture and the target picture, comparing the menu name in the target picture and the target menu name, and determining that the customized test of the target equipment passes under the condition that the achievable effects are consistent and the menu name in the target picture is consistent with the target menu name. According to the method and the device, the web login pages of the source device and the target device are automatically screenshot and then are compared, so that the technical problems of low test efficiency and easiness in missing test points in an existing test method are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software testing, and in particular to an automatic testing method, device and electronic equipment for customizing a web interface. Background Art

[0002] The web interface customization test is mainly for each customized manufacturer: log in to the device through the web interface, check whether the interface menu name, page style, interface product name, version number, and included menu function points are consistent with the customized manufacturer information.

[0003] Customized testing is generally done manually, which has the disadvantages of incomplete coverage, labor-intensive, and difficult to traverse all interfaces and styles in each test, resulting in low test efficiency and easy omission of test points. Summary of the invention

[0004] In view of this, it is necessary to provide an automatic testing method, device and electronic device with a customized web interface to solve the technical problems of low testing efficiency and easy omission of test points in existing testing methods.

[0005] In order to solve the above problems, on the one hand, the present invention provides a customized automatic testing method for a web interface, comprising: After logging into the web login page of the source device, take a screenshot of the web login page of the source device to obtain the source image; After logging into the web login page of the target device, take a screenshot of the web login page of the target device to obtain the target image; Compare the achievable effects of the source image with the target image, and compare the menu name in the target image with the target menu name. If the achievable effects are consistent and the menu name in the target image is consistent with the target menu name, determine that the customization test of the target device has passed.

[0006] In a possible implementation, comparing the achievable effects of the source image and the target image includes: Based on the page style, page layout and customized manufacturer information between the source image and the target image, the achievable effects of the source image and the target image are compared.

[0007] In a possible implementation, before comparing the menu name in the target image with the target menu name, the method further includes: Based on the pytesseract tool and the Pillow tool in the Python tool library, the text in the target image is extracted, and the menu name is filtered out from the extracted text to obtain the menu name of the target image.

[0008] In a possible implementation, before comparing the menu name in the target image with the target menu name, the method further includes: The menu names in the directory tree file are extracted based on the pandas tool in the Python tool library, and the target menu names are determined based on the menu names in the directory tree file.

[0009] In a possible implementation, when the achievable effect is consistent and the menu name in the target image is consistent with the target menu name, determining that the customization test of the target device passes includes: When the achievable effect is consistent, the menu name in the target image is consistent with the target menu name, and the number in the target image is consistent with the number of menus in the target menu, it is determined that the customization test of the target device has passed.

[0010] On the other hand, the present invention also provides an automatic testing device with customized web interface, comprising: The first screenshot module is used to take a screenshot of the web login page of the source device after logging in to the web login page of the source device to obtain a source image; The second screenshot module is used to take a screenshot of the web login page of the target device after logging in to the web login page of the target device to obtain a target image; The test module is used to compare the achievable effects of the source image with the target image, and to compare the menu name in the target image with the target menu name. When the achievable effects are consistent and the menu name in the target image is consistent with the target menu name, it is determined that the customized test of the target device has passed.

[0011] In a possible implementation, the testing module is used to compare the achievable effects of the source image and the target image based on the page style, page layout, and customized manufacturer information between the source image and the target image.

[0012] In a possible implementation, the automatic testing device for customizing a web interface further includes: The menu extraction module is used to extract the text in the target image based on the pytesseract tool and the Pillow tool in the Python tool library before comparing the menu name in the target image with the target menu name, and filter out the menu name from the extracted text to obtain the menu name of the target image.

[0013] On the other hand, the present invention also provides an electronic device, including a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps of the automatic testing method for customized web interface as described in any one of the above items.

[0014] On the other hand, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the automatic testing method for customizing a web interface as described in any one of the above items are implemented.

[0015] The beneficial effect of adopting the above-mentioned implementation method is: the automatic testing method, device and electronic device for customized web interface provided by the present invention automatically takes a screenshot of the web login page of the source device to obtain the source image, and takes a screenshot of the web login page of the target device to obtain the target image, and compares the source image with the target image to determine whether the customized test passes, that is, whether the customized information of the test interface is correct and whether the customized function has changed. The testing process does not require frequent manual operations, thereby solving the technical problems of low testing efficiency and easy omission of test points in existing testing methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0017] Figure 1 A flowchart of an embodiment of the automatic testing method for customizing a web interface provided by the present invention; Figure 2 A flowchart of an embodiment of obtaining a source image and a target image provided by the present invention; Figure 3 A flowchart of an embodiment of comparing a source image and a target image provided by the present invention; Figure 4 A principle block diagram of an embodiment of an automatic testing device with customized web interface provided by the present invention; Figure 5 A schematic structural diagram of an embodiment of an electronic device provided by the present invention. DETAILED DESCRIPTION

[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0019] In the description of the embodiments of the present application, unless otherwise specified, “plurality” means two or more than two.

[0020] The terms "including" and "having" and any variations thereof in the embodiments of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product or equipment comprising a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules not clearly listed or inherent to these processes, methods, products or equipment.

[0021] The naming or numbering of the steps in the embodiments of the present invention does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The execution order of the named or numbered process steps can be changed according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved.

[0022] Reference to an "embodiment" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiment may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0023] The present invention provides a web interface customized automatic testing method, device and electronic equipment, which are described below respectively.

[0024] like Figure 1 As shown, the present invention provides an automatic testing method for customizing a web interface, comprising: S101, after logging into the web login page of the source device, taking a screenshot of the web login page of the source device to obtain a source image; S102, after logging into the web login page of the target device, taking a screenshot of the web login page of the target device to obtain a target image; S103, comparing the achievable effects of the source image and the target image, and comparing the menu name in the target image with the target menu name, and when the achievable effects are consistent and the menu name in the target image is consistent with the target menu name, determining that the customization test of the target device has passed.

[0025] It is understandable that the source device is the correct customized device, that is, the device used as a reference, and the target device is the customized device being tested. After obtaining the customized test results of the target device, the test results can be saved to provide a reference basis for subsequent test result tracing.

[0026] The customization test passed, indicating that the interface customization information of the target device is correct and the customized functions have not changed.

[0027] The automatic testing method provided by the present invention automatically takes a screenshot of the web login page of the source device to obtain a source image, and takes a screenshot of the web login page of the target device to obtain a target image, and compares the source image with the target image, thereby determining whether the customized test has passed, that is, determining whether the customized information of the test interface is correct and whether the customized function has changed. The testing process does not require frequent manual operations, thereby solving the technical problems of low testing efficiency and easy omission of test points in the existing testing methods.

[0028] In some embodiments, comparing the achievable effects of the source image and the target image includes: Based on the page style, page layout and customized manufacturer information between the source image and the target image, the achievable effects of the source image and the target image are compared.

[0029] It can be understood that page style is the formatting attribute of the page that controls the appearance of a text block or text area, page layout includes information such as font, font size, color, paper size, etc., and customized manufacturer information includes information of customers who need customization.

[0030] In some embodiments, before comparing the menu name in the target image with the target menu name, the method further includes: Based on the pytesseract tool and the Pillow tool in the Python tool library, the text in the target image is extracted, and the menu name is filtered out from the extracted text to obtain the menu name of the target image.

[0031] In some embodiments, before comparing the menu name in the target image with the target menu name, the method further includes: The menu names in the directory tree file are extracted based on the pandas tool in the Python tool library, and the target menu names are determined based on the menu names in the directory tree file.

[0032] In some embodiments, when the achievable effect is consistent and the menu name in the target image is consistent with the target menu name, determining that the customization test of the target device passes includes: When the achievable effect is consistent, the menu name in the target image is consistent with the target menu name, and the number in the target image is consistent with the number of menus in the target menu, it is determined that the customization test of the target device has passed.

[0033] In some embodiments, the web interface customized automatic testing method provided by the present invention has the following specific testing process: 1. Reference Figure 2 , the process of obtaining the source image and the target image is as follows: On the source device, take a screenshot of the source image according to customized requirements; Take a screenshot of the web login page of the source device and save it to the corresponding directory; Take a screenshot of the target device's login page and save it. Then compare the source icon with the target image to efficiently test the customization. 2. Reference Figure 3 , the process of comparing the source image with the target image is as follows: Read the screenshot of the target device, extract the text in the picture, and filter out the menu name; Use Python open source libraries pytesseract and Pillow to extract text from images and filter out menu names; Read the directory tree file in Excel format for customized testing, compare the menu names extracted from the image with the menu names read from the directory tree, and check if there are any inconsistent menus; Comparing the menu names can achieve the following results: the menu names of the customized test version are consistent with the menu names in the directory tree file without omissions, the customized version product names are correct, the customized version software version names are correct, and the function items required by the customized version are correct; By comparing the source image and the target image of the device, and extracting the target image and comparing it with the directory tree file of the customized test, the customized test of the web interface can be completed quickly, the efficiency of the customized test of the interface can be improved, repetitive and boring manual labor can be avoided, and the test can be targeted.

[0034] like Figure 4 As shown, the present invention also provides an automatic testing device 400 with a customized web interface, comprising: The first screenshot module 401 is used to take a screenshot of the web login page of the source device after logging in to the web login page of the source device to obtain a source image; The second screenshot module 402 is used to take a screenshot of the web login page of the target device after logging into the web login page of the target device to obtain a target image; The test module 403 is used to compare the achievable effects of the source image and the target image, and to compare the menu name in the target image with the target menu name. When the achievable effects are consistent and the menu name in the target image is consistent with the target menu name, it is determined that the customized test of the target device has passed.

[0035] In some embodiments, the testing module is used to compare the achievable effects of the source image and the target image based on the page style, page layout and customized manufacturer information between the source image and the target image.

[0036] In some embodiments, the web interface customized automatic testing device further includes: The menu extraction module is used to extract the text in the target image based on the pytesseract tool and the Pillow tool in the Python tool library before comparing the menu name in the target image with the target menu name, and filter out the menu name from the extracted text to obtain the menu name of the target image.

[0037] The web interface customized automatic testing device provided in the above embodiment can implement the technical solution described in the above web interface customized automatic testing method embodiment. The specific implementation principles of the above modules or units can refer to the corresponding contents in the above web interface customized automatic testing method embodiment, which will not be repeated here.

[0038] like Figure 5 As shown, the present invention also provides an electronic device 500. The electronic device 500 includes a processor 501, a memory 502 and a display 503. Figure 5 Only some components of the electronic device 500 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0039] In some embodiments, the memory 502 may be an internal storage unit of the electronic device 500, such as a hard disk or memory of the electronic device 500. In other embodiments, the memory 502 may also be an external storage device of the electronic device 500, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 500.

[0040] Furthermore, the memory 502 may include both an internal storage unit of the electronic device 500 and an external storage device. The memory 502 is used to store application software installed in the electronic device 500 and various data.

[0041] In some embodiments, the processor 501 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 502, such as the automatic testing method for customized web interface in the present invention.

[0042] In some embodiments, the display 503 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 503 is used to display information on the electronic device 500 and to display a visual user interface. The components 501-503 of the electronic device 500 communicate with each other via a system bus.

[0043] In some embodiments of the present invention, when the processor 501 executes the automatic test program for web interface customization in the memory 502, the following steps may be implemented: After logging into the web login page of the source device, take a screenshot of the web login page of the source device to obtain the source image; After logging into the web login page of the target device, take a screenshot of the web login page of the target device to obtain the target image; Compare the achievable effects of the source image with the target image, and compare the menu name in the target image with the target menu name. If the achievable effects are consistent and the menu name in the target image is consistent with the target menu name, determine that the customization test of the target device has passed.

[0044] It should be understood that: when the processor 501 executes the customized automatic test program of the web interface in the memory 502, in addition to the above functions, other functions can also be implemented. For details, please refer to the description of the corresponding method embodiment above.

[0045] Furthermore, the embodiment of the present invention does not specifically limit the type of the electronic device 500 mentioned, and the electronic device 500 may be a portable electronic device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device, a laptop computer, etc. Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with IOS, Android, Microsoft or other operating systems. The above-mentioned portable electronic devices may also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present invention, the electronic device 500 may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).

[0046] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the automatic testing method for customizing a web interface provided by the above methods is implemented, and the method comprises: After logging into the web login page of the source device, take a screenshot of the web login page of the source device to obtain the source image; After logging into the web login page of the target device, take a screenshot of the web login page of the target device to obtain the target image; Compare the achievable effects of the source image with the target image, and compare the menu name in the target image with the target menu name. If the achievable effects are consistent and the menu name in the target image is consistent with the target menu name, determine that the customization test of the target device has passed.

[0047] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.

[0048] The above is a detailed introduction to the automatic testing method, device and electronic device for customized web interface provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A web interface customized automatic testing method, characterized in that: include: After logging into the web login page of the source device, take a screenshot of the web login page of the source device to obtain the source image; After logging into the web login page of the target device, take a screenshot of the web login page of the target device to obtain the target image; Compare the achievable effects of the source image with the target image, and compare the menu name in the target image with the target menu name. If the achievable effects are consistent and the menu name in the target image is consistent with the target menu name, determine that the customization test of the target device has passed.

2. The automatic testing method for customized web interface according to claim 1, characterized in that: Comparing the achievable effects of the source image and the target image includes: Based on the page style, page layout and customized manufacturer information between the source image and the target image, the achievable effects of the source image and the target image are compared.

3. The automatic testing method for customized web interface according to claim 1, characterized in that: Before comparing the menu name in the target image with the target menu name, the method further includes: Based on the pytesseract tool and the Pillow tool in the Python tool library, the text in the target image is extracted, and the menu name is filtered out from the extracted text to obtain the menu name of the target image.

4. The automatic testing method for customized web interface according to claim 3, characterized in that: Before comparing the menu name in the target image with the target menu name, the method further includes: The menu names in the directory tree file are extracted based on the pandas tool in the Python tool library, and the target menu names are determined based on the menu names in the directory tree file.

5. The automatic testing method for customizing a web interface according to any one of claims 1 to 4, characterized in that: In the case where the effect can be achieved consistently and the menu name in the target image is consistent with the target menu name, determining that the customization test of the target device passes includes: When the achievable effect is consistent, the menu name in the target image is consistent with the target menu name, and the number in the target image is consistent with the number of menus in the target menu, it is determined that the customization test of the target device has passed.

6. An automatic testing device with customized web interface, characterized in that: include: The first screenshot module is used to take a screenshot of the web login page of the source device after logging in to the web login page of the source device to obtain a source image; The second screenshot module is used to take a screenshot of the web login page of the target device after logging in to the web login page of the target device to obtain a target image; The test module is used to compare the achievable effects of the source image with the target image, and to compare the menu name in the target image with the target menu name. When the achievable effects are consistent and the menu name in the target image is consistent with the target menu name, it is determined that the customized test of the target device has passed.

7. The automatic testing device for customizing a web interface according to claim 6, characterized in that: The testing module is used to compare the achievable effects of the source image and the target image based on the page style, page layout and customized manufacturer information between the source image and the target image.

8. The automatic testing device for customizing a web interface according to claim 6, characterized in that: Also includes: The menu extraction module is used to extract the text in the target image based on the pytesseract tool and the Pillow tool in the Python tool library before comparing the menu name in the target image with the target menu name, and filter out the menu name from the extracted text to obtain the menu name of the target image.

9. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps of the automatic testing method for customized web interface as described in any one of claims 1 to 5.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the automatic testing method for customizing a web interface as claimed in any one of claims 1 to 5 are implemented.