软件质量与结构化测试_第1页
软件质量与结构化测试_第2页
软件质量与结构化测试_第3页
软件质量与结构化测试_第4页
软件质量与结构化测试_第5页
已阅读5页,还剩138页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

ualitySoftware软件质量与结构化测试WhyQualityandStableSoftware“SoftwareGlitch(失灵)TakesOutSchwabWebSite”“AResumesService;Stockoff5%inWakeofGlitch”“GlitchSnuffsOutOnlineBroker(经纪人)

ForHours”(E-Trade)SoftwareQualityDrivers

软件失败带来的高损失

系统直接开放给客户

有限的预算和资源SoftwareDevelopmentLifecycleUserRequirementsRequirementSpecificationFunctionalSpecificationArchitecturalDesignDetailedDesignImplementationModuleTestInstallationComponentTest&IntegrationSystemTest&IntegrationQualityRequirementValidationthroughBeta/FieldtestQualityCheck软件开发过程策略知道怎么做目标DecidePredictEvaluateAdjustProcess软件项目软件产品Models测量工具AnalyzeRegulationRequirementsDocumentsSpecificationDocumentsDesignDocumentsSourceCodesTestPlansTestingMaintenanceDesignCoding软件开发Maintenance软件开发的工作分配DesignCodingTesting什么是软件质量“Thetotalityoffeaturesandcharacteristicsofaproductorservicethatbearonitsabilitytosatisfystatedorimpliedneeds”(ISO8402)Thedegreeofexcellence“Theabilityofasoftwareproducttosatisfyitsspecifiedrequirements”(DoD-STD-2168)“Thedegreetowhichasystem,component,orprocessmeetsspecifiedrequirements.”(IEEEstandard610.12-1990)“Thedegreetowhichasystem,component,orprocessmeetscustomeroruserneedsorexpectations.”(IEEEstandard610.12-1990)ISO9126SoftwareQuality:

Thetotalityoffeaturesandcharacteristicsofasoftwareproductthatbearonitsabilitytosatisfystatedorimpliedneeds.SoftwareQualityCharacteristics:

Asetofattributesofasoftwareproductbywhichitsabilityisdescribedandevaluated.Asoftwarequalitycharacteristicmayberefinedintomultiplelevelsofsub-characteristics.SoftwareQualityMetric:

Aquantitativescaleandmethodwhichcanbeusedtodeterminethevalueafeaturetakesforaspecificsoftwareproduct.用户角度供应商的角度QualityinSoftware软件过程商业价值易于修改可实现性可靠性更少的bug多功能性特征的多少Quality needs QualityAssurance needsaQualitySystem needs QualityManagement软件错误不是产生于: -故意的 -无能为力只是因为在开发过程中质量和开销,时间矛盾质量差缩短时间表“Qualitydoesnothappenbymistake!”为什么质量差?压缩的预算人事的变化用户需求的改变提高或增加功能或性能BugFixing无效的测试SoftwareQualityAssurance原则

质量不必是“最好”的质量是用户想要的和愿意购买的

范围QAismorethantestingQAnotonlyattheendoftheprojectQAofproductandprocess

格言

Movingfromqualitycontrolling(expost)topreventionbyqualityservice. 通过质量服务把质量控制变换到预防

QualityCharacteristics

质量特征可靠性性能可维护性健壮性用户友好性ISO9126SoftwareComplexity软件产品系统体系复杂性模块文本复杂性模块的结构复杂Asoftwareproductisasolutionofaproblem.Thecomplexityofthesolutiongenerallydependsonthecomplexityoftheproblem.QualityModels分配用户需求

QualityFactors到开发标准

QualityCriteria到可证明的和测量的值

MetricsFactor-Criteria-MetricsRelationshipQualityTreeConceptQUALITYFACTOR1FACTORIFACTORLCRITERIA1CRITERIAJCRITERIAMMETRICKMETRIC1METRICNTheMetricsFACTORSCRITERIAMETRICS可维护性自描述性简单性简明性模块性嵌套级别数环数可执行语句数操作数频率语句平均长度组件级别注释率BoehmModelGENERALUTILITYASISUTILITYMAINTAINABILITY可移植性可靠性效率人类工程学易测性易读性可修改性独力于设备完整性准确度一致性设备效率易访问性通信性能自描述结构化简明性易理解可扩展性PRIMARYUSESINTERMEDIATECONSTRUCTSPRIMITIVECONSTRUCTS互用性可用性完整性效率正确性可靠性可维护性易测性复用性灵活性可移植性{{{产品操作产品修订产品迁移McCallModelOPERABILITYTRAININGCOMMUNICATIVENESSACCESSCONTROLACCESSAUDITSTORAGEEFFICIENCYEXECUTIONEFFIENCYTRACEABILITYCOMPLETENESSACCURACYERRORTOLERANCECONSISTENCYSIMPLICITYCONCISENESSTESTCOVERAGEINSTRUMENTATIONEXPANDABILITYGENERALITYSELFDESCRIPTIVENESSMODULARITYMACHINEINDEPENDENCESOFTWARESYSTEMINDEPENDENCECOMMUNICATIONSCOMMONALITYDATACOMMONALITYACTIVITYFACTORSCRITERIAQualityandQualityManagement质量需要用需求,可接受性和它们达到的证据来衡量质量是通过解决问题实现的质量管理确保前面解决过的问题不再出现没有质量测量来做质量管理只能是幻想测量工具的好处支持质量管理系统开发工程师可以自己检查支持代码评审评价外部软件支持测试ualitySoftwareMetricsWhatisaMetric?任何测量的单位e.g.Cm,Litre,Ohm,Second,Color描述一个实体的属性度量的类型:和项目相关时间表/开支估算测量功能点软件度量´只有当你对你所谈到的东西进行测量时,并用数量表示时,你就对它有了一定了解,反之,你对它并没有真正的了解.´LordKelvin,1889´Youcan‘tcontrolwhatyoucan‘tmeasure.´DeMarco,1982SoftwareQualityMetricsMeasurementisusefulbut...

5.1o-1sMeasurementWhatdowewanttomeasure?Howdowemeasure?n?Whatdothemeasurementsmea复杂性尺寸测试路径冗余结构模块性可维护性可靠性可复用性可测量的不可测量的5.2o-2sWhattoMeasure?直观的GoodMetricsshould:和错误出现有直接关系GoodMetricsGoodMetricsmust:客观的语言独立和测试努力直接有关自动化简单提高质量4.1s测量确定质量TimeQuality防止质量退化辅助做出决策理解提高生产力确定变更的影响风险分析测试确保质量提高测试效率Metrics++HalsteadMetricsAvailableMeasurementsInclude:FunctionPointLineCountMetricsMcCabeMetricsDataMetricsSystemLevelMetricsOOMetricsDerivedMetricsHalsteadMetrics起源:1977年MauriceHalstead开发介绍MeansofdeterminingaquantitativemeasureofcomplexitydirectlyfromoperatorsandoperandsinthemoduleWasdevelopedtomeasuremodule’scomplexityfromsourcecode,emphasisingoncomputationcomplexityAstheyappliedtocode,oftenusedasamaintenancemetricWidelydifferingopinionsontheirworthSource:SoftwareEngineeringInstituteCarnegieMellon技术TheHalsteadmeasuresarebasedonfourscalarnumbersderiveddirectlyfromaprogram'ssourcecode:n1=thenumberofdistinct(独立的)operators操作符 n2=thenumberofdistinctoperands操作数 N1=thetotalnumberofoperators N2=thetotalnumberofoperands Measure

Symbol

Formula

Programlength N N=N1+N2Programvocabulary n n=n1+n2Volume V V=N*(LOG2n)Difficulty D D=(n1/2)*(N2/n2)Effort E E=D*Vfromtheabove,fivemeasuresarederived...Source:SoftwareEngineeringInstituteCarnegieMellonHalsteadMetricsHalsteadMetricsAdvantages不必深入分析程序的结构预测错误的数目预测维护的工作量对报告和计划项目的健康程度有帮助对整个程序有帮助计算简单适合任何编程语言经过很多工业研究,都支持使用Halstead来预测开发工作量和平均bugsFunctionPointsOriginWasdevisedin1977byA.J.AlbrechtthenwithIBM测量软件的大小和生产力Technique基本功能点分为5组:outputs,inquiries调查,inputs,files,andinterfaces.功能点就是最终用户的业务功能,比如对输入的查询.和软件完成的功能紧密相关Source:SoftwareEngineeringInstituteCarnegieMellonFunctionPointsAdvantagesGenerallyacceptedasaneffectivewayto:很大的用户社区;InternationalFunctionPointGroup(IFPG)多于1,200会员公司

建立每小时功能点的生产率评估对需求的支持Estimateasoftwareproject'ssize(andinpart,duration)Normalisethecomparisonofsoftwaremodules评估系统变更的开销StandardpracticesforcountingandusingFunctionPointsisavailableintheIFPGCountingPracticesManualSource:SoftwareEngineeringInstituteCarnegieMellonLineCountMetrics表明每个模块的行数,包括代码,注释,空白行,混合代码和注释.技术LOCiscategorisedintothefollowingcomponents:Lines-of-Code(LOC)metrics提供代码的总额,但是对内容的测量不太好blanks- Lineswithonlyspace(eg.spaceandtabs)ornotextcommentcode- Sourcelinesofcodethatcontainonlycodeandwhitespacecomments- SourcelinesofcodethatarepurelycommentsMixed- LinesthatcontainbothcodeandcommentsLineCountMetricsAdvantagesMeasuresphysicalsizeofsoftwareIdentifiesspecificlinecountcomponents,suchascommentandblanklinesHelpstopinpointamodulethatisdifficulttounderstand.(Commentlinesoftenincreasereadability,althoughanunusuallylargenumberofcommentscanindicatethatthemoduleisdifficulttounderstand.)McCabeMetricsOriginCyclomaticComplexityintroducedbyThomasMcCabein1976Itmeasuresthenumberoflinearly-independentpathsthroughaprogrammoduleThismeasureprovidesasingleordinalnumberthatcanbecomparedtothecomplexityofotherprogramsAbroadmeasureofsoundnessandconfidenceforaprogramOftenreferredtosimplyasprogramcomplexity,orasMcCabe’scomplexityMcCabeMetricsAdvantages广泛应用的静态软件度量

和其他度量互补

独立于开发语言扩展到可以包括设计和结构复杂度

基于软件结构的严格的数学分析McCabeMetricsAdvantages可以应用到几个领域:维护的风险分析Codecomplexitytendstoincreasethroughmaintenanceovertime.Bymeasuringbeforeandaftercomplexitycanbemonitored,managedandminimisetheriskofchange.代码开发的风险分析:whileunderdevelopment,complexitycanbemeasuredforinherentriskandriskbuildup.测试的计划Cyclomaticcomplexitygivestheexactnumberoftestsneededtotesteverydecisionpoint.Thisaidsintestplanning.Highlycomplexmodulesrequireaprohibitivenumberofteststeps,thatnumbercanbereducedtoamorepragmaticsizebybreakingthemoduleintosmallerlesscomplexsubmodules.再工程Cyclomaticcomplexityanalysisprovidesinsighttothestructureofcode.Reengineeringriskisrelatedtothecodecomplexity.Thisinsighthelpswithcostandriskanalysis.Source:SoftwareEngineeringInstituteCarnegieMellonMcCabeMetricsTheMcCabeMetricsinclude...Cyclomaticcomplexity(v(G))Essentialcomplexity(ev(G))Moduledesigncomplexity(iv(G))Designcomplexity(S0)Integrationcomplexity(S1)DatacomplexityGlobaldatacomplexity(gdv(G))Specifieddatacomplexity(sdv(G))Isconstructedfromwrittencode分析一个模块Flowgraphs...Anarchitecturaldiagramofasoftwaremodule’slogicIsavisualizationofthemodule’sdecisionlogic分析一个模块Flowgraphs…anexampleinClanguage

function_test(y)0 { x=3;1

if(y<4)2 x=sin(y); else3 x=cos(y);4

x=x*x;5 }分析一个模块Flowgraphs…anexampleinClanguage0

function_test(y)0 { x=3;1 if(y<4)2 x=sin(y); else3 x=cos(y);4 x=x*x;5 }分析一个模块Flowgraphs…anexampleinClanguage0132

function_test(y)0 { x=3;1 if(y<4)2 x=sin(y); else3 x=cos(y);4 x=x*x;5 }分析一个模块Flowgraphs…anexampleinClanguage013452

function_test(y)0 { x=3;1 if(y<4)2 x=sin(y); else3 x=cos(y);4 x=x*x;5 }If..thenIf..then..elseIf..and..thenIf..or..thenDo..WhileWhile..DoSwitch分析一个模块ClanguageFlowgraphNotation分析一个模块Flowgraphs…anexampleinCOBOLlanguage0

PARA-SUB-PROC. DISPLAY“SUB-PROC”. MOVEATOB.1

IFSOME-NUMBER>OTHER-NUMBER2 DISPLAY“If-True” ELSE3 MOVEATOB.4

PERFORMDISPLAY-PROC.5 EXIT.分析一个模块0Flowgraphs…anexampleinCOBOLlanguage0

PARA-SUB-PROC. DISPLAY“SUB-PROC”. MOVEATOB.1 IFSOME-NUMBER>OTHER-NUMBER2 DISPLAY“If-True” ELSE3 MOVEATOB.4 PERFROMDISPLAY-PROC.5 EXIT.分析一个模块0132Flowgraphs…anexampleinCOBOLlanguage0

PARA-SUB-PROC. DISPLAY“SUB-PROC”. MOVEATOB.1 IFSOME-NUMBER>OTHER-NUMBER2 DISPLAY“If-True” ELSE3 MOVEATOB.4 PERFROMDISPLAY-PROC.5 EXIT.分析一个模块013452Flowgraphs…anexampleinCOBOLlanguage0

PARA-SUB-PROC. DISPLAY“SUB-PROC”. MOVEATOB.1 IFSOME-NUMBER>OTHER-NUMBER2 DISPLAY“If-True” ELSE3 MOVEATOB.4 PERFROMDISPLAY-PROC.5 EXIT.IF…THENIF…ELSE...IF…AND…THENIF…OR…THENPERFORMnTIMESPERFORM…UNTILEVALUATE分析一个模块COBOLlanguageFlowgraphNotation分析一个模块ExerciseonFlowgraphs1

IF condition2 statement3 ENDIF4 statement5 WHILEcondition6 DOSWITCH7 Label18 statement9 Label210 statement11 Default12 statement13 ENDSWITCH14 ENDWHILE分析一个模块CyclomaticComplexity(v(G))...ameasureofthecomplexityofamodule’sdecisionstructure.Itisthenumberoflinearlyindependentpathsand,therefore,theminimumnumberofpathsthatcouldbetestedtoreasonablyguardagainsterrors.Abbreviatedasv(G)Ahighcyclomaticcomplexityindicatesthatthecodemaybeoflowqualityanddifficulttotestandmaintainempiricalstudieshaveestablishedacorrelationbetweenhighcyclomaticcomplexityanderror-pronesoftwareThreemethods:

AllmethodsprovidesameresultFormalPredicateRegion分析一个模块CalculatingComplexity(v(G))...FormalMethod

分析一个模块CalculatingComplexity(v(G))...CountalledgesandnodesUseFormulaV(G)=e-n+2ExampleV(G)=e-n+2FormalMethod

分析一个模块CalculatingComplexity(v(G))...CountalledgesandnodesUseFormulaV(G)=e-n+2123456147815910111213ExampleV(G)=e-n+2FormalMethod

分析一个模块CalculatingComplexity(v(G))...CountalledgesandnodesUseFormulaV(G)=e-n+2ExampleV(G)=15-n+2FormalMethod

分析一个模块CalculatingComplexity(v(G))...CountalledgesandnodesUseFormulaV(G)=e-n+2132546710121198ExampleV(G)=15-n+2FormalMethod

分析一个模块CalculatingComplexity(v(G))...CountalledgesandnodesUseFormulaV(G)=e-n+2ExampleV(G)=15-12+2FormalMethod

分析一个模块CalculatingComplexity(v(G))...CountalledgesandnodesUseFormulaV(G)=e-n+2ExampleV(G)=15-12+2V(G)=5PredicateMethod

分析一个模块CalculatingComplexity(v(G))...CountallPredicatesandadd1UseFormulaV(G)=Predicates+1ExampleV(G)=4+1V(G)=5V(G)=Predicates+1RegionMethod

分析一个模块CalculatingComplexity(v(G))...CountalltheregionsthatthegraphdividesthepageintoUseFormulaV(G)=RegionExampleV(G)=RegionV(G)=514325DoesnotworkifLinescross分析一个模块v(G)=e-n+2v(G)=22-18+2v(G)=6ExerciseonCyclomaticComplexity(v(G))CyclomaticComplexity(v(G))MetricAdvantages预测潜在错误的软件比率指出过于复杂需要分解的模块通过限制程序的逻辑量来指导测试过程帮助管理测试和维护的资源(基于复杂度)分析一个模块应用任何语言和易于应用使程序易于理解易于测试分析一个模块EssentialComplexity(ev(G))...ameasureofthedegreetowhichamodulecontainsunstructuredconstructs.Abbreviatedas(ev(G))Ahighessentialcomplexityindicatesthatthereisahighnumberofunstructuredconstructs降低代码的质量维护工作加重很难分割模块在维护时修改一个错误经常引入其他错误分析一个模块EssentialComplexity(ev(G))MethodofCalculation...Iscalculatedbyremovingallstructuredconstructsfromamodule’sflowgraphandthenmeasuringthecyclomaticcomplexityofthereducedflowgraph.ThereducedflowgraphisaviewoftheunstructuredcodeCyclomaticComplexity=4McCabe’sEssentialComplexityev(G)RemovestructuredelementsandrecalculatethecomplexityEssentialComplexity=1分析一个模块FlowgraphReduction...ReducedReducedBranchingoutofaloopBranchingintoaloopBranchingintoadecisionBranchingoutofadecision分析一个模块ExamplesofUnstructuredLogic...v(G)=5分析一个模块EssentialComplexity(ev(G))FlowgraphReduction...ReducedFlowgraphv(G)=3Thereforeev(G)oforiginalFlowgraph=3SuperimposedFlowgraphv(G)=5ev(G)=3Gooddesignscanquicklydeteriorate

v(G)=10ev(G)=1

v(G)=11ev(G)=10分析一个模块EssentialComplexity(ev(G))helpsdetectunstructuredcodeEssentialComplexity(ev(G))MetricAdvantagesRevealsthequalityofthecodePredictstheeffortrequiredtomaintainthecodeandbreakitintoseparatemodulesAppliestoprogramswritteninanyprogramminglanguage分析一个模块MeasuresthedegreeofunstructurednessAnalysingaModule分析一个模块ModuleDesignComplexity(iv(G))...ModulesdonotexistinisolationMeasurehow“ManagerialaModuleIs”?MeasurehowmuchtestingisrequiredtoIntegratethismoduleintotherestofthesystem?ModulescallchildmodulesModulesdependsonservicesprovidedbyothermodulesCallsinteractwithothermodulesWeKnow….Canwethen...分析一个模块ModuleDesignComplexity(iv(G))...ameasureofamodule’sdecisionstructureasitrelatestocallstoothermodulesAbbreviatedasiv(G)QuantifiesthetestingeffortofamodulewithrespecttointegrationwithsubordinatemodulesHighmoduledesigncomplexitytendstohaveHighdegreeofcontrolcouplingmakingitdifficulttoisolatemaintainreuse分析一个模块ModuleDesignComplexity(iv(G))Methodofcalculation...Themoduledesigncomplexityiscalculatedasthecyclomaticcomplexityofthereducedmodule’sflowgraph.Reductioniscompletedbyremovingdecisions,loopsandnodesthatdonotimpactthecallingcontrolofthemoduleoveritssubordinates.Flowgraphofmainproge()progd()Therefore,

iv(G)oftheoriginalflowgraph=3

v(G)=3iv(G)=3mainprogeprogdmain(){ if(a==b)progd(); if(m==n)proge(); switch(expression) { casevalue_1: statement1; break; casevalue_2: statement2; break; casevalue_3: statement3; }}

v(G)=5分析一个模块Example...ReducedFlowgraphproge()progd()ReducedModuleDesignComplexity(iv(G))MetricAdvantagesMeasuresthesupervisoryroleofamoduleoveritssubordinatesMeasurestheminimumnumberofintegrationtestsfromamoduletoitsimmediatesubordinatesDiscriminatesbetweenmodules分析一个模块ApplytoanyprogramminglanguageandeasyapplicationwithcomplexcomputationlogicandthosewhichseriouslycomplicatethedesignofaprogramProvidesthebasisforprogramdesign(S0)andIntegration(S1)complexitytobecalculated分析一个模块ExampleofLowComplexityModule...Cyclomatic7Essential1Design4ReliableSimplelogicNoterror-proneEasytotestMaintainableGoodstructureEasytounderstandEasytomodify分析一个模块ExampleofModeratelyComplexModule...Cyclomatic16Essential1Design3UnreliableComplicatedlogicError-proneHardtotestMaintainableCanbeunderstoodCanbemodifiedComplexitycanbereduced分析一个模块ExampleofHighlyComplexModule...Cyclomatic22Essential22Design6UnreliableError-proneVeryhardtotestUnmaintainableHardtounderstandHardtomodifyHardtoreducecomplexity分析一个模块Cyclomatic192Essential151Design36Problem:Therearesizeand complexityboundariesbeyond whichsoftwarebecomes hopelessToerror-pronetouseToocomplextofixSolution:Controlcomplexity duringdevelopment andmaintenanceStayawayfromtheboundaryToolargetoredevelopeToolsetDemonstration...Demonstration...Complexitycalculation-Cyclomatic,Essential,Design分析一个模块MetricscreationAutomationofgraphingofflowgraphsDerivedMetricsClickHereforMcCabeToolsetProgramLevelMetricsMeasurethecomplexityofaprogramdesignIdentifyminimumyeteffectiveintegrationtestsHelpassesstheimpactofchangeDesignComplexity(S0)Measurestheamountofinteractionbetweenmodulesinaprogram.AbbreviatedasS0AsummaryofthemoduledesigncomplexityofthesystemcomponentsProgramLevelMetricsMeasurestheeffortrequiredforbottom-upintegrationtestingAnoverallmeasureofthesizeandcomplexityofaprogramdesignWithoutreflectingtheinternalcalculationofindividualmodulesSystemwithhighdesigncomplexityoftenHavecomplexinteractionsbetweencomponentsTendtobedifficulttomaintainDesignComplexity(S0)MethodofCalculation...S0isthesumofthemoduledesigncomplexities-iv(G)-ofallmodulesinaprogramandiscalculatedasfollows…ProgramLevelMetricsS0=iv(G)ProgramLevelMetricsHowcanweassessthecomplexityofthisdesign?MarketingDevelopmentRevenueSupportMaintenanceCalculatingDesignComplexity(S0)...ProgramLevelMetricsSystemDesignComplexityS0=ModuleDesignComplexity(iv(G))

DevelopmentMarketingRevenueSupportMaintenanceIv(G)=2Iv(G)=2Iv(G)=1Iv(G)=3Iv(G)=1S0=iv(G)S0=2+3+2+1+1S0=9CalculatingDesignComplexity(S0)...DesignComplexityS0MetricAdvantagesAppliestoacompleteprogram,aswellassubsystemsIndicatesthetotalcomplexityofadesign,reflectingeachmoduleandallinter-modulecontrolRevealsthequalityofthecodeRevealsthecomplexityofthemodulecallsinaprogramContributestotheintegrationcomplexity(S1)

ProgramLevelMetricsIntegrationComplexity(S1)Measuresthenumberofintegrationtestsnecessary.Inotherwords,itisthenumberoflinearlyindependentsubtreesinaprogram.AsubtreeisasequenceofcallsandreturnsfromamoduletoitsdescendantmodulesAbbreviatedasS1ProgramLevelMetricsIntegrationComplexity(S1)MethodofCalculation...TheIntegrationComplexity(S1)ofaprogramissimilartothecyclomaticcomplexity(v(G))ofamodule.Youmustcalculatethenumberofintegrationteststhatwouldberequiredtofullytesttheprogram.S1iscalculatedasfollows...ProgramLevelMetricsS1=S0-n+1ProgramLevelMetricsWhatisrequiredtotesttheintegrationofthissystem?MarketingDevelopmentRevenueSupportMaintenanceWhatistheminimumnumberofteststoexercisetheinteractionofeachofthesemodules?CalculatingIntegrationComplexity(S1)...ProgramLevelMetricsDevelopmentMarketingRevenueSupportMaintenanceIv(G)=2Iv(G)=2Iv(G)=1Iv(G)=3Iv(G)=1S0=iv(G)S0=2+3+2+1+1S0=9CalculatingIntegrationComplexity(S1)...ProgramLevelMetricsDevelopmentMarketingRevenueSupportMaintenanceS1=S0

-n+1S1=9-5+1S0=9S1=5CalculatingIntegrationComplexity(S1)...DesignComplexityS1MetricAdvantagesProvidesabasisforintegrationtestingQuantifiestheintegrationtestingeffortandrepresentsthecomplexityofthesystemdesignIsolatessystemcomplexityfromtotalsizeModuleswithnodecisionlogicdonotcontributetoS1ProgramLevelMetricsGlobalDataComplexity(gdv(G))...Quantifiesthecomplexityofamodule’sstructureasitrelatestoglobalandparameterdata.GlobaldataisdatathatcanbeaccessedbymultiplemodulesAbbreviatedasgdv(G)Showsamodule’slevelofdependencyonexternaldataDataMetricsMeasuresthetestingeffortwithrespecttoglobaldataAlsomeasuresthecontributionofeachmoduletothesystem’sdatacouplingTherebycanpinpointpotentialmaintenanceproblemsGlobalDataComplexitygdv(G)MethodofCalculation...AlldecisionsandloopsthatdonotcontainglobalorparameterdataaretreatedasstraightlinecodeDataMetrics

Nogreaterthanthecyclomaticcomplexity(v(G)) of theoriginalflowgraph

TypicallymuchlessDataMetricssubroutine(x){ if(c1) { if(c2)

x=y+n; if(c3) z=y+m; else printf(message1); if(z>10) printf(message2); flaga=1; if(c5) moda(x); } else { printf(message3); }}

gdv(G)x=3CalculatingGlobalDataComplexitygdv(G)...CALLmoda(x)C1C4C5x=y+nC2C3C1C4C5x=y+nCALLmoda(x)C2C3ReducedGlobalDataComplexitygdv(G)MetricAdvantages...IsolatethemoduleswiththehighestexternaldatacouplingRevealsthequalityofthecodeCombinescontrolflowanddataanalysistogiveacomprehensiveviewofsoftwareDataMetricsSpecifiedDataComplexity(sdv(G))...Quantifiesthecomplexityofamodule’sstructureasitrelatestouserdata.Abbreviatedassdv(G)Quantifiesthedatasetwitheachmodule’scontrolstructureDataMetricsGlobalDataComplexitysdv(G)MethodofCalculation...AlldecisionsandloopsthatdonotcontainspecifieddataelementsaretreatedasstraightlinecodeDataMetrics

Thespecifieddatacomplexityisthecyclomatic complexityofthereducedflowgraphCalculatingSpecifiedDataComplexitysdv(G)...DataMetrics

sdvz=3main(){ if(c1) { if(c2) x=y+n; if(c3)

z=y+m; else pritf(message1); if(z>10) printf(message2) flaga=1; if(c5) moda(x); } else { printf(message3); }}C1C4C5z=y+mC2C3z>10ReducedC2C5C3C4z=y+mC1z>10SpecifiedDataComplexitygdv(G)MetricAdvantages...IndicatesthedatacomplexityofamodulewithrespecttoaspecifieddataEqualstothenumberofbasistestpathstotestallusesofthespecifiedsetofdatainamoduleIsolatetheimpactofadatastructurechangeonsoftwareDataMetricsToolsetDemonstration...Demonstration...DesignComplexityAnalysingaModuleIntegrationComplexityGlobalandSpecifiedDataComplexityChangeImpactAnalysisClickHereforMcCabeToolsetOtherFacetsofComplexityMeasures...HenryandKafurametricsCouplingbetweenmodules(parameters,globalvariables,calls)MetricsModuleandsystemcomplexity;couplingviaparametersandglobalvariablesModularityorcoupling;complexityofstructure(maximumdepthofstructurechart);calls-toandcalled-byModularityofthestructurechartBowlesmetricsTroyandZwebenmetricsLigiermetricsSource:SoftwareEngineeringInstituteCarnegieMellonMcCabeMetricsHowMetricsCanHelpAccessQuality...CyclomaticComplexityv(G)ComprehensibilityTestingEffortReliabilityEssentialComplexityev(G)StructurednessMaintainabilityRe-engineeringEffortModuleDesignComplexityiv(G)IntegrationEffortMcCabeMetricsHowMetricsCanHelpAccessQuality...DesignComplexityS0ComplexityofadesignComplexityofthemodulecallsIntegrationComplexityS1QuantifiestheintegrationeffortGlobalComplexity(gdv(G))ModulesexternaldatacouplingControlflowanddataanalysisSpecifiedComplexity(sdv(G))ImpactsofadatastructurechangeMcCabeMetricsOtherMcCabeMetrics...NumberofLines(nl)NormalisedComplexity(nv)PathologicalComplexity(pv(G))GlobalDataDensity(global_data_density)SpecifiedDataReference(sdr)SpecifiedDataComplexityDecisionSeverity(sdv_severity)SpecifiedDataReferenceDecisionSeverity(sdr_severity)TestingSoftware“测试花费了软件项目开支的1/3到1/2,但不幸的是,大量的测试努力错误的放在事故后的无效测试上,问题是怎样量化需要执行多少测试,怎样区分什么是可测的什么不是?“TomMcCabe,McCabe&AssociatesSoftwareTestingSoftwareTestingWhatisSoftwareTesting?Verification:Validation:“Arewebuildingtherightproduct?”V&V(Boehm,1984)“Arewebuildingtheproductright?”`RisingcostofsoftwarefailureSoftwareTestingWhytheneedtoTestSoftware?RisingriskofsoftwarefailureExternalization形象化throughweb,e-businessITasaprofitcenterratherthanjustacostcenterMulti-layeredarchitecturesMixedlanguages:Java,C++,C,VB,COBOLinoneapplicationMixedplatforms:Windows,Unix,MainframeinoneapplicationSoftwareTestingSoftwareTestingIssues...RiskVsCostCostofdelay-firsttomarketCostofResources-peopleandnon-peopleCostifdefectiveafterreleaseProbabilityofdefectsafterreleaseEstimationsizeandeffortandtherebythecostoftestingSoftwareTestingSoftwareTestingIssues...OtherTestingIssuesLackofManagementSupportConstraintbyreleasedateConstraintbyBudgetShortageandchronicsupplyofskilledresourcesTestingisnotthemostattractivecareerPrioritisingTestsDeriving“good”testingdataVerifyingTestWhentostoptestingHowmuchtestingisappropriateSoftwareTestingSomeTestingTerminology...UnitTestingUsuallyperformedbytheSoftwareEngineer/AuthorPurposeistolocateProgrammaticerrorsStandalonetestLowestLevelofTestingOftenAd-hoc(NoStandards)DifficulttoderiveSuitableTestCanbetimeconsumingSoftwareTestingSomeTestingTerminology...IntegrationTestingVerifythatComponents/modulesInter-operatecorrectlyUsuallydoneinincrementalmannerVerifyintegrityofsub-systemTestingofacomb

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论