-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestscript.m
More file actions
68 lines (53 loc) · 2.02 KB
/
testscript.m
File metadata and controls
68 lines (53 loc) · 2.02 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
%% Create suite
apsuite = testsuite("02_Models\AHRS_Voter\test_cases\AHRS_Voter_REQ_Based_Test.mldatx");
%% Create runner
import matlab.unittest.TestRunner
aprunner = TestRunner.withNoPlugins;
%% Create test report
import matlab.unittest.plugins.TestReportPlugin
pdffile = 'testresults.pdf';
trp = TestReportPlugin.producingPDF(pdffile);
addPlugin(aprunner,trp)
%% Create TestManagerResults
% (Generate enhanced test results with the MATLAB Unit Test framework)
import sltest.plugins.TestManagerResultsPlugin
tmr = TestManagerResultsPlugin;
addPlugin(aprunner,tmr)
%% Generate results with TAP format
import matlab.unittest.plugins.TAPPlugin
import matlab.automation.streams.ToFile
tapFile = 'Output.tap';
tap = TAPPlugin.producingVersion13(ToFile(tapFile));
addPlugin(aprunner,tap)
%% Cenerate test coverage metrics
import sltest.plugins.coverage.CoverageMetrics
cmet = CoverageMetrics('Decision',true);
import sltest.plugins.coverage.ModelCoverageReport
import matlab.unittest.plugins.codecoverage.CoberturaFormat
rptfile = 'R13Coverage.xml';
rpt = CoberturaFormat(rptfile);
import sltest.plugins.ModelCoveragePlugin
mcp = ModelCoveragePlugin('Collecting',cmet,'Producing',rpt);
addPlugin(aprunner,mcp)
%% Run
apresults = runInParallel(aprunner,apsuite);
% import matlab.unittest.plugins.CodeCoveragePlugin;
% import matlab.unittest.plugins.XMLPlugin;
% import matlab.unittest.plugins.codecoverage.CoberturaFormat;
%
% %addpath(genpath('matlab'));
% % pwd
% % openProject('ProcessAdvisorExample.prj')
% % suite = testsuite(pwd, 'IncludeSubfolders', true);
% suite = testsuite('02_Models\AHRS_Voter\test_cases\AHRS_Voter_REQ_Based_Test.mldatx');
%
% [~,~] = mkdir('code-coverage');
% [~,~] = mkdir('test-results');
%
% runner = testrunner();
% runner.addPlugin(XMLPlugin.producingJUnitFormat('test-results/results.xml'));
% runner.addPlugin(CodeCoveragePlugin.forFolder({'.'}, 'IncludingSubfolders', true, 'Producing', CoberturaFormat('code-coverage/coverage.xml')));
%
% results = runner.run(suite1);
% display(results);
% assertSuccess(results);