Structural Testing Saranya.V AP/CSE,Sri Vidya College of Engineering & Technology, Virudhunagar
Test cases based upon the structure of the code under testing.Stronger than other testing methodologies.Complementary Testing:Testing strategy (A) detects some errors.Testing strategy (B) detects some more errors which is uncovered by (A). This is known as complementary testing strategy.
Categories of Structural TestingStatement CoveragePath CoverageBranch CoverageCondition Coverage
1. Statement Coverage Weakest form of testing. Because this kind of testing requires that Begin every statement in the code has been executed at least once. yesEx: Y>=0 Y=0-yBeginIf(y>= 0) then y=0-y; NoAbc=y; Abc=yend
2. Branch CoverageTest cases are generated to test each branch condition assume true or false values in turn.Also known as Edge Testing.Edge of the programs control flow graph is traversed at least once.These kind of test cases checks Branches of decision box.
3. Condition Coverage Testing• Check all possible combinations of IF ("X && Y") conditions.• While branch TEST 1: X=TRUE, coverage is stronger than statement Y=FALSE coverage, its not TEST 2: X=FALSE, suitable for multiple Y=TRUE conditions checking.
• Example: “if (A or B)” requires 4 test cases: A = True, B = True A = True, B = False A = False, B = True A = False, B = False
4. Path Coverage Testing Paths in the program executed at least once. 1 2 Independent path can be P1 F T defined in terms of CFG. White box testing is used here. P2 F Test the each independent path. T But this process will be complex one when the loop occurs.