@@ -187,9 +187,8 @@ public void verifyBuilderFailsForInvalidMATLABPath() throws Exception {
187187 public void verifyBuildFailureWhenMatlabException () throws Exception {
188188 MatlabBuilderTester tester = new MatlabBuilderTester (getMatlabroot ("R2018b" ),
189189 matlabExecutorAbsolutePath , "-positiveFail" );
190- // tester.setFailBuildIfTestFailureCheckBox(false );
190+ tester .setTestRunTypeList ( new RunTestsAutomaticallyOption () );
191191 project .getBuildersList ().add (tester );
192-
193192 FreeStyleBuild build = project .scheduleBuild2 (0 ).get ();
194193 jenkins .assertBuildStatus (Result .FAILURE , build );
195194 }
@@ -202,6 +201,7 @@ public void verifyBuildFailureWhenMatlabException() throws Exception {
202201 public void verifyMatlabInvokedWithValidExecutable () throws Exception {
203202 MatlabBuilderTester tester = new MatlabBuilderTester (getMatlabroot ("R2018b" ),
204203 matlabExecutorAbsolutePath , "-positive" );
204+ tester .setTestRunTypeList (new RunTestsAutomaticallyOption ());
205205 project .getBuildersList ().add (tester );
206206 FreeStyleBuild build = project .scheduleBuild2 (0 ).get ();
207207 jenkins .assertBuildStatus (Result .SUCCESS , build );
@@ -218,7 +218,7 @@ public void verifyMatlabPointsToValidExecutable() throws Exception {
218218 MatlabBuilderTester tester = new MatlabBuilderTester (getMatlabroot ("R2018b" ),
219219 matlabExecutorAbsolutePath , "-positive" );
220220 project .getBuildersList ().add (tester );
221-
221+ tester . setTestRunTypeList ( new RunTestsAutomaticallyOption ());
222222 FreeStyleBuild build = project .scheduleBuild2 (0 ).get ();
223223 jenkins .assertBuildStatus (Result .SUCCESS , build );
224224 jenkins .assertLogContains (matlabExecutorAbsolutePath , build );
@@ -301,6 +301,32 @@ public void verifyRunTestAutomaticallyIsDefault() throws Exception {
301301 jenkins .assertLogContains ("true,true,true" , build );
302302 }
303303
304+ /*
305+ * Test to verify if MATALB scratch file is generated in workspace for Automatic option.
306+ */
307+ @ Test
308+ public void verifyMATLABscratchFileGeneratedForAutomaticOption () throws Exception {
309+ this .matlabBuilder .setMatlabRoot (getMatlabroot ("R2018b" ));
310+ this .matlabBuilder .setTestRunTypeList (new RunTestsAutomaticallyOption ());
311+ project .getBuildersList ().add (this .matlabBuilder );
312+ FreeStyleBuild build = project .scheduleBuild2 (0 ).get ();
313+ File matlabRunner = new File (build .getWorkspace () + File .separator + "runMatlabTests.m" );
314+ Assert .assertTrue (matlabRunner .exists ());
315+ }
316+
317+ /*
318+ * Test to verify if MATALB scratch file is not generated in workspace for Custom option.
319+ */
320+ @ Test
321+ public void verifyMATLABscratchFileGeneratedForCustomOption () throws Exception {
322+ this .matlabBuilder .setMatlabRoot (getMatlabroot ("R2018b" ));
323+ this .matlabBuilder .setTestRunTypeList (new RunTestsWithCustomCommandOption ());
324+ project .getBuildersList ().add (this .matlabBuilder );
325+ FreeStyleBuild build = project .scheduleBuild2 (0 ).get ();
326+ File matlabRunner = new File (build .getWorkspace () + File .separator + "runMatlabTests.m" );
327+ Assert .assertFalse (matlabRunner .exists ());
328+ }
329+
304330 /*
305331 * Test to verify default value of getStringByName() when Automatic test mode.
306332 */
0 commit comments