In the past I've written test scripts outside the MATLAB xUnit Test Framework that modify the current directory or the MATLAB path so the stub functions appear first. Taking advantage of the MATLAB function name resolution rules to call something else instead.
Unfortunately, I'm still stuck developing in R2007b, haven't used the MATLAB xUnit Test Framework, and so don't have any idea if this is something the Framework or the individual test case is in a better position to handle.
In R2013a, a curious glitch has emerged in the behavior of the documentation. When I type 'doc', go to the home page, and click on 'Supplemental Software', I get the documentation for this package (and some others). However, the display flickers. MATLAB Support uncovered the source of the problem: the line
<meta http-equiv="REFRESH" content="0;url=xunit_product_page.html">
in the file index.html.
The fix was to delete index.html and replace it with a copy of xunit_product_page.html, renamed to index.html.
Keith - On my Mac, MATLAB xUnit passes 150 of the 151 test cases in its own test suite. (The one failure seems to be a bad test case.) Use the contact form on my author page (http://www.mathworks.com/matlabcentral/fileexchange/authors/22204) to send me more details about the problem you are experiencing.
Hey, I understand that xUnit is superceded by the official unit test framework in 2013b, but I have a lot of test functions set up for xUnit. When I try to run them in 2013b, even with xUnit put at the top of the path, it doesn't work. Is there a way to either (a) get my old functions to work, or (b) automatically convert my xUnit tests to the new system?
I am sorry it took me so long to post here the promised link to the mocking framework created by Vladimir Peric, a student of mine.
You can download mmockito from GitHub:
It is a lightweight package, that definitely cannot do all the mocking things out there, but for the basic usage it shall be quite handy.
It is created using the new MATLAB unit test framework and should be compliant with it. It should also work with Steve Edins' MATLAB xUnit Framework, although maybe with a bit limited capabilities.
Feel free to report any issues directly on the GitHub page.
We hope you will find it useful.