Basis Path Testing

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

Basis Path Testing Basis path testing is a white box testing technique first proposed by Tom McCabe.

The Basis path method enables to derive a logical complexity measure of a procedural design and use this measure as a guide for defining a basis set of execution paths. Test Cases derived to exercise the basis set are guaranteed to execute every statement in the program at least one time during testing. Designing Test Cases There are various techniques in which you can design test cases. For example, the below illustrated gives you an overview as to how you derive test cases using the basis path method The basis path testing method can be applied to a procedural design or to source code. The following steps can be applied to derive the basis set !. "se the design or code as a foundation, draw corresponding flow graph. #. $etermine the Cyclomatic complexity of the resultant flow graph. %. $etermine a basis set of linearly independent paths. &. 'repare test cases that will fore execution of each path in the basis set. (et us now see how to design test cases in a generic manner !. "nderstand the requirements document. #. Brea) the requirements into smaller requirements *if it improves your testability+. %. For each ,equirement, decide what technique you should use to derive the test cases. For example, if you are testing a (ogin page, you need to write test cases basing on error guessing and also negative cases for handling failures. &. -ave a Traceability Matrix as follows ,equirement .o */n ,$+ ,equirement Test Case .o 0hat this Traceability Matrix provides you is the coverage of Testing. 1eep filling in the Traceability matrix when you complete writing test case2s for each requirement.

Basis Path Testing 3 testing mechanism proposed by McCabe. 3im is to derive a logical complexity measure of a procedural design and use this as a guide for defining a basic set of execution paths. Test cases which exercise basic set will execute every statement at least once. Flow Graph Notation .otation for representing control flow

4n a flow graph 3rrows called edges represent flow of control Circles called nodes represent one or more actions. 3reas bounded by edges and nodes called regions. 3 predicate node is a node containing a condition 3ny procedural design can be translated into a flow graph. .ote that compound boolean expressions at tests generate at least two predicate node and additional arcs.

5xample !.%.# Cyclomatic Complexity The cyclomatic complexity gives a quantitative measure of the logical complexity. This value gives the number of independent paths in the basis set, and an upper bound for the number of tests to ensure that each statement and both sides of every condition is executed at least once. 3n independent path is any path through a program that introduces at least one new set of processing statements *i.e., a new node+ or a new condition *i.e., a new edge+

5xample has Cyclomatic Complexity of &. Can be calculated as .umber of regions of flow graph. 65dges 7 6.odes 8 6terminal vertices *usually #+ 6'redicate .odes 8 ! /ndependent 'aths !, 9 !, #, %, :b, !, 9 !, #, &, ;, :a, :b, !, 9 !, #, &, <, :a, :b, !, 9

Cyclomatic complexity provides upper bound for number of tests required to guarantee coverage of all program statements. !.%.% $eriving Test Cases "sing the design or code, draw the corresponding flow graph. $etermine the cyclomatic complexity of the flow graph. $etermine a basis set of independent paths. 'repare test cases that will force execution of each path in the basis set. .ote some paths may only be able to be executed as part of another test.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy