{"id":1464,"date":"2018-07-13T18:35:47","date_gmt":"2018-07-13T18:35:47","guid":{"rendered":"https:\/\/www.h2kinfosys.com\/blog\/?p=1464"},"modified":"2020-11-05T15:51:04","modified_gmt":"2020-11-05T10:21:04","slug":"statement-coverage-testing","status":"publish","type":"post","link":"https:\/\/www.h2kinfosys.com\/blog\/statement-coverage-testing\/","title":{"rendered":"STATEMENT COVERAGE TESTING"},"content":{"rendered":"<p>There are two major types of <a href=\"https:\/\/www.h2kinfosys.com\/blog\/white-box-testing\/\">White box testing<\/a> techniques: Statement coverage testing and <a href=\"https:\/\/www.h2kinfosys.com\/blog\/decision-testing\/\">branch coverage<\/a> testing.<\/p>\n<p>STATEMENT COVERAGE TESTING:<\/p>\n<p>Statement coverage type of white box software testing technique. It is called line or segment coverage testing. This testing is done to the code written to test whether the code written is qualitative or whether it does what it is expected to be done. It is checked in true conditions it is verified for every line of statements. Consider an example:<\/p>\n<p>Example 1:<\/p>\n<p>Read A<br>\nRead B<br>\nIf A &gt; B then<br>\nx = 0<br>\nEnd if<\/p>\n<p>To achieve 100% statement coverage we need to check only one test case here. We ensure that A value is greater than B for input values like A=14 and B=11. Here we check the structural design first as we are choosing input values to make certain the statement of coverage. The main disadvantage of this technique is here we cannot check the false condition of statements.<\/p>\n<p>Example 2:<\/p>\n<p>To check if number is greater than 50<\/p>\n<p>Read A<br>\nIf A &gt; 50 then<br>\nprint \u201cA is greater than 50\u201d<br>\nEnd if<\/p>\n<p>In statement coverage testing, to achieve 100% statement coverage we check with value of A greater than 50.<\/p>\n<p>In statement coverage testing, 100% statement coverage is said to be achieved if all the statements are tested at least once. This type of testing is usually performed by the developers using development tools.<br>\nCheck your understanding:<\/p>\n<p>What is difference between statement coverage and <a href=\"https:\/\/www.h2kinfosys.com\/blog\/decision-testing\/\">decision coverage<\/a><br>\nWhich one is better? statement coverage or decision coverage? Why?<\/p>\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.h2kinfosys.com\/courses\/java-online-training-course-details\"><img fetchpriority=\"high\" decoding=\"async\" width=\"728\" height=\"90\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/11\/Java-Beginners-1.jpeg\" alt=\"Java for beginners\" class=\"wp-image-6615\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/11\/Java-Beginners-1.jpeg 728w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2020\/11\/Java-Beginners-1-300x37.jpeg 300w\" sizes=\"(max-width: 728px) 100vw, 728px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>There are two major types of White box testing techniques: Statement coverage testing and branch coverage testing. STATEMENT COVERAGE TESTING: Statement coverage type of white box software testing technique. It is called line or segment coverage testing. This testing is done to the code written to test whether the code written is qualitative or whether [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1470,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[211,205,47,51,210,108],"class_list":["post-1464","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-qa-tutorials","tag-decision-coverage-testing","tag-decision-testing","tag-qa","tag-software-testing","tag-statement-coverage-testing","tag-white-box-testing"],"_links":{"self":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/1464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/comments?post=1464"}],"version-history":[{"count":0,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/1464\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media\/1470"}],"wp:attachment":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media?parent=1464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/categories?post=1464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/tags?post=1464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}