{"id":46,"date":"2024-10-11T19:27:36","date_gmt":"2024-10-11T19:27:36","guid":{"rendered":"https:\/\/wetestit.ro\/?p=46"},"modified":"2024-10-11T19:27:37","modified_gmt":"2024-10-11T19:27:37","slug":"partitioning-and-equivalence-testing-2","status":"publish","type":"post","link":"https:\/\/wetestit.ro\/index.php\/2024\/10\/11\/partitioning-and-equivalence-testing-2\/","title":{"rendered":"Partitioning and equivalence testing"},"content":{"rendered":"\n<p>Partitioning and equivalence testing are both techniques used in software testing to ensure that the software behaves as expected under various conditions. Here&#8217;s a brief comparison:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Partitioning<\/h3>\n\n\n\n<p>Partitioning involves dividing the input data of a software program into partitions of equivalent data from which test cases can be derived. The idea is to reduce the number of test cases to a manageable level while still maintaining reasonable test coverage. The main types of partitioning are:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Equivalence Partitioning (EP)<\/strong>: This is a black-box testing technique that divides the input data into partitions or classes where the data is expected to behave similarly. Each partition represents a set of valid or invalid states, and only one test case from each partition is chosen to test the software.<\/li>\n\n\n\n<li><strong>Boundary Value Analysis (BVA)<\/strong>: Often used in conjunction with equivalence partitioning, BVA focuses on the boundaries between partitions. The idea is that errors often occur at the boundaries rather than within the partitions, so tests are created for the values at the edges of each partition.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Equivalence Testing<\/h3>\n\n\n\n<p>Equivalence testing is essentially the application of equivalence partitioning. It involves identifying sets of inputs that are treated equivalently by the system, meaning they should produce the same output or behavior. Test cases are then created for each equivalence class. The main focus is on:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Valid Equivalence Classes<\/strong>: These include sets of inputs that are expected to be processed correctly by the software.<\/li>\n\n\n\n<li><strong>Invalid Equivalence Classes<\/strong>: These cover inputs that are outside the expected range or format and should be handled appropriately by the software, typically by generating an error message.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Comparison<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Objective<\/strong>:\n<ul class=\"wp-block-list\">\n<li><strong>Partitioning<\/strong>: Divides the input space to manage test cases efficiently.<\/li>\n\n\n\n<li><strong>Equivalence Testing<\/strong>: Focuses on testing representative values from each partition.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Techniques<\/strong>:\n<ul class=\"wp-block-list\">\n<li><strong>Partitioning<\/strong>: Includes equivalence partitioning and boundary value analysis.<\/li>\n\n\n\n<li><strong>Equivalence Testing<\/strong>: Primarily uses equivalence partitioning to identify and test representative values.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Approach<\/strong>:\n<ul class=\"wp-block-list\">\n<li><strong>Partitioning<\/strong>: Both an analytical and design approach to organizing test data.<\/li>\n\n\n\n<li><strong>Equivalence Testing<\/strong>: A practical application of partitioning to generate test cases.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>In summary, equivalence testing is a specific implementation of the partitioning technique where test cases are derived from equivalence classes. Both methods aim to reduce the number of test cases while ensuring adequate coverage to detect defects in the software.<\/p>\n\n\n\n<p>Let&#8217;s use a simple example to illustrate both partitioning and equivalence testing. We&#8217;ll consider a function that validates the age input for a service that requires users to be between 18 and 65 years old.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Partitioning<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Identify Input Range<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Valid age range: 18 to 65<\/li>\n\n\n\n<li>Invalid age range: Less than 18 and greater than 65<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Create Partitions<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Partition 1: Valid age (18-65)<\/li>\n\n\n\n<li>Partition 2: Invalid age (less than 18)<\/li>\n\n\n\n<li>Partition 3: Invalid age (greater than 65)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Boundary Values<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Lower boundary: 18<\/li>\n\n\n\n<li>Upper boundary: 65<\/li>\n\n\n\n<li>Just outside lower boundary: 17<\/li>\n\n\n\n<li>Just outside upper boundary: 66<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Equivalence Testing<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Select Test Cases<\/strong> from each partition:\n<ul class=\"wp-block-list\">\n<li><strong>Partition 1 (Valid age)<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Choose a typical value within the range: 25<\/li>\n\n\n\n<li>Boundary values: 18, 65<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Partition 2 (Invalid age &#8211; less than 18)<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Choose a typical value below the range: 10<\/li>\n\n\n\n<li>Boundary value: 17<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Partition 3 (Invalid age &#8211; greater than 65)<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Choose a typical value above the range: 70<\/li>\n\n\n\n<li>Boundary value: 66<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Test Cases:<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Valid Age Tests<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Test case 1: Input age 25 (expected result: valid)<\/li>\n\n\n\n<li>Test case 2: Input age 18 (expected result: valid)<\/li>\n\n\n\n<li>Test case 3: Input age 65 (expected result: valid)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Invalid Age Tests<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Test case 4: Input age 10 (expected result: invalid)<\/li>\n\n\n\n<li>Test case 5: Input age 17 (expected result: invalid)<\/li>\n\n\n\n<li>Test case 6: Input age 70 (expected result: invalid)<\/li>\n\n\n\n<li>Test case 7: Input age 66 (expected result: invalid)<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Summary<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Partitioning<\/strong>: We&#8217;ve divided the input range into three partitions and identified boundary values.<\/li>\n\n\n\n<li><strong>Equivalence Testing<\/strong>: We derived test cases from each equivalence class to test representative values from each partition.<\/li>\n<\/ul>\n\n\n\n<p>Using these techniques, you can ensure that your tests cover a wide range of possible inputs efficiently, identifying both typical and edge cases that might cause the function to behave unexpectedly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Partitioning and equivalence testing are both techniques used in software testing to ensure that the software behaves as expected under various conditions. Here&#8217;s a brief comparison: Partitioning Partitioning involves dividing the input data of a software program into partitions of equivalent data from which test cases can be derived. The idea is to reduce the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"reviews_category":[],"guides_category":[],"class_list":["post-46","post","type-post","status-publish","format-standard","hentry","category-software-testing"],"_links":{"self":[{"href":"https:\/\/wetestit.ro\/index.php\/wp-json\/wp\/v2\/posts\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wetestit.ro\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wetestit.ro\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wetestit.ro\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wetestit.ro\/index.php\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":1,"href":"https:\/\/wetestit.ro\/index.php\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"predecessor-version":[{"id":47,"href":"https:\/\/wetestit.ro\/index.php\/wp-json\/wp\/v2\/posts\/46\/revisions\/47"}],"wp:attachment":[{"href":"https:\/\/wetestit.ro\/index.php\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wetestit.ro\/index.php\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wetestit.ro\/index.php\/wp-json\/wp\/v2\/tags?post=46"},{"taxonomy":"reviews_category","embeddable":true,"href":"https:\/\/wetestit.ro\/index.php\/wp-json\/wp\/v2\/reviews_category?post=46"},{"taxonomy":"guides_category","embeddable":true,"href":"https:\/\/wetestit.ro\/index.php\/wp-json\/wp\/v2\/guides_category?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}