The online community for software testing & quality assurance professionals

 Web SQAforums.com
Calendar   Today's Topics
 You are not logged in. [Login] Main Index · Search · Active Topics New user · Who's Online · FAQ · Calendar

Software Testing >> Unit Testing

Pages: 1
rigziu
Newbie

Reged: 03/13/11
Posts: 1
Unit Testing: Block Testing Help !
#664076 - 03/13/11 03:34 PM

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 && condition2) is considered 4 Blocks in BlockExample2 ?

 Post Extras:
QAMgrMjk
Member

Reged: 11/18/11
Posts: 28
Loc: Florida
Re: Unit Testing: Block Testing Help ! [Re: rigziu]
#691554 - 11/18/11 12:52 PM

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

--------------------
QAMgrMjk

 Post Extras:
dlai
Junior Member

Reged: 05/02/06
Posts: 1041
Loc: CA, USA
Re: Unit Testing: Block Testing Help ! [Re: QAMgrMjk]
#691555 - 11/18/11 01:09 PM

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

http://stackoverflow.com/questions/5201765/block-testing-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 & condition2=any; and condition1=true & 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.

--------------------
David Lai

 Post Extras:
Pages: 1

Extra information
0 registered and 3 anonymous users are browsing this forum.

Moderator:  AJ, Jeanj

Print Topic

Forum Permissions
You cannot start new topics