An automatic test method for pre-setting mode processing of exchange upgrade and downgrade

By using configuration files and automated scripts to pre-configure page element positioning methods, the problem of menu structure changes caused by version differences in switches was solved, automated testing of switch upgrades and downgrades was achieved, the code structure was optimized, and testing efficiency and maintainability were improved.

CN115964281BActive Publication Date: 2025-11-04武汉迈威通信股份有限公司
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211613967.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-15
Publication Date
2025-11-04
Estimated Expiration
2042-12-15

AI Technical Summary

Technical Problem

The menu structure of the switch has changed due to version differences. After the upgrade, the automation script cannot find the corresponding page element and fails to execute. Existing technology cannot effectively solve this problem, and the code is redundant and difficult to maintain.

Method used

By setting up a test environment with pre-defined page element location methods in the configuration file, an automated script is used to simulate mouse clicks to perform upgrade operations. By judging the execution results and attribute matching of page elements, the location methods are automatically retrieved, the page element location methods are optimized, and the fault tolerance is enhanced.

Benefits of technology

The code structure was optimized, the fault tolerance of the automated process was enhanced, the robustness and readability of the script were improved, and multiple upgrade and downgrade tests without human intervention were realized, generating test reports.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115964281B_ABST
    Figure CN115964281B_ABST
Patent Text Reader

Abstract

The application provides an automatic test method for pre-setting mode processing of upgrade and downgrade of a switch, relates to the technical field of communication equipment maintenance, and comprises the following steps: a test environment is built, an upgrade image is prepared, and a configuration file of a pre-setting page element positioning mode is prepared; an automatic script is checked, the number of times of upgrade and downgrade is set and saved, and the automatic script is manually started to be executed; the automatic script simulates mouse clicking of a web interface to execute an upgrade operation, judges whether the execution result is successful when each type of page element is operated, then judges whether a search result is matched, and finally judges whether pictures or text attributes are matched with the page elements; after all version tests of each type of page element are completed, a function test script logic process is run, an assertion result is obtained, and a test report is output. Through the pre-setting of the positioning mode of the page elements in different versions, the code structure redundancy is optimized, the fault tolerance of the automatic process is enhanced, and it is ensured that the upgrade and downgrade processes can be continuously performed without manual intervention.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of communication equipment maintenance, and in particular to an automatic test method for handling upgrade and downgrade of switches in a preset manner. BACKGROUND

[0002] With the continuous updating and upgrading of switch functions, the upgrade and downgrade test of switch versions has become an indispensable and very important part. For various software and hardware problems derived from the upgrade and downgrade operation of switches, we need to perform multiple version upgrade and downgrade tests to find more problems or reproduce abnormal test scenarios. Even some abnormal phenomena need to be repeated several times to appear. At this time, the test personnel need to perform repeated operations of upgrading and downgrading on the webpage, which is repetitive and laborious. At this time, the advantages of automatic testing are obvious.

[0003] For different versions of the same application, the code update iteration will cause the menu and page element positions corresponding to the upgrade function to change, resulting in the failure of the automatic script after the upgrade due to the inability to find the corresponding page element. Writing multiple scripts for the same function will make the code redundant and difficult to maintain, and the later modification operation is tedious. Chinese patent CN109669873A "User interface automatic test method and device, electronic equipment and storage medium" provides a user interface automatic test method, which obtains the position information of the page element in the user interface through the initialization configuration file, triggers the automatic test script, and realizes the debugging of the page element. However, this method cannot solve the problem of menu structure change caused by version difference of switches, and the fault tolerance is not strong. SUMMARY

[0004] Therefore, the present application provides an automatic test method for handling upgrade and downgrade of switches in a preset manner, which solves the problem of menu structure change caused by version difference of switches and the failure of automatic script after upgrade due to the inability to find the corresponding page element.

[0005] The technical solution of the present application is as follows: The present application provides an automatic test method for handling upgrade and downgrade of switches in a preset manner, comprising the following steps:

[0006] S1, build a test environment, prepare an upgrade image, and preset a configuration file of page element positioning method;

[0007] S2, check the automatic script, set the number of upgrade and downgrade executions and save, and manually start the execution of the automatic script;

[0008] S3, the automatic script simulates mouse clicks on the web interface to perform upgrade operations, judges whether the execution result is successful when operating each type of page element, if so, asserts the result, completes the verification, performs the next version upgrade, otherwise, triggers the automatic search of the page element positioning method, and judges the search result; if the search result matches successfully, exit the search, use the searched positioning method to obtain the picture or text attribute, and judge whether the picture or text attribute matches the page element, if the search result matches unsuccessfully, assert that the upgrade fails, and perform the next version upgrade; if the picture or text attribute matches successfully, assert the result, complete the search, update the positioning method of the page element, if the matching fails, assert that the upgrade fails, and perform the next version upgrade;

[0009] S4, after completing the test of all versions of each type of page element, the function test script logic process is run, the result is asserted, and a test report is output.

[0010] Preferably, step S1 specifically comprises:

[0011] The test environment is built by powering on the pre-tested switch, directly connecting it with a PC computer, building a python environment, and installing a robotframe tool.

[0012] Preferably, step S1 further comprises:

[0013] The preparation of the upgrade image comprises placing the image to be upgraded under the automatic script folder.

[0014] Preferably, step S1 further comprises:

[0015] The configuration file for pre-setting the page element positioning method is specifically: collecting the page elements whose positions in the web interface change when the same application in different versions is upgraded, and pre-setting the positioning methods of the corresponding page elements in different versions in the configuration file.

[0016] Preferably, step S2 specifically comprises:

[0017] The script is opened using the RIDE tool, the script to be executed is checked, the number of upgrades and downgrades is set and saved, the "start" button is clicked, and the automatic script is triggered to execute.

[0018] Preferably, step S2 further comprises:

[0019] The automatic script comprises four modules of public data, page elements, business processes and test cases;

[0020] The public data module is in communication connection with the page element module, and is used to store public data, including device IP, login web username and password, and pre-upgrade image file;

[0021] The page element module is in communication connection with the public data module and the business process module, and is used for upgrading the positioning mode script of the process page element.

[0022] The business process module is in communication connection with the page element module and the test case module, and is used for executing the upgrade process, checking the difference element execution result, starting the fault tolerance processing, automatically retrieving the pre-set positioning mode, accurately positioning again according to the element picture or text attribute, and verifying the upgrade execution result.

[0023] The test case module is in communication connection with the business process module, and is used for result assertion and generation of an automatic test result report.

[0024] Preferably, the step S3 specifically comprises:

[0025] The judgment operation is whether the execution result of each type of page element is successful, specifically, in the process of simulating the mouse to execute the clicking of the page element, the script checks the page elements with different positioning modes in different versions, that is, judges whether the execution result is successful when operating this type of page element, if the operation result is True, the result is asserted, the verification is completed, the next version upgrade is executed, otherwise the page element positioning mode automatic retrieval is triggered.

[0026] Preferably, the step S3 further comprises:

[0027] The page element positioning mode automatic retrieval specifically comprises obtaining the pre-set positioning mode data list of the corresponding element, then performing loop traversal on the data list, and finding the value of the target element in the data set with the True execution result according to the positioning mode.

[0028] Preferably, the step S3 further comprises:

[0029] The picture or text attribute is matched with the page element, specifically, according to the new positioning mode of the retrieved page element, the corresponding picture attribute or text content is obtained, the picture attribute or text content is matched, and the positioning mode of the page element in the automatic script is updated.

[0030] The automatic test method for pre-set mode processing of the upgrade and downgrade of the switch of the application has the following beneficial effects compared with the prior art:

[0031] (1) By pre-setting the positioning mode of the page element in different versions, the code structure redundancy is optimized, the fault tolerance capability of the automatic process is enhanced, the multiple upgrade and downgrade processes can be continuously performed without manual intervention, and the manpower can be released to do other creative work.

[0032] (2) By setting an automatic script, including a public data module, a page element module, a business process module and a test case module, the target element can be further accurately positioned by obtaining an effective attribute of an element or a text label of a corresponding element according to a pre-set positioning mode, and the robustness and fault tolerance of the automatic script are enhanced;

[0033] (3) The automatic script becomes clearer and more readable through the pre-set mode, and the reusable script becomes more convenient to optimize and maintain;

[0034] (4) The test process can be automatically completed, the test results can be recorded, and the test result report can be output through the automatic execution of the version elevator test. BRIEF DESCRIPTION OF DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0036] Figure 1 A pre-set mode processing switcher upgrade automatic test method flow chart of the present application;

[0037] Figure 2 An automatic script composition structure diagram of the pre-set mode processing switcher upgrade automatic test method of the present application;

[0038] Figure 3 A flow chart of the pre-set mode processing switcher upgrade automatic test method of the present application. DETAILED DESCRIPTION

[0039] The technical solutions in the embodiments of the present application will be described clearly and completely below in combination with the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0040] EMBODIMENT

[0041] A pre-set mode processing switcher upgrade automatic test method is provided, as shown in Figure 1 The method comprises the following steps:

[0042] S1, build a test environment, prepare an upgrade image, and pre-set a configuration file of a page element positioning mode;

[0043] S2, check the automation script, set the number of upgrade and downgrade execution times and save, manually start the execution of the automation script;

[0044] S3, the automation script simulates mouse clicks on the web interface to perform upgrade operations, judges whether the execution result is successful when operating each type of page element, if so, asserts the result, completes the verification, and performs the next version upgrade, otherwise, triggers the page element positioning method automation search, and judges the search result; if the search result matches successfully, exit the search, use the searched positioning method to obtain the picture or text attribute, and judge whether the picture or text attribute matches the page element, if the search result matches unsuccessfully, assert that the upgrade fails, and perform the next version upgrade; if the picture or text attribute matches successfully, assert the result, complete the search, update the positioning method of the page element, if the matching fails, assert that the upgrade fails, and perform the next version upgrade;

[0045] S4, after completing the test of all versions of each type of page element, run the function test script logic process, assert the result, and output the test report.

[0046] The automation script is written using the architecture of rebotframework+python, which liberates the test personnel from repetitive manual testing through automation testing, improves work efficiency, automatically performs upgrade actions, and automatically compares the version number and page information after upgrade to assert whether the upgrade and downgrade are successful.

[0047] Step S1 specifically includes:

[0048] The test environment is built, including powering on the pre-tested switch, connecting it directly with the PC computer, building the python environment, and installing the robotframe tool.

[0049] Preparing the upgrade image includes placing the image to be upgraded under the automation script folder.

[0050] The configuration file for pre-setting the page element positioning method is specifically: collecting the page elements whose positions in the web interface change when the same application is in different versions, and pre-setting the positioning method of the corresponding page elements in different versions of the page elements in the configuration file.

[0051] Step S2 specifically includes:

[0052] Open the script using the RIDE tool, check the script to be executed, set the number of upgrade and downgrade, save, click the "start" button, and trigger the execution of the automation script.

[0053] For example Figure 2As shown, the automation script includes four modules of public data, page elements, business processes and test cases.

[0054] The device is powered on and in the same network segment with the PC, the PC can ping the device normally, and the correct username and password can be used to log in the web application of the device normally, and the upgrade function of the web application can be used normally.

[0055] The public data module is in communication connection with the page element module, and is used for storing public data, including device IP, login web username and password and pre-upgrade image file;

[0056] The page element module is in communication connection with the public data module and the business process module, and is used for upgrading process page element positioning mode script;

[0057] The business process module is in communication connection with the page element module and the test case module, and is used for executing the upgrade process, checking the difference element execution result, starting the fault tolerance processing, automatically retrieving the pre-set positioning mode, accurately positioning again according to the element picture or text attribute, and verifying the upgrade execution result.

[0058] The test case module is in communication connection with the business process module, and is used for result assertion and generation of automation test result report.

[0059] The step S3 specifically includes:

[0060] The operation result of each type of page element is judged, specifically, in the process of simulating mouse to execute clicking page element, the script will check the page elements with different version positioning modes, that is, to judge whether the operation result is successful when operating this type of page element, if the operation result is True, the result is asserted, the verification is completed, the next version upgrade is executed, otherwise the page element positioning mode automatic retrieval is triggered.

[0061] The page element positioning mode automatic retrieval specifically refers to obtaining the positioning mode data list of the corresponding element pre-set, then performing loop traversal on the data list, and finding the value of the target element in the data set with True execution result according to the positioning mode.

[0062] Whether the picture or text attribute matches the page element, specifically, according to the new positioning mode of the retrieved page element, the corresponding picture attribute or text content is obtained, the picture attribute or text content is matched, and the positioning mode of the page element in the automation script is updated.

[0063] The elements with different version positioning modes are checked, that is, whether the execution result is successful when operating such elements is judged, whether the function of retrieving the element positioning mode is triggered is judged according to the execution result, after the accurate positioning mode is successfully retrieved, the picture attribute or the text attribute is further acquired for accurate matching, the upgrading process is smoothly executed through various fault-tolerant modes, and if the retrieval fails, it is judged that the upgrading fails, and the upgrading operation of other versions is continued.

[0064] As shown in Figure 3 It is a flow chart of an automatic test method for upgrading and downgrading of a switch in a preset mode of the application,

[0065] First, the test environment is built, then the upgrading image is prepared, then the page element positioning mode configuration file is preset, the script is checked, the upgrading execution times are set and maintained, then the script is manually started to execute, the automatic script simulates mouse clicking of a web interface to execute the upgrading operation;

[0066] The execution result of the element is checked, if the check is passed, the check is directly asserted to be completed, the next version upgrading is executed, and if the check is not passed, the element positioning mode automatic retrieval function is triggered;

[0067] The execution result of the positioning mode is checked, if the check is passed, the picture or the text attribute is acquired, if the check is not passed, the upgrading is asserted to fail, and the next version upgrading is performed;

[0068] It is judged whether the picture or the text is the target page element, if not, the upgrading is asserted to fail, and the next version upgrading is performed, if yes, the result is asserted, the retrieval is completed, and the positioning method of the page element is updated.

[0069] After all versions of each type of page element are tested, the function test script logic process is run, the result is asserted, and the test report is output.

[0070] The script processing mode is described by way of example.

[0071] In the case that the positioning mode of a certain page element is different in different versions of the same application, multiple positioning mode schemes (i.e., scheme 1, scheme 2, scheme 3, scheme 4, and the like) are preset in a configuration file. In the script execution process, when the default positioning mode fails, the multi-fault-tolerant page element positioning mode retrieval is started, that is, the preset positioning schemes (i.e., scheme 1, scheme 2, scheme 3, scheme 4, and the like) are searched and matched. In the retrieval process, when the positioning mode with the execution result of True is matched, the retrieval is exited, and the retrieved new positioning mode is used to obtain the picture or text attribute, so as to further accurately match and position the target page element. If the new positioning mode has the execution result of True and the picture or text attribute matches the pre-judged value successfully, the retrieval is completed, the positioning method of the target element is updated, the script continues to be executed, otherwise, the version upgrade is exited and marked as failed, and then the next version upgrade is continued.

[0072] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, and the like within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. An automated testing method for pre-configured switching upgrade / downgrade processes, characterized in that, Includes the following steps: S1, Set up the test environment, prepare to upgrade the image, and configure the configuration file for pre-setting the page element positioning method; S2, check the automated script, set the number of times to execute upgrade / downgrade and save, then manually start executing the automated script; Step S2 specifically includes: Open the script using the RIDE tool, select the scripts to be executed, set the number of upgrades and downgrades, save, and click the "start" button to trigger the automated script execution; The automation scripts consist of four modules: public data, page elements, business processes, and test cases. The public data module communicates with the page element module to store public data, including device IP, web login username and password, and pre-upgrade image file; The page element module communicates and connects with the public data module and business process module to upgrade the script for locating page elements in the process. The business process module communicates with the page element module and the test case module to execute the upgrade process, verify the execution results of the difference elements, enable fault tolerance, automatically retrieve the preset positioning method, accurately locate the element again according to the element image or text attributes, and verify the upgrade execution results. The test case module communicates with the business process module to assert results and generate automated test result reports. S3, the automated script simulates mouse clicks on the web interface to perform an upgrade operation. It determines whether the execution result is successful for each type of page element. If successful, it asserts the result, completes the verification, and executes the next version upgrade. Otherwise, it triggers an automated search for page element location methods and judges the search results. If the search result matches successfully, it exits the search, uses the retrieved location method to obtain image or text attributes, and judges whether the image or text attributes match the page element. If the search result fails to match, it asserts that the upgrade has failed and executes the next version upgrade. If the image or text attribute matches successfully, it asserts the result, completes the search, and updates the page element location method. If the match fails, it asserts that the upgrade has failed and executes the next version upgrade. Step S3 specifically includes: The script determines whether the operation on each type of page element is successful. Specifically, during the process of simulating mouse clicks on page elements, the script will perform validation for page elements with different positioning methods in different versions. That is, it will determine whether the operation on such page elements is successful. If the operation result is True, the result will be asserted, the validation will be completed, and the next version upgrade will be executed. Otherwise, the automatic retrieval of page element positioning methods will be triggered. S4, after completing all versions of testing for each type of page element, runs the functional test script logic process, asserts the results, and outputs the test report.

2. The automated testing method for pre-configured switch upgrade / downgrade processing as described in claim 1, characterized in that, Step S1 specifically includes: Setting up the test environment includes powering on the switch to be tested, connecting it directly to a PC, setting up a Python environment, and installing the RobotFrame tool.

3. The automated testing method for pre-configured switch upgrade / downgrade processing as described in claim 1, characterized in that, Step S1 further includes: Preparing the upgrade image involves placing the image to be upgraded in the automation script folder.

4. The automated testing method for pre-configured switching upgrade / downgrade processing as described in claim 1, characterized in that, Step S1 further includes: The configuration file for pre-setting page element positioning methods is as follows: collect page elements whose positions on the web interface will change when the same application is upgraded in different versions, and pre-set the page element positioning methods for the corresponding page elements in different versions in the configuration file.

5. The automated testing method for pre-configured switching upgrade / downgrade processing as described in claim 1, characterized in that, Step S3 further includes: The page element positioning method is automatically retrieved. Specifically, it obtains a data list of preset positioning methods for the corresponding element, then iterates through the data list to find values ​​in the data set where the result of operating on the target element according to this positioning method is True.

6. The automated testing method for pre-configured switch upgrade / downgrade processing as described in claim 5, characterized in that, Step S3 further includes: The system determines whether image or text attributes match page elements. Specifically, it retrieves the corresponding image attributes or text content based on the new positioning method of the retrieved page elements, matches the image attributes or text content, and updates the positioning method of page elements in the automated script.

Citation Information

Patent Citations

  • User interface automatic test method and device, electronic device and storage medium

    CN109669873A

  • Automatic test method and device

    CN108075938A

  • Web automatic test method and device

    CN112579456A