Skip to content

Commit 5252176

Browse files
committed
Comment out SolnSmokeTests
1 parent db23a45 commit 5252176

File tree

1 file changed

+117
-115
lines changed

1 file changed

+117
-115
lines changed

SoftwareTests/SolnSmokeTests.m

Lines changed: 117 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,147 @@
11
classdef SolnSmokeTests < matlab.unittest.TestCase
22

3-
properties
4-
RootFolder
5-
isSolnOnPath
6-
end
7-
8-
properties (ClassSetupParameter)
9-
Project = {currentProject()};
10-
end
113

12-
properties (TestParameter)
13-
File;
14-
end
4+
% properties
5+
% RootFolder
6+
% isSolnOnPath
7+
% end
158

16-
methods (TestParameterDefinition,Static)
9+
% properties (ClassSetupParameter)
10+
% Project = {currentProject()};
11+
% end
1712

18-
function File = GetScriptName(Project)
19-
% Retrieve student template files:
20-
RootFolder = Project.RootFolder;
21-
File = dir(fullfile(RootFolder,"Scripts","*.mlx"));
22-
File = {File.name};
23-
end
13+
% properties (TestParameter)
14+
% File;
15+
% end
2416

25-
end
17+
% methods (TestParameterDefinition,Static)
2618

27-
methods (TestClassSetup)
19+
% function File = GetScriptName(Project)
20+
% % Retrieve student template files:
21+
% RootFolder = Project.RootFolder;
22+
% File = dir(fullfile(RootFolder,"Scripts","*.mlx"));
23+
% File = {File.name};
24+
% end
2825

29-
function SetUpPath(testCase,Project)
30-
% Navigate to project root folder:
31-
testCase.RootFolder = Project.RootFolder;
32-
cd(testCase.RootFolder)
26+
% end
3327

34-
% Check that solutions are on path:
35-
testCase.isSolnOnPath = isfolder("Solutions");
36-
if testCase.isSolnOnPath == 0
37-
addpath(fullfile(testCase.RootFolder,"InstructorResources","Solutions"))
38-
end
28+
% methods (TestClassSetup)
3929

40-
% Close the StartUp app if still open:
41-
delete(findall(groot,'Name','StartUp App'))
30+
% function SetUpPath(testCase,Project)
31+
% % Navigate to project root folder:
32+
% testCase.RootFolder = Project.RootFolder;
33+
% cd(testCase.RootFolder)
4234

43-
% Log MATLAB version:
44-
testCase.log("Running in " + version)
35+
% % Check that solutions are on path:
36+
% testCase.isSolnOnPath = isfolder("Solutions");
37+
% if testCase.isSolnOnPath == 0
38+
% addpath(fullfile(testCase.RootFolder,"InstructorResources","Solutions"))
39+
% end
4540

46-
end % function setUpPath
41+
% % Close the StartUp app if still open:
42+
% delete(findall(groot,'Name','StartUp App'))
4743

48-
end % methods (TestClassSetup)
44+
% % Log MATLAB version:
45+
% testCase.log("Running in " + version)
4946

50-
methods(Test)
47+
% end % function setUpPath
5148

52-
% Check that solutions files exist for each of the student
53-
% templates
54-
function ExistSolns(testCase,File)
55-
SolutionName = replace(string(File),".mlx","Soln.mlx");
56-
assert(exist(SolutionName,"file"),"Missing solutions for "+File);
57-
end
49+
% end % methods (TestClassSetup)
5850

51+
% methods(Test)
5952

60-
function SmokeRun(testCase,File)
53+
% % Check that solutions files exist for each of the student
54+
% % templates
55+
% function ExistSolns(testCase,File)
56+
% SolutionName = replace(string(File),".mlx","Soln.mlx");
57+
% assert(exist(SolutionName,"file"),"Missing solutions for "+File);
58+
% end
6159

62-
% Navigate to project root folder:
63-
cd(testCase.RootFolder)
64-
FileToRun = replace(string(File),".mlx","Soln.mlx");
6560

66-
% Pre-test:
67-
PreFiles = CheckPreFile(testCase,FileToRun);
68-
run(PreFiles);
61+
% function SmokeRun(testCase,File)
6962

70-
% Run SmokeTest
71-
disp(">> Running " + FileToRun);
72-
try
73-
run(fullfile("InstructorResources","Solutions",FileToRun));
74-
catch ME
63+
% % Navigate to project root folder:
64+
% cd(testCase.RootFolder)
65+
% FileToRun = replace(string(File),".mlx","Soln.mlx");
7566

76-
end
67+
% % Pre-test:
68+
% PreFiles = CheckPreFile(testCase,FileToRun);
69+
% run(PreFiles);
7770

78-
% Post-test:
79-
PostFiles = CheckPostFile(testCase,FileToRun);
80-
run(PostFiles)
71+
% % Run SmokeTest
72+
% disp(">> Running " + FileToRun);
73+
% try
74+
% run(fullfile("InstructorResources","Solutions",FileToRun));
75+
% catch ME
8176

82-
% Log every figure created during run:
83-
Figures = findall(groot,'Type','figure');
84-
Figures = flipud(Figures);
85-
if ~isempty(Figures)
86-
for f = 1:size(Figures,1)
87-
if ~isempty(Figures(f).Number)
88-
FigDiag = matlab.unittest.diagnostics.FigureDiagnostic(Figures(f),'Formats','png');
89-
log(testCase,1,FigDiag);
90-
end
91-
end
92-
end
77+
% end
9378

94-
% Close all figures and Simulink models
95-
close all force
96-
if any(matlab.addons.installedAddons().Name == "Simulink")
97-
bdclose all
98-
end
79+
% % Post-test:
80+
% PostFiles = CheckPostFile(testCase,FileToRun);
81+
% run(PostFiles)
9982

100-
% Rethrow error if any
101-
if exist("ME","var")
102-
if ~any(strcmp(ME.identifier,KnownIssuesID))
103-
rethrow(ME)
104-
end
105-
end
83+
% % Log every figure created during run:
84+
% Figures = findall(groot,'Type','figure');
85+
% Figures = flipud(Figures);
86+
% if ~isempty(Figures)
87+
% for f = 1:size(Figures,1)
88+
% if ~isempty(Figures(f).Number)
89+
% FigDiag = matlab.unittest.diagnostics.FigureDiagnostic(Figures(f),'Formats','png');
90+
% log(testCase,1,FigDiag);
91+
% end
92+
% end
93+
% end
10694

107-
end
95+
% % Close all figures and Simulink models
96+
% close all force
97+
% if any(matlab.addons.installedAddons().Name == "Simulink")
98+
% bdclose all
99+
% end
108100

109-
end
101+
% % Rethrow error if any
102+
% if exist("ME","var")
103+
% if ~any(strcmp(ME.identifier,KnownIssuesID))
104+
% rethrow(ME)
105+
% end
106+
% end
107+
108+
% end
109+
110+
% end
110111

111-
methods (Access = private)
112-
113-
function Path = CheckPreFile(testCase,Filename)
114-
PreFile = "Pre"+replace(Filename,".mlx",".m");
115-
PreFilePath = fullfile(testCase.RootFolder,"SoftwareTests","PreFiles",PreFile);
116-
if ~isfolder(fullfile(testCase.RootFolder,"SoftwareTests/PreFiles"))
117-
mkdir(fullfile(testCase.RootFolder,"SoftwareTests/PreFiles"))
118-
end
119-
if ~isfile(PreFilePath)
120-
writelines("% Pre-run script for "+Filename,PreFilePath)
121-
writelines("% ---- Known Issues -----",PreFilePath,'WriteMode','append');
122-
writelines("KnownIssuesID = "+char(34)+char(34)+";",PreFilePath,'WriteMode','append');
123-
writelines("% ---- Pre-run commands -----",PreFilePath,'WriteMode','append');
124-
writelines(" ",PreFilePath,'WriteMode','append');
125-
end
126-
Path = PreFilePath;
127-
end
128-
129-
function Path = CheckPostFile(testCase,Filename)
130-
PostFile = "Post"+replace(Filename,".mlx",".m");
131-
PostFilePath = fullfile(testCase.RootFolder,"SoftwareTests","PostFiles",PostFile);
132-
if ~isfolder(fullfile(testCase.RootFolder,"SoftwareTests/PostFiles"))
133-
mkdir(fullfile(testCase.RootFolder,"SoftwareTests/PostFiles"))
134-
end
135-
if ~isfile(PostFilePath)
136-
writelines("% Post-run script for "+Filename,PostFilePath)
137-
writelines("% ---- Post-run commands -----",PostFilePath,'WriteMode','append');
138-
writelines(" ",PostFilePath,'WriteMode','append');
139-
end
140-
Path = PostFilePath;
141-
end
142-
143-
end
112+
% methods (Access = private)
113+
114+
% function Path = CheckPreFile(testCase,Filename)
115+
% PreFile = "Pre"+replace(Filename,".mlx",".m");
116+
% PreFilePath = fullfile(testCase.RootFolder,"SoftwareTests","PreFiles",PreFile);
117+
% if ~isfolder(fullfile(testCase.RootFolder,"SoftwareTests/PreFiles"))
118+
% mkdir(fullfile(testCase.RootFolder,"SoftwareTests/PreFiles"))
119+
% end
120+
% if ~isfile(PreFilePath)
121+
% writelines("% Pre-run script for "+Filename,PreFilePath)
122+
% writelines("% ---- Known Issues -----",PreFilePath,'WriteMode','append');
123+
% writelines("KnownIssuesID = "+char(34)+char(34)+";",PreFilePath,'WriteMode','append');
124+
% writelines("% ---- Pre-run commands -----",PreFilePath,'WriteMode','append');
125+
% writelines(" ",PreFilePath,'WriteMode','append');
126+
% end
127+
% Path = PreFilePath;
128+
% end
129+
130+
% function Path = CheckPostFile(testCase,Filename)
131+
% PostFile = "Post"+replace(Filename,".mlx",".m");
132+
% PostFilePath = fullfile(testCase.RootFolder,"SoftwareTests","PostFiles",PostFile);
133+
% if ~isfolder(fullfile(testCase.RootFolder,"SoftwareTests/PostFiles"))
134+
% mkdir(fullfile(testCase.RootFolder,"SoftwareTests/PostFiles"))
135+
% end
136+
% if ~isfile(PostFilePath)
137+
% writelines("% Post-run script for "+Filename,PostFilePath)
138+
% writelines("% ---- Post-run commands -----",PostFilePath,'WriteMode','append');
139+
% writelines(" ",PostFilePath,'WriteMode','append');
140+
% end
141+
% Path = PostFilePath;
142+
% end
143+
144+
% end
145+
144146

145147
end

0 commit comments

Comments
 (0)