<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: MTEST - A unit test harness for MATLAB code</title>
	<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 &#60;a href="http://www.mathworks.com/"&#62;The MathWorks&#60;/a&#62; and coauthored &#60;a href="http://www.mathworks.com/support/books/book5291.html?category=-1&#38;language=-1"&#62;Digital Image Processing Using MATLAB&#60;/a&#62;. He writes here about image processing concepts, algorithm implementations, and MATLAB.&#60;br&#62;&#60;br&#62;&#60;img&#62;</description>
	<pubDate>Mon, 23 Nov 2009 00:40:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<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>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 "TestLearnXunit" as a test case. I renamed the class to "LTestXunit" 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>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 "+core/+xunit" with a file:

&lt;pre&gt;
classdef TestLearnXunit &#60; 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 "+core". When I "runtests", it gets confused about the fully qualified test class name:

&lt;pre&gt;
&#62;&#62; 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'.
&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 = <a href="mailto:self@TestCase(name);">self@TestCase(name);</a>
        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>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>
	<item>
		<title>By: Kay-Uwe</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21918</link>
		<dc:creator>Kay-Uwe</dc:creator>
		<pubDate>Mon, 29 Jun 2009 07:52:33 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21918</guid>
		<description>Having TestSuite.fromPackage() would be nice to have, but so far using simple "test" subdirs (no further package level) works fine for me.

Thanks for the answer,
Kay-Uwe</description>
		<content:encoded><![CDATA[<p>Having TestSuite.fromPackage() would be nice to have, but so far using simple &#8220;test&#8221; subdirs (no further package level) works fine for me.</p>
<p>Thanks for the answer,<br />
Kay-Uwe</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-21876</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 16 Jun 2009 13:49:51 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21876</guid>
		<description>Kay-Uwe&#8212;You can't CD into a package directory and then call M-files within that directory as if they weren't part of a package.  That's why TestSuite.fromPwd() doesn't find any test cases. It tries to call the M-files in the directory, but MATLAB can't find them because they aren't on the path, so no test cases are found.

To gather test cases from within a package, you would need to call the test M-files using the fully scoped package name, as in:

&lt;pre&gt;
suite = package1.subpack1.test.test_mfile;
suite.run()
&lt;/pre&gt;

Maybe we need a &lt;tt&gt;TestSuite.fromPackage()&lt;/tt&gt; method, and we need to teach &lt;tt&gt;runtests&lt;/tt&gt; to accept package names.</description>
		<content:encoded><![CDATA[<p>Kay-Uwe&mdash;You can&#8217;t CD into a package directory and then call M-files within that directory as if they weren&#8217;t part of a package.  That&#8217;s why TestSuite.fromPwd() doesn&#8217;t find any test cases. It tries to call the M-files in the directory, but MATLAB can&#8217;t find them because they aren&#8217;t on the path, so no test cases are found.</p>
<p>To gather test cases from within a package, you would need to call the test M-files using the fully scoped package name, as in:</p>
<pre>
suite = package1.subpack1.test.test_mfile;
suite.run()
</pre>
<p>Maybe we need a <tt>TestSuite.fromPackage()</tt> method, and we need to teach <tt>runtests</tt> to accept package names.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kay-Uwe</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21872</link>
		<dc:creator>Kay-Uwe</dc:creator>
		<pubDate>Tue, 16 Jun 2009 07:40:35 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21872</guid>
		<description>I am using a package structure to organize my MATLAB project and want to include unit-tests. I would like to have a single command to call all test cases inside the complete package hierarchy.

My stucture is something like package1.subpack1.mfile1 and I put test functions in package1.subpack1.test.test_mfile. I perform a search for "+test" directories by compiling a find command and calling system() (that is neither elegant nor portable), cd to the found directories, call TestSuite.fromPwd() to collect all test-cases and collect the test-suites from all directories in an array. At the end I simply call run() of the array members.
This does not work (no test-cases are found by TestSuite.fromPwd()), but does work, if I rename the test directories to something like "_test" (meaning they are no package hierarchy any more). Is this a bug?

Maybe there is a more elegant way to manage unit-tests in a package hierarchy?

Best regards,
Kay-Uwe</description>
		<content:encoded><![CDATA[<p>I am using a package structure to organize my MATLAB project and want to include unit-tests. I would like to have a single command to call all test cases inside the complete package hierarchy.</p>
<p>My stucture is something like package1.subpack1.mfile1 and I put test functions in package1.subpack1.test.test_mfile. I perform a search for &#8220;+test&#8221; directories by compiling a find command and calling system() (that is neither elegant nor portable), cd to the found directories, call TestSuite.fromPwd() to collect all test-cases and collect the test-suites from all directories in an array. At the end I simply call run() of the array members.<br />
This does not work (no test-cases are found by TestSuite.fromPwd()), but does work, if I rename the test directories to something like &#8220;_test&#8221; (meaning they are no package hierarchy any more). Is this a bug?</p>
<p>Maybe there is a more elegant way to manage unit-tests in a package hierarchy?</p>
<p>Best regards,<br />
Kay-Uwe</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-21696</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 22 Apr 2009 16:48:11 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21696</guid>
		<description>Rubshtein&#8212;MTEST makes heavy use of object-oriented language features introduced in R2008a.  I have no plans to port MTEST to earlier MATLAB versions.  However, there are other MATLAB test frameworks available.  Search the File Exchange for "unit test", or search Google for "matlab unit test".</description>
		<content:encoded><![CDATA[<p>Rubshtein&mdash;MTEST makes heavy use of object-oriented language features introduced in R2008a.  I have no plans to port MTEST to earlier MATLAB versions.  However, there are other MATLAB test frameworks available.  Search the File Exchange for &#8220;unit test&#8221;, or search Google for &#8220;matlab unit test&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rubshtein Andrey</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21695</link>
		<dc:creator>Rubshtein Andrey</dc:creator>
		<pubDate>Wed, 22 Apr 2009 16:37:33 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21695</guid>
		<description>Dear Steve,
First of all, thank you very much for this post.
However, it seems that 'mtest' will not work with older Matlab version, specifically R2007b. 

I wonder, is there a possibility of releasing a version compatible with this version? 

Or perhaps you have some other useful advice?

Thanks in advance
Andrey</description>
		<content:encoded><![CDATA[<p>Dear Steve,<br />
First of all, thank you very much for this post.<br />
However, it seems that &#8216;mtest&#8217; will not work with older Matlab version, specifically R2007b. </p>
<p>I wonder, is there a possibility of releasing a version compatible with this version? </p>
<p>Or perhaps you have some other useful advice?</p>
<p>Thanks in advance<br />
Andrey</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-21666</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 08 Apr 2009 20:40:04 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21666</guid>
		<description>James&#8212;Thanks for the link.</description>
		<content:encoded><![CDATA[<p>James&mdash;Thanks for the link.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Ong</title>
		<link>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21649</link>
		<dc:creator>James Ong</dc:creator>
		<pubDate>Fri, 03 Apr 2009 08:38:46 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2009/02/03/mtest-a-unit-test-harness-for-matlab-code/#comment-21649</guid>
		<description>Here's a short fun document about unit testing: http://www.agitar.com/downloads/TheWayOfTestivus.pdf</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a short fun document about unit testing: <a href="http://www.agitar.com/downloads/TheWayOfTestivus.pdf" rel="nofollow">http://www.agitar.com/downloads/TheWayOfTestivus.pdf</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
