{"id":1698,"date":"2019-03-03T08:15:16","date_gmt":"2019-03-03T08:15:16","guid":{"rendered":"https:\/\/www.h2kinfosys.com\/blog\/?p=1698"},"modified":"2025-03-07T08:48:29","modified_gmt":"2025-03-07T13:48:29","slug":"mutation-testing","status":"publish","type":"post","link":"https:\/\/www.h2kinfosys.com\/blog\/mutation-testing\/","title":{"rendered":"MUTATION TESTING 1"},"content":{"rendered":"<p>Mutation testing is a type of <a href=\"https:\/\/www.h2kinfosys.com\/blog\/software-testing-technique\/\">testing technique<\/a> where a certain change in the source code statements is made to check whether the test cases are able to find the error. It is a type of <a href=\"https:\/\/www.h2kinfosys.com\/blog\/white-box-testing\/\">white box testing<\/a> which is used for unit testing. The goal or purpose of this testing is to check the quality of test cases which is robust enough to fail the mutant code. It is also called as fault based testing.<\/p>\n<h2><b>Types of mutation testing:<\/b><\/h2>\n<ol>\n<li>Statement mutation: Some part of source code is cut and pasted by the developer, that is changes are done by deleting or duplicating the line, which may be to find fault.<\/li>\n<\/ol>\n<ol>\n<li>Value mutation: Primary parameter values are modified. We usually change one value to much larger value or one value to much smaller value.<\/li>\n<\/ol>\n<ol>\n<li>Decision mutation: Control statements which are used for <a href=\"https:\/\/www.h2kinfosys.com\/blog\/decision-testing\/\">decision<\/a> making are to be changed. The conditions are checked for design errors. For example: one change in arithmetic operators to locate the defects and also consider mutating the relational operators and logical operators.<\/li>\n<\/ol>\n<h2><b>How mutant program is created<\/b><\/h2>\n<p>A mutation is nothing but a small change in syntactic code of original program statement.<\/p>\n<h3><b>Original program<\/b><\/h3>\n<p>If(x&gt;y)<\/p>\n<p>Print \u201cHello\u201d;<\/p>\n<p>Else<\/p>\n<p>Print \u201cHi\u201d;<\/p>\n<p><b>Mutant program<\/b><\/p>\n<p>If(x&lt;y)<\/p>\n<p>Print \u201cHello\u201d;<\/p>\n<p>Else<\/p>\n<p>Print \u201cHow are you\u201d;<\/p>\n<h2>Mutation testing benefits:<\/h2>\n<ol>\n<li>It is used to find a special new kind of errors and drags developer\u2019s attention<\/li>\n<li>It is most effective way to find the hidden defects in a program which is difficult to identify, by the developer.<\/li>\n<li>Increased customer satisfaction index as product would cause less bugs<\/li>\n<li>Debugging and maintaining is easy.<\/li>\n<\/ol>\n<h3><b>How to do mutation testing<\/b><\/h3>\n<figure id=\"attachment_1699\" aria-describedby=\"caption-attachment-1699\" style=\"width: 802px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.h2kinfosys.com\/blog\/mutation-testing\/mutant\/\" rel=\"attachment wp-att-1699\"><img fetchpriority=\"high\" decoding=\"async\" class=\"size-full wp-image-1699\" src=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2019\/03\/MUTANT.jpg\" alt=\"MUTATION TESTING\" width=\"802\" height=\"341\" title=\"\" srcset=\"https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2019\/03\/MUTANT.jpg 802w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2019\/03\/MUTANT-300x128.jpg 300w, https:\/\/www.h2kinfosys.com\/blog\/wp-content\/uploads\/2019\/03\/MUTANT-768x327.jpg 768w\" sizes=\"(max-width: 802px) 100vw, 802px\" \/><\/a><figcaption id=\"caption-attachment-1699\" class=\"wp-caption-text\">MUTATION TESTING<\/figcaption><\/figure>\n<p><a href=\"https:\/\/www.h2kinfosys.com\/blog\/mutation-testing-2\/\">CLICK HERE TO CONTINUE READING&#8230;<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mutation testing is a type of testing technique where a certain change in the source code statements is made to check whether the test cases are able to find the error. It is a type of white box testing which is used for unit testing. The goal or purpose of this testing is to check [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[249],"class_list":["post-1698","post","type-post","status-publish","format-standard","hentry","category-qa-tutorials","tag-mutation-testing"],"_links":{"self":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/1698","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=1698"}],"version-history":[{"count":0,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/1698\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media?parent=1698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/categories?post=1698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/tags?post=1698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}