Selenium-based automatic test method and system
Through the automated testing method based on Selenium, the repetitive steps and human error problems caused by manual traversing the activation of cloud products in cloud platform delivery tests are solved, and automated testing is realized, testing efficiency and accuracy are improved, and computing overhead is significantly reduced through intelligent scheduling and resource utilization control.
Patent Information
- Application Number
- CN202411742781.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-05-06
AI Technical Summary
During the cloud platform delivery test process, manual batch traversal of opening cloud products causes test engineers to forget the product model they last opened, resulting in more repetitive steps, increasing the possibility of human errors, and reducing the efficiency and accuracy of delivery tests.
Using an automated testing method based on Selenium, the plug-in is called by the Selenium module to automatically access the cloud platform URL, simulate clicking on the corresponding control, and traversing and opening tests for different models, specifications and different operating system versions of the elastic cloud host. At the same time, calculate the energy efficiency index of each test project, sort the test items according to the energy efficiency index; calculate resource utilization, predict the probability of failure, and remind human intervention when the probability of failure exceeds the threshold.
Automatic testing is realized, reducing manual repeated operations, improving testing efficiency and accuracy, reducing the possibility of human errors, and significantly reducing the computing overhead during the test process through intelligent scheduling and resource utilization control.
Smart Images

Figure CN119938509A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automatic testing, and in particular to a selenium-based automatic testing method and system. Background Art
[0002] The existing platform currently uses the B / S model. After deployment, it needs to go through a series of tests and ensure that the test results pass before it can be delivered to customers. Currently, delivery test engineers are responsible for completing cloud platform delivery tests. Among them, the first step is to conduct product activation testing. Only after the product is successfully activated can subsequent functional testing be performed. During the testing process, testers need to manually activate products of different versions and models on the cloud platform WEB interface, and perform tests on the association and binding of other products.
[0003] Selenium is an open source framework that allows users to use and customize it for free, and supports multiple operating systems and browsers, including Windows, Mac, and Linux, which ensures that it can run on most devices. Due to its powerful positioning mechanism, it can locate controls based on ID, XPath, CSS selectors, etc., simulate mouse clicks, and more accurately locate page elements for operation.
[0004] During the cloud platform delivery test process, manually batch traversing and activating cloud products may cause test engineers to forget the product model activated last time and the next model to be activated, resulting in a large number of repetitive steps. This process is prone to human errors, increases the workload of test engineers, and reduces the efficiency and accuracy of delivery testing. Summary of the invention
[0005] To achieve the above-mentioned purpose and other related purposes, the present invention discloses a selenium-based automated testing method, comprising: Use the selenium module to call the plug-in to automatically access the cloud platform website, simulate clicking the corresponding controls, and perform traversal and activation tests on elastic cloud hosts of different models, specifications, and operating system versions; During the test, the energy efficiency index of each test item is calculated, and the test order of the test items is sorted according to the energy efficiency index, and the test is carried out according to the order; Calculate the resource utilization rate of each test item, and test multiple test items at the same time under the premise that the total resource utilization rate is less than the first threshold; The failure probability is predicted, and when the failure probability is greater than a second threshold, a reminder is given to perform manual intervention.
[0006] Furthermore, the energy efficiency index includes: ETI = log (Ai × Vi × Qi) × K; in: Ai: test activity index, reflecting the execution frequency of the i-th test item; Vi: test value coefficient, indicating the importance of the i-th test item to system verification; Qi: quality impact factor, reflecting the historical record of defects found in the i-th test item; K: Environmental compensation coefficient, used to adjust the differences in different test environments.
[0007] Furthermore, the failure probability includes: PRI=(1 / n)×Yi×Zi×(1+ln(Bi)) in: n: number of test cycles; Yi: system stability index of the i-th test item; Zi: risk coefficient of the i-th test item; Bi: The business scenario complexity of the i-th test item.
[0008] Furthermore, the resource utilization rate includes: DRB=[(Ni×Li)+(Mi×Si)]×(1-Di / 100); in: Ni: Network resource occupancy rate of the i-th test item; Li: network load weight of the ith test item; Mi: storage resource occupancy rate of the i-th test item; Si: storage performance weight of the i-th test item; Di: System delay rate of the i-th test item.
[0009] Furthermore, the method also includes introducing a test accuracy index to evaluate the test effect, including: TAI=√(Ex²+Gx²+Jx²) / 3 Parameter explanation: Ei: execution accuracy of the i-th test item; Gi: the test case coverage accuracy of the i-th test item; Ji: The accuracy of the result judgment of the i-th test item.
[0010] On the other hand, the present invention also provides a selenium-based automated testing system, comprising: The plug-in calling module uses the selenium module to call the plug-in to automatically access the cloud platform website, simulate clicking the corresponding controls, and perform traversal and activation tests on elastic cloud hosts of different models, specifications, and operating system versions; The energy efficiency calculation module is used to calculate the energy efficiency index of each test item during the test process, sort the test order of the test items according to the energy efficiency index, and perform the test according to the order; A resource utilization test module, used to calculate the resource utilization of each test item, and to test multiple test items at the same time under the premise that the total resource utilization is less than a first threshold; The fault prediction module is used to predict the fault probability and to remind human intervention when the fault probability is greater than a second threshold.
[0011] By using the above technical solution, automatic testing is achieved by traversing and calling test items, eliminating the need for manual repetitive actions, thereby improving test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, among which:
[0013] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0014] 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.
[0015] Reference Figure 1 The embodiment of the present invention provides a selenium-based automated testing method, comprising the following steps: Use the selenium module to call the plug-in to automatically access the cloud platform website, simulate clicking the corresponding controls, and perform traversal and activation tests on elastic cloud hosts of different models, specifications, and operating system versions; During the test, the energy efficiency index of each test item is calculated, and the test order of the test items is sorted according to the energy efficiency index, and the test is carried out according to the order; Calculate the resource utilization rate of each test item, and test multiple test items at the same time under the premise that the total resource utilization rate is less than the first threshold; The failure probability is predicted, and when the failure probability is greater than a second threshold, a reminder is given to perform manual intervention.
[0016] As mentioned above, the Selenium-based plug-in calling module implements a comprehensive traversal test of the cloud platform elastic host, covering different models, specifications and operating system versions. This matrix testing method ensures the breadth and depth of the test and greatly improves the system's compatibility verification capabilities.
[0017] The energy efficiency index includes: ETI = log (Ai × Vi × Qi) × K; in: Ai: test activity index, reflecting the execution frequency of the i-th test item; Vi: test value coefficient, indicating the importance of the i-th test item to system verification; Qi: quality impact factor, reflecting the historical record of defects found in the i-th test item; K: Environmental compensation coefficient, used to adjust the differences in different test environments.
[0018] By introducing parameters such as the test activity index and the test value coefficient, this solution establishes a self-learning mechanism based on historical data. Each round of testing can accumulate experience for the system, continuously optimize the test strategy, and form a positive closed loop of technical iteration.
[0019] The failure probabilities include: PRI=(1 / n)×Yi×Zi×(1+ln(Bi)) in: n: number of test cycles; Yi: system stability index of the i-th test item; Zi: risk coefficient of the i-th test item; Bi: The business scenario complexity of the i-th test item.
[0020] The resource utilization rate includes: DRB=[(Ni×Li)+(Mi×Si)]×(1-Di / 100); in: Ni: Network resource occupancy rate of the i-th test item; Li: network load weight of the ith test item; Mi: storage resource occupancy rate of the i-th test item; Si: storage performance weight of the i-th test item; Di: System delay rate of the i-th test item.
[0021] The method further includes introducing a test accuracy index to evaluate the test effect, including: TAI=√(Ex²+Gx²+Jx²) / 3 Parameter explanation: Ei: execution accuracy of the i-th test item; Gi: the test case coverage accuracy of the i-th test item; Ji: The accuracy of the result judgment of the i-th test item.
[0022] Traditional automated testing is often superficial. The present invention realizes intelligent scheduling of the test process by introducing multi-dimensional evaluation indicators, such as energy efficiency index (ETI), failure probability (PRI) and test accuracy index (TAI). Testing is no longer a mechanical repetition, but an "intelligent" and adaptive process that can dynamically adjust the test strategy according to historical data and system characteristics. This solution innovatively proposes a resource utilization rate (DRB) calculation model to accurately control system resource consumption while ensuring the comprehensiveness of the test. By dynamically balancing network resources and storage resources, the computing overhead in the test process can be significantly reduced, and efficient parallelization of multiple test projects can be achieved. The fault prediction part of the present invention breaks through the passive test mode and is transformed into an active early warning mechanism. Through multi-dimensional evaluation of the risk factor of the test project, system stability, etc., when the probability of failure exceeds the preset threshold, the manual intervention process can be triggered in time to minimize the potential risk of system failure.
[0023] Compared with traditional manual testing, the present invention can significantly reduce testing manpower costs and improve testing efficiency.
[0024] An embodiment of the present invention further provides a system, comprising: The plug-in calling module uses the selenium module to call the plug-in to automatically access the cloud platform website, simulate clicking the corresponding controls, and perform traversal and activation tests on elastic cloud hosts of different models, specifications, and operating system versions; The energy efficiency calculation module is used to calculate the energy efficiency index of each test item during the test process, sort the test order of the test items according to the energy efficiency index, and perform the test according to the order; A resource utilization test module, used to calculate the resource utilization of each test item, and to test multiple test items at the same time under the premise that the total resource utilization is less than a first threshold; The fault prediction module is used to predict the fault probability and to remind human intervention when the fault probability is greater than a second threshold.
[0025] Those skilled in the art will appreciate that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined.
[0026] For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0027] It can be known from the description of the above implementation modes that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute the methods described in the various implementation modes of the present application or certain parts of the implementation modes.
[0028] 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 aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. An automated testing method based on selenium, characterized in that: include: Use the selenium module to call the plug-in to automatically access the cloud platform website, simulate clicking the corresponding controls, and perform traversal and activation tests on elastic cloud hosts of different models, specifications, and operating system versions; During the test, the energy efficiency index of each test item is calculated, and the test order of the test items is sorted according to the energy efficiency index, and the test is carried out according to the order; Calculate the resource utilization rate of each test item, and test multiple test items at the same time under the premise that the total resource utilization rate is less than the first threshold; The failure probability is predicted, and when the failure probability is greater than a second threshold, a reminder is given to perform manual intervention.
2. The method according to claim 1, characterized in that: The energy efficiency index includes: ETI = log (Ai × Vi × Qi) × K; in: Ai: test activity index, reflecting the execution frequency of the i-th test item; Vi: test value coefficient, indicating the importance of the i-th test item to system verification; Qi: quality impact factor, reflecting the historical record of defects found in the i-th test item; K: Environmental compensation coefficient, used to adjust the differences in different test environments.
3. The method according to claim 1, characterized in that The failure probabilities include: PRI=(1 / n)×Yi×Zi×(1+ln(Bi)); in: n: number of test cycles; Yi: system stability index of the i-th test item; Zi: risk coefficient of the i-th test item; Bi: The business scenario complexity of the i-th test item.
4. The method according to claim 1, characterized in that The resource utilization rate includes: DRB=[(Ni×Li)+(Mi×Si)]×(1-Di / 100); in: Ni: Network resource occupancy rate of the i-th test item; Li: network load weight of the ith test item; Mi: storage resource occupancy rate of the i-th test item; Si: storage performance weight of the i-th test item; Di: System delay rate of the ith test item.
5. The method according to claim 1, characterized in that The method further includes introducing a test accuracy index to evaluate the test effect, including: TAI=√(Ex²+Gx²+Jx²) / 3; Parameter explanation: Ei: execution accuracy of the i-th test item; Gi: the test case coverage accuracy of the i-th test item; Ji: The accuracy of the result judgment of the i-th test item.
6. A selenium-based automated testing system, characterized in that: include: The plug-in calling module uses the selenium module to call the plug-in to automatically access the cloud platform website, simulate clicking the corresponding controls, and perform traversal and activation tests on elastic cloud hosts of different models, specifications, and operating system versions; The energy efficiency calculation module is used to calculate the energy efficiency index of each test item during the test process, sort the test order of the test items according to the energy efficiency index, and perform the test according to the order; A resource utilization test module, used to calculate the resource utilization of each test item, and to test multiple test items at the same time under the premise that the total resource utilization is less than a first threshold; The fault prediction module is used to predict the fault probability and to remind human intervention when the fault probability is greater than a second threshold.