# Thread: Unit Testing: Block Testing Help !

1. ## Unit Testing: Block Testing Help !

Hello Everyone,

I am trying to understand Block Testing using the book: "How we test software at Microsoft" by Alen Page, Ken Johnston, Bj Rollison. On page 118 and 119 of the book I am given two block function examples. I have provided pictures of these functions:

Block Example 1

Block Example 2

The Book says block coverage measures the number of contiguous groups of statements unbound by branches. I believe I am not understanding this. Can someone explain why

int x = 0, y =0, z=0 ; if (condition) is considered 1 block in BlockExample1 Function

and

int x=0, y=0, ze=0; if (condition 1 &amp;&amp; condition2) is considered 4 Blocks in BlockExample2 ?

2. ## Re: Unit Testing: Block Testing Help !

I never heard of block testing and I have been testing a loooooooong time!! But it figures its a microsoft thing.

3. ## Re: Unit Testing: Block Testing Help !

I just had to google it.. and ran into the same question.

http://stackoverflow.com/questions/5...sting-question

That's actually pretty interesting. It's like taking data flow coverage to the next degree.

Their explaination was if condition1 is false, condition2 is never evaluated. So even though you can achieve dataflow coverage by using condition1=false &amp; condition2=any; and condition1=true &amp; condition2=true. (as you have covered all possible datapaths) It's not really full test coverage if say just the evaluation of contidtion2 can cause an error because condition2 is never evaluated if condition 1 is false.

But I still don't get how they count the blocks. I guess i'll have to read the book.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.