{"id":6004,"date":"2020-03-24T11:23:20","date_gmt":"2020-03-24T11:23:20","guid":{"rendered":"http:\/\/www.max-sperling.bplaced.net\/?p=6004"},"modified":"2024-02-16T10:29:00","modified_gmt":"2024-02-16T10:29:00","slug":"test-doubles","status":"publish","type":"post","link":"http:\/\/www.max-sperling.bplaced.net\/?p=6004","title":{"rendered":"Unit testing series &#8211; Intro \/ Setup (Part 1)"},"content":{"rendered":"<p><strong>Introduction<\/strong><\/p>\n<p>With unit testing you want to test the smallest unit possible, which means a single function. These units shall be tested without dependencies to other units. This makes it sometimes necessary to double these dependencies.<\/p>\n<hr>\n<p><strong>Framework setup<\/strong><\/p>\n<p>The used testing and mocking framework for this series is Google Test.<\/p>\n<ol>\n<li>Get and build the framework\n<pre>\r\n~\/Projects$ git clone https:\/\/github.com\/google\/googletest.git\r\n~\/Projects$ cd googletest && git tag -l\r\n~\/Projects\/googletest$ git checkout &lt;release&gt;\r\n~\/Projects\/googletest$ mkdir bin && cd bin\r\n~\/Projects\/googletest\/bin$ cmake .. && make\r\n<\/pre>\n<\/li>\n<li>Deploy the artifacts to &#8216;\/usr\/local&#8217;\n<pre>\r\n~\/Projects\/googletest$ sudo cp -r googlemock\/include\/gmock \/usr\/local\/include\r\n~\/Projects\/googletest$ sudo cp -r googletest\/include\/gtest \/usr\/local\/include\r\n~\/Projects\/googletest$ sudo cp bin\/googlemock\/libgmock.a \/usr\/local\/lib\r\n~\/Projects\/googletest$ sudo cp bin\/googlemock\/libgmock_main.a \/usr\/local\/lib\r\n~\/Projects\/googletest$ sudo cp bin\/googlemock\/gtest\/libgtest.a \/usr\/local\/lib\r\n~\/Projects\/googletest$ sudo cp bin\/googlemock\/gtest\/libgtest_main.a \/usr\/local\/lib\r\n<\/pre>\n<\/li>\n<\/ol>\n<hr>\n<ul>\n<li>Next: <a href=\"http:\/\/www.max-sperling.bplaced.net\/?p=6054\">Unit testing series \u2013 Test scenario (Part 2)<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction With unit testing you want to test the smallest unit possible, which means a single function. These units shall<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[33],"tags":[],"_links":{"self":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/6004"}],"collection":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6004"}],"version-history":[{"count":1,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/6004\/revisions"}],"predecessor-version":[{"id":16590,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/6004\/revisions\/16590"}],"wp:attachment":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6004"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}