22
33 properties
44 RootFolder
5- end
5+ sparedEditors % Files already open when the test starts
6+ end % properties
67
78 properties (ClassSetupParameter )
89 Project = {currentProject()};
9- end
10+ end % ClassSetupParameter
1011
1112 properties (TestParameter )
1213 File ;
13- end
14+ end % TestParameter
1415
1516 methods (TestParameterDefinition ,Static )
1617
2122 File = {File .name };
2223 end
2324
24- end
25+ end % Static TestParameterDefinition
2526
2627 methods (TestClassSetup )
2728
@@ -37,8 +38,28 @@ function SetUpSmokeTest(testCase,Project) %#ok<INUSD>
3738 testCase .log(" Running in " + version )
3839 end
3940
40- end
41+ end % TestClassSetup
42+
43+ methods (TestMethodSetup )
44+ function recordEditorsToSpare(testCase )
45+ testCase.sparedEditors = matlab .desktop .editor .getAll ;
46+ testCase.sparedEditors = {testCase .sparedEditors .Filename };
47+ end
48+ end % TestMethodSetup
4149
50+ methods (TestMethodTeardown )
51+ function closeOpenedEditors_thenDeleteWorkingDir(testCase )
52+ openEditors = matlab .desktop .editor .getAll ;
53+ for editor= openEditors(1 : end )
54+ if any(strcmp(editor .Filename , testCase .sparedEditors ))
55+ continue ;
56+ end
57+ % if not on our list, close the file
58+ editor .close();
59+ end
60+ end
61+ end % TestMethodTeardown
62+
4263 methods (Test )
4364
4465 function SmokeRun(testCase ,File )
@@ -90,7 +111,7 @@ function SmokeRun(testCase,File)
90111
91112 end
92113
93- end
114+ end % Test Methods
94115
95116
96117 methods (Access = private )
@@ -125,6 +146,6 @@ function SmokeRun(testCase,File)
125146 Path = PostFilePath ;
126147 end
127148
128- end
149+ end % Private Methods
129150
130- end
151+ end % Smoketests
0 commit comments