OTA upgrade pressure automatic test method and system and readable storage medium
By automating OTA upgrade testing using Python scripts, test cases are generated, device status is monitored in real time, and results are verified. This solves the problem of low efficiency in manual operation in existing technologies and achieves efficient and reliable OTA upgrade stress testing.
Patent Information
- Application Number
- CN202511768495.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-02-27
AI Technical Summary
In existing technologies, OTA upgrade stress testing relies on manual operation, resulting in low testing efficiency, lack of reliability, and inability to achieve continuous stress testing.
OTA upgrade test cases are written using Python scripts. The automated scripts simulate click operations, monitor device status in real time, automatically verify upgrade results, and generate test reports.
It automates and automates the OTA upgrade process, improves testing efficiency and accuracy, and enables continuous 24/7 stress testing.
Smart Images

Figure CN121579040A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automated testing technology, and in particular to an automated test method, system, and readable storage medium for OTA upgrade stress testing. Background Technology
[0002] Currently, stress testing for OTA (Over-The-Air) upgrades of smart hardware devices primarily relies on manual operation. This typically requires developers to manually upload the firmware version to be upgraded to a cloud-based MQTT server. Testers then manually click the upgrade button in the management interface, manually observe device restarts, check version numbers, and verify real-time log information to see if the device has received the new version information, downloads the new version, and performs the upgrade. They then confirm the upgrade's success by checking real-time log information again. OTA upgrade stress testing may require thousands of iterations, consuming at least tens of thousands of hours. This manual approach to OTA upgrade stress testing has the following drawbacks: Testers need to pay close attention to observe the transmission and upgrade results throughout the process. When the firmware needs to be transmitted and upgraded repeatedly, it will waste a lot of testers' time, resulting in low testing efficiency and failing to meet the testing needs of rapid iteration. Furthermore, excessive reliance on human factors makes manual inspection prone to misjudgment due to fatigue, resulting in a lack of reliability. Moreover, it is impossible to achieve continuous stress testing, such as difficulty in conducting different stress tests 24 / 7.
[0003] Therefore, how to provide an automated, efficient, and reliable OTA upgrade stress testing solution has become an urgent technical problem to be solved. Summary of the Invention
[0004] To address the problems of existing technologies where manual OTA upgrade stress testing consumes a significant amount of testers' time, resulting in low testing efficiency, excessive reliance on human factors leading to unreliable checks, and an inability to achieve continuous stress testing, this application provides an automated, efficient, and highly reliable OTA upgrade stress testing method, system, and readable storage medium.
[0005] Specifically, this application discloses an automated OTA upgrade stress testing method, which includes: Test environment setup and preparation; On the test equipment, a Python environment was used to install the Selenium library using a Python package management tool, and OTA upgrade test cases were written using the Python scripting language. The automated upgrade triggering step involves marking upgrade triggering elements on the OTA management page with a script and simulating click operations to initiate OTA upgrade commands. Monitor the upgrade status of the equipment; By continuously sending network probe requests to the device, the online status of the device can be monitored in real time; based on changes in the device's network connection status, it can be determined whether the device upgrade is complete. Verify the upgrade result; after the device restarts and returns to online status, obtain the current firmware version number by accessing the device's version information interface or parsing the relevant page; compare the obtained version number with the target upgrade version number to verify whether the upgrade was successful; The test loop and test report generation output.
[0006] The OTA upgrade stress automated testing method is characterized in that the automated upgrade triggering step includes: Import the time module, subprocess module, selenium module, and frequently used methods and classes from the selenium module; Define constants and unify configuration parameters; Create a browser for all subsequent webpage operations; Log in to the router and navigate to the firmware upgrade page; Check the router's current version number and update status; To perform the upgrade, once it is confirmed that the current device is using the new version, the tester clicks the upgrade button to perform the upgrade.
[0007] The step of checking the router's current version number and update status includes: Get the current version number displayed on the page; The version number displayed on the current page is compared with the version number entered by the tester. If they match, it means that the version number of the device under test is correct; otherwise, an error is reported, and the tester is prompted to confirm the version of the device under test. Check the correctness of the current device version to avoid accidental upgrades.
[0008] The monitoring of the upgrade status of the equipment includes the following steps: Send probe packets to the device using the PING command of a network probing tool; Analyze the detection response to determine the network connection status of the device; The upgrade is determined based on changes in the device's network connection status; if not, probe packets are sent to the device via the PING command using a network probing tool.
[0009] The verification of the upgrade results includes: Log back into the page and go to the upgrade page to obtain the current firmware version through the device's firmware version information interface; The current version information is compared with the target upgrade version information; the upgraded version is verified to be correct; if the upgraded version is consistent with the version number preset by the tester, the upgrade is successful; otherwise, an error is reported and the tester is notified. An upgrade result report will be generated based on the above verification results.
[0010] The steps for generating and outputting the test cycle and test report include: Execute the loop test multiple times based on the test case set; Collect test data; Generate a visual test report based on the collected test data; Push the test report to the designated test management system.
[0011] This application discloses an automated OTA upgrade stress testing system. The system includes an environment preparation module for sequentially forming a test loop through data connections, an upgrade triggering module, a device status monitoring module, an upgrade result verification module, and a loop and report output module. The environment preparation module is used to set up and prepare the test environment; The upgrade triggering module is used to mark the upgrade triggering elements on the OTA management page through scripts and simulate click operations to initiate OTA upgrade commands; The device status monitoring module is used to monitor the upgrade status of the device; the device status monitoring module includes a device status detection unit, an analysis response unit, and an upgrade completion detection unit. The detection device status unit is used to send detection packets to the device via the PING command of the network detection tool; the detection interval time can be set as needed. The analysis response unit is used to analyze the detection response and determine the network connection status of the device by analyzing the detection response; The upgrade completion detection unit is used to determine whether the upgrade is complete based on changes in the device's network connection status. The upgrade result verification module is used to verify whether the device upgrade was successful. The loop and report output module is used for loop testing and generates a visual test report.
[0012] The upgrade triggering module includes an import and configuration unit, a browser creation unit, a login unit, a version check unit, a new version detection unit, and an upgrade execution unit. The import and configuration unit is used to import frequently used methods and classes from the time module, subprocess module, selenium module, and selenium module, and to define constants and configure parameters uniformly. The browser creation unit is used to create a browser, which facilitates the operation of all subsequent web pages; The login operation unit completes login authentication by entering a login account and password; The version checking unit is used to obtain the current version number displayed on the page and compare the version number displayed on the page with the version number entered by the tester. If they match, it means that the version number of the device under test is correct; otherwise, an error is reported and the tester is reminded to confirm the version of the device under test. The new version detection unit is used to check the correctness of the current device version and determine whether it is a new version; The upgrade execution unit is used to perform the upgrade operation. When it is determined that the current device is a new version, the tester clicks the upgrade button to perform the upgrade operation.
[0013] The upgrade result verification module includes a re-login unit, a version reading unit, and a result comparison unit. The re-login unit is used to recreate the browser and log in; The version reading unit obtains the current firmware version through the device's firmware version information interface; The result comparison unit is used to compare the acquired current version information with the target upgrade version; verify whether the upgraded version is correct; if the upgraded version is consistent with the preset version number of the tester, the upgrade is successful; otherwise, an error is reported, the tester is reminded, and an upgrade result report is generated.
[0014] The present invention also proposes a readable storage medium storing a test program, which, when executed by a processor, implements the steps of the OTA upgrade stress automated testing method as described in any of the preceding claims.
[0015] The OTA upgrade stress automated testing method, system, and readable storage medium of this application, by marking upgrade trigger elements on the OTA management page with scripts, realizes the automation and intelligence of the OTA upgrade process, avoiding manual operation by testers and significantly improving testing efficiency. Furthermore, the entire testing process is monitored in real time for changes in device status, enabling real-time monitoring and intelligent analysis of the upgrade process, timely location and detection of problems during the upgrade, and automatic verification and cyclic testing of the upgrade results, further improving the accuracy and reliability of the test results. The testing method described in this application can greatly improve testing efficiency and accuracy. Attached Figure Description
[0016] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings: Figure 1 This is the first flowchart of the OTA upgrade stress automated testing method of the present invention; Figure 2 This is a flowchart of the test environment setup for the OTA upgrade stress automated testing method of the present invention; Figure 3 This is a flowchart of the automated upgrade triggering method of the OTA upgrade stress automated testing method of the present invention; Figure 4 This is a flowchart of the router's current version number and update status method in the OTA upgrade stress automated testing method of the present invention; Figure 5 This is a flowchart of the device upgrade status monitoring method of the OTA upgrade stress automated testing method of the present invention; Figure 6 This is a flowchart of the upgrade structure verification method of the OTA upgrade stress automated testing method of the present invention; Figure 7 This is a flowchart of the test cycle machine test report generation and output steps of the OTA upgrade stress automated testing method of the present invention; Figure 8 This is a structural block diagram of the OTA upgrade stress automated testing system of the present invention; Figure 9 This is a structural block diagram of the upgrade trigger module of the OTA upgrade stress automated testing system of the present invention; Figure 10 This is a structural block diagram of the device status monitoring module of the OTA upgrade stress automated testing system of the present invention; Figure 11 This is a structural block diagram of the upgrade result verification module of the OTA upgrade stress automated testing system of the present invention; Figure 12 This is a structural block diagram of the loop and report output module of the OTA upgrade stress automated testing system of the present invention. Detailed Implementation
[0017] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.
[0018] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustrative purposes and has no specific meaning in itself. Therefore, "module," "part," or "unit" may be used interchangeably.
[0019] Example 1 This invention provides an automated method for OTA upgrade stress testing. Please refer to [link / reference]. Figures 1 to 7 The method specifically includes the following implementation steps: S10. Test environment setup and preparation: On the test equipment, based on the Python environment, install the Selenium library using Python's package management tool, and write OTA upgrade test cases using the Python scripting language. Specifically, the setup and preparation of the test environment includes the following steps: S101. Install a Python environment on the computer used for OTA upgrade stress testing. The Python version is 3.7.9. In one embodiment, the Python version can also be 3.8.5. S102. Install the selenium library using Python's package manager. The selenium library version is 3.141.59; in one embodiment, the selenium library version can also be 4.0.0. S103. Write OTA upgrade test cases using the Python scripting language, including the marking of upgrade trigger elements and upgrade operation instructions; In one embodiment, the upgrade trigger element includes the button's label, ID, etc.; S104. Integrate test cases into the test suite and configure test environment parameters, including device model, firmware version, number of tests, etc.
[0020] S20, Automated Upgrade Triggering Steps The OTA upgrade command is initiated by marking upgrade trigger elements (such as button labels and IDs) on the OTA management page using scripts and simulating click operations. Specifically, the steps include the following: S201. Import the time module, subprocess module, selenium module, and frequently used methods and classes in the selenium module; Specifically, a time module is imported for sleep waiting; a subprocess module is introduced for PING to check if the device has restarted successfully; and the webDriver module of the selenium module is introduced to control the browser to open web pages and simulate user operations. Based on the provided element location methods such as ID and tags, common waiting conditions (such as element visibility, clickability, text appearance, etc.) are introduced, and an upgrade is triggered when a certain condition is met (such as element appearance, clickability, etc.).
[0021] The implemented program code is as follows: import time import subprocess from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC S202. Define constants and unify configuration parameters; Specifically, the unified configuration parameters include settings for the maximum number of PING attempts, the PING interval, the restart wait time, the login wait time, and the page loading wait time. Furthermore, in this embodiment, MAX_PING_ATTEMPTS = 60 can be set to detect whether the device has completed restarting; the PING interval can be set to 10 seconds, and PING_INTERVAL = 10, meaning the waiting time for each PING check is 10 seconds; REBOOT_WAIT_TIME = 30, meaning the initial waiting time after the device starts restarting is set to 30 seconds; LOGIN_WAIT_TIME = 30, meaning the login waiting time is set to 30 seconds, that is, the maximum time for waiting for the page to load and for login to succeed is 30 seconds; PAGE_LOAD_WAIT_TIME = 2, meaning the page loading waiting time is set to 2 seconds; that is, the waiting time after navigating to a new page is set to 2 seconds.
[0022] S203. Create a browser for all subsequent webpage operations; Specifically, a browser is created and returned for all subsequent webpage operations, including login, navigation, and clicking. The browser can be the Edge browser, which can support extensions. In one embodiment, it can be changed to support browsers such as Chrome and Firefox through parameter control.
[0023] S204. Log in to the router and navigate to the firmware upgrade page; Specifically, this includes opening the router login page, such as http: / / {router_ip; entering the login password, locating the password input box (ID: userpassword_ctrl); clicking the login button, locating the login button (ID: loginbtn), and waiting for successful login. When the homepage element (ID: home) appears, it indicates successful login. If login failure is displayed, return to the login page, enter the password again, and continue until successful login, then redirect to the firmware upgrade page.
[0024] S205. Check the router's current version number and update status; Specifically, it includes: S2051. Get the current version number displayed on the page; S2052. Compare the version number displayed on the current page (page_current_version) with the version number (expected_version) entered by the tester. If they match, it means that the version number of the device under test is correct; otherwise, report an error and remind the tester to confirm the version of the device under test. S2053. Check the correctness of the current device version to avoid accidental upgrades.
[0025] Check if the upgrade page of the device under test has indicated that a new version has been detected. Ensure that the current device version is correct to prevent accidental upgrades to the wrong version. Specifically, check if you need to manually click "Check for updates". If the button text says "Check for updates", click it to check if there is a new version. Once the device has detected a new version, prepare to proceed to the next upgrade step.
[0026] This can be achieved using the following code. def check_for_updates(driver): "Check if there is a new version." try: # Check if you need to click the "Check for Updates" button check_button = driver.find_element(By.ID, "onlinecheck") button_text = check_button.text print(f"Detect button text: {button_text}") If "Check for updates" is in button_text: print("Checking for updates...") check_button.click() time.sleep(5) else: print("New version detected") # Check if there is a new version new_version_elements = driver.find_elements(By.ID, "onlineupdate") if not new_version_elements: print("No new version available") return None print("New version found") return new_version_elements[0] except Exception as e: print(f"An error occurred while checking for updates: {e}") return None S206. Perform the upgrade operation. Once it is confirmed that the current device is the new version, the tester clicks the upgrade button to perform the upgrade operation.
[0027] Specifically, clicking the "Upgrade" button passes in the element returned by check_for_updates(); the user click operation is simulated using ChromeDriver from the selenium library, triggering the OTA upgrade command; the system waits for the upgrade and responds according to the set waiting time.
[0028] S30. Monitor the upgrade status of the device by continuously sending network probe requests to the device to monitor its online status in real time; determine whether the device upgrade is complete based on changes in the device's network connection status.
[0029] Specifically, after initiating the upgrade, the device's online status is monitored in real time by continuously sending network probe requests (such as ICMP PING commands); based on the device's status change from "online" to "offline" and then back to "online", it is determined that the device has completed the upgrade and restart.
[0030] In this embodiment, the system waits for and checks whether the device under test has completed the upgrade and restart by PING. If the PING is successful, it indicates that the device under test has completed the upgrade and restart; otherwise, an error is reported, and the device is notified that the restart timed out. Specifically, the method includes the following steps: S301. Send probe packets to the device using the PING command of the network detection tool at a preset probe interval of 5 seconds. S302. Analyze the detection response to determine the network connection status of the device; Specifically, the network connection status of the device includes "online" and "offline" states.
[0031] S303. Determine whether the upgrade is complete based on the changes in the device's network connection status. If not, return to step 301; if complete, proceed to step S40.
[0032] Specifically, the change in the state includes the device network connection state changing from "online" to "offline" and then back to "online". If the device has completed the upgrade and restart, it can proceed to the next step. If the device network connection state is only in the state of "online" to "offline" or only one of these states, it means that the upgrade has not been completed, and the process returns to step 301 to continue network detection.
[0033] This application monitors the device status in real time by continuously sending network probe requests to the device, and determines whether the device has completed the upgrade and restart based on the device's status changes from "online" to "offline" and then back to "online". This enables real-time monitoring and intelligent analysis of the upgrade process, and allows for timely detection and location of problems during the upgrade process.
[0034] S40. Verify the upgrade result. After the device restarts and returns to online status, obtain the current firmware version number by accessing the device's version information interface or parsing the relevant page. Compare the obtained version number with the target upgrade version number to verify whether the upgrade was successful. This includes the following steps: S401. Log in again and enter the upgrade page. Obtain the current firmware version through the device's firmware version information interface. S402. Compare the obtained current version information with the target upgrade version information; verify whether the upgraded version is correct; if the upgraded version is consistent with the version number preset by the tester, the upgrade is successful; otherwise, report an error and remind the tester. S403. Generate an upgrade result report based on the above verification results.
[0035] Specifically, the result report includes reading the upgraded version string through the DOM and performing an equality comparison with target_version; if they are equal, the CPU writes an "upgrade successful" log to memory; otherwise, a report with version mismatch exception information is thrown.
[0036] This application obtains the current firmware version number by accessing the device's version information interface or parsing relevant pages, and compares it with the target upgrade version number, thereby realizing automatic verification of OTA upgrade results and improving the accuracy of test results.
[0037] S50, Test Cycle, and Test Report Generation and Output Steps S501. Perform the above steps S20-S40 repeatedly to conduct cyclic testing based on the test case set. Specifically, the test is performed repeatedly based on the test case set. The number of tests can be set as needed, for example, the number of tests can be set to 5. S502. Collect test data, including upgrade results, time consumption, and other indicators; S503. Generate a visual test report based on the collected test data; S504. Push the test report to the designated test management system.
[0038] This application employs a cyclical testing and report generation process, automatically recording the success / failure status and time consumption information for each upgrade, and generating a final test report. This achieves standardized and normalized processing of test results, ensuring their reliability.
[0039] This application, based on a Python environment with the Selenium library installed, uses scripts to mark upgrade trigger elements on the OTA management page, achieving automation and intelligence in the OTA upgrade process. This avoids manual operation by testers and significantly improves testing efficiency. Furthermore, the entire testing process monitors device status changes in real time, performs real-time monitoring and intelligent analysis of the upgrade process, promptly locates and discovers problems during the upgrade process, and automatically verifies and iterates the upgrade results, further improving the accuracy and reliability of the test results. The testing method described in this application can greatly improve testing efficiency and accuracy.
[0040] Example 2 This application further provides an automated OTA upgrade stress testing system. Please refer to [link to relevant documentation]. Figures 8 to 12 The OTA upgrade stress automated testing system includes an environment preparation module 10, an upgrade trigger module 20, a device status monitoring module 30, an upgrade result verification module 40, and a loop and report output module 50. The data of each module is connected in sequence to form a closed-loop stress test circuit.
[0041] Please see Figures 8 to 9 The environment preparation module 10 is used to set up and prepare the test environment; on the test device, based on the Python environment, the selenium library is installed through the Python package management tool, and OTA upgrade test cases are written through the Python scripting language.
[0042] The upgrade triggering module 20 is used to mark the upgrade triggering elements of the OTA management page through scripts and simulate click operations to initiate OTA upgrade commands; The upgrade triggering module 20 includes an import and configuration unit 21, a browser creation unit 22, a login unit 23, a version check unit 24, a new version detection unit 25, and an upgrade execution unit 26.
[0043] The import and configuration unit 21 is used to import frequently used methods and classes from the time module, subprocess module, selenium module, and selenium module, and to define constants and configure parameters uniformly.
[0044] Specifically, the import and configuration unit 21 imports a time module for sleep waiting; introduces a subprocess module for PING detection of whether the device has restarted successfully; introduces the webDriver of the selenium module for controlling the browser to open web pages and simulate user operations. Based on the provided element location methods such as ID and tags, it introduces common waiting conditions (such as element visibility, clickability, and text appearance). When a certain condition is met (such as element appearance or clickability), an upgrade is triggered; and configures constant definitions, including setting the maximum number of PING attempts, the PING interval, the restart waiting time, the login waiting time, and the page loading waiting time.
[0045] The browser creation unit 22 is used to create a browser, which facilitates the operation of all subsequent web pages.
[0046] The login operation unit 23 completes login authentication by entering a login account and password.
[0047] This includes entering driver.find_element(By.ID, “userpassword_ctrl”) and “loginbtn” to complete authentication.
[0048] The version checking unit 24 is used to obtain the current version number displayed on the page and compare the version number displayed on the current page with the version number entered by the tester. If they match, it means that the version number of the device under test is correct; otherwise, an error is reported, and the tester is reminded to confirm the version of the device under test.
[0049] Specifically, the text CLASS_NAME="currentversion" is read and compared with the expected version; The new version detection unit 25 is used to check the correctness of the current device version and determine whether it is a new version.
[0050] If the button with ID="onlinecheck" contains the text "Check for updates", click it and wait for the element with ID="onlineupdate" to appear; The upgrade execution unit 26 is used to perform the upgrade operation. When it is determined that the current device is a new version, the tester clicks the upgrade button to perform the upgrade operation.
[0051] Specifically, click the button with ID="onlineupdate" to officially issue the upgrade command.
[0052] The device status monitoring module 30 is used to monitor the upgrade status of the device, including a device status detection unit 301, an analysis and response unit 302, and an upgrade completion detection unit 303.
[0053] The detection device status unit 301 is used to send detection packets to the device via the PING command of the network detection tool; the detection interval time can be set as needed. The analysis response unit 302 is used to analyze the detection response and determine the network connection status of the device by analyzing the detection response; The upgrade completion detection unit 303 is used to determine whether the upgrade is complete based on changes in the network connection status of the device.
[0054] The upgrade result verification module 40 is used to verify whether the device upgrade is successful, and specifically includes a re-login unit 41, a version reading unit 42, and a result comparison unit 43.
[0055] The re-login unit 41 is used to recreate the browser and log in; The version reading unit 42 obtains the current firmware version through the device's firmware version information interface and extracts the upgraded version string through CLASS_NAME="currentversion"; The result comparison unit 43 is used to compare the acquired current version information with the target upgrade version; verify whether the upgraded version is correct; if the upgraded version is consistent with the preset version number of the tester, the upgrade is successful; otherwise, an error is reported, the tester is reminded, and an upgrade result report is generated.
[0056] The loop and report output module 50 is used for testing loops and generating visual test reports. The loop and report module 50 includes a data collection unit 501, a report generation unit 502, and a report push unit 503 that are interconnected.
[0057] The data collection unit 501 is used to collect test data, which includes indicators such as upgrade results and time consumption.
[0058] The report generation unit 502 is used to generate a visualized test report based on the collected test data; The collected test data includes records of the results, time consumption, and anomalies of each loop test, and a CSV / HTML visual test report is generated after all loop tests are completed.
[0059] The report push unit 503 is used to push the test report to the designated test management system.
[0060] The OTA upgrade stress testing system described in this application simulates manual clicking on a web management page to issue upgrade commands using the Selenium framework. The device status monitoring module 30 detects the network connection status of the device under test ("online-offline-online"), and the upgrade result verification module 40 and the loop and reporting module 50 confirm successful upgrade through dual verification. The system automatically verifies the OTA upgrade result by comparing the current firmware version number with the target upgrade version number. The system automatically loops between the two firmware versions a specified number of times, ultimately generating a visual test report. Compared to purely manual operation, this solution enables 24 / 7 uninterrupted stress testing, improving efficiency by two orders of magnitude, and providing high reliability. It can be seamlessly ported to smart hardware scenarios such as routers, IPCs, and set-top boxes for OTA upgrade stress testing.
[0061] It should be noted that the above system embodiments and method embodiments belong to the same concept. The specific implementation process can be found in the method embodiments. Furthermore, the technical features in the method embodiments are also applicable to the system embodiments, and will not be repeated here.
[0062] Based on the above embodiments, the present invention also proposes a readable storage medium storing a test program, which, when executed by a processor, implements the steps of the OTA upgrade stress automated testing method as described in any of the above embodiments.
[0063] It should be noted that the above-described medium embodiments and method embodiments belong to the same concept. The specific implementation process can be found in the method embodiments, and the technical features in the method embodiments are also applicable to the medium embodiments, which will not be repeated here.
[0064] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0065] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0066] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0067] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.
Claims
1. An OTA upgrade pressure automation testing method, characterized in that, The method comprises: Test environment setup and preparation; Based on the Python environment on the test device, install the selenium library through the package management tool of Python, and write OTA upgrade test cases through the Python script language; Automatic upgrade triggering step, mark the upgrade triggering element of the OTA management page through the script, simulate the click operation, and initiate the OTA upgrade instruction; Monitoring the upgrade state of the device; Real-time monitoring of the online state of the device by continuously sending network probe requests to the device; according to the network connection state change of the device, it is judged whether the device is upgraded or not; Verify the upgrade result; after the device restarts and recovers online, access the device version information interface or parse the relevant page to obtain the current firmware version number; compare the obtained version number with the target upgrade version number to verify whether the upgrade is successful; Test cycle and test report generation and output.
2. The OTA upgrade pressure automation testing method of claim 1, wherein, The automatic upgrade triggering step comprises: Import time module, subprocess module, selenium module and frequently used methods and classes in selenium module; Constant definition, unified configuration parameters; Create a browser for subsequent web page operations; Login to the router and navigate to the firmware upgrade page; Check the current version number and update state of the router; Perform the upgrade operation, and when it is determined that the current device is a new version, the tester clicks the upgrade button to perform the upgrade operation.
3. The OTA upgrade pressure automation testing method of claim 2, wherein, The step of checking the current version number and update state of the router comprises: Obtain the current version number displayed on the page; Compare the version number displayed on the current page with the version number input by the tester; when they are consistent, it indicates that the version number of the device under test is correct, otherwise, an error is reported, and the tester is reminded to confirm the version of the device under test; Check the correctness of the current device version to avoid misupgrade.
4. The OTA upgrade pressure automation testing method of claim 1, wherein, The step of monitoring the upgrade state of the device comprises: Send a probe packet to the device through the network probe tool PING command; Analyze the probe response to determine the network connection state of the device; According to the network connection state change of the device, it is judged whether the upgrade is completed or not; if not, continue to send a probe packet to the device through the network probe tool PING command.
5. The OTA upgrade pressure automation testing method of claim 1, wherein, The step of verifying the upgrade result comprises: Re-login the page and enter the upgrade page, and obtain the current firmware version through the firmware version information interface of the device; Compare the obtained current version information with the target upgrade version information; check whether the version after upgrade is correct; if the version after upgrade is consistent with the version number preset by the tester, it indicates that the upgrade is successful, otherwise, an error is reported, and the tester is reminded; Generate an upgrade result report according to the above verification result.
6. The OTA upgrade pressure automation testing method of claim 1, wherein, The test cycle and test report generation and output step comprises: According to the test case set, execute the loop test multiple times; Collect test data; Generate a visual test report based on the collected test data; Push the test report to the specified test management system.
7. An OTA upgrade pressure automation test system, characterized in that, The system comprises an environment preparation module, an upgrade triggering module, a device state monitoring module, an upgrade result verification module, and a cycle and report output module which are sequentially connected to form a test loop, wherein The environment preparation module is configured to build and prepare a test environment. The upgrade triggering module is configured to mark an upgrade triggering element of an OTA management page by a script and simulate a click operation to initiate an OTA upgrade instruction. The device state monitoring module is configured to monitor an upgrade state of the device. The detection device state unit is configured to send a detection packet to the device by a PING command of a network detection tool. The analysis response unit is configured to analyze a detection response to determine a network connection state of the device. The upgrade completion detection unit is configured to determine whether the upgrade is completed according to a network connection state change of the device. The upgrade result verification module is configured to verify whether the device upgrade is successful. The cycle and report output module is configured to cycle the test and generate a visual test report.
8. The OTA upgrade pressure automation test system of claim 7, wherein, The upgrade triggering module includes an import and configuration unit, a browser creation unit, a login unit, a version checking unit, a new version detection unit, and an upgrade execution unit. The import and configuration unit is configured to import a time module, a sub-process module, a selenium module, and frequently used methods and classes in the selenium module, and define constants and configure parameters uniformly. The browser creation unit is configured to create a browser to facilitate subsequent operations on all web pages. The login unit is configured to complete login authentication by inputting a login account and a password. The version checking unit is configured to compare a version number displayed on a current page with a version number input by a test personnel, and determine that the version number of the device under test is correct when the version numbers are consistent, or report an error and remind the test personnel to confirm the version of the device under test. The new version detection unit is configured to check the correctness of the current device version and determine whether it is a new version. The upgrade execution unit is configured to perform an upgrade operation when it is determined that the current device is a new version.
9. The OTA upgrade pressure automation test system of claim 7 or 8, wherein, The upgrade result verification module includes a re-login unit, a version reading unit, and a result comparison unit. The re-login unit is configured to re-create a browser and log in. The version reading unit is configured to obtain a current firmware version through a firmware version information interface of the device. The result comparison unit is configured to compare the obtained current version information with a target upgrade version, check whether the upgraded version is correct, and generate an upgrade result report if the upgraded version is consistent with the preset version number input by the test personnel, or report an error and remind the test personnel.
10. A readable storage medium, characterized by, The readable storage medium stores a test program, and the test program is executed by the processor to implement the steps of the OTA upgrade stress automatic test method according to any one of claims 1 to 7.