2121import org .junit .Test ;
2222import org .jvnet .hudson .test .JenkinsRule ;
2323import com .gargoylesoftware .htmlunit .WebAssert ;
24+ import com .gargoylesoftware .htmlunit .html .DomElement ;
2425import com .gargoylesoftware .htmlunit .html .HtmlCheckBoxInput ;
2526import com .gargoylesoftware .htmlunit .html .HtmlPage ;
27+ import com .gargoylesoftware .htmlunit .html .HtmlSelect ;
28+ import com .gargoylesoftware .htmlunit .javascript .host .html .HTMLSelectElement ;
2629import com .mathworks .ci .RunMatlabTestsBuilder .CoberturaArtifact ;
2730import com .mathworks .ci .RunMatlabTestsBuilder .JunitArtifact ;
2831import com .mathworks .ci .RunMatlabTestsBuilder .ModelCovArtifact ;
@@ -87,6 +90,8 @@ public static void classSetup() throws URISyntaxException, IOException {
8790 public void testSetup () throws IOException {
8891 this .project = jenkins .createFreeStyleProject ();
8992 this .testBuilder = new RunMatlabTestsBuilder ();
93+ testBuilder .setLoggingLevel ("default" );
94+ testBuilder .setOutputDetail ("default" );
9095 this .buildWrapper = new UseMatlabVersionBuildWrapper ();
9196 }
9297
@@ -525,23 +530,106 @@ public void verifySystemTempDirDeleted() throws Exception {
525530 jenkins .assertLogContains ("rmdir(tmpDir,'s')" , build );
526531 }
527532
533+
528534 /*
535+ * Test to verify Use Parallel check box present.
536+ */
537+
538+ @ Test
539+ public void verifyUseParallelPresent () throws Exception {
540+ this .buildWrapper .setMatlabBuildWrapperContent (new MatlabBuildWrapperContent (Message .getValue ("matlab.custom.location" ), getMatlabroot ("R2018b" )));
541+ project .getBuildWrappersList ().add (this .buildWrapper );
542+ project .getBuildersList ().add (this .testBuilder );
543+ HtmlPage page = jenkins .createWebClient ().goTo ("job/test0/configure" );
544+ WebAssert .assertElementPresentByXPath (page , "//input[@name=\" _.useParallel\" ]" );
545+ }
546+
547+ /*
548+ * Test to verify Strict check box present.
549+ */
550+
551+ @ Test
552+ public void verifyStrictPresent () throws Exception {
553+ this .buildWrapper .setMatlabBuildWrapperContent (new MatlabBuildWrapperContent (Message .getValue ("matlab.custom.location" ), getMatlabroot ("R2018b" )));
554+ project .getBuildWrappersList ().add (this .buildWrapper );
555+ project .getBuildersList ().add (this .testBuilder );
556+ HtmlPage page = jenkins .createWebClient ().goTo ("job/test0/configure" );
557+ WebAssert .assertElementPresentByXPath (page , "//input[@name=\" _.strict\" ]" );
558+ }
559+
560+ /*
561+ * Test to verify Logging Level is present.
562+ */
563+
564+ @ Test
565+ public void verifyLoggingLevelPresent () throws Exception {
566+ this .buildWrapper .setMatlabBuildWrapperContent (new MatlabBuildWrapperContent (Message .getValue ("matlab.custom.location" ), getMatlabroot ("R2018b" )));
567+ project .getBuildWrappersList ().add (this .buildWrapper );
568+ project .getBuildersList ().add (this .testBuilder );
569+ HtmlPage page = jenkins .createWebClient ().goTo ("job/test0/configure" );
570+ WebAssert .assertElementPresentByXPath (page , "//select[@name=\" _.loggingLevel\" ]" );
571+ }
572+
573+ /*
574+ * Test to verify Output Detail is present.
575+ */
576+
577+ @ Test
578+ public void verifyOutputDetailPresent () throws Exception {
579+ this .buildWrapper .setMatlabBuildWrapperContent (new MatlabBuildWrapperContent (Message .getValue ("matlab.custom.location" ), getMatlabroot ("R2018b" )));
580+ project .getBuildWrappersList ().add (this .buildWrapper );
581+ project .getBuildersList ().add (this .testBuilder );
582+ HtmlPage page = jenkins .createWebClient ().goTo ("job/test0/configure" );
583+ WebAssert .assertElementPresentByXPath (page , "//select[@name=\" _.outputDetail\" ]" );
584+ }
585+
586+ /*
587+ * Test to verify Logging Level set to default
588+ */
589+
590+ @ Test
591+ public void verifyLoggingLevelSetToDefault () throws Exception {
592+ this .buildWrapper .setMatlabBuildWrapperContent (new MatlabBuildWrapperContent (Message .getValue ("matlab.custom.location" ), getMatlabroot ("R2018b" )));
593+ project .getBuildWrappersList ().add (this .buildWrapper );
594+ project .getBuildersList ().add (this .testBuilder );
595+ HtmlPage page = jenkins .createWebClient ().goTo ("job/test0/configure" );
596+ HtmlSelect loggingLevel = page .getElementByName ("_.loggingLevel" );
597+ assertEquals ("default" , loggingLevel .getAttribute ("value" ));
598+ }
599+
600+ /*
601+ * Test to verify Output Detail set to default
602+ */
603+
604+ @ Test
605+ public void verifyOutputDetailSetToDefault () throws Exception {
606+ this .buildWrapper .setMatlabBuildWrapperContent (new MatlabBuildWrapperContent (Message .getValue ("matlab.custom.location" ), getMatlabroot ("R2018b" )));
607+ project .getBuildWrappersList ().add (this .buildWrapper );
608+ project .getBuildersList ().add (this .testBuilder );
609+ HtmlPage page = jenkins .createWebClient ().goTo ("job/test0/configure" );
610+ HtmlSelect outputDetail = page .getElementByName ("_.outputDetail" );
611+ assertEquals ("default" , outputDetail .getAttribute ("value" ));
612+ }
613+
614+
615+ /*
616+ * @Integ
529617 * Test To verify if Logging level is set correctly
530618 *
531619 */
532620
533- @ Test
621+
534622 public void verifyLoggingLevelSet () throws Exception {
535623 this .buildWrapper .setMatlabBuildWrapperContent (new MatlabBuildWrapperContent (
536624 Message .getValue ("matlab.custom.location" ), getMatlabroot ("R2018b" )));
537625 project .getBuildWrappersList ().add (this .buildWrapper );
538- Map <String , String > logginggLevel = new HashMap <String , String >();
539- logginggLevel .put ("None" , "'LoggingLevel', 0" );
540- logginggLevel .put ("Terse" , "'LoggingLevel', 1" );
541- logginggLevel .put ("Concise" , "'LoggingLevel', 2" );
542- logginggLevel .put ("Detailed" , "'LoggingLevel', 3" );
543- logginggLevel .put ("Verbose" , "'LoggingLevel', 4" );
544- logginggLevel .forEach ((key , val ) -> {
626+ Map <String , String > loggingLevel = new HashMap <String , String >();
627+ loggingLevel .put ("None" , "'LoggingLevel', 0" );
628+ loggingLevel .put ("Terse" , "'LoggingLevel', 1" );
629+ loggingLevel .put ("Concise" , "'LoggingLevel', 2" );
630+ loggingLevel .put ("Detailed" , "'LoggingLevel', 3" );
631+ loggingLevel .put ("Verbose" , "'LoggingLevel', 4" );
632+ loggingLevel .forEach ((key , val ) -> {
545633 testBuilder .setLoggingLevel (key );
546634 project .getBuildersList ().add (this .testBuilder );
547635 FreeStyleBuild build ;
@@ -555,12 +643,12 @@ public void verifyLoggingLevelSet() throws Exception {
555643 });
556644 }
557645
558- /*
646+ /*@Integ
559647 * Test To verify if Output Detail is set correctly
560648 *
561649 */
562650
563- @ Test
651+
564652 public void verifyOutputDetailSet () throws Exception {
565653 this .buildWrapper .setMatlabBuildWrapperContent (new MatlabBuildWrapperContent (
566654 Message .getValue ("matlab.custom.location" ), getMatlabroot ("R2018b" )));
@@ -586,12 +674,12 @@ public void verifyOutputDetailSet() throws Exception {
586674 });
587675 }
588676
589- /*
677+ /*@Integ
590678 * Test To verify when Strict option set
591679 *
592680 */
593681
594- @ Test
682+
595683 public void verifyStrictSet () throws Exception {
596684 this .buildWrapper .setMatlabBuildWrapperContent (new MatlabBuildWrapperContent (
597685 Message .getValue ("matlab.custom.location" ), getMatlabroot ("R2018b" )));
@@ -604,12 +692,12 @@ public void verifyStrictSet() throws Exception {
604692
605693 }
606694
607- /*
695+ /*@Integ
608696 * Test To verify when Strict option not set
609697 *
610698 */
611699
612- @ Test
700+
613701 public void verifyStrictNotSet () throws Exception {
614702 this .buildWrapper .setMatlabBuildWrapperContent (new MatlabBuildWrapperContent (
615703 Message .getValue ("matlab.custom.location" ), getMatlabroot ("R2018b" )));
@@ -622,12 +710,12 @@ public void verifyStrictNotSet() throws Exception {
622710
623711 }
624712
625- /*
713+ /*@Integ
626714 * Test To verify when Run in Parallel option is set
627715 *
628716 */
629717
630- @ Test
718+
631719 public void verifyRunParallelSet () throws Exception {
632720 this .buildWrapper .setMatlabBuildWrapperContent (new MatlabBuildWrapperContent (
633721 Message .getValue ("matlab.custom.location" ), getMatlabroot ("R2018b" )));
@@ -639,12 +727,12 @@ public void verifyRunParallelSet() throws Exception {
639727 jenkins .assertLogContains ("runInParallel" , build );
640728 }
641729
642- /*
730+ /*@Integ
643731 * Test To verify when Run in Parallel option is set
644732 *
645733 */
646734
647- @ Test
735+
648736 public void verifyRunParallelNotSet () throws Exception {
649737 this .buildWrapper .setMatlabBuildWrapperContent (new MatlabBuildWrapperContent (
650738 Message .getValue ("matlab.custom.location" ), getMatlabroot ("R2018b" )));
0 commit comments