{"id":26548,"date":"2020-07-29T00:00:00","date_gmt":"2020-07-28T22:00:00","guid":{"rendered":"https:\/\/blexin.com\/un-modo-diverso-di-pensare-al-testing-property-based-test\/"},"modified":"2021-05-20T18:23:09","modified_gmt":"2021-05-20T16:23:09","slug":"a-different-way-of-thinking-about-testing-the-property-based-test","status":"publish","type":"post","link":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/","title":{"rendered":"A different way of thinking about testing: the Property Based Test"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"608\" data-attachment-id=\"26536\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/attachment\/93d45811-c894-43d4-966e-330770b66b71-2-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/93d45811-c894-43d4-966e-330770b66b71-1.png?fit=1024%2C608&amp;ssl=1\" data-orig-size=\"1024,608\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"93d45811-c894-43d4-966e-330770b66b71\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/93d45811-c894-43d4-966e-330770b66b71-1.png?fit=1024%2C608&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/93d45811-c894-43d4-966e-330770b66b71-1.png?resize=1024%2C608&#038;ssl=1\" alt=\"\" class=\"wp-image-26536\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/93d45811-c894-43d4-966e-330770b66b71-1.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/93d45811-c894-43d4-966e-330770b66b71-1-980x582.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/93d45811-c894-43d4-966e-330770b66b71-1-480x285.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In my previous article, we have seen how testing and refactorizing legacy code with Golden Master Pattern. Now, we will continue to talk about testing, introducing a new paradigm with a simple example.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We are familiar with writing tests based on examples. In literature we talk about &#8220;Example test&#8221;: given an input we have an expected output.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The spread of techniques like TDD and the growing relevance of tests in software building could create a misunderstanding, that a good test is such if it maximizes the coverage. Writing test for each statement, doesn\u2019t make our codebase error-free. Indeed, the test development time become too long and makes it difficult to maintain them when we have to add or modify a feature.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Kent Beck spoke on this topic on&nbsp;<a href=\"https:\/\/stackoverflow.com\/questions\/153234\/how-deep-are-your-unit-tests\/\" target=\"_blank\" rel=\"noreferrer noopener\">Stack Overflow<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s take a simple case of study. Our company is conducting many interviews for developer position and, to carry out first skim, we assign candidates a kata.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Manually check the result involves big effort, so, we develop a test suite that checks automatically the proposed solutions, in order to reduce as many as possible our work. You know that laziness is one of the virtues of the developer:&nbsp;<a href=\"http:\/\/threevirtues.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Laziness is a virtue<\/a>!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The kata we assign to out candidates is a classic: The FizzBuzz. It comes to write an algorithm that, given a number, prints:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u201cFizz\u201d for multiples of three.<\/li><li>\u201cBuzz\u201d for multiples of five.<\/li><li>\u201cFizzBuzz\u201d for multiples of both.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The simplicity of exercise give us the opportunity to focus on concepts, without worrying about implementation problem. In the fsharp branch of&nbsp;<a href=\"https:\/\/github.com\/ntonjeta\/FizzBuzz\" target=\"_blank\" rel=\"noreferrer noopener\">the repo<\/a>&nbsp;you can find the complete solution in F#.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s write a test suite with 100% of coverage using TDD with example based tests.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n&#x5B;&lt;Tests&gt;]\nlet tests =\n      testList &quot;Example tests&quot; &#x5B;\n      testCase &quot;Three should be Fizz&quot; &lt;| fun _ -&gt;\n      Expect.equal (FizzBuzz.fizzbuzz 3) &quot;Fizz&quot; &quot;Is not Fizz.&quot;\n      ]\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The simple implementation:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nmodule FizzBuzz\u00a0 =\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0let fizzbuzz (x:int) = &quot;Fizz&quot;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s add more tests:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\ntestCase &quot;Five should be Buzz&quot; &lt;| fun _ -&gt;\n      Expect.equal (FizzBuzz.fizzbuzz 5) &quot;Buzz&quot; &quot;Is not Buzz.&quot;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The implementation becomes:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nlet fizzbuzz (x:int) =\n      match x with\n      | 3 -&gt; &quot;Fizz&quot;\n      | 5 -&gt; &quot;Buzz&quot;\n      | _ -&gt; string x \/\/ Complete pattern matching\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s go on faster and add the remaining tests covering all possible cases.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\ntestCase &quot;Nine should be Fizz&quot; &lt;| fun _ -&gt;\n      Expect.equal (FizzBuzz.fizzbuzz 9) &quot;Fizz&quot; &quot;Is not Fizz.&quot;\n \ntestCase &quot;Twentyi-Five should be Buzz&quot; &lt;| fun _ -&gt;\n      Expect.equal (FizzBuzz.fizzbuzz 25) &quot;Buzz&quot; &quot;Is not Buzz.&quot;\n \ntestCase &quot;Fifteen should be FizzBuzz&quot; &lt;| fun _ -&gt;\n      Expect.equal (FizzBuzz.fizzbuzz 15) &quot;FizzBuzz&quot; &quot;Is not FizzBuzz.&quot;\n\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">In this way we got the 100% of statement coverage!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We deliver the exercises to the candidates and, at the end, we launch the suite on the received papers. Among the various solutions proposed, the following stands out:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nmodule FizzBuzz  =\n      let fizzbuzz (x:int) =\n      match x with\n      | 3 -&gt; &quot;Fizz&quot;\n      | 5 -&gt; &quot;Buzz&quot;\n      | 9 -&gt; &quot;Fizz&quot;\n      | 15 -&gt; &quot;FizzBuzz&quot;\n      | 25 -&gt; &quot;Buzz&quot;\n      | _ -&gt; string x\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The solution is obviously wrong, even if all the tests are passed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We must therefore make our tests more robust. We add a test with random numbers generated at runtime. Here is a possible implementation:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nlet actualList =\n      randomList |&gt; List.map (FizzBuzz.fizzbuzz)\n \nlet expectedList =\n      randomList\n      |&gt; List.map (fun i -&gt;\n      match i with\n      | n when i % 3 = 0 &amp;&amp; i % 5 = 0 -&gt; &quot;FizzBuzz&quot;\n      | n when i % 3 = 0 -&gt; &quot;Fizz&quot;\n      | n when i % 5 = 0 -&gt; &quot;Buzz&quot;\n      | _ -&gt; string i)\n \ntestCase &quot;Random number test&quot;\n      &lt;| fun _ -&gt; Expect.sequenceEqual actualList expectedList &quot;Not equal&quot;\n\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The problem in using random numbers in tests comes out when we have to generate the expected results. To build it we have introduced the algorithm solution in tests.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s introduce now the concept of&nbsp;<strong>Property Based Testing<\/strong>&nbsp;become famous in function programming with&nbsp;<strong>QuickCheck&nbsp;<\/strong>for Haskell. The basic idea is straightforward: rather than using example for tests, we test&nbsp;<em>property<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A property can be tested with random inputs and covers even borderline cases. If the solution is correct the property is always valid; in this way we don\u2019t need to build expected result.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To implement property tests, let\u2019s use&nbsp;<strong>FsCheck,&nbsp;<\/strong>a F# porting of QuickCheck. In FsCheck the data for test will be generated from a&nbsp;<strong>Generator&nbsp;<\/strong>module<strong>,&nbsp;<\/strong>which is able to build random data. As we will see, you can define a custom Generator and use it in tests.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In addition to the Generator, another feature of Fscheck is the&nbsp;<strong>Shrinker<\/strong>&nbsp;that comes into play when a test fails. The Shrinker is able to return the least possible input for which the test may fail.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To implement the test suite, the first step is to define algorithm\u2019s properties:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The multiples of three should contain Fizz.<\/li><li>The multiples of five should contain Buzz.<\/li><li>The both multiples should be FizzBuzz.<\/li><li>The non multiple of three or five should be the same.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Once the properties have been defined, we can develop our Generator. Let\u2019s see how to define a multiples of three generator.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nlet multipleOfThree n = n * 3\n \nlet gen3 =\n      Arb.generate&lt;NonNegativeInt&gt;\n      |&lt; Gen.map (fun (NonNegativeInt n) -&gt; multipleOfThree n)\n      |&lt; Arb.fromGen\n\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;<strong>Arb&nbsp;<\/strong>module lets you generate automatically a sequence of random number: it specifies the type&nbsp;<em>NonNegativeInt<\/em>&nbsp;the module generates only non negative numbers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With the&nbsp;<strong>Gen<\/strong>&nbsp;module we can execute operations on Generator: initialize, filter, conver ecc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We has used the function Gen.map for mapping the random number generated by Arb for obtain multiples of three.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A this point, the generator has to be registered before we can use it in test. To do that, we must specify a new type.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\ntype ThreeGenerator =\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0static member ThreeMultiple() =\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Arb.generate&lt;NonNegativeInt&gt;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0|&gt; Gen.map (fun (NonNegativeInt n) -&gt; multipleOfThree n)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0|&gt; Gen.filter(fun n-&gt;\u00a0 n&gt; 0)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0|&gt; Arb.fromGen\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">and register it using, for example, the library&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/haf\/expecto\" target=\"_blank\">Expecto<\/a>&nbsp;(often used together with FsCheck)<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nlet multipleOfThreeConfig =\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{ FsCheckConfig.defaultConfig with\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0arbitrary = &#x5B; typeof&lt;ThreeGenerator&gt; ] }\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">At this point we can write the test using our Generator<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nlet tests =\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0testList &quot;Property based tests&quot;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#x5B; testPropertyWithConfig multipleOfThreeConfig &quot;Multiple of three should contain Fizz&quot;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;| fun x -&gt; Expect.containsAll (FizzBuzz.fizzbuzz x) &quot;Fizz&quot; &quot;Not contain Fizz&quot; ]\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">In the same way, we can write the remaining generators.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nlet multipleOfFive n = n * 5\nlet multipleOfBoth n = n * 15\nlet noMultiple n = (multipleOfBoth n) - 1\n \ntype FiveGenerator =\n      static member FiveMultiple() =\n      Arb.generate&lt;NonNegativeInt&gt;\n      |&gt; Gen.map (fun (NonNegativeInt n) -&gt; multipleOfFive n)\n      |&gt; Gen.filter (fun n -&gt; n &gt; 0)\n      |&gt; Arb.fromGen\n \ntype BothGenerator =\n      static member BothMultiple() =\n      Arb.generate&lt;NonNegativeInt&gt;\n      |&gt; Gen.map (fun (NonNegativeInt n) -&gt; multipleOfBoth n)\n      |&gt; Arb.fromGen\n \ntype NoMultipleGenerator =\n      static member BothMultiple() =\n      Arb.generate&lt;NonNegativeInt&gt;\n      |&gt; Gen.map (fun (NonNegativeInt n) -&gt; noMultiple n)\n      |&gt; Arb.fromGen\n\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Testing property give us the ability to use random input, this input can cover also edge cases with no need to build expected value.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We have seen how we can obtain robust test suites for lazy developers, just by changing the paradigm used to the code!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can find references below<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/fsharpforfunandprofit.com\/posts\/property-based-testing\">https:\/\/fsharpforfunandprofit.com\/posts\/property-based-testing<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/fsharpforfunandprofit.com\/posts\/property-based-testing-2\">https:\/\/fsharpforfunandprofit.com\/posts\/property-based-testing-2<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/fscheck.github.io\/FsCheck\/TestData.html\">https:\/\/fscheck.github.io\/FsCheck\/TestData.html<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I hope I\u2019ve intrigued you.<br>See you at the next article!<\/p>\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>Let\u2019s see why a coverage of 100% is not enough to make us sleep safe and sound<\/p>\n","protected":false},"author":196716249,"featured_media":26745,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_crdt_document":"","inline_featured_image":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[688637524],"tags":[688637410,688637411],"class_list":["post-26548","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-en","tag-f-en","tag-testing-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>A different way of thinking about testing: the Property Based Test - Blexin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A different way of thinking about testing: the Property Based Test - Blexin\" \/>\n<meta property=\"og:description\" content=\"Let\u2019s see why a coverage of 100% is not enough to make us sleep safe and sound\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/\" \/>\n<meta property=\"og:site_name\" content=\"Blexin\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-28T22:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-20T16:23:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i1.wp.com\/blexin.com\/wp-content\/uploads\/2020\/07\/image.png?fit=1024%2C608&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"608\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Antonio Tammaro\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Antonio Tammaro\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/a-different-way-of-thinking-about-testing-the-property-based-test\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/a-different-way-of-thinking-about-testing-the-property-based-test\\\/\"},\"author\":{\"name\":\"Antonio Tammaro\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/6e574a2e13d47c9167c5cfb475d9bfc5\"},\"headline\":\"A different way of thinking about testing: the Property Based Test\",\"datePublished\":\"2020-07-28T22:00:00+00:00\",\"dateModified\":\"2021-05-20T16:23:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/a-different-way-of-thinking-about-testing-the-property-based-test\\\/\"},\"wordCount\":866,\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/a-different-way-of-thinking-about-testing-the-property-based-test\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/image.png?fit=1024%2C608&ssl=1\",\"keywords\":[\"F#\",\"Testing\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/a-different-way-of-thinking-about-testing-the-property-based-test\\\/\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/a-different-way-of-thinking-about-testing-the-property-based-test\\\/\",\"name\":\"A different way of thinking about testing: the Property Based Test - Blexin\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/a-different-way-of-thinking-about-testing-the-property-based-test\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/a-different-way-of-thinking-about-testing-the-property-based-test\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/image.png?fit=1024%2C608&ssl=1\",\"datePublished\":\"2020-07-28T22:00:00+00:00\",\"dateModified\":\"2021-05-20T16:23:09+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/6e574a2e13d47c9167c5cfb475d9bfc5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/a-different-way-of-thinking-about-testing-the-property-based-test\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/a-different-way-of-thinking-about-testing-the-property-based-test\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/a-different-way-of-thinking-about-testing-the-property-based-test\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/image.png?fit=1024%2C608&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/image.png?fit=1024%2C608&ssl=1\",\"width\":1024,\"height\":608},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/a-different-way-of-thinking-about-testing-the-property-based-test\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blexin.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"A different way of thinking about testing: the Property Based Test\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/\",\"name\":\"Blexin\",\"description\":\"Con noi \u00e8 semplice\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blexin.com\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/6e574a2e13d47c9167c5cfb475d9bfc5\",\"name\":\"Antonio Tammaro\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ddb88ac3dfb067ae6f1592d451eab3587e41bbbe98325961161cc286844e8d0d?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ddb88ac3dfb067ae6f1592d451eab3587e41bbbe98325961161cc286844e8d0d?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ddb88ac3dfb067ae6f1592d451eab3587e41bbbe98325961161cc286844e8d0d?s=96&d=identicon&r=g\",\"caption\":\"Antonio Tammaro\"},\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/author\\\/antonio-tammaroblexin-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"A different way of thinking about testing: the Property Based Test - Blexin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/","og_locale":"en_US","og_type":"article","og_title":"A different way of thinking about testing: the Property Based Test - Blexin","og_description":"Let\u2019s see why a coverage of 100% is not enough to make us sleep safe and sound","og_url":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/","og_site_name":"Blexin","article_published_time":"2020-07-28T22:00:00+00:00","article_modified_time":"2021-05-20T16:23:09+00:00","og_image":[{"width":1024,"height":608,"url":"https:\/\/i1.wp.com\/blexin.com\/wp-content\/uploads\/2020\/07\/image.png?fit=1024%2C608&ssl=1","type":"image\/png"}],"author":"Antonio Tammaro","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Antonio Tammaro","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/#article","isPartOf":{"@id":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/"},"author":{"name":"Antonio Tammaro","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/6e574a2e13d47c9167c5cfb475d9bfc5"},"headline":"A different way of thinking about testing: the Property Based Test","datePublished":"2020-07-28T22:00:00+00:00","dateModified":"2021-05-20T16:23:09+00:00","mainEntityOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/"},"wordCount":866,"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/07\/image.png?fit=1024%2C608&ssl=1","keywords":["F#","Testing"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/","url":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/","name":"A different way of thinking about testing: the Property Based Test - Blexin","isPartOf":{"@id":"https:\/\/blexin.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/#primaryimage"},"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/07\/image.png?fit=1024%2C608&ssl=1","datePublished":"2020-07-28T22:00:00+00:00","dateModified":"2021-05-20T16:23:09+00:00","author":{"@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/6e574a2e13d47c9167c5cfb475d9bfc5"},"breadcrumb":{"@id":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/#primaryimage","url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/07\/image.png?fit=1024%2C608&ssl=1","contentUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/07\/image.png?fit=1024%2C608&ssl=1","width":1024,"height":608},{"@type":"BreadcrumbList","@id":"https:\/\/blexin.com\/en\/blog-en\/a-different-way-of-thinking-about-testing-the-property-based-test\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blexin.com\/en\/"},{"@type":"ListItem","position":2,"name":"A different way of thinking about testing: the Property Based Test"}]},{"@type":"WebSite","@id":"https:\/\/blexin.com\/en\/#website","url":"https:\/\/blexin.com\/en\/","name":"Blexin","description":"Con noi \u00e8 semplice","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blexin.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/6e574a2e13d47c9167c5cfb475d9bfc5","name":"Antonio Tammaro","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ddb88ac3dfb067ae6f1592d451eab3587e41bbbe98325961161cc286844e8d0d?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ddb88ac3dfb067ae6f1592d451eab3587e41bbbe98325961161cc286844e8d0d?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ddb88ac3dfb067ae6f1592d451eab3587e41bbbe98325961161cc286844e8d0d?s=96&d=identicon&r=g","caption":"Antonio Tammaro"},"url":"https:\/\/blexin.com\/en\/author\/antonio-tammaroblexin-com\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/07\/image.png?fit=1024%2C608&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pcyUBx-6Uc","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/26548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/users\/196716249"}],"replies":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/comments?post=26548"}],"version-history":[{"count":6,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/26548\/revisions"}],"predecessor-version":[{"id":31816,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/26548\/revisions\/31816"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media\/26745"}],"wp:attachment":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media?parent=26548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/categories?post=26548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/tags?post=26548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}