CN115964281A - Automatic testing method for processing switch upgrading and downgrading in preset mode - Google Patents
Automatic testing method for processing switch upgrading and downgrading in preset mode Download PDFInfo
- Publication number
- CN115964281A CN115964281A CN202211613967.8A CN202211613967A CN115964281A CN 115964281 A CN115964281 A CN 115964281A CN 202211613967 A CN202211613967 A CN 202211613967A CN 115964281 A CN115964281 A CN 115964281A
- Authority
- CN
- China
- Prior art keywords
- upgrading
- script
- result
- page element
- automatic
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Debugging And Monitoring (AREA)
- Stored Programmes (AREA)
Abstract
The invention provides an automatic testing method for processing switch upgrading and downgrading in a preset mode, which relates to the technical field of communication equipment maintenance and comprises the following steps: building a test environment, preparing an upgrade mirror image, and presetting a configuration file of a page element positioning mode; checking the automation script, setting and storing the number of execution times of the upgrading and the downgrading, and manually starting the execution automation script; the automatic script simulates a mouse to click a web interface to execute upgrading operation, judges whether an execution result is successful when each type of page elements are operated, then judges whether a retrieval result is matched, and finally judges whether picture or character attributes are matched with the page elements; and after testing all versions of each type of page elements, running a functional test script logic process, asserting a result and outputting a test report. The positioning mode of the page elements in different versions is preset, so that the redundancy condition of the code structure is optimized, the fault tolerance of the automatic process is enhanced, and the continuous implementation of the multi-time upgrading and downgrading process without manual intervention is ensured.
Description
Technical Field
The invention relates to the technical field of communication equipment maintenance, in particular to an automatic testing method for processing switch upgrading and downgrading in a preset mode.
Background
With the continuous updating and upgrading of functions of the switch, the upgrading and downgrading test of the version of the switch becomes an indispensable and very important part, aiming at various software and hardware problems derived from the upgrading and downgrading operation of the switch, the upgrading and downgrading test of different versions needs to be carried out for many times to find more problems or reproduce abnormal test scenes, even some abnormal phenomena can occur only by repeated operation, at the moment, a tester needs to carry out repeated upgrading and downgrading of operation versions on a webpage, the work content is repeated, the workload is large, and at the moment, the advantages of automatic testing are obvious.
For different versions of the same application, because the positions of menus and page elements corresponding to the upgrading function are changed due to code updating iteration, the automatic scripts after upgrading fail to execute due to the fact that the corresponding page elements cannot be found, codes are redundant and difficult to maintain due to the fact that multiple sets of scripts are compiled in the same function, and later-stage modification operation is complex. Chinese patent CN109669873A, "user interface automatic test method and apparatus, electronic device and storage medium", provides a user interface automatic test method, which obtains location information of a page element in a user interface by initializing a configuration file, triggers an automatic test script, and implements debugging of the page element. However, the method cannot solve the problem that the menu structure changes due to version differences of the switch, and the fault-tolerant capability is not strong.
Disclosure of Invention
In view of this, the present invention provides an automatic test method for handling switch upgrade in a preset manner, which is used to solve the problem that an automatic script after upgrade cannot find a corresponding page element and fails to execute due to a change of a menu structure caused by version difference of a switch.
The technical scheme of the invention is realized as follows: the invention provides an automatic testing method for processing switch upgrading and downgrading in a preset mode, which comprises the following steps of:
s1, building a test environment, preparing an upgrade mirror image, and presetting a configuration file of a page element positioning mode;
s2, checking the automatic script, setting the execution times of the upgrading and the downgrading, storing, and manually starting the execution automatic script;
s3, simulating a mouse to click a web interface by the automatic script to execute upgrading operation, judging whether the execution result is successful when each type of page elements are operated, if so, asserting the result, finishing verification, executing next version upgrading, and otherwise, triggering page element positioning mode automatic retrieval and judging the retrieval result; if the retrieval result is matched successfully, skipping retrieval, acquiring the image or character attribute by using the retrieved positioning mode, judging whether the image or character attribute is matched with the page element, if the retrieval result is matched unsuccessfully, declaring that the upgrading is failed, and executing next version upgrading; if the image or character attributes are successfully matched, the result is asserted, the retrieval is completed, the page element positioning method is updated, if the matching fails, the assertion is failed, and the next version upgrading is executed;
and S4, after testing all versions of each type of page elements, running a function testing script logic process, asserting a result and outputting a testing report.
Preferably, step S1 specifically includes:
and the test environment building comprises the steps of powering on a pre-tested switch, directly connecting the pre-tested switch with a PC (personal computer), building a python environment and installing a robotframe tool.
Preferably, step S1 further comprises:
preparing the upgrade image includes placing the image to be upgraded under an automation script folder.
Preferably, step S1 further comprises:
the configuration file for presetting the page element positioning mode specifically comprises the following steps: and when the upgrading function is applied to different versions, page elements which can change at the position of the web interface are collected, and the corresponding page elements are preset in the configuration file in the page element positioning modes of different versions.
Preferably, step S2 specifically includes:
and opening the script by using an RIDE tool, checking the script to be executed, setting the number of times of upgrading and downgrading, storing, clicking a 'start' button, and triggering the execution of the automatic script.
Preferably, step S2 further comprises:
the automatic script comprises four modules of public data, page elements, a service flow and a test case;
the public data module is in communication connection with the page element module and is used for storing public data including an equipment IP, a user name and a password for logging in a web and a pre-upgrade image file;
the page element module is in communication connection with the public data module and the business process module and is used for upgrading the process page element positioning mode script;
the business process module is in communication connection with the page element module and the test case module and is used for executing an upgrading process, verifying execution results of the different elements, starting fault-tolerant processing, automatically retrieving a preset positioning mode, accurately positioning again according to the attributes of the element pictures or characters, and verifying the upgrading execution results;
the test case module is in communication connection with the business process module and used for result assertion and generation of an automatic test result report.
Preferably, step S3 specifically includes:
judging whether the execution result is successful when each type of page element is operated, specifically, in the process that the script simulates a mouse to execute clicking on the page element, checking the page elements with different version positioning modes, namely judging whether the execution result is successful when the page element of the type is operated, if the operation result is True, asserting the result, completing checking, executing next version upgrading, otherwise, triggering the automatic retrieval of the page element positioning mode.
Preferably, step S3 further comprises:
the page element positioning mode automatic retrieval comprises the steps of acquiring a preset positioning mode data list of corresponding elements, then performing cycle traversal on the data list, and finding out a value with a True execution result of operating a target element in a data set according to the positioning mode.
Preferably, step S3 further comprises:
and whether the picture or text attributes are matched with the page elements is specifically determined by acquiring the corresponding picture attributes or text contents according to the new positioning mode of the retrieved page elements, and updating the positioning mode of the page elements in the automatic script through matching the picture attributes or the text contents.
Compared with the prior art, the automatic testing method for processing switch upgrading and downgrading in the preset mode has the following beneficial effects:
(1) By presetting the positioning modes of the page elements in different versions, the redundancy condition of the code structure is optimized, the fault tolerance of an automatic process is enhanced, the continuous implementation of multiple upgrading and downgrading processes is ensured without manual intervention, and manpower can be released to do other creative work;
(2) By setting the automation script which comprises a public data module, a page element module, a service flow module and a test case module, the character tags of corresponding elements can be obtained by obtaining effective attributes of the elements or according to a preset positioning mode, the target elements are further accurately positioned, and the robustness and the fault-tolerant capability of the automation script are enhanced;
(3) The automatic script becomes clearer and highly readable through a preset mode, and the reusable script becomes more convenient to optimize and maintain;
(4) By automatically executing the test of the version elevator, the test process can be automatically completed, the test result is recorded, and a test result report is output.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart of an automated testing method for handling switch upgrade in a preset manner according to the present invention;
FIG. 2 is a diagram of an automated script composition for a pre-configured approach to handling switch upgrade automation testing methods of the present invention;
fig. 3 is a block flow diagram of an automated testing method for handling switch upgrade in a preset manner according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
Examples
An automated testing method for handling switch upgrade in a preset manner is provided, as shown in fig. 1, including the following steps:
s1, building a test environment, preparing an upgrade mirror image, and presetting a configuration file of a page element positioning mode;
s2, checking the automatic script, setting the number of execution times of the upgrading and the downgrading, storing, and manually starting the automatic script;
s3, simulating a mouse to click a web interface by the automatic script to execute upgrading operation, judging whether the execution result is successful when each type of page elements are operated, if so, asserting the result, finishing verification, executing next version upgrading, and otherwise, triggering page element positioning mode automatic retrieval and judging the retrieval result; if the retrieval result is matched successfully, skipping retrieval, acquiring the image or character attribute by using the retrieved positioning mode, judging whether the image or character attribute is matched with the page element, if the retrieval result is matched unsuccessfully, declaring that the upgrading is failed, and executing next version upgrading; if the matching of the picture or character attributes is successful, the result is asserted, the retrieval is completed, the page element positioning method is updated, if the matching fails, the assertion is failed, and the next version upgrading is executed;
and S4, after testing all versions of each type of page elements, running a function testing script logic process, asserting a result and outputting a testing report.
The rebotframe + python architecture is adopted to compile an automatic script, testers are liberated from repeated manual tests through automatic tests, meanwhile, the work efficiency is improved, upgrading actions are automatically executed, after upgrading is completed, the upgraded version number and page information are automatically compared, and whether upgrading and upgrading are successful or not is predicated.
The step S1 specifically includes:
and the test environment building comprises the steps of powering on a pre-tested switch, directly connecting the pre-tested switch with a PC (personal computer), building a python environment and installing a robotframe tool.
Preparing the upgrade image includes placing the image to be upgraded under an automation script folder.
The configuration file for presetting the page element positioning mode specifically comprises the following steps: and when the upgrading function is applied to different versions, page elements which can change at the position of the web interface are collected, and the corresponding page elements are preset in the configuration file in the page element positioning modes of different versions.
The step S2 specifically includes:
and opening the script by using an RIDE tool, checking the script to be executed, setting the number of times of upgrading and downgrading, storing, clicking a 'start' button, and triggering the execution of the automatic script.
As shown in FIG. 2, the automation script includes four modules of public data, page elements, business processes, and test cases.
The equipment is powered on and is in the same network segment with the PC, the PC can normally ping the equipment, and can normally log in the web application of the equipment by using a correct user name and password, and the upgrading function of the web application can be normally used.
The public data module is in communication connection with the page element module and is used for storing public data including an equipment IP, a user name and a password for logging in a web and a pre-upgrade image file;
the page element module is in communication connection with the public data module and the business process module and is used for upgrading the process page element positioning mode script;
the business process module is in communication connection with the page element module and the test case module and is used for executing an upgrading process, verifying execution results of different elements, starting fault-tolerant processing, automatically retrieving a preset positioning mode, accurately positioning again according to the attributes of the element pictures or characters, and verifying the upgrading execution results;
the test case module is in communication connection with the business process module and used for result assertion and generation of an automatic test result report.
Step S3 specifically includes:
judging whether the execution result is successful when each type of page element is operated, specifically, in the process that the script simulates a mouse to execute clicking of the page element, checking the page elements with different version positioning modes, namely judging whether the execution result is successful when the type of page element is operated, if the operation result is True, asserting the result, completing the checking, executing the next version upgrading, otherwise, triggering the page element positioning mode automatic retrieval.
And the page element positioning mode automatic retrieval comprises the steps of acquiring a preset positioning mode data list of the corresponding element, and then performing cyclic traversal on the data list to find out a value with a True execution result of operating the target element in the data set according to the positioning mode.
And whether the picture or text attributes are matched with the page elements is specifically determined by acquiring the corresponding picture attributes or text contents according to the new positioning mode of the retrieved page elements, and updating the positioning mode of the page elements in the automatic script through matching the picture attributes or the text contents.
Checking the elements with different version positioning modes, namely judging whether the execution result is successful when the elements are operated, judging whether the function of searching the element positioning mode is triggered according to the execution result, acquiring the picture attribute or the character attribute for further accurate matching after the accurate positioning mode is successfully searched, ensuring the smooth execution of the upgrading process through various fault-tolerant modes, judging the upgrading failure if the searching is failed, and continuing the upgrading operation of other versions.
Fig. 3 is a flow chart of an automated testing method for handling switch upgrade in a preset manner according to the present invention,
firstly, building a test environment, then preparing an upgrade mirror image, then presetting a page element positioning mode configuration file, checking a script, setting upgrade execution times and keeping, then manually starting an execution script, and simulating a mouse to click a web interface by an automatic script to execute upgrade operation;
judging the execution result of the check element, if the check element passes, directly asserting to finish the check, executing next version upgrade, and if the check element does not pass, triggering an element positioning mode automatic retrieval function;
judging the execution result of the checking and positioning mode, if the execution result passes through the checking and positioning mode, acquiring the image or character attribute, and if the execution result does not pass through the checking and positioning mode, declaring that the upgrading fails and carrying out the next version upgrading;
and judging whether the picture or the character is checked to be matched with the target page element, if not, declaring that the upgrading is failed, upgrading the next version, and if so, declaring the result, completing the retrieval and updating the page element.
And after testing all versions of each type of page elements, running a functional test script logic process, asserting a result and outputting a test report.
The script processing mode is illustrated by way of example:
aiming at the condition that a certain page element has different positioning modes in different versions of the same application, schemes (namely scheme 1, scheme 2, scheme 3 and scheme 4) of a plurality of positioning modes are preset in a configuration file of a preset value, in the script execution process, when the execution of a default positioning mode is verified to be failed, multi-fault-tolerant page element positioning mode retrieval is started, namely, the multi-fault-tolerant page element positioning mode retrieval is searched and matched in the preset positioning scheme (namely, the scheme 1, the scheme 2, the scheme 3 and the scheme 4 are mentioned), in the retrieval process, when the positioning mode with the execution result of True is matched, the retrieval is skipped, a new positioning mode which is retrieved is used for obtaining image or character attributes, and the target page element is further accurately matched and positioned. If the execution result of the new positioning mode is True and the matching of the image or character attributes and the pre-judged value is successful, the retrieval is completed, the positioning method of the target element is updated, the script is continuously executed, otherwise, the version is skipped for upgrading and is marked as failure, and then the upgrading of the next version is continued.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Claims (9)
1. An automatic testing method for processing switch upgrading and downgrading in a preset mode is characterized by comprising the following steps:
s1, building a test environment, preparing an upgrade mirror image, and presetting a configuration file of a page element positioning mode;
s2, checking the automatic script, setting the execution times of the upgrading and the downgrading, storing, and manually starting the execution automatic script;
s3, simulating a mouse to click a web interface by the automatic script to execute upgrading operation, judging whether an execution result is successful when each type of page element is operated, if so, asserting the result, finishing verification, executing next version upgrading, and otherwise, triggering page element positioning mode automatic retrieval and judging a retrieval result; if the retrieval result is matched successfully, skipping retrieval, acquiring the image or character attribute by using the retrieved positioning mode, judging whether the image or character attribute is matched with the page element, if the retrieval result is matched unsuccessfully, declaring that the upgrading is failed, and executing next version upgrading; if the matching of the picture or character attributes is successful, the result is asserted, the retrieval is completed, the page element positioning method is updated, if the matching fails, the assertion is failed, and the next version upgrading is executed;
and S4, after testing all versions of each type of page elements, running a function testing script logic process, asserting a result and outputting a testing report.
2. The method for automated testing of pre-configured mode processing switch upgrades and downgrades according to claim 1, wherein the step S1 specifically includes:
and the test environment building comprises the steps of powering on a pre-tested switch, directly connecting the pre-tested switch with a PC (personal computer), building a python environment and installing a robotframe tool.
3. The method for automated testing of pre-configured processing switch upgrades and downgrades according to claim 1, wherein the step S1 further comprises:
preparing the upgrade image includes placing the image to be upgraded under an automation script folder.
4. The method for automated testing of pre-configured approach to switch upgrade as set forth in claim 1, wherein the step S1 further comprises:
the configuration file for presetting the page element positioning mode specifically comprises the following steps: and when the upgrading function is applied to different versions, page elements which can change at the position of the web interface are collected, and the corresponding page elements are preset in the configuration file in the page element positioning modes of different versions.
5. The method for automated testing of pre-configured processing switch upgrades and downgrades according to claim 4, wherein the step S2 specifically includes:
and opening the script by using an RIDE tool, checking the script to be executed, setting the number of upgrading and downgrading, storing the number, clicking a 'start' button, and triggering the execution of the automatic script.
6. The method for automated testing of pre-configured processing switch upgrades and downgrades of claim 5, wherein the step S2 further comprises:
the automatic script comprises four modules of public data, page elements, a service flow and a test case;
the public data module is in communication connection with the page element module and is used for storing public data including an equipment IP, a user name and a password for logging in a web and a pre-upgrade image file;
the page element module is in communication connection with the public data module and the business process module and is used for upgrading the process page element positioning mode script;
the business process module is in communication connection with the page element module and the test case module and is used for executing an upgrading process, verifying execution results of the different elements, starting fault-tolerant processing, automatically retrieving a preset positioning mode, accurately positioning again according to the attributes of the element pictures or characters, and verifying the upgrading execution results;
the test case module is in communication connection with the business process module and used for result assertion and generation of an automatic test result report.
7. The method for automatically testing the pre-configured approach to switch upgrade of claim 6, wherein the step S3 specifically includes:
judging whether the execution result is successful when each type of page element is operated, specifically, in the process that the script simulates a mouse to execute clicking of the page element, checking the page elements with different version positioning modes, namely judging whether the execution result is successful when the type of page element is operated, if the operation result is True, asserting the result, completing the checking, executing the next version upgrading, otherwise, triggering the page element positioning mode automatic retrieval.
8. The method for automated testing of pre-configured processing switch upgrades and downgrades of claim 7, wherein the step S3 further comprises:
the page element positioning mode automatic retrieval comprises the steps of acquiring a preset positioning mode data list of corresponding elements, then performing cycle traversal on the data list, and finding out a value with a True execution result of operating a target element in a data set according to the positioning mode.
9. The method for automated testing of pre-configured processing switch upgrades and downgrades of claim 8, wherein the step S3 further comprises:
and whether the picture or text attributes are matched with the page elements is specifically determined by acquiring the corresponding picture attributes or text contents according to the new positioning mode of the retrieved page elements, and updating the positioning mode of the page elements in the automatic script through matching the picture attributes or the text contents.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211613967.8A CN115964281A (en) | 2022-12-15 | 2022-12-15 | Automatic testing method for processing switch upgrading and downgrading in preset mode |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211613967.8A CN115964281A (en) | 2022-12-15 | 2022-12-15 | Automatic testing method for processing switch upgrading and downgrading in preset mode |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115964281A true CN115964281A (en) | 2023-04-14 |
Family
ID=87362811
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211613967.8A Pending CN115964281A (en) | 2022-12-15 | 2022-12-15 | Automatic testing method for processing switch upgrading and downgrading in preset mode |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115964281A (en) |
-
2022
- 2022-12-15 CN CN202211613967.8A patent/CN115964281A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11281570B2 (en) | Software testing method, system, apparatus, device medium, and computer program product | |
CN109902016B (en) | Web test method and test platform | |
CN111382070B (en) | Compatibility testing method and device, storage medium and computer equipment | |
US8839201B2 (en) | Capturing test data associated with error conditions in software item testing | |
US10067858B2 (en) | Cloud-based software testing | |
CN111124919A (en) | User interface testing method, device, equipment and storage medium | |
US9069902B2 (en) | Software test automation | |
CN112506807A (en) | Automatic test system for interface serving multiple systems | |
CN112068981B (en) | Knowledge base-based fault scanning recovery method and system in Linux operating system | |
CN111694752B (en) | Application testing method, electronic device and storage medium | |
CN115658529A (en) | Automatic testing method for user page and related equipment | |
CN111679982A (en) | Automatic testing method for REST API (representational State transfer) interface software | |
CN111629200A (en) | Method and device for rapidly detecting differential packet reliability and readable storage medium | |
CN111813659A (en) | UI and interface based automatic test method, device, equipment and readable medium | |
CN115576816A (en) | Linux operating system-based android application function automatic testing method and device | |
CN115437925A (en) | Functional automated testing tools for operating systems | |
CN113986263A (en) | Code automation testing method, device, electronic device, storage medium | |
US20140109056A1 (en) | Scheduled software item testing | |
CN112988578A (en) | An automated testing method and device | |
CN113094281A (en) | Hybrid App testing method and device | |
CN116383090B (en) | Automatic testing method and platform for kylin system migration tool | |
CN116541270B (en) | Method and device for testing adaptation verification of operating system | |
CN115964281A (en) | Automatic testing method for processing switch upgrading and downgrading in preset mode | |
CN115599683A (en) | Automatic testing method, device, equipment and storage medium | |
CN111694728A (en) | Automatic generation method and device of script |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |