matlab.unittest.testcase not found on path
    11 views (last 30 days)
  
       Show older comments
    
    Error using SolverTest
    The specified superclass 'matlab.unittest.TestCase' contains a parse error, cannot be found on MATLAB's search path, or is shadowed by another file with the same name.
I'm running R2015b on xUbuntu. The folder /usr/local/MATLAB/R2015b/toolbox/matlab/testframework is on the path and the files all seem to be there.I already reinstalled MATLAB.
Any Ideas? Thx, martin
0 Comments
Answers (4)
  Kiran
    
 on 12 Feb 2016
        There could be multiple issue causing this behavior.
1. You may not had executed following command at MATLAB command prompt:
 import matlab.unittest.TestSuite
2. There could be another file by name with name TestSuites which is shadowing the original file. To check this, execute following command:
 which -all matlab.unittest.TestSuite
This should give output as
 C:\Program Files\MATLAB\R2015a\toolbox\matlab\testframework\+matlab\+unittest\TestSuite.m  % matlab.unittest.TestSuite constructor
Also, if this file is not on MATLAB path then add it to MATLAB path using method "addpath".
Let me know if doesn't solve the issue.
4 Comments
  Bill Tubbs
      
 on 15 Jun 2022
				Now I downloaded Matlab R2021b and still get the same error.  I will ask a new question.
  Andy Campbell
    
 on 12 Feb 2016
        This does seem like an installation problem. A couple things to try:
1. Look for TestCase
 >> which -all matlab.unittest.TestCase
 matlab.unittest.TestCase is a built-in method  % matlab.unittest.TestCase constructor
2. Look for the resulting library. Look for matlab/bin/glnxa64/libmwmatlabunit.so in your installation, as well as matlab/bin/registry/libmwmatlabunit.xml. If they are not there this is a problem with your installation.
3 Comments
  Andy Campbell
    
 on 15 Feb 2016
				
      Edited: Andy Campbell
    
 on 15 Feb 2016
  
			Hmmmm, I'm stumped, everything looks fine as far as I can tell. I would suggest connecting with our installation support team, they should be able to help you get to the bottom of these problems.
  Marcelo
      
 on 1 Nov 2017
        I am with this same problem.
I tried to execute the example "TestCarpet" described in https://www.mathworks.com/help/matlab/matlab_prog/create-basic-parameterized-test.html and also in the "Create Basic Parameterized Test" section within Help, but I received always the same error:
>> suite = matlab.unittest.TestSuite.fromFile('TestCarpet.m');
Error using matlab.unittest.TestSuite.fromFile (line 159)
The specified superclass 'matlab.unittest.TestCase' contains a parse error, cannot be found on MATLAB's search path, or is shadowed by another file with the same name.
Like Martin, I am using Matlab R2015b 32-bits, but the Windows version.
Is there some incompatibility between the Unit Test Framework and the 2015b release?
I looked for in Bug Reports, but I did not find anything about this particular problem.
Debugging the code it was possible to see that the problem occurred during the calling
suite = factory.createSuiteExplicitly(selector);
inside TestSuite class definition file.
Thanks
Marcelo
0 Comments
  Benoît Bourassa-Moreau
 on 11 Jun 2019
        
      Edited: Benoît Bourassa-Moreau
 on 11 Jun 2019
  
      I have the same error prompt as Martin but on Matlab R2016a (9.0.0.341360) win64. I've been working with Test objects for the past few months without any issues and previously working Test Case stopped working this morning. I'm able to find TestSuite, but not TestCase in my path:
>> which -all matlab.unittest.TestSuite
C:\Program Files\MATLAB\R2016a\toolbox\matlab\testframework\core\+matlab\+unittest\TestSuite.m  % matlab.unittest.TestSuite constructor
And
>> which -all matlab.unittest.TestCase
'matlab.unittest.TestCase' not found.
I've tried to restore my Matlab path and rehash the Matlab root functions and class:
>> restoredefaultpath
>> rehash toolboxcache
TestCase still cannot be found.
Thank you,
Benoit
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




