An automated testing method for reliability of smart energy meter software upgrade
The abnormal upgrade test cases are executed through the LUA automated script platform, which solves the safety hazards in abnormal situations during the upgrade of the smart power meter software, and ensures the reliability and stability of the upgrade function.
Patent Information
- Application Number
- CN202411812582.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-01
AI Technical Summary
It is easy to occur during the upgrade of smart power meter software, such as transmission interruption, data packet leakage and illegal transmission permissions, which leads to unreliable upgrades and poses huge security risks.
The LUA automated script platform is used to execute abnormal upgrade test cases, simulate various abnormal scenarios, and judge the reliability of the upgrade results by comparing the data before and after the upgrade, and output the test result document.
Ensure that when abnormal situations occur during on-site transmission of the power meter upgrade file, the power meter upgrade function is reliable, improves testing efficiency and automation, and reduces safety hazards.
Smart Images

Figure CN119739636A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automatic testing of electric energy meters, and more specifically, to an automatic testing method for software upgrade reliability of smart electric energy meters. Background Art
[0002] In recent years, with the popularization of smart grids, thousands of smart energy meters have been installed on the grid. When a software failure occurs in an energy meter, a firmware upgrade is required. However, the complex environment on site will affect the upgrade, resulting in a variety of abnormal upgrade situations during the on-site transmission of the upgrade file, which is very common in the process of upgrading a large number of meters. If the meter cannot properly handle the abnormal upgrade situation, it will cause huge safety hazards. The reliability of the energy meter software upgrade is one of the core indicators for evaluating the quality of the energy meter.
[0003] Currently, upgrade tests for electric energy meters are mainly carried out under normal upgrade procedures, and there is a lack of targeted testing for abnormal situations. Summary of the invention
[0004] The purpose of the present invention is to propose an automated testing method for the abnormal problem of smart electric energy meter software upgrade, which can perform effective testing in the production stage to ensure that the electric energy meter upgrade function is reliable when an abnormal situation occurs during the on-site transmission of the electric energy meter upgrade file.
[0005] The technical solution of the present invention is:
[0006] The present invention provides an automated testing method for the reliability of software upgrade of a smart electric energy meter, the method comprising the following steps:
[0007] Obtain the pre-upgrade test data of the electric energy meter under test;
[0008] Execute abnormal upgrade test cases through the LUA automated script platform, and control the test bench to perform error verification on the electric energy meter under test;
[0009] Obtain the upgraded test data of the tested electric energy meter;
[0010] According to the data before the upgrade test and the data after the upgrade test, it is determined whether the upgrade result of the tested electric energy meter meets expectations, and a test result document is output.
[0011] Furthermore, the abnormal upgrade test case includes:
[0012] Upgrade file transfer interruption test case, upgrade file data packet random transmission test case, upgrade file data packet missing test case, upgrade file data packet transmission content error test case, upgrade file data packet transmission length error test case and upgrade file illegal transmission permission test case.
[0013] Furthermore, the LUA automation script platform is connected to the test bench body and the electric energy meter under test respectively through the communication serial port, and the test bench body is connected to the electric energy meter under test. The LUA automation script platform can call the communication protocol dynamic library and the test bench body dynamic library to realize data interaction with the electric energy meter under test and the test bench body.
[0014] Furthermore, the interface between the LUA automation script platform and the electric energy meter under test and the interface of the test bench body support optical port, RS485, 4G and RS232.
[0015] Furthermore, the LUA automated script platform can modify the transmission content, transmission length, transmission order, and transmission permissions of the upgrade file data packet, and call upgrade-related commands according to the electric energy meter communication protocol dynamic library to perform abnormal upgrade testing.
[0016] Furthermore, the pre-upgrade test data and post-upgrade test data include:
[0017] The electric energy meter upgrade result, internal storage data and error verification data, the electric energy meter upgrade result includes two situations: upgrade success and upgrade failure, the internal storage data includes power, maximum demand, events and curves, and the error verification data includes metering error and clock error.
[0018] Furthermore, when the upgrade result of the electric energy meter is successful, the firmware of the electric energy meter is updated; when the upgrade result of the electric energy meter is failed, the electric energy meter still uses the original firmware.
[0019] Further, determining the upgrade result of the electric energy meter is achieved by comparing whether the version numbers of the electric energy meter firmware before and after the upgrade test are consistent;
[0020] The internal storage data is determined by comparing whether the internal storage data of the electric energy meter before and after the upgrade test are consistent;
[0021] The error verification data is determined by comparing the error verification result of the electric energy meter after the upgrade test to see whether it meets the requirements.
[0022] Beneficial effects of the present invention:
[0023] The method of the present invention can test the situations of smart electric energy meter upgrade file transmission interruption, random transmission of upgrade file data packets, missing upgrade file data packets, upgrade file data packet transmission content errors, upgrade file data packet transmission length errors, and illegal upgrade file transmission permissions, and can ensure that the electric energy meter upgrade function is reliable when the above-mentioned abnormal situations occur during the on-site transmission process of the electric energy meter upgrade file.
[0024] The test method of the present invention is automated and can perform a comprehensive, convenient and rapid check on the data before and after the test, which can save manpower, improve test efficiency and reduce the risk of operational errors by testers. The method can automatically generate a test document in CSV format, which can be used for problem location, cause analysis and test management.
[0025] The abnormal upgrade test method for an electric energy meter of the present invention adopts a LUA automated script platform to execute preset abnormal upgrade test cases for various abnormal situations that may occur during the upgrade process of the electric energy meter, simulating various abnormal scenarios such as upgrade file transmission interruption, random data packet transmission, packet leakage, content error, etc.; by comparing the internal storage data and error verification data before and after the upgrade, the reliability of the upgrade function is judged.
[0026] The present invention also realizes the communication connection with the electric energy meter and the simulation of abnormal conditions by calling the electric energy meter communication protocol dynamic library and the test bench dynamic library. The method of the present invention automatically generates a formatted test report including the test process log, data comparison results and error verification results; improves the automation and comprehensiveness of the abnormal upgrade test of the electric energy meter, and effectively ensures the reliability and stability of the electric energy meter upgrade function.
[0027] Other features and advantages of the present invention will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The above and other objects, features and advantages of the present invention will become more apparent through a more detailed description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components throughout the exemplary embodiments of the present invention.
[0029] Figure 1 The flowchart of the automated testing method for the reliability of software upgrade of a smart electric energy meter of the present invention is shown.
[0030] Figure 2 A schematic diagram of the test case execution steps of the present invention is shown. DETAILED DESCRIPTION
[0031] The preferred embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0032] Example 1
[0033] Figure 1 The flowchart of the automated testing method for the reliability of software upgrade of a smart electric energy meter of the present invention is shown.
[0034] like Figure 1 As shown, the present invention provides an automated testing method for the reliability of smart electric energy meter software upgrade, which may specifically include:
[0035] The pre-upgrade data of the electric energy meter under test is obtained, wherein the pre-upgrade data includes internal storage data and error verification data of the electric energy meter, wherein the internal storage data includes electric quantity, maximum demand, events, curves, etc.
[0036] The LUA automated script platform is used to perform upgrade operations on the tested electric energy meter according to preset abnormal upgrade test cases. The abnormal upgrade test cases include upgrade file transmission interruption, random transmission of upgrade file data packets, upgrade file data packet leakage, upgrade file data packet transmission content error, upgrade file data packet transmission length error, upgrade file illegal transmission permission, etc.
[0037] Obtain the upgrade results, internal storage data after the upgrade and error verification data after the upgrade of the electric energy meter under test.
[0038] It is determined whether the upgrade result is consistent with the expectation, whether the internal storage data after the upgrade is consistent with the internal storage data before the upgrade, and whether the error verification data after the upgrade meets the preset conditions.
[0039] If the judgment result is yes, it is determined that the upgrade function of the tested electric energy meter is reliable, and a test qualified result document is output; if the judgment result is no, it is determined that the upgrade function of the tested electric energy meter is unreliable, and a test unqualified result document is output.
[0040] In one example, the error verification data includes a measurement error and a clock error, and the preset condition is that the measurement error and the clock error are both within an allowable range.
[0041] In one example, before the LUA automation script platform is used to perform the upgrade operation, it also includes: establishing a communication connection with the electric energy meter under test through the LUA automation script platform; when the LUA automation script platform is used to perform the upgrade operation, the LUA automation script platform calls the electric energy meter communication protocol dynamic library to send an upgrade instruction, and controls the test bench body through the test bench body dynamic library to simulate the upgrade abnormality.
[0042] In one example, when outputting the test result document, the LUA automated script platform exports information such as the test process log, data comparison results before and after the upgrade, and error detection results, and generates a formatted test report document.
[0043] Example 2
[0044] Figure 2 A schematic diagram of the test case execution steps of the present invention is shown.
[0045] like Figure 2 The invention discloses an automated test method for reliability of software upgrade of a smart electric energy meter. The test cases are written and run using a LUA automated script platform according to abnormal upgrade conditions of the electric energy meter.
[0046] This test case specifically includes the following steps:
[0047] S1, upgrade file transfer interruption test;
[0048] S2, random transmission test of upgrade file data packets;
[0049] S3, test the upgrade file data packet for missing packets and refilling packets;
[0050] S4, upgrade file data packet transmission content error test;
[0051] S5. Test the transmission length error of the upgrade file data packet.
[0052] S6, upgrade file illegal transfer permission test;
[0053] The S1, S2, S3, S4, S5, and S6 test steps are in parallel. The test cases of each individual step need to use the LUA automated script platform to judge the test data and output the corresponding test result documents.
[0054] After the test cases of each step of the present invention are executed, the expected test results are as follows:
[0055] The expected results of step S1 are as follows:
[0056] The upgrade was successful; the internal storage data was not affected; the verification error met the customer's requirements
[0057] The expected results of step S2 are as follows:
[0058] The upgrade was successful; the internal storage data was not affected; the verification error met the customer's requirements
[0059] The expected results of the S3 step are as follows:
[0060] Upgrade failed; internal storage data is not affected; verification error meets customer requirements
[0061] The expected results of step S4 are as follows:
[0062] Upgrade failed; internal storage data is not affected; verification error meets customer requirements
[0063] The expected results of step S5 are as follows:
[0064] Upgrade failed; internal storage data is not affected; verification error meets customer requirements
[0065] The expected results of step S6 are as follows:
[0066] Upgrade failed; internal storage data is not affected; verification error meets customer requirements
[0067] If the test result meets the above expected results, the test result is judged as qualified, otherwise, it is unqualified, and the test result document in CSV format is output.
[0068] The test steps of S1 specifically include the following steps:
[0069] The LUA automated script platform obtains the data before the upgrade test, executes upgrade-related commands, and starts the upgrade process. The script platform controls the generation of various upgrade transmission interruptions, including power failure of the platform, closing the communication serial port, sending disconnection data frames, and then continues to transmit until all upgrade data packets are fully transmitted. The script platform obtains the data required after the upgrade test, determines whether the data before and after the test should meet the expected results of S1, and outputs the test document.
[0070] The test steps of S2 specifically include the following steps:
[0071] The LUA automated script platform obtains the pre-upgrade test data, executes upgrade-related commands, and starts the upgrade process. The script platform transmits upgrade data packets in a random order until all data packets are fully transmitted.
[0072] The script platform obtains the data required after the upgrade test, determines the data before and after the test, and whether it meets the expected results of S2, and outputs the test document.
[0073] The test steps of S3 specifically include the following steps:
[0074] The LUA automated script platform obtains the data before the upgrade test, executes the upgrade-related commands, and starts the upgrade process. Only part of the upgrade data package is transmitted, and some upgrade packages are not transmitted, which meets the packet leakage situation. The script platform obtains the data required after the upgrade test, determines that the data before and after the test should meet the expected results of S3, and outputs the test document.
[0075] The test step of S4 specifically includes the following steps:
[0076] The LUA automated script platform obtains the data before the upgrade test, executes the upgrade-related commands, and starts the upgrade process. The script platform modifies the content of the upgrade data packet, generates an upgrade data packet with incorrect content, and completes the transmission of the upgrade data packet with incorrect content. The script platform obtains the data required after the upgrade test, determines whether the data before and after the test should meet the expected results of S4, and outputs the test document.
[0077] The test step of S5 specifically includes the following steps:
[0078] The LUA automated script platform obtains the data before the upgrade test, executes the upgrade-related commands, and starts the upgrade process. The script platform modifies the upgrade data packet length and generates an upgrade data packet with an incorrect length. Transmit to the end. The LUA automated script platform obtains the data required after the upgrade test, determines whether the data before and after the test should meet the expected results of S5, and outputs the test document.
[0079] The test step of S6 specifically includes the following steps:
[0080] The LUA automated script platform obtains the data before the upgrade test, executes the upgrade-related commands, and starts the upgrade process. The script platform uses illegal client permissions to upgrade, and the meter should refuse to upgrade. The script platform obtains the data required after the upgrade test, determines that the data before and after the test should meet the expected results of S6, and outputs the test document.
[0081] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments.
Claims
1. An automated testing method for the reliability of smart electric energy meter software upgrade, characterized in that: The method comprises the following steps: Obtain the pre-upgrade test data of the electric energy meter under test; Execute abnormal upgrade test cases through the LUA automated script platform, and control the test bench to perform error verification on the electric energy meter under test; Obtain the upgraded test data of the tested electric energy meter; According to the data before the upgrade test and the data after the upgrade test, it is determined whether the upgrade result of the tested electric energy meter meets expectations, and a test result document is output.
2. The automated testing method for the reliability of smart electric energy meter software upgrade according to claim 1 is characterized in that: The abnormal upgrade test cases include: Upgrade file transfer interruption test case, upgrade file data packet random transmission test case, upgrade file data packet missing test case, upgrade file data packet transmission content error test case, upgrade file data packet transmission length error test case and upgrade file illegal transmission permission test case.
3. The automated testing method for the reliability of smart electric energy meter software upgrade according to claim 1 is characterized in that: The LUA automation script platform is connected to the test bench body and the electric energy meter under test respectively through the communication serial port, and the test bench body is connected to the electric energy meter under test. The LUA automation script platform can call the communication protocol dynamic library and the test bench body dynamic library to realize data interaction with the electric energy meter under test and the test bench body.
4. The automated testing method for the reliability of smart electric energy meter software upgrade according to claim 3 is characterized in that: The interface between the LUA automated script platform and the electric energy meter under test and the interface of the test bench body support optical port, RS485, 4G and RS232.
5. The automated testing method for the reliability of smart electric energy meter software upgrade according to claim 1 is characterized in that: The LUA automated script platform can modify the transmission content, transmission length, transmission sequence, and transmission authority of the upgrade file data packet, and call upgrade-related commands according to the electric energy meter communication protocol dynamic library to perform abnormal upgrade testing.
6. The automated testing method for the reliability of smart electric energy meter software upgrade according to claim 1 is characterized in that: The pre-upgrade test data and post-upgrade test data include: The electric energy meter upgrade result, internal storage data and error verification data, the electric energy meter upgrade result includes two situations: upgrade success and upgrade failure, the internal storage data includes power, maximum demand, events and curves, and the error verification data includes metering error and clock error.
7. The automated testing method for the reliability of smart electric energy meter software upgrade according to claim 6 is characterized in that: When the upgrade result of the electric energy meter is successful, the electric energy meter firmware is updated; when the upgrade result of the electric energy meter is failed, the electric energy meter still uses the original firmware.
8. The automated testing method for the reliability of smart electric energy meter software upgrade according to claim 6 is characterized in that: The upgrade result of the electric energy meter is determined by comparing whether the version numbers of the electric energy meter firmware before and after the upgrade test are consistent; The internal storage data is determined by comparing whether the internal storage data of the electric energy meter before and after the upgrade test are consistent; The error verification data is determined by comparing the error verification result of the electric energy meter after the upgrade test to see whether it meets the requirements.