@@ -118,8 +118,8 @@ public void verifyBuildStepWithMatlabTestBuilder() throws Exception {
118118 }
119119
120120 /*
121- * Test To verify MATLAB is launched with default arguments and with -batch when release
122- * supports -batch
121+ * Test To verify MATLAB is launched using run matlab script for version above R2018b
122+ *
123123 */
124124
125125 @ Test
@@ -129,12 +129,12 @@ public void verifyMATLABlaunchedWithDefaultArgumentsBatch() throws Exception {
129129 setAllTestArtifacts (false , this .testBuilder );
130130 project .getBuildersList ().add (this .testBuilder );
131131 FreeStyleBuild build = project .scheduleBuild2 (0 ).get ();
132- jenkins .assertLogContains ("-batch " , build );
132+ jenkins .assertLogContains ("run_matlab_command " , build );
133133 jenkins .assertLogContains ("exit(runMatlabTests" , build );
134134 }
135135
136136 /*
137- * Test To verify MATLAB is launched with default arguments and with -r when release supports -r
137+ * Test To verify MATLAB is launched using run matlab script for version below R2018b
138138 * on windows
139139 */
140140
@@ -145,8 +145,8 @@ public void verifyMATLABlaunchedWithDefaultArgumentsRWindows() throws Exception
145145 setAllTestArtifacts (false , this .testBuilder );
146146 project .getBuildersList ().add (testBuilder );
147147 FreeStyleBuild build = project .scheduleBuild2 (0 ).get ();
148- jenkins .assertLogContains ("-r " , build );
149- jenkins .assertLogContains ("runMatlabTests" , build );
148+ jenkins .assertLogContains ("run_matlab_command " , build );
149+ jenkins .assertLogContains ("exit( runMatlabTests" , build );
150150 }
151151
152152 /*
@@ -224,7 +224,7 @@ public void verifyRunTestAutomaticallyIsDefault() throws Exception {
224224 setAllTestArtifacts (true , testBuilder );
225225 project .getBuildersList ().add (this .testBuilder );
226226 FreeStyleBuild build = project .scheduleBuild2 (0 ).get ();
227- jenkins .assertLogContains ("-batch " , build );
227+ jenkins .assertLogContains ("run_matlab_command " , build );
228228 jenkins .assertLogContains ("\' PDFReport\' ,true,\' TAPResults\' ,true,"
229229 + "\' JUnitResults\' ,true,\' SimulinkTestResults\' ,true,"
230230 + "\' CoberturaCodeCoverage\' ,true,\' CoberturaModelCoverage\' ,true" , build );
@@ -243,6 +243,26 @@ public void verifyMATLABscratchFileGeneratedForAutomaticOption() throws Exceptio
243243 File matlabRunner = new File (build .getWorkspace () + File .separator + "runMatlabTests.m" );
244244 Assert .assertTrue (matlabRunner .exists ());
245245 }
246+
247+ /*
248+ * Test to verify if appropriate MATALB runner file is copied in workspace.
249+ */
250+ @ Test
251+ public void verifyMATLABrunnerFileGeneratedForAutomaticOption () throws Exception {
252+ this .buildWrapper .setMatlabRootFolder (getMatlabroot ("R2018b" ));
253+ project .getBuildWrappersList ().add (this .buildWrapper );
254+
255+ project .getBuildersList ().add (testBuilder );
256+ FreeStyleBuild build = project .scheduleBuild2 (0 ).get ();
257+ String runnerFile ;
258+ if (!System .getProperty ("os.name" ).startsWith ("Win" )) {
259+ runnerFile = "run_matlab_command.sh" ;
260+ }else {
261+ runnerFile = "run_matlab_command.bat" ;
262+ }
263+ File matlabRunner = new File (build .getWorkspace () + File .separator + runnerFile );
264+ Assert .assertTrue (matlabRunner .exists ());
265+ }
246266
247267 /*
248268 * Test To verify UI displays Cobertura Warning message when unsupported MATLAB version used.
@@ -365,28 +385,6 @@ public void verifyInvalidMatlabWarningForSTMResults() throws Exception {
365385 .contains (TestMessage .getValue ("Builder.invalid.matlab.root.warning" )));
366386 }
367387
368- /*
369- * Test to verify if MatlabRoot field supports Jenkins environment variables.
370- *
371- */
372-
373- @ Test
374- public void verifyEnvVarSupportForMatlabRoot () throws Exception {
375- EnvironmentVariablesNodeProperty prop = new EnvironmentVariablesNodeProperty ();
376- EnvVars var = prop .getEnvVars ();
377- var .put ("MATLAB" , "R2017a" );
378- jenkins .jenkins .getGlobalNodeProperties ().add (prop );
379- String mroot = getMatlabroot ("R2017a" );
380- this .buildWrapper .setMatlabRootFolder (mroot .replace ("R2017a" , "$MATLAB" ));
381- project .getBuildWrappersList ().add (this .buildWrapper );
382- setAllTestArtifacts (false , testBuilder );
383- project .getBuildersList ().add (this .testBuilder );
384- FreeStyleBuild build = project .scheduleBuild2 (0 ).get ();
385- jenkins .assertLogContains (mroot , build );
386-
387- }
388-
389-
390388 private void setAllTestArtifacts (boolean val , RunMatlabTestsBuilder testBuilder ) {
391389 testBuilder .setCoberturaChkBx (val );
392390 testBuilder .setJunitChkBx (val );
0 commit comments