軟件質量與結構化測試_第1頁
軟件質量與結構化測試_第2頁
軟件質量與結構化測試_第3頁
軟件質量與結構化測試_第4頁
軟件質量與結構化測試_第5頁
已閱讀5頁,還剩138頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

ualitySoftware軟件質量與結構化測試WhyQualityandStableSoftware“SoftwareGlitch(失靈)TakesOutSchwabWebSite”“AResumesService;Stockoff5%inWakeofGlitch”“GlitchSnuffsOutOnlineBroker(經(jīng)紀人)

ForHours”(E-Trade)SoftwareQualityDrivers

軟件失敗帶來的高損失

系統(tǒng)直接開放給客戶

有限的預算和資源SoftwareDevelopmentLifecycleUserRequirementsRequirementSpecificationFunctionalSpecificationArchitecturalDesignDetailedDesignImplementationModuleTestInstallationComponentTest&IntegrationSystemTest&IntegrationQualityRequirementValidationthroughBeta/FieldtestQualityCheck軟件開發(fā)過程策略知道怎么做目標DecidePredictEvaluateAdjustProcess軟件項目軟件產(chǎn)品Models測量工具AnalyzeRegulationRequirementsDocumentsSpecificationDocumentsDesignDocumentsSourceCodesTestPlansTestingMaintenanceDesignCoding軟件開發(fā)Maintenance軟件開發(fā)的工作分配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軟件過程商業(yè)價值易于修改可實現(xiàn)性可靠性更少的bug多功能性特征的多少Q(mào)uality needs QualityAssurance needsaQualitySystem needs QualityManagement軟件錯誤不是產(chǎn)生于: -故意的 -無能為力只是因為在開發(fā)過程中質量和開銷,時間矛盾質量差縮短時間表“Qualitydoesnothappenbymistake!”為什么質量差?壓縮的預算人事的變化用戶需求的改變提高或增加功能或性能BugFixing無效的測試SoftwareQualityAssurance原則

質量不必是“最好”的質量是用戶想要的和愿意購買的

范圍QAismorethantestingQAnotonlyattheendoftheprojectQAofproductandprocess

格言

Movingfromqualitycontrolling(expost)topreventionbyqualityservice. 通過質量服務把質量控制變換到預防

QualityCharacteristics

質量特征可靠性性能可維護性健壯性用戶友好性ISO9126SoftwareComplexity軟件產(chǎn)品系統(tǒng)體系復雜性模塊文本復雜性模塊的結構復雜Asoftwareproductisasolutionofaproblem.Thecomplexityofthesolutiongenerallydependsonthecomplexityoftheproblem.QualityModels分配用戶需求

QualityFactors到開發(fā)標準

QualityCriteria到可證明的和測量的值

MetricsFactor-Criteria-MetricsRelationshipQualityTreeConceptQUALITYFACTOR1FACTORIFACTORLCRITERIA1CRITERIAJCRITERIAMMETRICKMETRIC1METRICNTheMetricsFACTORSCRITERIAMETRICS可維護性自描述性簡單性簡明性模塊性嵌套級別數(shù)環(huán)數(shù)可執(zhí)行語句數(shù)操作數(shù)頻率語句平均長度組件級別注釋率BoehmModelGENERALUTILITYASISUTILITYMAINTAINABILITY可移植性可靠性效率人類工程學易測性易讀性可修改性獨力于設備完整性準確度一致性設備效率易訪問性通信性能自描述結構化簡明性易理解可擴展性PRIMARYUSESINTERMEDIATECONSTRUCTSPRIMITIVECONSTRUCTS互用性可用性完整性效率正確性可靠性可維護性易測性復用性靈活性可移植性{{{產(chǎn)品操作產(chǎn)品修訂產(chǎn)品遷移McCallModelOPERABILITYTRAININGCOMMUNICATIVENESSACCESSCONTROLACCESSAUDITSTORAGEEFFICIENCYEXECUTIONEFFIENCYTRACEABILITYCOMPLETENESSACCURACYERRORTOLERANCECONSISTENCYSIMPLICITYCONCISENESSTESTCOVERAGEINSTRUMENTATIONEXPANDABILITYGENERALITYSELFDESCRIPTIVENESSMODULARITYMACHINEINDEPENDENCESOFTWARESYSTEMINDEPENDENCECOMMUNICATIONSCOMMONALITYDATACOMMONALITYACTIVITYFACTORSCRITERIAQualityandQualityManagement質量需要用需求,可接受性和它們達到的證據(jù)來衡量質量是通過解決問題實現(xiàn)的質量管理確保前面解決過的問題不再出現(xiàn)沒有質量測量來做質量管理只能是幻想測量工具的好處支持質量管理系統(tǒng)開發(fā)工程師可以自己檢查支持代碼評審評價外部軟件支持測試ualitySoftwareMetricsWhatisaMetric?任何測量的單位e.g.Cm,Litre,Ohm,Second,Color描述一個實體的屬性度量的類型:和項目相關時間表/開支估算測量功能點軟件度量′只有當你對你所談到的東西進行測量時,并用數(shù)量表示時,你就對它有了一定了解,反之,你對它并沒有真正的了解.′LordKelvin,1889′Youcan‘tcontrolwhatyoucan‘tmeasure.′DeMarco,1982SoftwareQualityMetricsMeasurementisusefulbut...

5.1o-1sMeasurementWhatdowewanttomeasure?Howdowemeasure?n?Whatdothemeasurementsmea復雜性尺寸測試路徑冗余結構模塊性可維護性可靠性可復用性可測量的不可測量的5.2o-2sWhattoMeasure?直觀的GoodMetricsshould:和錯誤出現(xiàn)有直接關系GoodMetricsGoodMetricsmust:客觀的語言獨立和測試努力直接有關自動化簡單提高質量4.1s測量確定質量TimeQuality防止質量退化輔助做出決策理解提高生產(chǎn)力確定變更的影響風險分析測試確保質量提高測試效率Metrics++HalsteadMetricsAvailableMeasurementsInclude:FunctionPointLineCountMetricsMcCabeMetricsDataMetricsSystemLevelMetricsOOMetricsDerivedMetricsHalsteadMetrics起源:1977年MauriceHalstead開發(fā)介紹MeansofdeterminingaquantitativemeasureofcomplexitydirectlyfromoperatorsandoperandsinthemoduleWasdevelopedtomeasuremodule’scomplexityfromsourcecode,emphasisingoncomputationcomplexityAstheyappliedtocode,oftenusedasamaintenancemetricWidelydifferingopinionsontheirworthSource:SoftwareEngineeringInstituteCarnegieMellon技術TheHalsteadmeasuresarebasedonfourscalarnumbersderiveddirectlyfromaprogram'ssourcecode:n1=thenumberofdistinct(獨立的)operators操作符 n2=thenumberofdistinctoperands操作數(shù) 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不必深入分析程序的結構預測錯誤的數(shù)目預測維護的工作量對報告和計劃項目的健康程度有幫助對整個程序有幫助計算簡單適合任何編程語言經(jīng)過很多工業(yè)研究,都支持使用Halstead來預測開發(fā)工作量和平均bugsFunctionPointsOriginWasdevisedin1977byA.J.AlbrechtthenwithIBM測量軟件的大小和生產(chǎn)力Technique基本功能點分為5組:outputs,inquiries調(diào)查,inputs,files,andinterfaces.功能點就是最終用戶的業(yè)務功能,比如對輸入的查詢.和軟件完成的功能緊密相關Source:SoftwareEngineeringInstituteCarnegieMellonFunctionPointsAdvantagesGenerallyacceptedasaneffectivewayto:很大的用戶社區(qū);InternationalFunctionPointGroup(IFPG)多于1,200會員公司

建立每小時功能點的生產(chǎn)率評估對需求的支持Estimateasoftwareproject'ssize(andinpart,duration)Normalisethecomparisonofsoftwaremodules評估系統(tǒng)變更的開銷StandardpracticesforcountingandusingFunctionPointsisavailableintheIFPGCountingPracticesManualSource:SoftwareEngineeringInstituteCarnegieMellonLineCountMetrics表明每個模塊的行數(shù),包括代碼,注釋,空白行,混合代碼和注釋.技術LOCiscategorisedintothefollowingcomponents:Lines-of-Code(LOC)metrics提供代碼的總額,但是對內(nèi)容的測量不太好blanks- Lineswithonlyspace(eg.spaceandtabs)ornotextcommentcode- Sourcelinesofcodethatcontainonlycodeandwhitespacecomments- SourcelinesofcodethatarepurelycommentsMixed- LinesthatcontainbothcodeandcommentsLineCountMetricsAdvantagesMeasuresphysicalsizeofsoftwareIdentifiesspecificlinecountcomponents,suchascommentandblanklinesHelpstopinpointamodulethatisdifficulttounderstand.(Commentlinesoftenincreasereadability,althoughanunusuallylargenumberofcommentscanindicatethatthemoduleisdifficulttounderstand.)McCabeMetricsOriginCyclomaticComplexityintroducedbyThomasMcCabein1976Itmeasuresthenumberoflinearly-independentpathsthroughaprogrammoduleThismeasureprovidesasingleordinalnumberthatcanbecomparedtothecomplexityofotherprogramsAbroadmeasureofsoundnessandconfidenceforaprogramOftenreferredtosimplyasprogramcomplexity,orasMcCabe’scomplexityMcCabeMetricsAdvantages廣泛應用的靜態(tài)軟件度量

和其他度量互補

獨立于開發(fā)語言擴展到可以包括設計和結構復雜度

基于軟件結構的嚴格的數(shù)學分析McCabeMetricsAdvantages可以應用到幾個領域:維護的風險分析Codecomplexitytendstoincreasethroughmaintenanceovertime.Bymeasuringbeforeandaftercomplexitycanbemonitored,managedandminimisetheriskofchange.代碼開發(fā)的風險分析: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降低代碼的質量維護工作加重很難分割模塊在維護時修改一個錯誤經(jīng)常引入其他錯誤分析一個模塊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,但不幸的是,大量的測試努力錯誤的放在事故后的無效測試上,問題是怎樣量化需要執(zhí)行多少測試,怎樣區(qū)分什么是可測的什么不是?“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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論