forked from matlab-deep-learning/mtcnn-face-detection
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunAllTests.m
26 lines (21 loc) · 1002 Bytes
/
runAllTests.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function runAllTests
import matlab.unittest.TestRunner;
import matlab.unittest.Verbosity;
import matlab.unittest.plugins.CodeCoveragePlugin;
import matlab.unittest.plugins.TestReportPlugin;
import matlab.unittest.plugins.codecoverage.CoverageReport;
suite = testsuite(pwd, 'IncludeSubfolders', true);
resultsDir = "public/jobs/" + getenv("GITHUB_RUN_NUMBER");
testResultsDir = resultsDir + "/test-results";
coverageDir = resultsDir + "/code-coverage";
[~,~] = mkdir(testResultsDir);
[~,~] = mkdir(coverageDir);
runner = TestRunner.withTextOutput('OutputDetail', Verbosity.Detailed);
runner.addPlugin(TestReportPlugin.producingHTML(testResultsDir,...
IncludingPassingDiagnostics=true, ...
IncludingCommandWindowText=true));
runner.addPlugin(CodeCoveragePlugin.forFolder({'code'}, MetricLevel="mcdc", IncludingSubfolders=true, Producing=CoverageReport(coverageDir)));
results = runner.run(suite);
nfailed = nnz([results.Failed]);
assert(nfailed == 0, [num2str(nfailed) ' test(s) failed.']);
end