102

ISBN : 978-81-963532-2-3 (E-Book) program.Writing test cases to cover all the paths of a typical program is impractical. For this reason, coveragetestingdoesnotrequirecoverageofallpathsbutonlycoverageoflinearlyindependentpaths. Linearlyindependentpath Alinearlyindependentpathisanypaththroughtheprogramthatintroducesatleastonenewedge that is not included in any other linearly independent paths. If a path has one new nodecompared to all other linearly independent paths, then the path is also linearly independent. This isbecause;anypathhavinganewnodeautomaticallyimpliesthatithasanewedge.Thus,apaththatissub-path ofanother pathisnot considered tobe alinearlyindependent path. ControlFlowGraph Inordertounderstandthepathcoverage-basedtestingstrategy,itisverymuchnecessarytounderstand the control flow graph (CFG) of a program. Control flow graph (CFG) of a program hasbeendiscussed earlier. LinearlyIndependentPath The path-coverage testing does not require coverage of all paths but only coverage of linearlyindependentpaths. Linearlyindependent pathshavebeen discussedearlier. CyclomaticComplexity For more complicated programs it is not easy to determine the number of independent paths of theprogram.McCabe’scyclomaticcomplexity definesanupperboundforthenumberoflinearlyindependent paths through a program. Also, the McCabe’s cyclomatic complexity is very simple tocompute. Thus, the McCabe’s cyclomatic complexity metric provides a practical way of determiningthe maximum number of linearly independent paths in a program. Though the McCabe’s metric doesnot directly identify the linearly independent paths, but it informs approximately how many paths tolookfor. There are three different ways to compute the cyclomatic complexity. The answers computed by thethreemethodsare guaranteed toagree. thepathMethod1: GivenacontrolflowgraphGofaprogram,thecyclomaticcomplexityV(G)canbecomputedas: 97 Software Engineering Keerthana P, Manasa KN, Ganga D Bengal

103 Publizr Home


You need flash player to view this online publication