{"id":10067,"date":"2021-08-03T21:27:20","date_gmt":"2021-08-03T15:57:20","guid":{"rendered":"https:\/\/www.h2kinfosys.com\/blog\/?p=10067"},"modified":"2021-08-03T21:27:21","modified_gmt":"2021-08-03T15:57:21","slug":"data-flow-testing","status":"publish","type":"post","link":"https:\/\/www.h2kinfosys.com\/blog\/data-flow-testing\/","title":{"rendered":"Data Flow Testing"},"content":{"rendered":"\n<p>Data Flow Testing which is may be a structural testing. It is a way, that finds the <a href=\"https:\/\/www.h2kinfosys.com\/blog\/10-myths-of-software-testing\/\" class=\"rank-math-link\">test paths<\/a> of a program consistent with the locations of definitions and uses variables in the program. It has nothing to do with data flow diagrams.<\/p>\n\n\n\n<p>It is concerned with:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u00a0Statements where <a href=\"https:\/\/en.wikipedia.org\/wiki\/Variable_(computer_science)\" class=\"rank-math-link\" rel=\"nofollow noopener\" target=\"_blank\">variables <\/a>receive values.<\/li><li>\u00a0Statements where these values may be used or referenced.<\/li><\/ol>\n\n\n\n<p>To illustrate the approach the&nbsp; data flow testing,assume the each statement within the program assigned a singular statement number. For e.g.:&nbsp; statement has number S<\/p>\n\n\n\n<p>DEF(S) = {X|statement S contains the definition of X}<\/p>\n\n\n\n<p>USE(S) = {X|statement S contains the use of X}<\/p>\n\n\n\n<p>The statement may be a loop or if condition then its DEF set&nbsp; is empty and USE set is based on the condition of statement S.<\/p>\n\n\n\n<p>Data Flow testing use the control flow graph which finds the situation which can interrupt the flow of program.<\/p>\n\n\n\n<p>Reference or may define mistakes in the flow of the data where&nbsp; detected at the time of associations between values and variables. The anomalies are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A variable is defined and not used or referenced.<\/li><li>A variable is used but never defined.<\/li><li>A variable is defined twice before it is used.<\/li><\/ul>\n\n\n\n<p>For example consider,<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Read x;\nIf (x>0)\u00a0 \u00a0 (1, (2, t), x), (1, (2, f),x)\n\na = x+1 \u00a0 (1, 3, x)\n\nif(x&lt;=0) {\u00a0 (1,(4,t),x),(1,(4,f),x)\n\nIf(x&lt;1) \u00a0 \u00a0 (1,(5,t),x),(1,(5,f),x)\n\nx=x+1 ; ( go to 5) (1, 7, x)\n\nElse \u00a0 (6, (5, f) x), (6,(5,t)x)\na=x+1 (6, 6, x)\nPrint a;\u00a0 \u00a0 (3, 8, a), (7, 8, a)<\/pre>\n\n\n\n<p>In the above code we have total 8 statements and we will be choosing a path which covers all 8 statements. As it is evident in the code, we cannot cover entire all statements in a single path, as the statement 2 is true then statements 4,5,6,7 not covered and if statement 4 is true then statement 2 and 3 are not covered.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Advantages of data flow testing<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>It is used to find a variable which is used but never defined.<\/li><li>It is used to find a variable that defined but never used.<\/li><li>It is used to find a variable that is defined multiple times before it is used.<\/li><li>Deallocating a variable before it is used.<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Disadvantage of data flow testing<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>It is time consuming and costly process<\/li><li>it requires knowledge of programming languages.<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Types of Data Flow testing<\/strong><\/h2>\n\n\n\n<p>This process of data flow testing may be done through two approaches<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>Static data flow testing<\/strong><\/li><\/ol>\n\n\n\n<p>In static testing, study and analysis of code is done without performing the actual execution of the code like wrong header files and library files use a syntax error, during this type of testing d-u-k pattern(Definition Usage and Kill pattern). Therefore Definition Usage and Kill pattern of the data variables is monitored and observed with the help of control flow graph.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\"><li><strong>Dynamic data flow testing<\/strong><\/li><\/ol>\n\n\n\n<p>It has the execution of the code to monitor and observe the intermediate results.It basically looks after the coverage of data flow properties. This type of testing may comprise of following activities<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Identification of all d-u pairs i.e. definition and usage in the code.<\/li><li>Detecting feasible path between each definition and usage pair.<\/li><li>It is designing and creating sets of test cases for each path.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Data Flow Testing which is may be a structural testing. It is a way, that finds the test paths of a program consistent with the locations of definitions and uses variables in the program. It has nothing to do with data flow diagrams. It is concerned with: \u00a0Statements where variables receive values. \u00a0Statements where these [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":10070,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-10067","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/10067","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/comments?post=10067"}],"version-history":[{"count":0,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/10067\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media\/10070"}],"wp:attachment":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media?parent=10067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/categories?post=10067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/tags?post=10067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}