error stack trace visible with verifyError
Show older comments
Hello all,
How can I make my test running silently when using a VerifyError which checks an error is occurring? Now it displays the entire exception trace.
My testcase is defined as:
function testcaseFHwrong(testCase)
cd(testCase.foldername);
try
testCase.verifyError(@() LoadFaultTable('Faulttablewrong.xls','SilentMode',1),'readfaulttable:NoFaultTable');
catch ME
disp(ME);
testCase.verifyTrue(False);
end
end
The function LoadFaultTable will issue an error when being run, and this error is correctly verified by the unit test framework.
The unit test is triggered using:
import matlab.unittest.TestSuite;
import matlab.unittest.TestRunner;
import matlab.unittest.plugins.TAPPlugin;
import matlab.unittest.plugins.ToFile;
suite = TestSuite.fromPackage('test_LIB_SDS_LoadFaultTable');
runner= TestRunner.withTextOutput;
tapFile = 'FHtest.tap';
plugin = TAPPlugin.producingOriginalFormat(ToFile(tapFile));
runner.addPlugin(plugin);
delete(tapFile);
result = runner.run(suite);
The command line shows the error stack trace when running this function. I did not expect this behavior
regards, Han
Accepted Answer
More Answers (0)
Categories
Find more on Run Unit Tests in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!