Skip to content
Snippets Groups Projects
Commit 30e61345 authored by Ferdinand Fischer's avatar Ferdinand Fischer
Browse files

New helper function to simplify the call of a single test function

parent d4bdd455
Branches
Tags
No related merge requests found
function runSingleTest(testSuite, testName)
%RUNSINGLETEST runs a single test of a test file
% runSingleTest(testSuite, testName) runs the testfunction with the name
% 'testName' of the 'testSuite'. A testSuite can be produced by
% matlab.unittest.TestSuite.from*... or if the tests are defined in a
% file, this file can be directly used as testSuite.
% Example:
% testSuite = unittests.quantity.testSymbolic
% testName = 'testCat'
% runSingletest(testSuite, testName)
testSuite(strcmp({testSuite.ProcedureName}, testName)).run
end
......@@ -3,6 +3,9 @@ To run multiple unittests in packages use:
If you want to run only the tests for a subpackage, you can use the code:
result = run(matlab.unittest.TestSuite.fromPackage('unittests.<subpackage name>', 'IncludingSubpackages', true))
If you want to run only a single test of a subpackage, you can use the helper function
misc.runSingleTest(testSuite, testName)
Some tests need reference results or save data locally in order to improve speed.
This is usually done in a setupOnce() function. Therefore, calling unittests for the first time, might take
a lot longer then afterwards.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment