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

Jared Jacobs

E-mail
Company/University
Stanford University

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Jared View all
Updated File Comments Rating
17 Jun 2010 MATLAB xUnit Test Framework MATLAB xUnit is a unit test framework for MATLAB code. Author: Steve Eddins

Thanks for the prompt fix Steve!

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

I get an error trying to run a test defined in a package too. xUnit tries to run the constructor as a test method. Suppose I put the following code in a +foo directory:

classdef FooTest < TestCase
methods
function object = FooTest(name)
object = object@TestCase(name);
end
function test_sanity(object)
assertEqual(0, 0)
end
end
end

The error message I get is:

>> runtests 'foo'
Starting test run with 2 test cases.
.F
FAILED in 0.060 seconds.

===== Test Case Failure =====
Location: ...\src_test\+foo\FooTest.m
Name: FooTest

...\matlab_xunit_3.0\xunit\TestCase.m at line 74
...\matlab_xunit_3.0\xunit\TestSuite.m at line 85
...\matlab_xunit_3.0\xunit\TestSuite.m at line 85
...\matlab_xunit_3.0\xunit\runtests.m at line 96

Undefined function or method 'FooTest' for input arguments of type 'foo.FooTest'.

I think the problem is in TestSuite.methodIsConstructor, which is comparing 'FooTest' with 'foo.FooTest' and expecting an exact match. One idea for a fix would be to have the method do something like this instead:

result = regexp(method.DefiningClass.Name, ['(.*[.])?' method.Name '$']);

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

Contact us