1、Recognized as anAmerican National Standard (ANSI)Copyright 1986 byThe Institute of Electrical and Electronics Engineers, Inc., 3 Park Avenue, New York, NY 10016-5997, USAPrint: ISBN 1-55937-672-4 SH10587PDF: ISBN 0-7381-0400-0 SS10587No part of this publication may be reproduced in any form, in an e
2、lectronic retrieval system or otherwise, without the prior written permission of the publisher.ANSI/IEEE Std 1008-1987(R2009)IEEE Standard for Software Unit TestingSponsorSoftware Engineering Standards Subcommitteeof theIEEE Power Engineering SocietyReaffirmed 9 December 2009Approved 11 December 198
3、6IEEE-SA Standards BoardApproved 18 April 2003American National Standards InstituteIEEE Standards documents are developed within the IEEE Societies and the Standards Coordinating Committees of theIEEE Standards Association (IEEE-SA) Standards Board. The IEEE develops its standards through a consensu
4、s develop-ment process, approved by the American National Standards Institute, which brings together volunteers representing variedviewpoints and interests to achieve the final product. Volunteers are not necessarily members of the Institute and serve with-out compensation. While the IEEE administer
5、s the process and establishes rules to promote fairness in the consensus devel-opment process, the IEEE does not independently evaluate, test, or verify the accuracy of any of the information containedin its standards.Use of an IEEE Standard is wholly voluntary. The IEEE disclaims liability for any
6、personal injury, property or other dam-age, of any nature whatsoever, whether special, indirect, consequential, or compensatory, directly or indirectly resultingfrom the publication, use of, or reliance upon this, or any other IEEE Standard document.The IEEE does not warrant or represent the accurac
7、y or content of the material contained herein, and expressly disclaimsany express or implied warranty, including any implied warranty of merchantability or fitness for a specific purpose, or thatthe use of the material contained herein is free from patent infringement. IEEE Standards documents are s
8、upplied “AS IS.”The existence of an IEEE Standard does not imply that there are no other ways to produce, test, measure, purchase, market,or provide other goods and services related to the scope of the IEEE Standard. Furthermore, the viewpoint expressed at thetime a standard is approved and issued i
9、s subject to change brought about through developments in the state of the art andcomments received from users of the standard. Every IEEE Standard is subjected to review at least every five years for revi-sion or reaffirmation. When a document is more than five years old and has not been reaffirmed
10、, it is reasonable to concludethat its contents, although still of some value, do not wholly reflect the present state of the art. Users are cautioned to checkto determine that they have the latest edition of any IEEE Standard.In publishing and making this document available, the IEEE is not suggest
11、ing or rendering professional or other servicesfor, or on behalf of, any person or entity. Nor is the IEEE undertaking to perform any duty owed by any other person orentity to another. Any person utilizing this, and any other IEEE Standards document, should rely upon the advice of a com-petent profe
12、ssional in determining the exercise of reasonable care in any given circumstances.Interpretations: Occasionally questions may arise regarding the meaning of portions of standards as they relate to specificapplications. When the need for interpretations is brought to the attention of IEEE, the Instit
13、ute will initiate action to prepareappropriate responses. Since IEEE Standards represent a consensus of concerned interests, it is important to ensure that anyinterpretation has also received the concurrence of a balance of interests. For this reason, IEEE and the members of itssocieties and Standar
14、ds Coordinating Committees are not able to provide an instant response to interpretation requestsexcept in those cases where the matter has previously received formal consideration. Comments for revision of IEEE Standards are welcome from any interested party, regardless of membership affiliation wi
15、thIEEE. Suggestions for changes in documents should be in the form of a proposed change of text, together with appropriatesupporting comments. Comments on standards and requests for interpretations should be addressed to:Secretary, IEEE-SA Standards Board445 Hoes LanePiscataway, NJ 08854USAAuthoriza
16、tion to photocopy portions of any individual standard for internal or personal use is granted by the Institute ofElectrical and Electronics Engineers, Inc., provided that the appropriate fee is paid to Copyright Clearance Center. Toarrange for payment of licensing fee, please contact Copyright Clear
17、ance Center, Customer Service, 222 Rosewood Drive,Danvers, MA 01923 USA; (978) 750-8400. Permission to photocopy portions of any individual standard for educationalclassroom use can also be obtained through the Copyright Clearance Center.Note: Attention is called to the possibility that implementati
18、on of this standard may require use of subject mat-ter covered by patent rights. By publication of this standard, no position is taken with respect to the existence orvalidity of any patent rights in connection therewith. The IEEE shall not be responsible for identifying patentsfor which a license m
19、ay be required by an IEEE standard or for conducting inquiries into the legal validity orscope of those patents that are brought to its attention.Copyright 2001 IEEE. All rights reserved.1Forward(This forward is not a part of ANSI/IEEE Std 1008-1987, IEEE Standard for Software Unit Testing)Objective
20、sThis standards primary objective is to specify a standard approach to software unit testing that can be usedas a basis for sound software engineering practice.A second objective is to describe the software engineering concepts and testing assumptions on which thisstandard approach is based. This in
21、formation is contained in Appendix B. Note that Appendix B is not a partof this standard.A third objective is to provide guidance and resource information to assist with the implementation andusage of the standard unit testing approach. This information is contained in Appendixes A, C, and D. Noteth
22、at these Appendixes are not a part of this standard.MotivationA consensus definition of sound unit testing provides a baseline for the evaluation of specific approaches. Italso aids communication by providing a standard decomposition of the unit testing process.AudienceThe primary audience for this
23、standard is unit testers and unit test supervisors. This standard was developedto assist those who provide input to, perform, supervise, monitor, and evaluate unit testing.Relationship with Other Software Engineering StandardsANSI/IEEE Std 829-1983, IEEE Standard for Software Test Documentation, des
24、cribes the basic informationneeds and results of software testing. This unit testing standard requires the use of the test design specifica-tion and test summary report specified in ANSI/IEEE Std 829-1983. This standard is one of a series aimed at establishing the norms of professional practice in s
25、oftwareengineering. Any of the other software engineering standards in the series may be used in conjunction withit.TerminologyTerminology in this standard is consistent with ANSI/IEEE Std 729-1983, IEEE Standard Glossary ofSoftware Engineering Terminology. To avoid inconsistency when the glossary i
26、s revised, its definitions arenot repeated in this standard.The test unitreferred to in this standard is a specific case of the test itemreferred to in ANSI/IEEE 829-1983.The term test unitis used because of this standards narrower scope. The use of the term specification, description, or document r
27、efers to data recorded on either an electronic orpaper medium.The word must and imperative verb forms identify mandatory material within the standard. The wordsshould and may identify optional material.ivOverviewThe unit testing process is composed of three phasesthat are partitioned into a total of
28、 eight basic activitiesas follows:1)Perform the test planninga) Plan the general approach, resources, and scheduleb) Determine features to be testedc) Rene the general plan2)Acquire the test seta) Design the set of testsb) Implement the rened plan and design3)Measure the test unita) Execute the test
29、 proceduresb) Check for terminationc) Evaluate the test effort and unitThe major dataows into and out of the phases are shown in Fig A.Fig A Major Dataows of the Software Unit Testing PhasesWithin a phase, each basic activity is associated with its own set of inputs and outputs and is composed of as
30、eries of tasks. The inputs, tasks, and outputs for each activity are specied in the body of this standard.The set of outputs from all activities must contain sufcient information for the creation of at least two doc-umentsa test design specication and a test summary report. Both documents must confo
31、rm to the speci-cations in ANSI/IEEE Std 829-1983.vHistoryWork on this standard began in February 1983, following announcement of the formation of the task groupin the technical and commercial press in late 1982. The project authorization request was approved by theIEEE Standards Board on June 23, 1
32、983 following the second meeting. A total of seven meetings heldthroughout the United States at three month intervals produced the draft submitted for ballot in March 1985.A total of over 90 persons contributed to the initial development of this standard. Contributors are those indi-viduals who eith
33、er attended a working-group meeting, submitted written comments on a draft, or both.This standard was developed by a working group with the following members:David Gelperin, Chair A. Frank AckermanCraig AdamsDavid AdamsJack BarnardWanda BeckBoris BeizerK. Mack BishopJill E. BoogaardMilt BoydNathan B
34、. BradleyMartha BranstadFletcher BuckleyJohn W. CainChristopher CookeL. L. Doc CraddockPalmer CraigMichael CramerDave DahlinghausNoah DavidsHenry DavisBruce DawsonClaudia DenckerMichael DeutschJudie DivitaJim DobbinsDavid C. DotyBill DuprasJim EdwardsKaren FairchildPeter Farrell-VinayThom Foote-Lenn
35、oxKen FosterPat Wilburn, Co-ChairJohn FoxRoger FujiiRoss GaglianoMark GerhardEd GibsonTherese GilbertsonGary GirardKeith GordonPaul GrizenkoJeff GroveIsmet GungorMark HeinrichRudolph HodgesR. A. KesslerTom KuriharaCostas LabovitesFrank LaMonicaF. C. LimPhilip C. MarriottDebra L. McCuskerCharlie McCu
36、tcheonRudolf van MegenDenis MeredithEdward Miller, JrWilliam MilliganMarcus MullinsW. M. MurrayBruce NicholsDennis NickleLarry NitzscheJohn OwensWilliam PerryGerald PetersonBob PostonPatricia PowellSamuel T. Redwine, JrSanford RosenHans SchaeferEric SchnellmanHarvey SchockAl Sema, JrHarlan SeyferVic
37、tor ShternRick SimkinWayne SmithHarry SneedHugh B. SpillaneBen SunMurray TabachnickBarbara TauteLeonard TrippWilliam S. Turner IIIJohn VanceGuy VogtDolores WallaceJohn WalterJohn C. WangCheryl WebbWilliam WilsonEd YasiNatalie C. YopconkaThe following persons were on the balloting committee that appr
38、oved this document for submission to theIEEE Standards Board:Frank AckermanLeo BeltracchiRon BerlackWilliam Boll, JrF. BuckleyDouglas BurtHomer CarneySkip Carpenter, JrJung ChungWon Lyang ChungFrancois CoallierRichard CoatesA.J. Cote, JrPatricia DaggettJim DarlingN.S. DavidsHenry DavisPeter DennyA.
39、DniestrowskiDavid DobratzDavid DotyWalter DuBlanicaR.E. DwyerMary EadsJohn EarlsL.G. EganJohn FendrichGlenn FieldsCharles FinnellJim FlournoyviViolet FoldesJulian ForsterRick FredrickLee GagnerM. GalinierDavid GelperinL.M. GuntherDavid GustafsonRussell GustinVirl HaasWilliam HanrahanCarolyn Harrison
40、G.B. HawthorneClark HayLeslie Heselton, IIIMark HolthouseJohn HorchFrank JayLaurel KaledaAdi KasadRon KenettBob KesslerGary KrocRobert LaneGreg LarsenF.C. LimBertil LindbergGary LindsayBen LivsonM. MalagaroisW.A. MandevilleStuart MarcottePhilip C. MarriottRoger MartinPaul MauroBelden MenkusJerome Me
41、rskyGene MorunHironobu NaganoGeraldine NeidhartG.A. NiblackDennis NickleLarry NitzschePeter OlsenWilma OsborneBill PerryPoul Grav PetersonDonald PfeifferSharon Cobb-PiersonRobert PostonThomas RadiMeir RazyLarry ReedR. Waldo RothRaymond SandborghHans SchaeferNorm SchneidewindEric SchnellmanWolf Schno
42、egeRobert SchueppertDavid SchultzLeonard SeagrenGary SheaCraig ShermerRobert ShillatoDavid SiefertDavid SimkinsShirley Gloss-SolerWilliam SutcliffeK.C. TaiBarbara TautePaul ThompsonTerrence TillmannsR.L. Van TilburgDolores WallaceM.L. WeisbeinJoseph WeissN.P. WilburnPaul WolfgangCharles WortzEdward
43、YasiZhou Zhi YingNatalie YopconkaviiWhen the IEEE Standards Board approved this standard on December 11, 1986, it had the following mem-bership:John E. May, Chair Irving Kolodny, Vice Chair Sava I. Sherr, Secretary James H. BeallFletcher J. BuckleyPaul G. CummingsDonald C. FleckensteinJay ForsterDan
44、iel L. GoldbergKenneth D. HendrixIrvin N. HowellJack KinnJoseph L. Koepnger*Edward LohseLawrence V. McCallDonald T. Michael*Marco W. MigliaroStanley OwensJohn P. RiganatiFrank L. RoseRobert E. RountreeMartha SloanOley WanaseljaJ. Richard WegerWilliam B. WilkensHelen M. WoodCharles J. WylieDonald W.
45、Zipse* Member emeritusviiiContents1. Scope and References . 11.1 Inside the Scope 11.2 Outside the Scope . 21.3 References . 22. Definitions . 23. Unit Testing Activities 33.1 Plan the General Approach, Resources, and Schedule . 43.2 Determine Features To Be Tested . 53.3 Refine the General Plan 63.
46、4 Design the Set of Tests . 73.5 Implement the Refined Plan and Design 83.6 Execute the Test Procedures . 83.7 Check for Termination 113.8 Evaluate the Test Effort and Unit 12Appendix A (informative) Implementation and Usage Guidelines . 13Appendix B (informative) Concepts and Assumptions 16Appendix
47、 C (informative) Sources for Techniques and Tools.19Appendix D (informative) General References . 211An American National StandardIEEE Standard for Software Unit Testing1. Scope and References1.1 Inside the ScopeSoftware unit testing is a process that includes the performance of test planning, the a
48、cquisition of a test set,and the measurement of a test unit against its requirements. Measuring entails the use of sample data to exer-cise the unit and the comparison of the units actual behavior with its required behavior as specied in theunits requirements documentation.This standard denes an int
49、egrated approach to systematic and documented unit testing. The approach usesunit design and unit implementation information, in addition to unit requirements, to determine the com-pleteness of the testing.This standard describes a testing process composed of a hierarchy of phases, activities, and tasks and denesa minimum set of tasks for each activity. Additional tasks may be added to any activity.This standard requires the performance of each activity. For each task within an activity, this standardrequires either that the task be performed, or that previous resul