Rank: 364619 based on 0 downloads (last 30 days) and 0 file submitted
photo

Jeff Beck

E-mail
Company/University
Northrop Grumman Electronic Systems
Lat/Long
34.1376, -117.8254

Personal Profile:

 

Watch this Author's files

 

Comments and Ratings by Jeff Beck View all
Updated File Comments Rating
12 Nov 2010 MATLAB xUnit Test Framework MATLAB xUnit is a unit test framework for MATLAB code. Author: Steve Eddins

Understood, Steve. Then you may just want to throw an error if nargout(self.SetupFcn()) > 1 or add a line to the setup() documentation that says there can only be ONE setup function and it can return at most ONE argument. It might save someone from beating their head against a wall trying to figure out why their additional output from setup ends up undefined. Thanks, again!

10 Nov 2010 MATLAB xUnit Test Framework MATLAB xUnit is a unit test framework for MATLAB code. Author: Steve Eddins

Steve,
First let me add my thanks for developing this test framework. I'd like to suggest a fix to a small issue I ran into. When I wanted my setup() function to return more than 1 output argument, I found that only the first output argument was recognized when being passed into the tests. To fix this, I forced FunctionHandleTestCase.TestData to be a cell array. Here's a diff showing my changes to FunctionHandleTestCase.m:
--- FunctionHandleTestCase.m (revision 220)
+++ FunctionHandleTestCase.m (working copy)
@@ -53,7 +53,7 @@
TeardownFcn;

%TestData - Data needed by test function or teardown function.
- TestData;
+ TestData = {};
end

methods
@@ -107,7 +107,7 @@
% pass self.TestData to the test function. Otherwise, call the
% test function with no input arguments.
if ~isempty(self.SetupFcn) && nargout(self.SetupFcn) > 0
- self.TestFcn(self.TestData);
+ self.TestFcn(self.TestData{:});
else
self.TestFcn();
end
@@ -120,7 +120,7 @@
% argument in instance data (TestData).
if ~isempty(self.SetupFcn)
if nargout(self.SetupFcn) > 0
- self.TestData = self.SetupFcn();
+ [self.TestData{1:nargout(self.SetupFcn)}] = self.SetupFcn()
;
else
self.SetupFcn();
end
@@ -135,7 +135,7 @@
% arguments.
if ~isempty(self.TeardownFcn)
if ~isempty(self.SetupFcn) && (nargout(self.SetupFcn) > 0)
- self.TeardownFcn(self.TestData);
+ self.TeardownFcn(self.TestData{:});
else
self.TeardownFcn();
end

Contact us