A method and system for software testing of an electric energy meter

CN113918448BActive Publication Date: 2025-08-01CHINA ELECTRIC POWER RESEARCH INSTITUTE CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111035471.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-01
Publication Date
2025-08-01
Estimated Expiration
2041-09-01

AI Technical Summary

Technical Problem

[0003]本公开的实施例提供了一种电能表软件测试的方法及系统,以至少解决现有技术中存在的需要以第三方形式对电能表软件APP进行接口标准化测试,以界定问题根因和归属的技术问题

Benefits of technology

[0010] In the present invention, through the APP test tool applied to design and development, the third-party and interchangeability tests of the IoT meter APP are assisted to be realized. The hidden bugs or defects that do not conform to the interface specifications left during the APP development process are effectively identified and verified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113918448B_ABST
    Figure CN113918448B_ABST
Patent Text Reader

Abstract

The present application discloses a method and a system for testing an electric energy meter software. Among them, the method includes: implementing each interface of the electric energy meter software APP in the Windows environment according to the programming standard of the electric energy meter software and the system interface standard of the electric energy meter, and generating an executable program for virtual operation of the electric energy meter software; in the virtual operation environment, calling an interface function to record the electric energy meter data, and checking whether the input parameters of each interface of the electric energy meter software APP and the service data and technical means called conform to the standard according to the electric energy meter data; when the executable program for virtual operation of the electric energy meter software is initialized, monitoring and recording the memory size applied by the executable program for virtual operation of the electric energy meter software; when the executable program for virtual operation of the electric energy meter software runs normally, measuring the length of time for the executable program for virtual operation of the electric energy meter software to occupy the CPU resources once through the clock segment provided by the system kernel, and counting and recording the number of times the APP calls the system within one second.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of smart electricity meter software, and particularly to a method and system for testing electricity meter software. Background Art

[0002] With the development of smart electricity meter technology and the deepening application of business requirements, the software functions of electricity meters have become increasingly complex, gradually forming a software technology architecture with separation of platform and application. The separation of software APP and platform supports independent development, each playing its own advantages. At the same time, matching and compatibility problems are likely to occur. Therefore, it is necessary to conduct interface standardization testing on the electricity meter software APP in the form of a third party to define the root cause and attribution of problems. Summary of the Invention

[0003] Embodiments of the present disclosure provide a method and system for testing electricity meter software to at least solve the technical problem in the prior art that it is necessary to conduct interface standardization testing on the electricity meter software APP in the form of a third party to define the root cause and attribution of problems.

[0004] According to one aspect of the embodiments of the present disclosure, a method for testing electricity meter software is provided, including: implementing each interface of the electricity meter software APP according to the electricity meter software programming standard and the electricity meter system interface standard in the windows environment to generate an executable program for virtual operation of the electricity meter software;

[0005] In the virtual operation environment, calling an interface function to record electricity meter data, and checking whether the input parameters of each interface of the electricity meter software APP and the business data and technical means called conform to the standard according to the electricity meter data;

[0006] When the executable program for virtual operation of the electricity meter software is initialized, monitoring and recording the memory size applied by the executable program for virtual operation of the electricity meter software; when the executable program for virtual operation of the electricity meter software is running normally, measuring the length of time for the executable program for virtual operation of the electricity meter software to occupy the CPU resources once through the clock segment provided by the system kernel, and counting and recording the number of times the APP calls the system within one second.

[0007] According to another aspect of the embodiments of the present disclosure, a system for testing electricity meter software is also provided, including: a program generation module for implementing each interface of the electricity meter software APP according to the electricity meter software programming standard and the electricity meter system interface standard in the windows environment to generate an executable program for virtual operation of the electricity meter software;

[0008] A data verification module for calling an interface function to record electricity meter data in the virtual operation environment, and checking whether the input parameters of each interface of the electricity meter software APP and the business data and technical means called conform to the standard according to the electricity meter data;

[0009] A monitoring and recording module, configured to monitor and record the memory size applied by the executable program of the virtual operation of the electricity meter software when the executable program of the virtual operation of the electricity meter software is initialized; when the executable program of the virtual operation of the electricity meter software runs normally, measure the time length of the executable program of the virtual operation of the electricity meter software occupying the CPU resources once through the clock slice provided by the system kernel, and count and record the number of times the APP calls the system within one second.

[0010] In the present invention, through the APP test tool applied to design and development, the third-party and interchangeability tests of the IoT meter APP are assisted to be realized. The hidden bugs or defects that do not conform to the interface specifications left during the APP development process are effectively identified and verified. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The drawings described herein are used to provide a further understanding of the present disclosure, and constitute a part of this application. The illustrative embodiments of the present disclosure and their descriptions are used to explain the present disclosure, and do not constitute an improper limitation to the present disclosure. In the drawings:

[0012] Figure 1 is a schematic flowchart of a method for testing an electricity meter software according to an embodiment of the present disclosure;

[0013] Figure 2 is a schematic diagram of a system for testing an electricity meter software according to an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0014] Now, exemplary embodiments of the present invention will be introduced with reference to the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. These embodiments are provided to disclose the present invention in detail and completely, and to fully convey the scope of the present invention to those skilled in the art. The terms in the exemplary embodiments shown in the drawings are not limitations to the present invention. In the drawings, the same unit / element uses the same reference numeral.

[0015] Unless otherwise specified, the terms (including scientific and technical terms) used herein have the ordinary meaning understood by those skilled in the art. In addition, it can be understood that the terms defined in the commonly used dictionary should be understood to have the same meaning as the context of their related fields, and should not be understood as idealized or overly formal meanings.

[0016] According to the first aspect of the present application, a method 100 for testing an electricity meter software is provided. Referring to Figure 1 as shown, the method 100 includes:

[0017] S102: According to the software programming standard of the electric energy meter and the system interface standard of the electric energy meter, in the Windows environment, implement each interface of the electric energy meter software APP, and generate an executable program for the virtual operation of the electric energy meter software;

[0018] S104: In the virtual operation environment, call the interface function to record the electric energy meter data, and check whether the input parameters of each interface of the electric energy meter software APP and the business data and technical means called meet the standards according to the electric energy meter data;

[0019] S106: When the executable program for the virtual operation of the electric energy meter software is initialized, monitor and record the memory size applied by the executable program for the virtual operation of the electric energy meter software; when the executable program for the virtual operation of the electric energy meter software is running normally, measure the time length of the executable program for the virtual operation of the electric energy meter software occupying the CPU resources once through the clock slice provided by the system kernel, count the number of times the APP calls the system within one second and record it.

[0020] Specifically, simulate the devices and services required for the operation of the electric energy meter software APP through WINDOS application programming, virtualize the operation environment of the electric energy meter software APP, and run the test environment in the form of a third party. Embed interface test functions in the simulated operation environment, record and analyze the data when the software APP calls the system interface, trace the on-site data when the electric energy meter software APP runs abnormally, monitor the consumption of system resources by the APP, test the performance indicators of the APP, and output the test data in an appropriate form:

[0021] Step 1:

[0022] According to the programming standard of the electric energy meter software APP, the system interface standard, etc., program under WINDOS, and implement each interface of the electric energy meter software APP with WINDOS resources to generate an executable program for the virtual operation of the electric energy meter APP software.

[0023] Step 2:

[0024] Design and develop a hook function for the APP interface program call in the virtual operation environment, record the scene when the interface function is called, and the hook function specifically records the context register group and the data values of the working register group at the entrance of the current function; judge the compliance of the input parameters of the APP interface and the called business and technology, and record the input parameter data values when they do not meet the requirements, and display and throw a call error to the system, prompting the specific error type and reason.

[0025] Step 3:

[0026] Design a monitoring function for the initialization and operation of the APP. When the APP is initialized, monitor and record the size of the memory space applied for by the APP, and determine whether the applied memory size exceeds the system-set value. If it exceeds the set value, record and prompt an error. During the normal operation of the APP, measure and calibrate the length of time the APP occupies the CPU resources once through the clock slices provided by the system kernel, count the number of times the APP calls the system within one second, and record it. By designing a memory out-of-bounds monitoring program, record memory exception information. When memory exceptions such as accessing memory that has been released on the heap, accessing the heap buffer overflow, accessing the stack buffer overflow, accessing the global buffer overflow, accessing memory that has been released on the stack, using stack objects beyond the defined range, and memory leakage occur, immediately stop running, record the memory address information, and record the current context working register group and the working register group.

[0027] Thus, through the APP test tool applied to design and development, the third-party and interchangeability tests of the IoT meter APP are assisted to be realized. Effectively identify and verify the hidden bugs or defects that do not conform to the interface specifications left over during the APP development process.

[0028] Optionally, in the virtual running environment, call the interface function to record the watt-hour meter data, and check whether the input parameters of each interface of the watt-hour meter software APP and the business data and technical means called conform to the standards according to the watt-hour meter data, including:

[0029] In the virtual running environment, call the hook function through the executable program for virtual running of the watt-hour meter software, call the interface function to record the watt-hour meter data according to the hook function, and check whether the input parameters of each interface of the watt-hour meter software APP and the business data and technical means called conform to the standards according to the watt-hour meter data.

[0030] Optionally, in the virtual running environment, call the interface function to record the watt-hour meter data, and check whether the input parameters of each interface of the watt-hour meter software APP and the business data and technical means called conform to the standards, and it also includes:

[0031] When the input parameters of each interface of the watt-hour meter software APP and the business data and technical means called do not conform to the standards, record the input parameter data values of each interface of the watt-hour meter software APP, and display the call error and the type and cause of the error;

[0032] The watt-hour meter data includes the data values of the context register group and the working register group.

[0033] When the executable program for virtual running of the watt-hour meter software is initialized, monitor and record the memory size applied for by the executable program for virtual running of the watt-hour meter software, including:

[0034] When the executable program of the virtual operation of the electricity meter software is initialized, monitor and record the memory size applied for by the executable program of the virtual operation of the electricity meter software;

[0035] Judge whether the applied memory size exceeds the system set value. If the applied memory size exceeds the system set value, record and prompt an error.

[0036] Optionally, when the executable program of the virtual operation of the electricity meter software is initialized, monitor and record the memory size applied for by the executable program of the virtual operation of the electricity meter software; when the executable program of the virtual operation of the electricity meter software is running normally, measure the length of time for the executable program of the virtual operation of the electricity meter software to occupy the CPU resources once through the clock slice provided by the system kernel, count and record the number of times the APP calls the system within one second, and further include:

[0037] By designing a memory out-of-bounds monitoring program, record memory exception information. When a memory exception occurs, stop running, record the memory address information, and record the current context working register group and the working register group.

[0038] Optionally, the memory exception includes at least one of the following:

[0039] Accessing memory that has been released on the heap, heap buffer access overflow, stack buffer access overflow, global buffer access overflow, accessing memory that has been released on the stack, stack object usage exceeding the defined range, and memory leakage.

[0040] Thus, through the APP test tool applied to design and development, the third-party and interchangeability tests of the Internet of Things meter APP are assisted to be realized. Effectively identify and verify the hidden bugs or defects that do not conform to the interface specifications left over during the APP development process.

[0041] According to the second aspect of the present application, a system 200 for testing the electricity meter software is further provided. The system 200 includes:

[0042] A program generation module 210, configured to implement each interface of the electricity meter software APP in the windows environment according to the electricity meter software programming standard and the electricity meter system interface standard, and generate an executable program for the virtual operation of the electricity meter software;

[0043] A data verification module 220, configured to call an interface function to record electricity meter data in a virtual operation environment, and verify whether the input parameters of each interface of the electricity meter software APP and the service data and technical means called conform to the standard according to the electricity meter data;

[0044] The monitoring and recording module 230 is used to monitor and record the memory size applied for by the virtual running executable program of the electricity meter software when the virtual running executable program of the electricity meter software is initialized; when the virtual running executable program of the electricity meter software is running normally, measure the time taken for the virtual running executable program of the electricity meter software to occupy the CPU resources once through the clock slice provided by the system kernel, and count and record the number of times the APP calls the system within one second.

[0045] Optionally, the verification data module 220 includes:

[0046] The verification sub-module is used to call the hook function through the virtual running executable program of the electricity meter software in the virtual running environment, record the electricity meter data according to the interface function called by the hook function, and verify whether the input parameters of each interface of the electricity meter software APP and the service data and technical means called meet the standards according to the electricity meter data.

[0047] Optionally, the verification data module 220 further includes:

[0048] The display error sub-module is used to record the input parameter data values of each interface of the electricity meter software APP, and display the call error and the type and cause of the error when the input parameters of each interface of the electricity meter software APP and the service data and technical means do not meet the standards;

[0049] The electricity meter data includes the data values of the context register group and the data values of the working register group.

[0050] Optionally, the monitoring and recording module 230 includes:

[0051] The monitoring and recording memory sub-module is used to monitor and record the memory size applied for by the virtual running executable program of the electricity meter software when the virtual running executable program of the electricity meter software is initialized;

[0052] The judgment memory sub-module is used to judge whether the applied memory size exceeds the system setting value. If the applied memory size exceeds the system setting value, record and prompt an error.

[0053] Optionally, the monitoring and recording module 230 further includes:

[0054] By designing a memory out-of-bounds monitoring program, record memory exception information. When a memory exception occurs, stop running, and record the memory address information, the current context working register group and the working register group.

[0055] Optionally, the memory exception includes at least one of the following:

[0056] Accessing memory on the heap that has been released, accessing heap buffer overflows, accessing stack buffer overflows, accessing global buffer overflows, accessing memory on the stack that has been released, using stack objects beyond the defined scope, and memory leaks.

[0057] A system 200 for testing an electric energy meter software according to an embodiment of the present invention corresponds to a method 100 for testing an electric energy meter software according to another embodiment of the present invention, which will not be elaborated herein.

[0058] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes. The solutions in the embodiments of the present application can be implemented in various computer languages, for example, object-oriented programming languages such as Java and interpreted scripting languages such as JavaScript.

[0059] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowchart and / or block diagram can also be implemented. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing devices to generate a machine, so that the instructions executed by the processors of the computer or other programmable data processing devices generate means for implementing the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0060] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means implements the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0061] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Therefore, the instructions executed on the computer or other programmable device provide means for implementing the specified functions in Figure 1Steps of the functions specified in one or more processes and / or boxes Figure 1 and / or one or more boxes.

[0062] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications that fall within the scope of the present application.

[0063] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

Claims

1. A method for testing an electricity meter software, characterized in that, Including: According to the software programming standard of the electric energy meter and the system interface standard of the electric energy meter, in the Windows environment, implement each interface of the electric energy meter software APP, and generate an executable program for the virtual operation of the electric energy meter software; In the virtual operation environment, call the interface function to record the electric energy meter data, and check whether the input parameters of each interface of the electric energy meter software APP and the service data and technical means called conform to the standard according to the electric energy meter data; When the executable program for the virtual operation of the electric energy meter software is initialized, monitor and record the memory size applied by the executable program for the virtual operation of the electric energy meter software; when the executable program for the virtual operation of the electric energy meter software runs normally, measure the length of time for the executable program for the virtual operation of the electric energy meter software to occupy the CPU resources once through the clock segment provided by the system kernel, and count and record the number of times the APP calls the system within one second; In the virtual operation environment, call the interface function to record the electric energy meter data, and check whether the input parameters of each interface of the electric energy meter software APP and the service data and technical means called conform to the standard according to the electric energy meter data, including: In the virtual operation environment, call the hook function through the executable program for the virtual operation of the electric energy meter software, record the electric energy meter data according to the hook function, and check whether the input parameters of each interface of the electric energy meter software APP and the service data and technical means called conform to the standard according to the electric energy meter data; In the virtual operation environment, call the interface function to record the electric energy meter data, and check whether the input parameters of each interface of the electric energy meter software APP and the service data and technical means called conform to the standard according to the electric energy meter data, and also include: When the input parameters of each interface of the electric energy meter software APP and the service data and technical means called do not conform to the standard, record the input parameter data values of each interface of the electric energy meter software APP, and display the call error and the type and cause of the error; The electric energy meter data includes the data values of the context register group and the data values of the working register group; When the executable program for the virtual operation of the electric energy meter software is initialized, monitor and record the memory size applied by the executable program for the virtual operation of the electric energy meter software, including: When the executable program for the virtual operation of the electric energy meter software is initialized, monitor and record the memory size applied by the executable program for the virtual operation of the electric energy meter software; Judge whether the applied memory size exceeds the system set value. If the applied memory size exceeds the system set value, record and prompt an error; When the executable program for the virtual operation of the electric energy meter software is initialized, monitor and record the memory size applied by the executable program for the virtual operation of the electric energy meter software; when the executable program for the virtual operation of the electric energy meter software runs normally, measure the length of time for the executable program for the virtual operation of the electric energy meter software to occupy the CPU resources once through the clock segment provided by the system kernel, and count and record the number of times the APP calls the system within one second, and also include: By designing a memory out-of-bounds monitoring program, record the memory exception information. When a memory exception occurs, stop running, record the memory address information, and record the current context working register group and the working register group; The memory anomalies include at least one of the following: Accessing memory on the heap that has already been freed, accessing the heap buffer beyond its bounds, accessing the stack buffer beyond its bounds, accessing the global buffer beyond its bounds, accessing memory on the stack that has already been freed, using a stack object beyond its defined scope, and memory leakage; In a virtual running environment, design and develop an APP interface program to call a hook function to record the context when the interface function is called. The hook function specifically records the context register group and the data values of the working register group when the current function enters. Judge the compliance of the input parameters of the APP interface and the called service in terms of compliance and technology. When it does not comply, record the input parameter data values and display and throw a call error to the system, indicating the specific error type and reason; Design a monitoring function for APP initialization and running. When the APP is initialized, monitor and record the size of the memory space applied for by the APP, and judge whether the applied memory size exceeds the system setting value. If it exceeds the setting value, record and prompt an error. During the normal operation of the APP, measure and calibrate the length of time the APP occupies the CPU resources once through the clock slice provided by the system kernel, count the number of times the APP calls the system within one second and record it. By designing a memory out-of-bounds monitoring program, record memory anomaly information. When memory anomalies such as accessing memory on the heap that has already been freed, accessing the heap buffer beyond its bounds, accessing the stack buffer beyond its bounds, accessing the global buffer beyond its bounds, accessing memory on the stack that has already been freed, using a stack object beyond its defined scope, and memory leakage occur, immediately stop running and record the memory address information, record the current context working register group and the working register group.

2. A system for testing an electricity meter software, characterized in that, It includes: A program generation module for implementing each interface of the electricity meter software APP in a Windows environment according to the electricity meter software programming standard and the electricity meter system interface standard, and generating an executable program for virtual running of the electricity meter software; A data verification module for calling an interface function to record electricity meter data in a virtual running environment, and verifying whether the input parameters of each interface of the electricity meter software APP and the service data and technical means of the call conform to the standard according to the electricity meter data; A monitoring and recording module for monitoring and recording the size of the memory applied for by the virtual running executable program of the electricity meter software when the virtual running executable program of the electricity meter software is initialized; when the virtual running executable program of the electricity meter software is running normally, measure the length of time the virtual running executable program of the electricity meter software occupies the CPU resources once through the clock slice provided by the system kernel, count the number of times the APP calls the system within one second and record it; The data verification module includes: A verification sub-module for calling a hook function through the virtual running executable program of the electricity meter software in a virtual running environment, recording electricity meter data according to the hook function calling the interface function, and verifying whether the input parameters of each interface of the electricity meter software APP and the service data and technical means of the call conform to the standard according to the electricity meter data; The data verification module further includes: A display error sub-module, which is used to record the input parameter data values of each interface of the smart meter software APP and display the call error, as well as the type and cause of the error, when the input parameters of each interface of the smart meter software APP, the service data and technical means called do not meet the standards; The smart meter data includes the context register group data value and the working register group data value; A monitoring and recording module, including: A monitoring and recording memory sub-module, which is used to monitor and record the memory size applied by the virtual running executable program of the smart meter software when the virtual running executable program of the smart meter software is initialized; A judgment memory sub-module, which is used to judge whether the applied memory size exceeds the system set value. If the applied memory size exceeds the system set value, record and prompt an error; The monitoring and recording module also includes: By designing a memory out-of-bounds monitoring program, record memory exception information. When a memory exception occurs, stop running, record the memory address information, record the current context working register group and the working register group; The memory exception includes at least one of the following: Accessing memory that has been released on the heap, heap buffer access overflow, stack buffer access overflow, global buffer access overflow, accessing memory that has been released on the stack, stack object usage exceeding the defined range, and memory leakage; Design and develop an APP interface program call hook function in the virtual running environment to record the scene when the interface function is called. The hook function specifically records the context register group and the working register group data value when the current function enters; judge the compliance of the APP interface input parameters and the called service and technical compliance. When it does not meet the requirements, record the input parameter data value, and display and throw a call error to the system, prompting the specific error type and cause; Design a monitoring function for APP initialization and operation. When the APP is initialized, monitor and record the memory space size applied by the APP, and judge whether the applied memory size exceeds the system set value. If it exceeds the set value, record and prompt an error. During the normal operation of the APP, measure and calibrate the length of time for the APP to occupy the CPU resources once through the clock slice provided by the system kernel, count the number of times the APP calls the system within one second and record it. By designing a memory out-of-bounds monitoring program, record memory exception information. When memory exceptions such as accessing memory that has been released on the heap, heap buffer access overflow, stack buffer access overflow, global buffer access overflow, accessing memory that has been released on the stack, stack object usage exceeding the defined range, and memory leakage occur, immediately stop running, record the memory address information, and record the current context working register group and the working register group.

Citation Information

Patent Citations

  • Electric energy meter-oriented virtualization test method and system

    CN110907882A

  • Python-based anomaly capture method and device, and computer readable storage medium

    CN112181815A