How to save results of a Class-Based Unittest without ToFile Plugin?

4 vues (au cours des 30 derniers jours)
Shar
Shar le 23 Nov 2016
Commenté : Shar le 29 Nov 2016
Hi, Is there any replacement for
matlab.unittest.plugins.ToFile
class? I have Matlab 2013 and my Matlab does not have this Plugin. This ToFile class creates an output stream that writes text output to a UTF-8 encoded file.
Thanks, Arsalan
  2 commentaires
Sean de Wolski
Sean de Wolski le 23 Nov 2016
Can you upgrade to a newer release that has ToFile?
Shar
Shar le 29 Nov 2016
No :)

Connectez-vous pour commenter.

Réponse acceptée

Ganesh Hegade
Ganesh Hegade le 23 Nov 2016
Create a test class with test cases
classdef Test_Class < matlab.unittest.TestCase
Then import the the test classes to a suite. If you have created test classes in a folder you can import all the test cases to Testsuite using below command.
suite = matlab.unittest.TestSuite.fromFolder(folder)
Then Run the suite to get the test results.
uniTestresult = run(suite);
uniTestresult will give you the information about the test carried.
  1 commentaire
Shar
Shar le 23 Nov 2016
classdef Test_MainFunction < matlab.unittest.TestCase
methods (Test)
function test_Caseone(testCase)
Heat_TestFunction('Caseone_Test.csv'testCase);
end
function test_Casetwo(testCase)
Heat_TestFunction('Casetwo_Tesst.csv',testCase);
end
end
end
This is my only Test Class, I want to save a .txt file for each of these tests like a report or something.

Connectez-vous pour commenter.

Plus de réponses (1)

Andy Campbell
Andy Campbell le 23 Nov 2016
As Sean alludes to in his comment, I think the best exxperience will be if you are able to upgrade to a newer release that has ToFile (it was introduced in R2014a). There are certainly many new capabilities and features of the test framework in newer releases.
However, until then, you may have some luck with the -logfile MATLAB startup option. Using this all of the output sent to the command window will also go to this logfile.
Good luck!

Catégories

En savoir plus sur Testing Frameworks dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by