Structural testing

9
Structural Testing Saranya.V AP/CSE, Sri Vidya College of Engineering & Technology, Virudhunagar

description

 

Transcript of Structural testing

Page 1: Structural testing

Structural Testing

Saranya.VAP/CSE,

Sri Vidya College of Engineering & Technology,Virudhunagar

Page 2: Structural testing

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.

Page 3: Structural testing

Categories of Structural Testing

Statement CoveragePath CoverageBranch CoverageCondition Coverage

Page 4: Structural testing

Weakest form of testing.Because this kind of

testing requires that every statement in the code has been executed at least once.

Ex:BeginIf(y>= 0) then y=0-y;Abc=y;end

yes

No

Begin

Y>=0

Abc=y

Y=0-y

Page 5: Structural testing

2. Branch Coverage

Test 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.

Page 6: Structural testing
Page 7: Structural testing

3. Condition Coverage TestingIF ("X && Y")

TEST 1: X=TRUE, Y=FALSETEST 2: X=FALSE, Y=TRUE

• Check all possible combinations of conditions.

• While branch coverage is stronger than statement coverage, its not suitable for multiple conditions checking.

Page 8: Structural testing

• Example: “if (A or B)” requires 4 test cases:A = True, B = TrueA = True, B = FalseA = False, B = TrueA = False, B = False

Page 9: Structural testing

4. Path Coverage TestingPaths in the program executed at

least once. Independent path can be defined

in terms of CFG.White box testing is used here.Test the each independent path.But this process will be complex

one when the loop occurs.

1 2

T F

T F

P1

P2