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.