{"id":76,"date":"2009-03-10T09:49:22","date_gmt":"2009-03-10T08:49:22","guid":{"rendered":"http:\/\/blog.eweibel.net\/?p=76"},"modified":"2009-03-10T10:10:14","modified_gmt":"2009-03-10T09:10:14","slug":"code-generation-for-unit-testing","status":"publish","type":"post","link":"https:\/\/blog.eweibel.net\/?p=76","title":{"rendered":"Code generation for unit testing"},"content":{"rendered":"<p>There exists a project at Microsoft which generate unit tests based of source code. The name of this interesting project is <a href=\"http:\/\/research.microsoft.com\/en-us\/projects\/Pex\/\">Pex<\/a>.<br \/>At the first time when I heard about this project I was skeptical.<\/p>\n<ul>\n<li>Where&#8217;s the value of generated tests?\n<li>Doesn&#8217;t it break the &#8220;test first&#8221; approach?<\/li>\n<\/ul>\n<p>After I saw this <a href=\"http:\/\/channel9.msdn.com\/pdc2008\/TL51\/\">screencast<\/a> from the PDC 2008, I could find the answers for me:<br \/>There is a value: It is often tedious to write all the unit tests with the extreme values which could pass to the method. For this tedious work it&#8217;s nice that you could generate all this &#8220;technical&#8221; unit tests. For this reason I would create an assembly where I would generate all this unit tests and separate them from the other unit tests, which I wrote by hand (and with the &#8220;test first&#8221; approach, like TDD).<br \/>The answer for the second question if it brakes the &#8220;test first&#8221; approach, is yes. But it isn&#8217;t a bad thing by nature. The generated tests are more technical stuff and they don&#8217;t serve as examples or specification.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There exists a project at Microsoft which generate unit tests based of source code. The name of this interesting project is Pex.At the first time when I heard about this project I was skeptical. Where&#8217;s the value of generated tests? Doesn&#8217;t it break the &#8220;test first&#8221; approach? After I saw this screencast from the PDC 2008, I could find the answers for me:There is a value: It is often tedious to write all the unit tests with the extreme values&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/blog.eweibel.net\/?p=76\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":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":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[13,10],"tags":[],"class_list":["post-76","post","type-post","status-publish","format-standard","hentry","category-net","category-testing"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/plOV9-1e","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":303,"url":"https:\/\/blog.eweibel.net\/?p=303","url_meta":{"origin":76,"position":0},"title":"From NUnit to MSTest","author":"Patrick","date":"30. Jun 2009","format":false,"excerpt":"Last week I migrated several projects from NUnit to MSTest. The developers use the Developer version of Microsoft Visual Studio Team System, so they have integrated unit-test support for MSTest. In this post I show you all the problems and work I had to migrate the tests from NUnit to\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/blog.eweibel.net\/?cat=13"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":200,"url":"https:\/\/blog.eweibel.net\/?p=200","url_meta":{"origin":76,"position":1},"title":"How to structure code in an unit test","author":"Patrick","date":"14. Jun 2009","format":false,"excerpt":"When you create your unit tests for a method in the SUT (software under test) you will ask yourself how to structure the code in the test method.I saw two kind of syntaxes which help to structure the code in a unit test method (well, actually there are at least\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/blog.eweibel.net\/?cat=13"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":34,"url":"https:\/\/blog.eweibel.net\/?p=34","url_meta":{"origin":76,"position":2},"title":"Are 100% code coverage reasonable?","author":"Patrick","date":"2. Mar 2009","format":false,"excerpt":"When you use a code coverage tool one of the first question is what is a good code coverage. Recently I listened to different podcasts (stackoverflow, scott hanselman) where they discuss this topic. I wasn't really surprised that there wasn't one unique opinion.One opinion was that 100% is a good\u2026","rel":"","context":"In &quot;Software architecture&quot;","block_context":{"text":"Software architecture","link":"https:\/\/blog.eweibel.net\/?cat=4"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":489,"url":"https:\/\/blog.eweibel.net\/?p=489","url_meta":{"origin":76,"position":3},"title":"Kaizen and Software Engineering","author":"Patrick","date":"27. Oct 2009","format":false,"excerpt":"Kaizen is a very interesting approach, also in the software industry. On Wikipedia you\u2019ll find the following description of Kaizen: Kaizen is a Japanese word adopted into English referring to a philosophy or practices focusing on continuous improvement in manufacturing activities, business activities in general, and even life in general,\u2026","rel":"","context":"In &quot;Agile&quot;","block_context":{"text":"Agile","link":"https:\/\/blog.eweibel.net\/?cat=17"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":160,"url":"https:\/\/blog.eweibel.net\/?p=160","url_meta":{"origin":76,"position":4},"title":"When to use stored procedures","author":"Patrick","date":"13. May 2009","format":false,"excerpt":"Recently I discussed with a colleague when to use stored procedures. As exptected it was quite a religious conversation. A few days later I found the following screencast: The Pros and Cons of Stored Procedures Based on the discussion and the screencast I tried to summarize my Pros and Cons:\u2026","rel":"","context":"In &quot;Good practices&quot;","block_context":{"text":"Good practices","link":"https:\/\/blog.eweibel.net\/?cat=5"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":982,"url":"https:\/\/blog.eweibel.net\/?p=982","url_meta":{"origin":76,"position":5},"title":"Jenkins and .Net","author":"Patrick","date":"24. Feb 2011","format":false,"excerpt":"This week I visited the first JUG\u2019s event in Bern. The topic was Jenkins (fork of Hudson). The presentation of Dr. Simon Wiest was very entertaining. He explained continuous integration and showed how easy it is to install, configure and run Jenkins. .Net integration in Jenkins Jenkins is from the\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/blog.eweibel.net\/?cat=13"},"img":{"alt_text":"butler","src":"https:\/\/i0.wp.com\/blog.eweibel.net\/wp-content\/uploads\/butler_thumb.gif?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/posts\/76","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=76"}],"version-history":[{"count":13,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/posts\/76\/revisions"}],"predecessor-version":[{"id":89,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=\/wp\/v2\/posts\/76\/revisions\/89"}],"wp:attachment":[{"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=76"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.eweibel.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}