<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: MTEST &#8211; A unit test harness for MATLAB code</title>
	<atom:link href="http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/</link>
	<description>Steve Eddins manages the Image &#38; Geospatial development team at The MathWorks and coauthored Digital Image Processing Using MATLAB. He writes here about image processing concepts, algorithm implementations, and MATLAB.</description>
	<lastBuildDate>Sat, 11 Feb 2012 18:27:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-24308</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 07 Jul 2011 16:11:55 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-24308</guid>
		<description>idimou&#8212;Yes, I can imagine a few ways to do this. Here&#039;s one approach:

&lt;pre class=&quot;code&quot;&gt;
function test_suite = classifier_functions_test
initTestSuite

function function_list = setup
function_list = {@classifier1, @classifier2, @classifier3};

function testThis(function_list)
for k = 1:numel(function_list)
    % Test &quot;This&quot; for each classifier function.
end

function testThat
for k = 1:numel(function_list)
    % Test &quot;That&quot; for each classifier function.
end
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>idimou&mdash;Yes, I can imagine a few ways to do this. Here&#8217;s one approach:</p>
<pre class="code">
function test_suite = classifier_functions_test
initTestSuite

function function_list = setup
function_list = {@classifier1, @classifier2, @classifier3};

function testThis(function_list)
for k = 1:numel(function_list)
    % Test "This" for each classifier function.
end

function testThat
for k = 1:numel(function_list)
    % Test "That" for each classifier function.
end
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: idimou</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-24299</link>
		<dc:creator>idimou</dc:creator>
		<pubDate>Mon, 04 Jul 2011 13:59:38 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-24299</guid>
		<description>First of all thank you for this great tool.
I have a collection of classifier functions and I&#039;d like to test them all for specific common properties.
Currently I have to write a test suite for each function. The  suites essentially only differ in the name of the function under test. The tests in are all identical. 
Is there a way to automate this? (i.e. provide the function name as an argument)</description>
		<content:encoded><![CDATA[<p>First of all thank you for this great tool.<br />
I have a collection of classifier functions and I&#8217;d like to test them all for specific common properties.<br />
Currently I have to write a test suite for each function. The  suites essentially only differ in the name of the function under test. The tests in are all identical.<br />
Is there a way to automate this? (i.e. provide the function name as an argument)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-24259</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 06 Jun 2011 16:12:08 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-24259</guid>
		<description>OE&#8212;Yes, I haven&#039;t written assertion functions for the container types such as cell or struct. I can suggest a slight simplification of what you wrote:

&lt;pre class=&quot;code&quot;&gt;
assertTrue(isequal(expectedresult, actualresult))
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>OE&mdash;Yes, I haven&#8217;t written assertion functions for the container types such as cell or struct. I can suggest a slight simplification of what you wrote:</p>
<pre class="code">
assertTrue(isequal(expectedresult, actualresult))
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oyster Engineer</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-24256</link>
		<dc:creator>Oyster Engineer</dc:creator>
		<pubDate>Fri, 03 Jun 2011 17:41:51 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-24256</guid>
		<description>Steve,

I want to write a test for a function that returns a cell array with mixed numbers &amp; text.  Which assert* test would you recommend using in this case?

The best I&#039;ve come up is:

&lt;pre class=&quot;code&quot;&gt;
assertEqual(logical(1), isequal(expectedresult, actualresult))
&lt;/pre&gt;

Thanks.</description>
		<content:encoded><![CDATA[<p>Steve,</p>
<p>I want to write a test for a function that returns a cell array with mixed numbers &amp; text.  Which assert* test would you recommend using in this case?</p>
<p>The best I&#8217;ve come up is:</p>
<pre class="code">
assertEqual(logical(1), isequal(expectedresult, actualresult))
</pre>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-22664</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 03 Feb 2010 01:51:46 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-22664</guid>
		<description>Peter&#8212;Be sure to check out the &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fx_files/22846/7/content/matlab_xunit/doc/xunit_product_page.html&quot; rel=&quot;nofollow&quot;&gt;doc&lt;/a&gt; for info on writing test cases to be automatically recognized.

I have no plans to post this package elsewhere.  Is there some particular reason you&#039;d like to see that?</description>
		<content:encoded><![CDATA[<p>Peter&mdash;Be sure to check out the <a href="http://www.mathworks.com/matlabcentral/fx_files/22846/7/content/matlab_xunit/doc/xunit_product_page.html" rel="nofollow">doc</a> for info on writing test cases to be automatically recognized.</p>
<p>I have no plans to post this package elsewhere.  Is there some particular reason you&#8217;d like to see that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-22658</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Mon, 01 Feb 2010 21:06:52 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-22658</guid>
		<description>Hi, I&#039;m trying to get started using xUnit with MatLab.  Having trouble getting it to recognize test files in some cases, but this is something I can work on figuring out.  My main question is, would it be possible to post this on GitHub or somewhere like that?</description>
		<content:encoded><![CDATA[<p>Hi, I&#8217;m trying to get started using xUnit with MatLab.  Having trouble getting it to recognize test files in some cases, but this is something I can work on figuring out.  My main question is, would it be possible to post this on GitHub or somewhere like that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-22397</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Fri, 04 Dec 2009 18:06:09 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-22397</guid>
		<description>Oren&#8212;I&#039;m interested in expanding MATLAB xUnit to support test suites in packages, but because of my current activities it&#039;s going to be at least a couple of months before I can look at it.</description>
		<content:encoded><![CDATA[<p>Oren&mdash;I&#8217;m interested in expanding MATLAB xUnit to support test suites in packages, but because of my current activities it&#8217;s going to be at least a couple of months before I can look at it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oren</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-22351</link>
		<dc:creator>Oren</dc:creator>
		<pubDate>Sun, 15 Nov 2009 18:06:43 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-22351</guid>
		<description>Quick update: mtest was trying to run the constructor of the class &quot;TestLearnXunit&quot; as a test case. I renamed the class to &quot;LTestXunit&quot; and it works now.

Following up on a package suite, is there a way to call TestSuite.fromPackage() that will scan the package and all its sub-packages for test classes and run them?

Thanks!</description>
		<content:encoded><![CDATA[<p>Quick update: mtest was trying to run the constructor of the class &#8220;TestLearnXunit&#8221; as a test case. I renamed the class to &#8220;LTestXunit&#8221; and it works now.</p>
<p>Following up on a package suite, is there a way to call TestSuite.fromPackage() that will scan the package and all its sub-packages for test classes and run them?</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oren</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-22350</link>
		<dc:creator>Oren</dc:creator>
		<pubDate>Sun, 15 Nov 2009 17:57:11 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-22350</guid>
		<description>Dear Steve,
I am encountering the same package-structure problem. Are you planning to support it any time soon? Perhaps you are and my usage below is wrong. Thank you so much in advance.
Oren

===
I have a package directory &quot;+core/+xunit&quot; with a file:

&lt;pre&gt;
classdef TestLearnXunit &lt; TestCase
    %TESTLEARNXUNIT A learning test of the xUnit testing framework.
    %   Detailed explanation goes here
    
    properties (GetAccess = protected)
        x
    end
    
    %=========================== CONSTRUCTORS ============================
    methods
        function self = TestLearnXunit(name)
            %TestLearnXunit Constructor
            %   TestCaseInDir(name, testDirectory) constructs a test case
            %   using the specified name.
            self = self@TestCase(name);
        end
    end
    
    %=========================== SETUP METHODS ===========================
    methods
        function setUp(self)
            %setUp Simple test fixture setup.
            self.x = 1;
        end
        
        function tearDown(self)
            %tearDown Simple test fixture tear-down.
            self.x = 0;
        end
    end
    
    %=========================== TESTING METHODS =========================
    methods
        function testXValue(self)
            assertEqual(self.x, 1);
        end
    end
    
end

&lt;/pre&gt;

My path contains the parent directory of &quot;+core&quot;. When I &quot;runtests&quot;, it gets confused about the fully qualified test class name:

&lt;pre&gt;
&gt;&gt; runtests core.xunit.TestLearnXunit
Starting test run with 2 test cases.
F.
FAILED in 0.002 seconds.

===== Test Case Failure =====
Location: c:\oren\core\src\test\+core\+xunit\TestLearnXunit.m
Name:     TestLearnXunit

C:\oren\core\matlab_xunit\xunit\TestCase.m at line 75
C:\oren\core\matlab_xunit\xunit\TestSuite.m at line 78
C:\oren\core\matlab_xunit\xunit\runtests.m at line 73

Undefined function or method &#039;TestLearnXunit&#039; for input arguments of type &#039;core.xunit.TestLearnXunit&#039;.
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Dear Steve,<br />
I am encountering the same package-structure problem. Are you planning to support it any time soon? Perhaps you are and my usage below is wrong. Thank you so much in advance.<br />
Oren</p>
<p>===<br />
I have a package directory &#8220;+core/+xunit&#8221; with a file:</p>
<pre>
classdef TestLearnXunit &lt; TestCase
    %TESTLEARNXUNIT A learning test of the xUnit testing framework.
    %   Detailed explanation goes here

    properties (GetAccess = protected)
        x
    end

    %=========================== CONSTRUCTORS ============================
    methods
        function self = TestLearnXunit(name)
            %TestLearnXunit Constructor
            %   TestCaseInDir(name, testDirectory) constructs a test case
            %   using the specified name.
            self = self@TestCase(name);
        end
    end

    %=========================== SETUP METHODS ===========================
    methods
        function setUp(self)
            %setUp Simple test fixture setup.
            self.x = 1;
        end

        function tearDown(self)
            %tearDown Simple test fixture tear-down.
            self.x = 0;
        end
    end

    %=========================== TESTING METHODS =========================
    methods
        function testXValue(self)
            assertEqual(self.x, 1);
        end
    end

end
</pre>
<p>My path contains the parent directory of &#8220;+core&#8221;. When I &#8220;runtests&#8221;, it gets confused about the fully qualified test class name:</p>
<pre>
&gt;&gt; runtests core.xunit.TestLearnXunit
Starting test run with 2 test cases.
F.
FAILED in 0.002 seconds.

===== Test Case Failure =====
Location: c:\oren\core\src\test\+core\+xunit\TestLearnXunit.m
Name:     TestLearnXunit

C:\oren\core\matlab_xunit\xunit\TestCase.m at line 75
C:\oren\core\matlab_xunit\xunit\TestSuite.m at line 78
C:\oren\core\matlab_xunit\xunit\runtests.m at line 73

Undefined function or method 'TestLearnXunit' for input arguments of type 'core.xunit.TestLearnXunit'.
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21922</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 29 Jun 2009 12:38:16 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21922</guid>
		<description>Kay-Uwe&#8212;Thanks for following up.  I am planning to make it easier to use test directories in a package.  The MATLAB &lt;tt&gt;what&lt;/tt&gt; function can be used to determine information about a package and its contents.</description>
		<content:encoded><![CDATA[<p>Kay-Uwe&mdash;Thanks for following up.  I am planning to make it easier to use test directories in a package.  The MATLAB <tt>what</tt> function can be used to determine information about a package and its contents.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

