{"id":1083,"date":"2014-06-25T15:24:35","date_gmt":"2014-06-25T20:24:35","guid":{"rendered":"https:\/\/blogs.mathworks.com\/steve\/?p=1083"},"modified":"2014-06-25T15:24:35","modified_gmt":"2014-06-25T20:24:35","slug":"parameterized-software-tests-and-dipum-examples","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/steve\/2014\/06\/25\/parameterized-software-tests-and-dipum-examples\/","title":{"rendered":"Parameterized software tests and DIPUM examples"},"content":{"rendered":"<p>\r\n<img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/2014\/frame.png\" alt=\"Testing DIPUM examples\" \/>\r\n<\/p>\r\n\r\n<p>\r\nThe book <a href=\"http:\/\/imageprocessingplace.com\/DIPUM-2E\/dipum2e_main_page.htm\" title=\"Digital Image Processing Using MATLAB\"><em>Digital Image Processing Using MATLAB<\/em><\/a> (DIPUM) contains 144 examples. I know this because I watch them all run in MATLAB at least a couple of times a year. I find watching all the images come and go during this process to be oddly entrancing.\r\n<\/p>\r\n\r\n<p>\r\nI have used the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab-unit-test-framework.html\">MATLAB unit test framework<\/a> to write automated tests that run every example script from the book to see whether each runs without error and without generating unexpected warning messages. I do this roughly twice a year to test the DIPUM examples against the next MATLAB and Image Processing Toolbox release that we are getting ready to ship. A couple of weeks ago I ran this using the latest development build of the upcoming R2014b release.\r\n<\/p>\r\n\r\n<p>\r\nNote for those interested in advanced unit testing techniques: I have recently modified these tests to use the parameterized test feature introduced in R2014a. Parameterized tests make it easy to create a large set of mostly repetitive test cases that vary over a certain parameter space. Using this feature, I've written code that turns every example script in a specified folder into a separate test case that automatically executes the script and checks for errors and warnings. If you are interested in this unit testing capability, you might start with the documentation section called <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/create-basic-parameterized-test.html\" title=\"Create Basic Parameterized Test\">\"Create Basic Parameterized Test.\"<\/a>\r\n<\/p>\r\n\r\n<p>\r\nI said above that I like to watch the images come and go. So I made a video of it for you. (I didn't want the video file to be huge, so I only captured a small portion of the screen.)\r\n<\/p>\r\n\r\n<p>\r\nThe video is just under 3 minutes long, and it's a complete waste of time. Enjoy.\r\n<\/p>\r\n\r\n<p>\r\n<div style=\"width: 800px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-1083-1\" width=\"800\" height=\"600\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/2014\/dipum_example_testing.mp4?_=1\" \/><a href=\"https:\/\/blogs.mathworks.com\/images\/steve\/2014\/dipum_example_testing.mp4\">https:\/\/blogs.mathworks.com\/images\/steve\/2014\/dipum_example_testing.mp4<\/a><\/video><\/div>\r\n<p>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/2014\/frame.png\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\n\r\n\r\n\r\n\r\nThe book Digital Image Processing Using MATLAB (DIPUM) contains 144 examples. I know this because I watch them all run in MATLAB at least a couple of times a year. I find watching all the... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/steve\/2014\/06\/25\/parameterized-software-tests-and-dipum-examples\/\">read more >><\/a><\/p>","protected":false},"author":42,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/1083"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/comments?post=1083"}],"version-history":[{"count":9,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/1083\/revisions"}],"predecessor-version":[{"id":1092,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/1083\/revisions\/1092"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/media?parent=1083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/categories?post=1083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/tags?post=1083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}