Hi Jonathan, Thanks for providing an update. It is worth noting that this is designed to support xUnit-style tests that subclass the TestCase class. Other test framework options such as function/initTestSuite/subfunction test code and single function test code don't produce useful xml as the test names are lost because the test names are derived from class and method names.
However, to support the other test framework types, I found the following modifications worked (around line 160 in XMLTestRunDisplay.testComponentFinished). May not be the best way to do it, but it is ok for me.
if isa(component, 'TestCase')
this.iTestCase = this.iTestCase + 1;
if strcmp(component.MethodName, 'runTestCase')
[~, filename, ~] = fileparts(component.Location);
classname = component.Name;
classname = filename;
this.TestCases(this.iTestCase).classname = classname;
this.TestCases(this.iTestCase).name = component.Name;
this.TestCases(this.iTestCase).classname = class(component);
this.TestCases(this.iTestCase).name = component.MethodName;
this.TestCases(this.iTestCase).location = component.Location;
this.TestCases(this.iTestCase).time = component_run_time;
Asan, this is a unit testing framework to help ensure your MATLAB programs have been written correctly and to prevent changes from introducing bugs. There is now a unit test framework included in MATLAB, and you may be interested in the following blog post describing how someone can use such a framework to ensure the quality of science & engineering:
I tried to understand 'MATLAB xUnit Test Framework' from description but unfortunately the most part I couldn't understand, can tell me is useful for what in more simple way, sorry I'm new user of MATLAB
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?