<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>Software design and embedded system tools. &#187; statement coverage</title>
	<atom:link href="http://embedsoftdev.com/tag/statement-coverage/feed/" rel="self" type="application/rss+xml" />
	<link>http://embedsoftdev.com</link>
	<description>Good information for software design</description>
	<lastBuildDate>Fri, 27 Aug 2010 22:53:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to do white box testing</title>
		<link>http://embedsoftdev.com/software-engineering/how-to-do-white-box-testing/</link>
		<comments>http://embedsoftdev.com/software-engineering/how-to-do-white-box-testing/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 15:27:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[branch coverage]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[condition coverage]]></category>
		<category><![CDATA[statement coverage]]></category>
		<category><![CDATA[white box]]></category>
		<category><![CDATA[white box testing]]></category>
		<guid isPermaLink="false">http://embedsoftdev.com/?p=202</guid>
		<description><![CDATA[The article for today is about white box testing.I had written article about white box testing in this blog but that time it was only introduction of white box testing.This article concern with how to do white box testing. The procedure of White box testing is normally saparated into 3 topic as follow 1.Statement Coverage [...]
Related posts:<ol><li><a href='http://embedsoftdev.com/software-engineering/software-testing-ii-white-box-and-black-box-testing/' rel='bookmark' title='Permanent Link: Software testing part II (White Box and Black Box testing)'>Software testing part II (White Box and Black Box testing)</a></li>
<li><a href='http://embedsoftdev.com/software-engineering/software-testing-part-i/' rel='bookmark' title='Permanent Link: Software testing part I.'>Software testing part I.</a></li>
<li><a href='http://embedsoftdev.com/software-engineering/user-acceptance-test/' rel='bookmark' title='Permanent Link: User Acceptance Testing.'>User Acceptance Testing.</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a rel="nofollow" target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fembedsoftdev.com%2Fsoftware-engineering%2Fhow-to-do-white-box-testing%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fembedsoftdev.com%2Fsoftware-engineering%2Fhow-to-do-white-box-testing%2F&amp;style=normal" height="61" width="50" title="How to do white box testing" alt="software engineering How to do white box testing" /><br />
			</a>
		</div>
<p>The article for today is about white box testing.I had written article about white box testing in this blog but that time it was only introduction of white box testing.This article concern with how to do white box testing.</p>
<p>   The procedure of White box testing is normally saparated into 3 topic as follow</p>
<p>1.<strong>Statement Coverage</strong><br />
   It is the testing to verify that all instructions or code must be executed at least one time.We can specify one or more than one test case for doing statement coverage testing (there may be a chance that one test case is not cover all the code we need to test).Below is an example demonstate how to do statement coverage testing.</p>
<p>Suppose you have a piece of code to test like this</p>
<div id="attachment_203" class="wp-caption aligncenter" style="width: 310px"><img src="http://embedsoftdev.com/wp-content/uploads/2009/10/untitled-300x258.jpg" alt="Code1" title="Code1" width="300" height="258" class="size-medium wp-image-203" /><p class="wp-caption-text">Code1</p></div>
<p>If you determin &#8216;C&#8217; as the test case then the coverage reach 100% (pass through all line of code) and only one test case is sufficient for doing Statement Coverage for this code.</p>
<p><strong>Advantage of Statement Coverage.</strong><br />
1.To ensure that all source code can be reached at least for one time.<br />
2.It is suitable for making Performance profiling because it can be applied directly to object code without processing source code.</p>
<p><strong>Disadvantage of Statement Coverage.</strong><br />
1.It is insensitive to logical operators such as OR (||),AND (&#038;&#038;) etc.<br />
2.If your source code have a lot of IF-ELSEIF-ELSE statements or contain consecutive switch labels then the test case used for doing Statement Coverage will be increased respectively.</p>
<p>2. <strong>Branch Coverage (Condition judgment Coverage)</strong><br />
   It is the testing to verify that all branches and instructions must be executed at least one time (Concentrate on testing to cover every branches or decision points in the code).It is the easiest way to perform testing of path or workflow of program.</p>
<p>Please consider the code below and its explanation to understand the operation of Branch Coverage testing.</p>
<div id="attachment_204" class="wp-caption aligncenter" style="width: 310px"><img src="http://embedsoftdev.com/wp-content/uploads/2009/10/untitled123-300x210.jpg" alt="code2" title="code2" width="300" height="210" class="size-medium wp-image-204" /><p class="wp-caption-text">code2</p></div>
<p>In the above code we need only two test case to cover all the branches (also all instructions too), they are&#8230;<br />
Test case #1 : Input n1 = 1 , n2 = 1<br />
Test case #2 : Input n1 = 2 , n2 = 0</p>
<p><strong>Advantage of Branch Coverage.</strong><br />
1.To validate all branches in the code can be reached and ensure that no branches lead to abnormal of the program&#8217;s operation.<br />
2.It eliminate problems that occur with Statement Coverage testing.</p>
<p><strong>Disadvantage of Branch Coverage.</strong><br />
1.There may be other condition that can be used for decision making.For the example, statement &#8220;if((b == TRUE) || functionA())&#8221;, in this statement we can define only test case with &#8220;B = TRUE&#8221; and this test case is cover this branch but functionA() isn&#8217;t tested.</p>
<p>3.<strong>Condition Coverage/Multiple Condition Coverage</strong></p>
<p>   It is the testing to verify that all condition expression within each branch will be tested (the true and the false condition of each sub-expression within the decision branch must be tested at least one time ).<br />
It is more intensive testing than Branch Coverage and Statement Coverage.Multiple Condition Coverage has detail of testing more than Condition Coverage.Its test cases are larger than test case of Condition<br />
Coverage because it ensures that all possible combination of conditions of sub-expression within each branch must be tested.</p>
<p>Please consider the code below for Condition Coverage testing.</p>
<div id="attachment_205" class="wp-caption aligncenter" style="width: 310px"><img src="http://embedsoftdev.com/wp-content/uploads/2009/10/untitled456-300x234.jpg" alt="code3" title="code3" width="300" height="234" class="size-medium wp-image-205" /><p class="wp-caption-text">code3</p></div>
<p>If you want to test above code by using Condition Coverage you must specify two test<br />
cases to cover all sub-expressions in this branch.The test cases are as follow…</p>
<p>Test case #1: Input n1 = 60 , n2 = 70<br />
Test case #2: Input n1 = 40 , n2 = 110</p>
<p>If you want to test above code with Multiple Condition Coverage you must specify four<br />
test cases to cover all combination of possible condition of sub-expressions in this branch and the test cases look like these</p>
<p>Test case #1: Input n1 = 60 , n2 = 70<br />
Test case #2: Input n1 = 60 , n2 = 110<br />
Test case #3: Input n1 = 40 , n2 = 70<br />
Test case #4: Input n1 = 40 , n2 = 110</p>
<p><strong>Advantage of Condition/Multiple Condition coverage.</strong><br />
1.It is very thorough testing and the bugs are normally found by this kind of testing.</p>
<p><strong>Disadvantage.. </strong><br />
1.If the decision branch contain lots of sub-expressions or has very complex boolean expressions , the tester will have to define a large number of test cases.</p>
<p>Thank you,<br />
      jitkasem pintaya.</p>
<p>Reference site:<br />
1.<a rel="nofollow" target="_blank" href="http://blog.mindblazetech.com/tag/statement-coverage/">MindBlaze Blog</a><br />
2.<a rel="nofollow" target="_blank" href="http://www.bullseye.com/coverage.html#basic_decision">Bullseye</a><br />
3.<a rel="nofollow" target="_blank" href="http://www.google.co.th/url?sa=t&#038;source=web&#038;ct=res&#038;cd=7&#038;ved=0CCcQFjAG&#038;url=http%3A%2F%2Freferaat.cs.utwente.nl%2Fnew%2Fpaper.php%3FpaperID%3D58&#038;ei=MJvUSu6xNYmE6QOs4dDWCw&#038;usg=AFQjCNF5o0Df22EvxrWGrvBtN252Q90Cfw&#038;sig2=sN8v_rOLdc_F9PC-oo9-Dg">The paper from utwente.nl by Arnold Zanderink</a></p>
<h4>Incoming search terms for the article:</h4><ul><li><a href="http://embedsoftdev.com/software-engineering/how-to-do-white-box-testing/" title="how to carry out white box testing">how to carry out white box testing</a></li><li><a href="http://embedsoftdev.com/software-engineering/how-to-do-white-box-testing/" title="what is white box testing in software engineering">what is white box testing in software engineering</a></li><li><a href="http://embedsoftdev.com/software-engineering/how-to-do-white-box-testing/" title="white box test">white box test</a></li></ul><!-- SEO SearchTerms Tagging 2 plugin took 1.192 ms -->
<p>Related posts:<ol><li><a href='http://embedsoftdev.com/software-engineering/software-testing-ii-white-box-and-black-box-testing/' rel='bookmark' title='Permanent Link: Software testing part II (White Box and Black Box testing)'>Software testing part II (White Box and Black Box testing)</a></li>
<li><a href='http://embedsoftdev.com/software-engineering/software-testing-part-i/' rel='bookmark' title='Permanent Link: Software testing part I.'>Software testing part I.</a></li>
<li><a href='http://embedsoftdev.com/software-engineering/user-acceptance-test/' rel='bookmark' title='Permanent Link: User Acceptance Testing.'>User Acceptance Testing.</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://embedsoftdev.com/software-engineering/how-to-do-white-box-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
