Automatic test method and device for new energy monitoring system and medium

By combining Sikuli and BrowserMob Proxy technologies, using image recognition and network request capture and analysis, the problems of complex interface interaction and data processing in automation testing of new energy monitoring systems are solved, efficient automated testing is achieved, and workload and manpower requirements are reduced. , ensuring the correctness of interface parameters.

CN119105958APending Publication Date: 2024-12-10YANCHI ZHONGYING CHUANGNENG NEW ENERGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411101386.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

There are a lot of repeated and monotonous manual processes in the automated testing of new energy monitoring systems. Simple http interface testing cannot ensure the consistency of front-end and back-end interface parameter transmission, especially in complex interface interaction and data processing, test maintenance and update The workload is high and requires a lot of manpower and time.

Method used

Sikuli and BrowserMob Proxy combined with Selenium, write simulated user operation scripts through image recognition and network request capture and analysis, realize automated testing, reduce the need to write complex code, and improve testing efficiency and accuracy.

Benefits of technology

The automated testing of the new energy monitoring system has been realized, which reduces workload, saves time and manpower, ensures the correctness of the interaction parameters between the front-end and server interfaces, and improves the efficiency and accuracy of the test.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119105958A_ABST
    Figure CN119105958A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic test method and device for a new energy monitoring system and a medium, and the method comprises the steps: integrating Sikuli, compiling a script for simulating user operation, calling an API of the Sikuli in a Selenium script, carrying out the image recognition through the Sikuli, and positioning and operating a to-be-operated target element in the monitoring system; the method comprises the following steps: importing a correlation library and dependency of a BrowserMob Proxy, starting and configuring the BrowserMob Proxy, and capturing and analyzing all network requests and responses sent by a browser; according to the method, the device and the medium, the automatic test of the new energy monitoring system can be carried out, the workload is small, and time and labor are saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of testing technology and relates to an automatic testing method, equipment and medium for a new energy monitoring system. Background Art

[0002] The visualization page of the new energy monitoring system involves a large amount of historical data and real-time data. There are many repetitive and monotonous processes in regression testing. Therefore, automation is needed to replace some manual testing to save time, improve work efficiency and test accuracy. Simple http interface testing cannot guarantee the consistency and accuracy of front-end and back-end interface parameter transmission. Although the front-end automated verification method can ensure the normal function of the system interface, the test script for the new energy smart operation and maintenance monitoring visualization system may involve complex interface interaction and data processing. The complexity and variability of the system may cause a lot of work to be done in testing, maintenance and updating, which requires a lot of manpower and time. Summary of the invention

[0003] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art and provide an automated testing method, device and medium for a new energy monitoring system. The method, device and medium can perform automated testing of the new energy monitoring system with a small workload, saving time and effort.

[0004] In order to achieve the above object, the present invention adopts the following technical scheme:

[0005] In one aspect, the present invention provides an automated testing method for a new energy monitoring system, comprising:

[0006] Integrate Sikuli and write scripts to simulate user operations. In the Selenium script, call Sikuli's API to find the target element through image recognition and perform operations.

[0007] Integrate BrowserMob Proxy;

[0008] Run the script to test the new energy monitoring system and complete the automated testing of the new energy control system.

[0009] The automated testing method of the new energy monitoring system of the present invention is further improved in that:

[0010] Furthermore, before writing the test script, the process also includes:

[0011] Install Selenium and configure the required WebDriver.

[0012] Furthermore, before writing the test script, the process also includes:

[0013] Install and configure SikuliX.

[0014] Furthermore, the process of integrating BrowserMob Proxy is as follows:

[0015] Introduce the BrowserMob Proxy dependency into the Selenium script and create a proxy instance;

[0016] Before Selenium starts the browser, configure the browser and use BrowserMob Proxy as a proxy;

[0017] Through BrowserMob Proxy's API, capture and analyze all network requests and response data issued by the browser.

[0018] Furthermore, it also includes:

[0019] Set up filters to capture requests and responses to focus on a preset URL or request type, and get the request header, request body, response status code, and response data.

[0020] Furthermore, it also includes:

[0021] Analyze the network request and response data captured by BrowserMob Proxy to verify the correctness of the network request and response data.

[0022] Furthermore, it also includes:

[0023] Check the execution results of the Selenium script to ensure that all the expected automation actions have been executed successfully.

[0024] Furthermore, it also includes:

[0025] When processing a web page, Selenium calls Sikuli to locate and operate through image recognition.

[0026] In a second aspect of the present invention, the automated testing system for the new energy monitoring system of the present invention comprises:

[0027] Test module, used for test environment preparation;

[0028] The first integration module is used to integrate Sikuli and write scripts that simulate user operations;

[0029] The second integration module is used to integrate BrowserMob Proxy;

[0030] The running module is used to run scripts to test the new energy monitoring system and complete the automated testing of the new energy control system.

[0031] The automatic test system of the new energy monitoring system of the present invention is further improved in that:

[0032] Furthermore, before writing the test script, the process also includes:

[0033] Install Selenium and configure the required WebDriver.

[0034] Furthermore, before writing the test script, the process also includes:

[0035] Install and configure SikuliX.

[0036] Furthermore, the process of integrating BrowserMob Proxy is as follows:

[0037] Introduce the BrowserMob Proxy dependency into the Selenium script and create a proxy instance;

[0038] Before Selenium starts the browser, configure the browser and use BrowserMob Proxy as a proxy;

[0039] Through BrowserMob Proxy's API, capture and analyze all network requests and response data issued by the browser.

[0040] Furthermore, it also includes:

[0041] Set up filters to capture requests and responses to focus on a preset URL or request type, and get the request header, request body, response status code, and response data.

[0042] Furthermore, it also includes:

[0043] Analyze the network request and response data captured by BrowserMob Proxy to verify the correctness of the network request and response data.

[0044] Furthermore, it also includes:

[0045] Check the execution results of the Selenium script to ensure that all the expected automation actions have been executed successfully.

[0046] Furthermore, it also includes:

[0047] When processing a web page, Selenium calls Sikuli to locate and operate through image recognition.

[0048] In a third aspect of the present invention, the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the automated testing method of the new energy monitoring system when executing the computer program.

[0049] In a fourth aspect of the present invention, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the automated testing method of the new energy monitoring system are implemented.

[0050] The present invention has the following beneficial effects:

[0051] In the specific operation of the automated testing method, device and medium of the new energy monitoring system described in the present invention, when Selenium processes a Web page, it calls Sikuli to locate and operate through image recognition, and uses Sikuli to automatically complete most programming tasks through the screenshot elements of the graphical user interface without writing complex codes. This combined use can fully utilize the advantages of the two frameworks to improve the efficiency and accuracy of automated testing. The combination of Selenium, Sikuli and browsermob-proxy can not only reduce the time and complexity of writing scripts that simulate browsers sending requests, but also monitor the correctness of the interaction parameters between the front-end and server-side interface interactions. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:

[0053] Figure 1 The figure is a flow chart of the method of the present invention. DETAILED DESCRIPTION

[0054] 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 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0055] In the description of the present invention, it should be understood that the terms “include” and “comprises” indicate the presence of described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.

[0056] It should also be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0057] It should be further understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present invention generally indicates that the associated objects are in an "or" relationship.

[0058] It should be understood that, although the terms first, second, third, etc. may be used to describe preset ranges, etc. in the embodiments of the present invention, these preset ranges should not be limited to these terms. These terms are only used to distinguish preset ranges from each other. For example, without departing from the scope of the embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.

[0059] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0060] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below 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 the embodiments. The components of the embodiments of the present invention described and shown in the drawings here can usually 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 invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0061] Various structural schematic diagrams of the embodiments disclosed in the present invention are shown in the accompanying drawings. These figures are not drawn to scale, and some details are magnified and some details may be omitted for the purpose of clear expression. The shapes of various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are only exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may additionally design regions / layers with different shapes, sizes, and relative positions according to actual needs.

[0062] The present invention is further described in detail below in conjunction with the accompanying drawings:

[0063] Embodiment 1

[0064] refer to Figure 1 The automatic testing method of the new energy monitoring system of the present invention comprises the following steps:

[0065] 1) Test environment preparation;

[0066] The process of step 1) is:

[0067] Install Selenium and configure the required WebDriver, such as ChromeDriver;

[0068] Install Sikuli and ensure that Sikuli can run normally;

[0069] Download BrowserMob Proxy and start the proxy service of BrowserMob Proxy.

[0070] 2) Integrate Sikuli and write scripts to simulate user operations;

[0071] Integrate Sikuli and write scripts to simulate user operations. In the Selenium script, call Sikuli's API to find the target element through image recognition and perform operations.

[0072] 3)Integrate BrowserMob Proxy;

[0073] The process of step 3) is:

[0074] Introduce the BrowserMob Proxy dependency into the Selenium script and create a proxy instance;

[0075] Before Selenium starts the browser, configure the browser and use BrowserMob Proxy as a proxy;

[0076] Through the BrowserMob Proxy API, all network requests and response data sent by the browser can be captured and analyzed. Among them, filters for capturing requests and responses can be set to focus on preset URLs or request types, obtain information such as request headers, request bodies, response status codes, and response data for verification and analysis.

[0077] 4) Run the script to test the new energy monitoring system and complete the automated testing of the new energy control system.

[0078] In addition, after the run is completed, you need to check the execution results of the Selenium script to ensure that all expected automated operations have been successfully executed. At the same time, analyze the network request and response data captured by BrowserMob Proxy to verify the correctness of the network request and response data.

[0079] The present invention has the following characteristics:

[0080] a) When Selenium encounters elements that are difficult to locate by ID or name when processing a web page, it can call Sikuli to locate and operate through image recognition. Sikuli can automatically complete most programming tasks through screenshot elements of the graphical user interface without writing complex code. This combination can fully utilize the advantages of the two frameworks and improve the efficiency and accuracy of automated testing.

[0081] b) When browsermob-proxy is used in conjunction with Selenium, it is easy to obtain all network request and response data sent by the browser, including request headers, request bodies, response status codes, and response contents.

[0082] c) The combination of Selenium, Sikuli and browsermob-proxy can not only reduce the time and complexity of writing scripts to simulate browser requests, but also monitor the correctness of the interaction parameters between the front-end and server-side interface interactions.

[0083] Embodiment 2

[0084] The automatic testing system of the new energy monitoring system of the present invention comprises:

[0085] Test module, used for test environment preparation;

[0086] The first integration module is used to integrate Sikuli and write scripts that simulate user operations;

[0087] The second integration module is used to integrate BrowserMob Proxy;

[0088] The running module is used to run scripts to test the new energy monitoring system and complete the automated testing of the new energy control system.

[0089] As an implementation manner of the present invention, before writing the test script, the process further includes:

[0090] Install Selenium and configure the required WebDriver.

[0091] As an implementation manner of the present invention, before writing the test script, the process further includes:

[0092] Install and configure SikuliX.

[0093] As an implementation mode of the present invention, the process of integrating BrowserMob Proxy is as follows:

[0094] Introduce the BrowserMob Proxy dependency into the Selenium script and create a proxy instance;

[0095] Before Selenium starts the browser, configure the browser and use BrowserMob Proxy as a proxy;

[0096] Through BrowserMob Proxy's API, capture and analyze all network requests and response data issued by the browser.

[0097] As an embodiment of the present invention, it also includes:

[0098] Set up filters to capture requests and responses to focus on a preset URL or request type, and get the request header, request body, response status code, and response data.

[0099] As an embodiment of the present invention, it also includes:

[0100] Analyze the network request and response data captured by BrowserMob Proxy to verify the correctness of the network request and response data.

[0101] As an embodiment of the present invention, it also includes:

[0102] Check the execution results of the Selenium script to ensure that all the expected automation actions have been executed successfully.

[0103] As an embodiment of the present invention, it also includes:

[0104] When processing a web page, Selenium calls Sikuli to locate and operate through image recognition.

[0105] The division of modules in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional module in each embodiment of the present application may be integrated into a processor, or may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0106] Embodiment 2

[0107] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the automated testing method of the new energy monitoring system are implemented, for example, comprising: 1) installing Selenium and configuring the required WebDriver, such as ChromeDriver; installing Sikuli and ensuring that Sikuli can run normally; downloading BrowserMob Proxy and starting the proxy service of BrowserMob Proxy; 2) integrating Sikuli and writing a script simulating user operations; 3) introducing the dependency of BrowserMob Proxy in the Selenium script and creating a proxy instance, introducing the dependency of BrowserMobProxy in the Selenium script and creating a proxy instance; before Selenium starts the browser, configuring the browser and using BrowserMobProxy as the proxy; Proxy's API captures and analyzes all network requests and response data sent by the browser, wherein filters for capturing requests and responses can be set to focus on preset URLs or request types, obtain information such as request headers, request bodies, response status codes, and response data, and perform verification and analysis; 4) Run the script to test the new energy monitoring system and complete the automated testing of the new energy control system; check the execution results of the Selenium script to ensure that all expected automated operations have been successfully executed. At the same time, analyze the network request and response data captured by BrowserMob Proxy to verify the correctness of the network request and response data. Among them, the memory may include memory, such as high-speed random access memory, and may also include non-volatile memory, such as at least one disk memory, etc.; the processor, network interface, and memory are interconnected through an internal bus, which may be an industrial standard architecture bus, a peripheral component interconnection standard bus, an extended industrial standard architecture bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. The memory is used to store programs. Specifically, the program may include program code, and the program code includes computer operation instructions. The memory may include memory and non-volatile memory, and provide instructions and data to the processor.

[0108] Embodiment 3

[0109] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps of implementing the automated testing method of the new energy monitoring system include: 1) installing Selenium and configuring the required WebDriver, such as ChromeDriver; installing Sikuli to ensure that Sikuli can run normally; downloading BrowserMob Proxy and starting the proxy service of BrowserMob Proxy; 2) integrating Sikuli and writing scripts that simulate user operations; 3) introducing the dependency of BrowserMob Proxy in the Selenium script and creating a proxy instance; introducing the dependency of BrowserMob Proxy in the Selenium script and creating a proxy instance; before Selenium starts the browser, configure the browser and use BrowserMob Proxy as the proxy; through BrowseMob Proxy's API captures and analyzes all network requests and response data issued by the browser, wherein filters for capturing requests and responses can be set to focus on preset URLs or request types, obtain information such as request headers, request bodies, response status codes, and response data, and perform verification and analysis; 4) Run the script to test the new energy monitoring system and complete the automated testing of the new energy control system; check the execution results of the Selenium script to ensure that all expected automated operations have been successfully executed. At the same time, analyze the network requests and response data captured by BrowserMob Proxy to verify the correctness of the network requests and response data. Specifically, the computer-readable storage medium includes, but is not limited to, for example, volatile memory and / or non-volatile memory. The volatile memory may include random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include read-only memory (ROM), hard disk, flash memory, optical disk, disk, etc.

[0110] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0111] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0112] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0113] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. An automated testing method for a new energy monitoring system, characterized in that: include: Integrate Sikuli and write scripts to simulate user operations. In the Selenium script, call Sikuli's API to find the target element through image recognition and perform operations. Integrate BrowserMob Proxy; Run the script to test the new energy monitoring system and complete the automated testing of the new energy control system.

2. The automated testing method for a new energy monitoring system according to claim 1, characterized in that: Before writing the test script, the following steps are also included: Install Selenium and configure the required WebDriver.

3. The automated testing method for a new energy monitoring system according to claim 1, characterized in that: Before writing the test script, the following steps are also included: Install and configure SikuliX.

4. The automated testing method for a new energy monitoring system according to claim 1, characterized in that: The process of integrating BrowserMob Proxy is: Introduce the BrowserMob Proxy dependency into the Selenium script and create a proxy instance; Before Selenium starts the browser, configure the browser and use BrowserMob Proxy as a proxy; Through BrowserMob Proxy's API, capture and analyze all network requests and response data issued by the browser.

5. The automated testing method for a new energy monitoring system according to claim 1, characterized in that: Also includes: Set up filters to capture requests and responses to focus on a preset URL or request type, and get the request header, request body, response status code, and response data.

6. The automated testing method for a new energy monitoring system according to claim 1, characterized in that: Also includes: Analyze the network request and response data captured by BrowserMob Proxy to verify the correctness of the network request and response data.

7. The automated testing method for a new energy monitoring system according to claim 1, characterized in that: Also includes: Check the execution results of the Selenium script to ensure that all the expected automation actions have been executed successfully.

8. The automated testing method for a new energy monitoring system according to claim 1, characterized in that: Also includes: When processing a web page, Selenium calls Sikuli to locate and operate through image recognition.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the automated testing method for the new energy monitoring system as described in any one of claims 1 to 8 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the automated testing method for the new energy monitoring system as claimed in any one of claims 1 to 8 are implemented.