CN107766244A - A kind of intelligent electric energy meter software unit testing method - Google Patents

A kind of intelligent electric energy meter software unit testing method Download PDF

Info

Publication number
CN107766244A
CN107766244A CN201710956381.4A CN201710956381A CN107766244A CN 107766244 A CN107766244 A CN 107766244A CN 201710956381 A CN201710956381 A CN 201710956381A CN 107766244 A CN107766244 A CN 107766244A
Authority
CN
China
Prior art keywords
electric energy
energy meter
test
intelligent electric
meter software
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710956381.4A
Other languages
Chinese (zh)
Inventor
游彪
钱晓耀
胡仁伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Jiliang University
Original Assignee
China Jiliang University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Jiliang University filed Critical China Jiliang University
Priority to CN201710956381.4A priority Critical patent/CN107766244A/en
Publication of CN107766244A publication Critical patent/CN107766244A/en
Pending legal-status Critical Current

Links

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

A kind of intelligent electric energy meter software unit testing method, it includes the first step, the unitunder test (101) to intelligent electric energy meter software unit carries out code inspection (103) and completes static analysis;Second step, establish sequence management of test cases and to above-mentioned unitunder test (101) complete design test case (105);3rd step, (107) are tested unit under test;4th step, the unit testing evaluation (109) for completing the intelligent electric energy meter software are simultaneously drawn a conclusion.The present invention is tested each function in software (107) by being tested intelligent electric energy meter software unit (107) and realizes that surveying unit to the most I of intelligent electric energy meter software unit is checked and verified, to realize that the quality problems for improving intelligent electric energy meter software create condition.

Description

A kind of intelligent electric energy meter software unit testing method
Technical field
The present invention relates to Programmable detection field, and in particular to a kind of intelligent electric energy meter software unit testing method.
Background technology
With the increase of intelligent electric energy meter function, intelligent electric energy meter software complexity more and more higher, intelligent electric energy meter at present Based on system testing, i.e., the function of intelligent electric energy meter modules is tested by system test, for intelligent electric energy The test of table software source code is also relatively fewer, so because intelligent electric energy meter problem caused by source code once would is that Batch occur and be not easy to find, so to intelligent electric energy meter software carry out unit testing be necessary.
Electric energy meter software unit testing is to survey unit to most I in software to be checked and verified, i.e., to every in software Individual function is tested.But function is not an independent program in itself, therefore to needing to consider during function progress unit testing The contact of the function and other functions.Unit testing can be early stage electric energy meter software life cycle, can degree of knowing in early days Measure coverage information.Unit testing checks function performance according to intelligent electric energy meter software-implemented fault injection, and intelligent electric energy meter is newly organized The code write can carry out unit testing immediately, so by intelligent electric energy meter software unit testing for improve electric energy meter software Quality it is significant.
The content of the invention
For realize the present invention purpose, i.e., " by intelligent electric energy meter software unit testing for raising electric energy meter software Quality " present invention intend use following technical scheme.
The first step, the unitunder test to intelligent electric energy meter software unit carry out code inspection and complete static analysis;
Second step, establish sequence management of test cases and to above-mentioned unitunder test complete design test case;
3rd step, unit under test is tested;
4th step, the unit testing for completing the intelligent electric energy meter software are evaluated and drawn a conclusion.
Preferably, described static analysis refers to enter above-mentioned unit under test the coding rule inspection of line code and generated quiet State analysis report.
Preferably, first having to establish sequence one group of test case of management when carrying out above-mentioned second step, after sequence is built up, Test Sample Design is carried out to function, external function is driven piles, sets expected input and output;
Then test is performed to test case, if the reason for test is not by needing and finding problem in time re-starts survey Examination;The information of coverage rate, including sentence covering rate and branch covering rate are checked if test passes through, if coverage rate reaches 100% Then carry out in next step, otherwise continuing design test case.
Preferably, program logic structure figure is formed simultaneously to tested function from LDRA Testbed when writing test case Marked with numeral.
Preferably, LDRA Testbed are selected according to the design test case completed according to above-mentioned 3rd step, the 4th step The unit testing for completing to test and generate test report completion intelligent electric energy meter software is evaluated and drawn a conclusion.
The beneficial effects of the present invention are by being tested intelligent electric energy meter software unit to each letter in software Number carries out test and realizes that surveying unit to the most I of intelligent electric energy meter software unit is checked and verified, improves intelligence to realize The quality problems of electric energy meter software create condition.
Brief description of the drawings
Fig. 1 illustrates the schematic flow sheet of the present invention (for summary diagram).
Fig. 2 illustrates program logic structure figure.
Embodiment
Told about in detail below according to the schematic flow sheet of the invention shown in Fig. 1,
Example one:The present invention assists to complete using LDRA Testbed instruments, and intelligent electric power meter hardware uses STM32F103 Processor, intelligent electric energy meter software development environment are IAR7.0.
Program elaborates by way of example for unitunder test 101 and demand and design documentation 102:
The static analysis of the first step, LDRA Testbed to intelligent electric energy meter software code is directly soft using intelligent electric energy meter The standard of part industry accreditation is MISRAC-2012;Pile function processing is carried out to said procedure simultaneously, found from program above GetMeterRunStatus, TranslateStatus0or1, EventMagneticBegin, EventMagneticend be from The function being called in other functions, it should which piling processing is carried out to it;GetMeterRunStatus, TranslateStatus0or1, the two pile functions take part in computing and call, it is necessary to set different return values to it; EventMagneticBegin, EVentMagneticend do not use its return value, without parameter call, therefore to this yet Two pile functions need not be handled.
Second step, LDRA Testbed can form program logic structure figure as shown below to tested function, and use Numeral is marked, and the logical relation of tested function is combined according to this figure, and point being tested can be clear that according to figure below Branch will become green,
The program logic structure figure according to Fig. 2, design test case are as follows:
TC1:Test if (EventMagneticSecond==EVENT_RTC_SECOND) is true, terminates and performs.Specifically Data such as following table:
The test case 1 of table 1
TC2:Test if (EventMagneticSecond==EVENT_RTC_SECOND) is false, if (1== TranslateStatus0or1 (&MagneticRealStatus ,s &EventMagneticStatusUse, & EventMagneticDuration, DurationTime, EventMagneticJudgeStatus)) it is true, if (1== MagneticRealStatus) it is true, specific test data such as following table:
The test case 2 of table 2
TC3:Test if (EventMagneticSecond==EVENT_RTC_SECOND) is false, f (1== TranslateStatus0or1 (&MagneticRealStatus ,s &EventMagneticStatusUse, & EventMagneticDuration, DurationTime, EventMagneticJudgeStatus)) it is vacation, specifically test number According to such as following table:
The test case 3 of table 3
TC4:Test if (EventMagneticSecond==EVENT_RTC_SECOND) is false, if (1== TranslateStatus0or1 (&MagneticRealStatus ,s &EventMagneticStatusUse, & EventMagneticDuration, DurationTime, EventMagneticJudeeStatus)) it is true, if (1== MagneticRealStatus) it is false, specific test data such as following table:
The test case 4 of table 4
4th step,
In test intelligent electric energy meter software several functions, it is found that some function statement coverage rates or branch covering rate Have and do not reach 100%, or unit testing failure.It is set forth below out in test process in some problems run into.
The unqualified part record of the electric energy meter software unit testing of table 5
It is soft that intelligent electric energy meter according to designed test case can effectively be measured by LDRA Testbed testing tools Some defects of part, can timely be changed, and the effective quality for improving electric energy meter software, thus pass through the completion of the present invention It is significant for the quality that improves intelligent electric energy meter to intelligent electric energy meter software unit testing.
Above-described is only embodiments of the invention, and the general knowledge such as known specific method or characteristic is not made herein in scheme Excessive description.It should be pointed out that for those skilled in the art, under the premise of not departing from the present invention, can also carry out Several modifications and improvements, these should also be considered as protection scope of the present invention, these effects implemented all without the influence present invention And practical applicability.This application claims protection domain should be defined by the content of claim, the specific reality in specification Apply the content that the records such as mode can be used for explaining claim.

Claims (5)

  1. A kind of 1. intelligent electric energy meter software unit testing method, it is characterised in that:
    The first step, the unitunder test (101) to intelligent electric energy meter software unit carry out code inspection and complete static analysis;
    Second step, establish sequence management of test cases and to above-mentioned unitunder test (101) complete design test case (105);
    3rd step, unit under test (101) is tested;
    4th step, the unit testing for completing the intelligent electric energy meter software are evaluated and drawn a conclusion.
  2. A kind of 2. intelligent electric energy meter software unit testing method as claimed in claim 1, it is characterised in that:
    Described static analysis refers to enter above-mentioned unit under test (101) the coding rule inspection of line code and generates static analysis Report.
  3. A kind of 3. intelligent electric energy meter software unit testing method as claimed in claim 1, it is characterised in that:
    First having to establish sequence one group of test case of management when carrying out above-mentioned second step, after sequence is built up, function is being carried out Design test case (105), external function is driven piles, sets expected input and output;
    Then test is performed to test case, if the reason for test is not by needing and finding problem in time re-starts test;If Test passes through the information for then checking coverage rate, including sentence covering rate and branch covering rate, is carried out if coverage rate reaches 100% In next step, design test case is otherwise continued.
  4. A kind of 4. intelligent electric energy meter software unit testing method as claimed in claim 1, it is characterised in that:
    Program logic structure figure is formed to tested function from LDRA Testbed when writing test case and marked with numeral.
  5. A kind of 5. intelligent electric energy meter software unit testing method as claimed in claim 1, it is characterised in that:
    Complete to survey from LDRA Testbed according to the design test case (105) completed according to above-mentioned 3rd step, the 4th step The unit testing for trying and generating test report completion intelligent electric energy meter software is evaluated and drawn a conclusion.
CN201710956381.4A 2017-10-11 2017-10-11 A kind of intelligent electric energy meter software unit testing method Pending CN107766244A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710956381.4A CN107766244A (en) 2017-10-11 2017-10-11 A kind of intelligent electric energy meter software unit testing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710956381.4A CN107766244A (en) 2017-10-11 2017-10-11 A kind of intelligent electric energy meter software unit testing method

Publications (1)

Publication Number Publication Date
CN107766244A true CN107766244A (en) 2018-03-06

Family

ID=61269605

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710956381.4A Pending CN107766244A (en) 2017-10-11 2017-10-11 A kind of intelligent electric energy meter software unit testing method

Country Status (1)

Country Link
CN (1) CN107766244A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110750456A (en) * 2019-10-21 2020-02-04 江苏科技大学 Defect detection and extraction method for C language project
CN112286833A (en) * 2020-12-31 2021-01-29 中国电力科学研究院有限公司 Intelligent electric energy meter real-time operating system drive test method and device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1641601A (en) * 2004-01-04 2005-07-20 华为技术有限公司 Software unit measuring method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1641601A (en) * 2004-01-04 2005-07-20 华为技术有限公司 Software unit measuring method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
孙小淋;: "基于LDRA Testbed软件的单元测试", 数字技术与应用, no. 09, pages 1 - 4 *
徐润德 等, 《海军航空工程学院学报》, pages 1 - 4 *
赵山;黄友朋;宋锡强;汪萍萍;胡珊妹;: "智能电能表软件可信保障技术白盒静态测试模型与编码规范探索", 电测与仪表, no. 1, pages 1 - 5 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110750456A (en) * 2019-10-21 2020-02-04 江苏科技大学 Defect detection and extraction method for C language project
CN112286833A (en) * 2020-12-31 2021-01-29 中国电力科学研究院有限公司 Intelligent electric energy meter real-time operating system drive test method and device

Similar Documents

Publication Publication Date Title
US11888885B1 (en) Automated security analysis of software libraries
CN110188544A (en) Leak detection method and device, equipment and storage medium
CN110458168A (en) Processing method, device, computer equipment and the storage medium of vehicle detection report
CN109614324A (en) A kind of method for generating test case and device
CN104635144A (en) Hardware trojan detection method independent of datum curve
CN106776324A (en) Interface test method and device
US6453437B1 (en) Method and system for performing transition fault simulation along long circuit paths for high-quality automatic test pattern generation
Kang et al. A secure-coding and vulnerability check system based on smart-fuzzing and exploit
CN105912460A (en) Software test method and system based on QTP
CN108459954A (en) Vulnerability of application program detection method and device
CN111400505A (en) Method and system for matching fault elimination scheme of power consumption information acquisition system
CN107766244A (en) A kind of intelligent electric energy meter software unit testing method
CN110427757A (en) A kind of Android leak detection method, system and relevant apparatus
CN115659335A (en) Block chain intelligent contract vulnerability detection method and device based on mixed fuzzy test
CN115827610A (en) Method and device for detecting effective load
CN103049374B (en) Automatic testing method and device
CN104063307A (en) Software testing method and system
CN106649110A (en) Software test method and system
CN107145417A (en) A kind of outer plug-in card installation site method of calibration and device
CN111898134B (en) Intelligent contract vulnerability detection method and device based on LSTM and BiLSTM
US8402421B2 (en) Method and system for subnet defect diagnostics through fault compositing
CN111858377B (en) Quality evaluation method and device for test script, electronic equipment and storage medium
CN108829575A (en) Test cases recommended method, electronic device and readable storage medium storing program for executing
CN102750220B (en) Method and device for analyzing safety defects of software source code
US20140281719A1 (en) Explaining excluding a test from a test suite

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
DD01 Delivery of document by public notice

Addressee: You Biao

Document name: Notice of expiration of the time limit for the trial

DD01 Delivery of document by public notice
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination