{"id":932,"date":"2017-06-15T07:20:54","date_gmt":"2017-06-15T07:20:54","guid":{"rendered":"http:\/\/punjabirevolution.com\/?page_id=932"},"modified":"2017-06-15T08:14:43","modified_gmt":"2017-06-15T08:14:43","slug":"slice-based-testing","status":"publish","type":"page","link":"http:\/\/punjabirevolution.com\/index.php\/slice-based-testing\/","title":{"rendered":"Slice Based Testing"},"content":{"rendered":"<p>The slice based testing is a technique to slice the code in multiple parts in such a way that every part could be executed successfully with respect to the given variable and line number.<br>\nThe notation used for slice based testing is as S(v,n). Where<\/p>\n<p>S: stands for Slice the code<br>\nv: variable under consideration<br>\nn: line number.<\/p>\n<p>To further explain the concept, let&rsquo;s study an example.<\/p>\n<pre class=\"lang:c++ decode:true\">#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nint main() \r\n{\r\n    int x;\r\n    int y;\r\n    int z;\r\n    x = y + z;\r\n    cout &lt;&lt; \"Hello, World!\";\r\n    cout&lt;&lt;x;\r\n    cout&lt;&lt;y;\r\n    cout&lt;&lt;z;\r\n    return 0;\r\n}<\/pre>\n<p>Let&rsquo;s slice the code with respect to the variable x at line 9. In slicing notation, we would write it as S(x,9). We have to find the variable and its related statements till statement 9. If we observe the code,&nbsp; the x has its declaration at line 6, we would include it as well. S(x,9) has two lines<\/p>\n<pre class=\"nums:false lang:c++ decode:true\"> int x; \r\n  x = y + z;\r\n<\/pre>\n<p>But the above two lines of S(x,9) can not be executed independently. To execute these two lines, we need to add the syntax that is compulsory for program execution e.g. headers , curly braces and the main function etc. so the final slice code for S(x,9) would be<\/p>\n<p>S(x,9) =1,2,4,5,6,9,14,15.<\/p>\n<pre class=\"nums:false lang:default decode:true\">#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nint main() \r\n{\r\n    int x;\r\n    x = y + z;   \r\n    return 0;\r\n}<\/pre>\n<p>and<br>\nS(x,14) = 1,2,4,5,6,9,11,14,15.<\/p>\n<pre class=\"nums:false lang:default decode:true\">#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nint main() \r\n{\r\n    int x;\r\n    x = y + z;\r\n    cout&lt;&lt;x;\r\n    return 0;\r\n}<\/pre>\n<p>This concept can be further digested by the following solved examples. \/* upload the class activity picture from directory *\/<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The slice based testing is a technique to slice the code in multiple parts in such a way that every part could be executed successfully with respect to the given variable and line number. The notation used for slice based testing is as S(v,n). Where S: stands for Slice the code v: variable under consideration &hellip; <a href=\"http:\/\/punjabirevolution.com\/index.php\/slice-based-testing\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Slice Based Testing&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/pages\/932"}],"collection":[{"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/comments?post=932"}],"version-history":[{"count":10,"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/pages\/932\/revisions"}],"predecessor-version":[{"id":942,"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/pages\/932\/revisions\/942"}],"wp:attachment":[{"href":"http:\/\/punjabirevolution.com\/index.php\/wp-json\/wp\/v2\/media?parent=932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}