Disclosure of Invention
Based on the foregoing, there is a need to provide a method, an apparatus, a computer device and a storage medium for testing a dual-core smart meter, which are capable of comprehensively testing various functions of an application layer of the dual-core smart meter.
A method of testing a dual-core smart meter, the method comprising:
obtaining a tested code, wherein the tested code is a code of a double-core intelligent ammeter application layer;
performing functional test on a basic application program of the application layer based on the tested code to obtain a first result;
metering and testing the basic application program based on the tested code to obtain a second result;
Performing performance test on the application layer based on the tested code to obtain a third result;
and generating a test report according to the first result, the second result and the third result.
In one embodiment, the performing, based on the tested code, a functional test on the basic application program of the application layer, to obtain a first result includes:
performing upgrade test on the basic application program based on the tested code to obtain an upgrade test result;
starting test is carried out on the basic application program based on the tested code, and a starting test result is obtained;
performing unloading test on the basic application program based on the tested code to obtain an unloading test result;
performing a system reset test on the basic application program based on the tested code to obtain a reset test result;
and determining a first result according to the upgrade test result, the start test result, the unload test result and the reset test result.
In one embodiment, the upgrade test comprises: loading test, file and version control test, upgrade interrupt test and first influence test;
the initiation test includes: repeatedly stopping power-on start test and upgrading start test;
The unloading test comprises the following steps: a bin file deletion test, a configuration file deletion test, a data file deletion test, a system resource release test and a second impact test.
In one embodiment, the performing the metering test on the basic application program based on the tested code to obtain a second result includes:
performing time-sharing electric quantity test on the basic application program based on the tested code to obtain a time-sharing electric quantity test result;
performing combined electric quantity test on the basic application program based on the tested code to obtain a combined electric quantity test result;
performing data synchronization test on the basic application program based on the tested code to obtain a data synchronization test result;
performing electric parameter test on the basic application program based on the tested code to obtain an electric parameter test result;
performing electric quantity display test on the basic application program based on the tested code to obtain an electric quantity display test result;
performing a third influence test on the basic application program based on the tested code to obtain a third influence test result;
performing zero clearing test on the basic application program based on the tested code to obtain a zero clearing test result;
And determining a second result according to the time-sharing electric quantity test result, the combined electric quantity test result, the data synchronization test result, the electric quantity display test result, the third influence test result and the zero clearing influence test result.
In one embodiment, the performing, by the application layer, a performance test based on the code under test, to obtain a third result includes:
performing resource test on the application layer based on the tested code to obtain a resource test result;
performing response test on the application layer based on the tested code to obtain a response test result;
and determining a third result according to the resource test result and the response test result.
In one embodiment, the resource test includes: newly increasing the resource test of the extended application program, unloading the resource test of the extended application program and upgrading the resource test of the extended application program;
the response test includes: external communication response time testing and internal data interaction response time testing.
In one embodiment, the method further comprises: and carrying out interchangeability test on the basic application program to obtain an interchangeability test result, wherein the interchangeability test comprises the following steps: after replacing the basic application program with a candidate application program similar to the basic application program, performing functional test, performance test and metering test to obtain an interchangeability test result;
Accordingly, the generating a test report according to the first result, the second result and the third result includes:
and generating a test report according to the first result, the second result, the third result and the interchangeability test result.
A test device for a dual-core smart meter, the device comprising:
the system comprises a tested code acquisition module, a tested code acquisition module and a control module, wherein the tested code is a code of a double-core intelligent ammeter application layer;
the function test module is used for carrying out function test on the basic application program of the application layer based on the tested code to obtain a first result;
the metering test module is used for performing metering test on the basic application program based on the tested code to obtain a second result;
the performance test module is used for performing performance test on the application layer based on the tested code to obtain a third result;
and the test report generation test module is used for generating a test report according to the first result, the second result and the third result.
A computer device comprising a memory storing a computer program and a processor which when executing the computer program performs the steps of:
Obtaining a tested code, wherein the tested code is a code of a double-core intelligent ammeter application layer;
performing functional test on a basic application program of the application layer based on the tested code to obtain a first result;
metering and testing the basic application program based on the tested code to obtain a second result;
performing performance test on the application layer based on the tested code to obtain a third result;
and generating a test report according to the first result, the second result and the third result.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
obtaining a tested code, wherein the tested code is a code of a double-core intelligent ammeter application layer;
performing functional test on a basic application program of the application layer based on the tested code to obtain a first result;
metering and testing the basic application program based on the tested code to obtain a second result;
performing performance test on the application layer based on the tested code to obtain a third result;
and generating a test report according to the first result, the second result and the third result.
According to the testing method of the double-core intelligent ammeter, the codes of the application layers of the double-core intelligent ammeter are obtained, the function test and the metering test are carried out on the basic application programs of the application layers based on the obtained tested codes, and the performance test is carried out on the application layers based on the tested codes. According to the method, the application layer is tested in three aspects, namely the function test, the performance test and the metering test, a comprehensive test method is provided, the blank of testing the application layer of the double-core intelligent electric meter is made up, accompanying test software is not needed in the test process, the test result directly reflects each function of the application layer, and the method has high pertinence and accuracy.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The testing method of the double-core intelligent ammeter can be applied to an application environment shown in fig. 1. The test device 102 communicates with the upper computer 104 through a serial port, the test device 102 may obtain a tested code from the dual-core smart meter, and the upper computer 104 sends a test instruction and a file required for testing to the test device 102, so that the test device 102 tests the tested code, generates a test report after a test result is obtained, and sends the test report to the upper computer 104. The test device 102 has the same function as the core board of the dual-core smart meter, and can simulate the operation of the dual-core smart meter, the test device 102 comprises a test program, and the test program can start or stop the process of simulating the operation of the dual-core smart meter so as to realize the code for pertinently testing one function.
In one embodiment, as shown in fig. 2, a method for testing a dual-core smart meter is provided, and the method is applied to the test device in fig. 1 for illustration, and includes the following steps:
step 201, a code under test is obtained.
The code to be tested is a code of an application layer of the dual-core intelligent electric meter. The double-core intelligent ammeter comprises a management core and a metering core, wherein the management core and the metering core are operated separately, the management core can meet diversified requirements of function expansion, remote upgrading and the like, and the metering core is focused on metering stability and reliability. The operating system of the double-core intelligent ammeter comprises an application layer, a middle layer and a kernel layer, wherein various services facing users are realized through the application layer, the services comprise basic services and extended services, the basic services comprise various basic functions such as a metering management function and a freezing function, and the extended services comprise other required functions such as a non-invasive load identification function.
The testing method of the dual-core intelligent ammeter is used for testing whether the codes of the application layer can realize multiple functions of the application layer. The whole code of the double-core intelligent ammeter is divided into a plurality of parts according to functions, wherein the code of the application layer exists in a whole form through encapsulation, and the tested code is obtained through header file analysis and function positioning after the whole code of the double-core intelligent ammeter is obtained.
And 202, performing functional test on the basic application program of the application layer based on the tested code to obtain a first result.
The basic application program is installed in the dual-core intelligent ammeter, and is used for realizing basic services of the dual-core intelligent ammeter for users, including metering management, freezing and the like. The functional test is used for testing whether the basic application program can normally run. The basic application program can be correctly upgraded, started and uninstalled, so that the reliable operation of the dual-core intelligent ammeter is ensured.
The upgrade test is used for testing the upgrade function of the basic application program, the test process simulates various conditions possibly encountered by the upgrade process of the basic application program, and tests whether the basic application program can be upgraded successfully under the various conditions; the starting test is used for testing the starting function of the basic application program, and the testing process simulates whether the basic application program can be normally started under various conditions; the uninstallation test is used for testing the uninstallation function of the basic application program, and whether the operations of releasing resources, deleting files and the like can be correctly performed after the basic application program is uninstalled; the system reset test is used for testing whether the basic application program starts to run normally after the system is reset. The first result is used to reflect whether the functional test passes.
And 203, performing metering test on the basic application program based on the tested code to obtain a second result.
The metering test is used for testing the accuracy of the metering function of the basic application program, specifically, the three-phase meter calibrating table is used for providing working conditions such as voltage, current, power factors and the like for the test equipment so as to measure the accuracy of the metering of the tested code, and further the accuracy of the metering function of the basic application program is tested.
Specifically, the accuracy of time-sharing electric quantity metering, the accuracy of combined electric quantity metering, the accuracy of metering data synchronization, the accuracy of electric parameter metering, the accuracy of electric quantity display, the accuracy of electric quantity settlement and the accuracy of metering influence quantity of the basic application program are tested to obtain a second result.
And 204, performing performance test on the application layer based on the tested code to obtain a third result.
The performance test is used for testing the performance of an application program in an application layer when the application program runs, the application program in the application layer comprises a basic application program and a plurality of extension application programs, the basic application program is used for realizing the basic function of the double-core intelligent electric meter, and the extension application program is used for realizing the extension function of the double-core intelligent electric meter. Performing performance testing on the application layer, including: and carrying out resource test and response test on the application layer, wherein the third result comprises a resource test result and a response test result.
Step 205, generating a test report according to the first result, the second result and the third result.
The test equipment generates a test report according to the first result, the second result and the third result, wherein the first result can be represented by characters, diagrams and the like in the test report, and the second result and the third result can be represented by the test report. The test equipment may send test reports to the host computer.
According to the testing method of the double-core intelligent ammeter, the codes of the application layers of the double-core intelligent ammeter are obtained, the function test and the metering test are carried out on the basic application programs of the application layers based on the obtained tested codes, and the performance test is carried out on the application layers based on the tested codes. According to the method, the application layer is tested in three aspects, namely the function test, the performance test and the metering test, a comprehensive test method is provided, the blank of testing the application layer of the double-core intelligent electric meter is made up, accompanying test software is not needed in the test process, the test result directly reflects each function of the application layer, and the method has high pertinence and accuracy.
In one embodiment, referring to fig. 3, the functional test includes: the system comprises an upgrading test, a starting test, an unloading test and a system resetting test, wherein the functional test results comprise an upgrading test result, a starting test result, an unloading test result and a system resetting test result.
Step 201 comprises:
and step 301, performing upgrade test on the basic application program based on the tested code to obtain an upgrade test result.
Specifically, the upgrade test process is:
(1) Importing an upgrade file of a basic application program into an upper computer, and establishing an upgrade channel between the upper computer and test equipment;
(2) The upper computer sends the upgrade file to a code to be tested, the code to be tested checks the upgrade file, if the check fails, the upgrade is not allowed, and if the check succeeds, the upgrade is allowed;
(3) After the verification is successful, the upper computer sends an upgrade command to the code to be tested, and the code to be tested upgrades the basic application program according to the upgrade command;
(4) And after the upgrading is completed, the upper computer sends an activation command to the code to be tested, and the code to be tested is automatically started according to the activation command.
In one embodiment, referring to FIG. 4, the upgrade test includes: load test, file and version control test, upgrade interrupt test, and first impact test, step 301 includes:
and step 3011, performing file and version control testing on the basic application program based on the tested code to obtain a file and version control testing result.
Wherein the file and version control test comprises: and checking and testing the upgrade file, repeatedly upgrading and testing the same upgrade file, upgrading and testing the high-version upgrade file and upgrading and testing the low-version upgrade file. The file and version control test is performed during the upgrade process.
Specifically, the verification test of the upgrade files is to verify a plurality of upgrade files sent by the test equipment to obtain a verification result corresponding to each upgrade file.
Wherein the plurality of upgrade files include a reference file and an error file, the reference file includes a file not exceeding a preset size, a high version upgrade file and a low version upgrade file, that is, the reference file is a file which can be upgraded successfully theoretically; the high-version upgrade file refers to an upgrade file having a version higher than that of the base application program, and the low-version upgrade file refers to an upgrade file having a version lower than that of the base application program. Error files include files that exceed a preset size, which are files that are theoretically not upgradeable.
If the verification result of each reference file is correct and the verification result of each error file is wrong, the test result of the upgrade file verification test is successful, otherwise, the test result of the upgrade file verification test is failed.
The multiple upgrade tests of the same upgrade file are carried out according to the multiple upgrades of the same upgrade file (reference file). If the upgrade can be successfully performed according to the same upgrade file every time, the test result of the multiple upgrade test of the same upgrade file is successful, otherwise, the test result of the multiple upgrade test of the same upgrade file is failed.
The high-version upgrade file upgrade test is to upgrade according to the high-version upgrade file, if upgrade succeeds, the test result of the high-version upgrade file upgrade test is successful, otherwise, the test result is failure.
The low-version upgrade file upgrade test is to perform rollback upgrade according to the high-version upgrade file, if the upgrade is successful, the test result of the low-version upgrade file upgrade test is successful, otherwise, the test result is failure.
If the upgrade file verification test result, the same upgrade file multiple upgrade test result, the high version upgrade file upgrade test result and the low version upgrade file upgrade test result are all successful, the file and version control test result is successful, otherwise the file and version control test result is failed.
The file and version control test results may include: the upgrade file checks the test result, the same upgrade file upgrades the test result for a plurality of times, the upgrade file upgrades the test result for a high version, and the upgrade file upgrades the test result for a low version.
And step 3012, performing upgrade interrupt test on the basic application program based on the tested code to obtain an upgrade interrupt test result.
Wherein the upgrade interrupt test comprises: the upgrade process interrupts the test and the upgrade process fails the test.
Specifically, when the upper computer sends the upgrade file, the upper computer executes a plurality of interrupt operations and power-off operations, if the upgrade file can be continuously transmitted after each interrupt operation, the upgrade interrupt test result is successful, otherwise, the upgrade interrupt test result is failed. If the upgrade file can be continuously transmitted after each power failure operation, the upgrade power failure test result is successful, otherwise, the upgrade power failure test result is failed.
If the upgrade process interruption test result is successful, the upgrade process power failure test result is successful, and if not, the upgrade interruption test result is failed. The upgrade interruption test results may include upgrade process interruption test results, and upgrade process power outage test results.
And step 3013, performing a first influence test on the basic application program based on the tested code to obtain a first influence test result.
Specifically, before the upgrade, the influence amount is read, and the influence amount includes: version information, metering data, parameter data, event record data, frozen data and running state quantity, after upgrading is completed, reading the influence quantity again, taking the influence quantity read before upgrading as standard data, comparing the influence quantity read after upgrading with the standard data, if the influence quantity read after upgrading has no abnormal change, such as data is disordered, determining that the first influence quantity test result is successful, otherwise, determining that the first influence quantity test result is successful.
And 3014, carrying out loading test on the basic application program based on the tested code to obtain a loading test result.
Specifically, in the upgrade test process, each time the loading of the basic application program is completed, the test result of the loading test is successful, and if the loading of the basic application program fails, the test result of the loading test is failed.
If the test results of the file and version control tests are successful, the test results of the upgrade interrupt test are successful, the test results of the first influence test are successful, the test results of the loading test are successful, the upgrade test results are successful, and if not, the upgrade test results are failed. The upgrade test result may include a test result of a file and version control test, a test result of an upgrade interrupt test, a test result of a first impact test, and a test result of a load test.
And step 302, performing a start test on the basic application program based on the tested code to obtain a start test result.
Specifically, loading, upgrading, power-off, abnormal system reset and other conditions can lead to the system restart of the dual-core intelligent ammeter, and the restart of a basic application program, so that whether the start of the basic application program is successful or not is critical to the stability of the dual-core intelligent ammeter.
In one embodiment, referring to fig. 5, the initiation test includes: and (3) powering up the starting test, repeatedly stopping the powering up the starting test and upgrading the starting test.
Specifically, the upper computer controls the three-phase verification table to electrify the test equipment, reads the influence quantity, and obtains a first starting test result to obtain a first test result; the upper computer controls the three-phase calibration table to repeatedly stop powering on the test equipment, reads the influence quantity and obtains a second starting test result; and the upper computer performs upgrading operation on the basic application program, reads the influence after the upgrading is finished, and obtains a third starting test result.
If the influence quantity read after the test equipment is electrified is not abnormal, the basic application program is successfully started, the first starting test result is successful, and otherwise, the first starting test result is failed; if the influence quantity is not abnormal after the test equipment is repeatedly electrified, the basic application program is successfully started, the second starting test result is successful, and otherwise, the second starting test result is failed; if the test equipment performs upgrading operation on the basic application program, the influence quantity read after the upgrading is completed is not abnormal, the starting of the basic application program is successful, the third starting test result is successful, and otherwise, the third starting test result is failed.
And if the first starting test result is successful, the second starting test result is successful, and the third starting test result is successful, the starting test result is successful, and if not, the starting test result is failed. The starting test result comprises a first starting test result and a second starting test result.
And step 303, performing an uninstall test on the basic application program based on the tested code to obtain an uninstall test result.
Specifically, referring to fig. 6, the offloading test includes a bin file delete test, a configuration file delete test, a data file delete test, a system resource release test, and a second impact test.
The upper computer sends an instruction for unloading the basic application program to the code to be tested, the code to be tested executes unloading operation, after the basic application program is unloaded, whether the bin file is deleted successfully is detected, so as to perform a bin file deletion test, whether the configuration file is deleted successfully is detected, so as to perform a configuration file deletion test, whether the data file is deleted successfully is detected, so as to perform a data file deletion test, and whether system resources are released is detected, so as to perform a system resource release test. If the bin file is deleted, the bin file deletion test result is successful; if the configuration file is deleted, the configuration file deletion test result is successful; if the data file is deleted, the data file deletion test result is successful; if the system resources are released, the system resource release test result is successful. And after unloading is completed, acquiring the influence quantity, and if the influence quantity is not abnormal, determining that the second influence quantity test result is successful.
If the bin file deleting test result is successful, the configuration file deleting test result is successful, the data file deleting test result is successful, the system resource releasing test result is successful, and the second influence test result is successful, the unloading test result is successful. The unloading test result comprises the following steps: the method comprises the steps of a bin file deletion test result, a configuration file deletion test result, a data file deletion test result, a system resource release test result and a second influence test result.
And step 304, performing a system reset test on the basic application program based on the tested code to obtain a reset test result.
And the system reset test is used for testing whether the basic application program can be normally started after the tested code is reset under a plurality of different conditions. Specifically, when the test equipment operates at normal voltage, resetting the test code, reading the influence after starting to obtain a first reset test result, when the test equipment operates at low voltage, resetting the tested code, reading the influence after starting to obtain a second reset test result, controlling the test equipment to be powered off and then powered on, resetting the tested code, reading the influence after starting to obtain a third reset test result, and obtaining the reset test result according to the first reset test result, the second reset test result and the third reset test result.
When the test equipment operates at normal voltage, resetting the test code, if the test code is started successfully and the influence quantity has no abnormal change, the first reset test result is successful, otherwise, the first reset test result is failed; when the test equipment runs at low voltage, resetting the tested code, if the test code is started successfully and the influence quantity has no abnormal change, the second resetting test result is successful, otherwise, the second resetting test result is failed; and controlling the test equipment to be powered up after power failure, and resetting the tested code, wherein if the dual-core intelligent ammeter is started successfully and the influence quantity has no abnormal change, the third reset test result is successful, and otherwise, the third reset test result is failed.
If the first reset test result is successful, the second reset test result is successful, and the third reset test result is successful, the reset test result is successful. The reset test results comprise a first reset test result, a second reset test result and a third reset test result.
Step 305, determining a first result according to the upgrade test result, the start test result, the unload test result and the reset test result.
Specifically, if the upgrade test result is successful, the start test result is successful, the unload test result is successful, and the reset test result is successful, the first result is successful. The first result includes: the upgrade test result, the start test result, the unload test result and the reset test result.
In one embodiment, referring to fig. 7, the metering test includes: time-sharing electric quantity test, combined electric quantity test, data synchronization test, electric parameter test, electric quantity display test, third influence quantity test and zero clearing test.
Step 203 comprises:
and step 401, performing time-sharing electric quantity test on the basic application program based on the tested code to obtain a time-sharing electric quantity test result.
Specifically, the time-sharing electric quantity test includes: the method comprises the steps of testing the total electric quantity and the time-sharing electric quantity, simulating the time-sharing electric quantity after communication disconnection of a metering core, simulating the testing of the total electric quantity and the time-sharing electric quantity after plug-in of a management core, stopping the testing of the total electric quantity and the time-sharing electric quantity after power-on, testing the total electric quantity and the time-sharing electric quantity after period rate switching, testing the total electric quantity and the time-sharing electric quantity after zero clearing, and testing the total electric quantity and the time-sharing electric quantity after electric quantity zero-turning. The time-sharing electric quantity metering should meet the standard requirements of the technical specifications of the single/three-phase intelligent electric meter.
If the total electric quantity and the time-sharing electric quantity are the same as the time-sharing electric quantity after the communication of the simulation and metering core is disconnected, the simulation manages the total electric quantity and the time-sharing electric quantity after the plug of the core, the total electric quantity and the time-sharing electric quantity after the power-up is stopped, the total electric quantity and the time-sharing electric quantity after the rate of time interval is switched, the total electric quantity and the time-sharing electric quantity after zero clearing are the same as the standard requirement of the technical specification of the single/three-phase intelligent electric meter, the time-sharing electric quantity test result is successful, and otherwise the time-sharing electric quantity test result is failure.
And step 402, performing a combined electric quantity test on the basic application program based on the tested code to obtain a combined electric quantity test result.
Specifically, the combined charge test includes: active combined mode word = test of combined power at positive + negative time, active combined mode word = test of combined power at positive-negative time, active combined mode word = test of combined power at positive time, no test of reactive power at the time of modification of the active combined mode word. The combined electric quantity measurement is calculated correctly according to the combined mode word, if the active combined mode word=the combined electric quantity when the positive and negative are combined, the active combined mode word=the combined electric quantity when the positive is combined, the reactive electric quantity when the non-working combined mode word is modified is correct, the combined electric quantity test result is successful, otherwise the combined electric quantity test result is failure.
And step 403, performing data synchronization test on the basic application program based on the tested code to obtain a data synchronization test result.
Specifically, the synchronization test is a test in which the metering core is synchronized with the management core data, and the metering data synchronization test includes: testing of forward active power, reverse active power and reactive power synchronization, testing of metering data synchronization after power-on is stopped, testing of metering data synchronization after plug of a simulated management core, testing of metering data synchronization after system reset and testing of synchronization time. The metering core should be properly synchronized with the metering data of the management core. If the measurement data of the measurement core and the management core can be synchronized, the data synchronization test result is successful, otherwise, the data synchronization test result is failed.
And step 404, performing an electrical parameter test on the basic application program based on the tested code to obtain an electrical parameter test result.
Specifically, the electrical parametric test includes: accuracy of test voltage, accuracy of test current, accuracy of test power factor, accuracy of test frequency and accuracy of test state quantity. If the voltage, current, power, test power factor, test frequency and test state quantity of the metering core and the management core are synchronous, the test result of the electric parameter is successful, otherwise the test result of the electric parameter is failed.
And step 405, performing an electric quantity display test on the basic application program based on the tested code to obtain an electric quantity display test result.
Specifically, the power display test includes: decimal place test, display item test, and metering data update test. If the electric quantity display data is changed, the display data can be updated in real time, the electric quantity display test result is successful, otherwise, the electric quantity display test result is failed.
And step 406, performing a third influence test on the basic application program based on the tested code to obtain a third influence test result.
Specifically, the third influence amount test includes: legitimacy test of the settlement date parameter, passing settlement date electric quantity settlement correctness test, cutting off the power, passing settlement date electric quantity settlement correctness test, and modifying the settlement date parameter electric quantity settlement correctness test. The over-settlement date is a date after the set settlement date. If the test is successful, the third influence test result is successful, otherwise, the third influence test result is failed.
And step 407, performing a zero clearing test on the basic application program based on the tested code to obtain a zero clearing test result.
Specifically, if the zero clearing is successful, the zero clearing test result is successful, otherwise, the zero clearing test result is failed.
And step 408, determining a second result according to the time-sharing electric quantity test result, the combined electric quantity test result, the data synchronization test result, the electric quantity display test result, the third influence test result and the zero clearing test result.
The second result includes: the time-sharing electric quantity test result, the combined electric quantity test result, the data synchronization test result, the electric quantity display test result, the third influence test result and the zero clearing test result.
In one embodiment, referring to FIG. 8, the performance test includes a resource test and a response test. Step 204 includes:
and step 501, performing resource test on the application layer based on the tested code to obtain a resource test result.
Specifically, the resource test includes: newly increasing the resource test of the extended application program, unloading the resource test of the extended application program and upgrading the resource test of the extended application program. The resource test result comprises: newly adding an extended application resource test result, unloading the extended application resource test result and upgrading the extended application resource test result.
The newly added extended application resource test comprises the following steps: resource testing of a single extended application and resource testing of a plurality of extended applications are newly added. The system resource test comprises the following steps: CPU resource occupation test and memory resource occupation test.
And adding an extended application program, reading a first system resource occupation value after adding the extended application program, calculating a first allowance according to the first system resource occupation value, and if the first system resource occupation value is in a preset range and the first allowance is more than 20% of the preset value, successfully testing the resources of the extended application program.
Unloading the extended application program, reading a second system resource occupation value after unloading the extended application program, and calculating a second allowance according to the second system resource occupation value, wherein if the second system resource occupation value is in a preset range and the second allowance is larger than 20% of the preset value, the resource test result of the extended application program is successful.
And upgrading the extended application program, reading a third system resource occupation value after upgrading the extended application program, calculating a third allowance according to the third system resource occupation value, and if the third system resource occupation value is within a preset range and the third allowance is greater than 20% of the preset value, successfully upgrading the extended application program resource test result.
And step 502, performing response test on the application layer based on the tested code to obtain a response test result.
Specifically, the response test includes: external communication response time testing and internal data interaction response time testing.
The external communication response time test includes: response time when the basic application program interacts data with other services, and response time and internal module message queues when the application program interacts data with other services are expanded. The simulation application program is controlled to simulate a frozen data class request of the virtual bus service to read the tested code, the tested code replies the responding frozen class data, and the simulation application program calculates first response time according to the time for sending the frozen data class request and the time for receiving the frozen class data; the simulation application program is controlled to simulate a request of the virtual bus service for reading the data of the expansion application program, the expansion application program replies the data, and the simulation application program calculates second response time according to the time for sending the request and the time for receiving the data; and determining an external communication response time test result according to the first response time and the second response time. Specifically, if the first response time and the second response time meet the technical requirements, the external communication response time test result is successful.
The internal data interaction response time test comprises: and testing the response time of each module message queue in the tested code to obtain third response time, and if the third response time meets the technical requirement, the internal data interaction response time test result is successful.
In one embodiment, the method further comprises: and carrying out interchangeability test on the basic application program to obtain an interchangeability test result, wherein the interchangeability test comprises the following steps: after replacing the basic application program with a candidate application program similar to the basic application program, performing functional test, performance test and metering test to obtain an interchangeability test result;
accordingly, the generating a test report according to the first result, the second result and the third result includes:
and generating a test report according to the first result, the second result, the third result and the interchangeability test result.
Specifically, the basic application program installed on the dual-core smart meter can be developed by different suppliers, and the basic application program should support interchangeability, so that the metering management function of the dual-core smart meter is not affected after the basic application program is replaced. The basic application program and the candidate basic application program belong to the same basic application program, and the basic application program and the candidate basic application program have the same function. And after replacing the basic application program with a candidate application program similar to the basic application program, acquiring a replacement application layer code, performing functional test and metering test on the candidate application program based on the replacement application layer code, and performing performance test on the application layer to obtain an interchangeability test result.
And performing functional test and metering test on the candidate application program, wherein the functional test and metering test process on the candidate application program is the same as that of the basic application program, and the performance test on the application layer is the same as that of the application layer.
After replacing the basic application program with a candidate application program similar to the basic application program, acquiring an application layer code, and if the candidate application program is subjected to functional test and metering test and the performance test of the application layer is passed, obtaining a successful result of the interchangeability test.
According to the testing method of the double-core intelligent ammeter, the application layer is tested from three aspects, namely the function test, the performance test and the metering test, so that a comprehensive testing method is provided, and the blank of testing the application layer of the double-core intelligent ammeter is made up; the test process does not need accompanying test software to participate, and the test result directly reflects each function of the application layer, so that the method has stronger pertinence and accuracy.
It should be understood that, although the steps in the flowchart of fig. 2 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps in fig. 2 may include a plurality of steps or stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily sequential, but may be performed in rotation or alternatively with at least a portion of the steps or stages in other steps or other steps.
In one embodiment, as shown in fig. 9, there is provided a test apparatus of a dual-core smart meter, including:
the system comprises a tested code acquisition module, a tested code acquisition module and a control module, wherein the tested code is a code of a double-core intelligent ammeter application layer;
the function test module is used for carrying out function test on the basic application program of the application layer based on the tested code to obtain a first result;
the metering test module is used for performing metering test on the basic application program based on the tested code to obtain a second result;
the performance test module is used for performing performance test on the application layer based on the tested code to obtain a third result;
and the test report generation test module is used for generating a test report according to the first result, the second result and the third result.
For specific limitations regarding the testing apparatus of the dual-core smart meter, reference may be made to the above limitations regarding the testing method of the dual-core smart meter, and no further description is given herein. The modules in the testing device of the dual-core intelligent ammeter can be fully or partially realized by software, hardware and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and an internal structure diagram thereof may be as shown in fig. 10. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program, when executed by the processor, implements a method for testing a dual-core smart meter. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 10 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
obtaining a tested code, wherein the tested code is a code of a double-core intelligent ammeter application layer;
performing functional test on a basic application program of the application layer based on the tested code to obtain a first result;
metering and testing the basic application program based on the tested code to obtain a second result;
performing performance test on the application layer based on the tested code to obtain a third result;
and generating a test report according to the first result, the second result and the third result.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
Obtaining a tested code, wherein the tested code is a code of a double-core intelligent ammeter application layer;
performing functional test on a basic application program of the application layer based on the tested code to obtain a first result;
metering and testing the basic application program based on the tested code to obtain a second result;
performing performance test on the application layer based on the tested code to obtain a third result;
and generating a test report according to the first result, the second result and the third result.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.