Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-6893

Fix flexmojos testing results reporting when running a maven2 build for flex projects

    • Icon: Patch Patch
    • Resolution: Fixed
    • Icon: Major Major
    • core, maven-plugin
    • None
    • maven2 + flexmojos > 3.5.0 + flex unit testing libraries

      When running flex related test cases in a maven2 build hudson will not retrieve the test results because it will only listen to surefire:test mojo. Flexmojos will behave similarly with surefire:test (put the results to target/surefire-results folder in the proper format) but Hudson will not pick the results after a build.

      One fix is to unconditionally run surefire:test on the project but in this way when the build fails the surefire:test mojos will not be run and the tests will not be picked up.

      This patch fixed the list of mojos observed by hudson for a maven build to treat flexmojos-maven-plugin:test-run mojo the same way it will treat a surefire:test mojo execution.

      The behaviour is the expected one:
      on a successfull build the test results are picked
      on a failed build the test results are picked too.

          [JENKINS-6893] Fix flexmojos testing results reporting when running a maven2 build for flex projects

          mtoader created issue -

          mtoader added a comment -

          Put the patch as an attachment.

          mtoader added a comment - Put the patch as an attachment.
          mtoader made changes -
          Attachment New: enable_test_results_collection_from_flexmojos_testing.patch [ 19552 ]
          Description Original: Index: src/main/java/hudson/maven/reporters/SurefireArchiver.java
          ===================================================================
          --- src/main/java/hudson/maven/reporters/SurefireArchiver.java (revision 32408)
          +++ src/main/java/hudson/maven/reporters/SurefireArchiver.java (working copy)
          @@ -135,6 +135,7 @@
           
               private boolean isSurefireTest(MojoInfo mojo) {
                   if ((!mojo.is("com.sun.maven", "maven-junit-plugin", "test"))
          + && (!mojo.is("org.sonatype.flexmojos", "flexmojos-maven-plugin", "test-run"))
                       && (!mojo.is("org.apache.maven.plugins", "maven-surefire-plugin", "test")))
                       return false;
           
          @@ -168,6 +169,13 @@
                               return false;
                           }
                       }
          + else if (mojo.is("org.sonatype.flexmojos", "flexmojos-maven-plugin", "test-run")) {
          + Boolean skipTests = mojo.getConfigurationValue("skipTest", Boolean.class);
          +
          + if (((skipTests != null) && (skipTests))) {
          + return false;
          + }
          + }
           
                   } catch (ComponentConfigurationException e) {
                       return false;
          New: When running flex related test cases in a maven2 build hudson will not retrieve the test results because it will only listen to surefire:test mojo. Flexmojos will behave similarly with surefire:test (put the results to target/surefire-results folder in the proper format) but Hudson will not pick the results after a build.

          One fix is to unconditionally run surefire:test on the project but in this way when the build fails the surefire:test mojos will not be run and the tests will not be picked up.

          This patch fixed the list of mojos obeserved by hudson for a maven build to treat flexmojos-maven-plugin:test-run mojo the same way it will treat a surefire:test mojo execution.

          The behaviour is the expected one:
            on a successfull build the test results are picked
            on a failed build the test results are picked too.

          mtoader made changes -
          Description Original: When running flex related test cases in a maven2 build hudson will not retrieve the test results because it will only listen to surefire:test mojo. Flexmojos will behave similarly with surefire:test (put the results to target/surefire-results folder in the proper format) but Hudson will not pick the results after a build.

          One fix is to unconditionally run surefire:test on the project but in this way when the build fails the surefire:test mojos will not be run and the tests will not be picked up.

          This patch fixed the list of mojos obeserved by hudson for a maven build to treat flexmojos-maven-plugin:test-run mojo the same way it will treat a surefire:test mojo execution.

          The behaviour is the expected one:
            on a successfull build the test results are picked
            on a failed build the test results are picked too.

          New: When running flex related test cases in a maven2 build hudson will not retrieve the test results because it will only listen to surefire:test mojo. Flexmojos will behave similarly with surefire:test (put the results to target/surefire-results folder in the proper format) but Hudson will not pick the results after a build.

          One fix is to unconditionally run surefire:test on the project but in this way when the build fails the surefire:test mojos will not be run and the tests will not be picked up.

          This patch fixed the list of mojos observed by hudson for a maven build to treat flexmojos-maven-plugin:test-run mojo the same way it will treat a surefire:test mojo execution.

          The behaviour is the expected one:
            on a successfull build the test results are picked
            on a failed build the test results are picked too.

          neiltingley added a comment -

          you can frig it by adding surefire:test to the maven goals. But it would be great to see this fixed.

          neiltingley added a comment - you can frig it by adding surefire:test to the maven goals. But it would be great to see this fixed.

          mtoader added a comment -

          Yes but it's half of the solution.

          If you add surefire:test to the maven goals you will get the tests recorded on successful builds.
          If on the other hand the build failed because the tests failed you won't see any test results.
          You can tell the flex mojos to ignore failed tests but in this way hudson will not know that the build failed .

          Also if you are building a multimodule maven project mixing java and flex modules and you put clean install surefire:test as the maven goals you will get duplicated java test results.

          The patch attached will fix this properly (aka. allow hudson to register when flexmojos tests have failed). I wish it would be included sooner so i can skip using the patched module on my machine .

          mtoader added a comment - Yes but it's half of the solution. If you add surefire:test to the maven goals you will get the tests recorded on successful builds. If on the other hand the build failed because the tests failed you won't see any test results. You can tell the flex mojos to ignore failed tests but in this way hudson will not know that the build failed . Also if you are building a multimodule maven project mixing java and flex modules and you put clean install surefire:test as the maven goals you will get duplicated java test results. The patch attached will fix this properly (aka. allow hudson to register when flexmojos tests have failed). I wish it would be included sooner so i can skip using the patched module on my machine .

          neiltingley added a comment -

          can someone shout if the patch gets released ? Otherwise I could patch our hudson if I get some time.

          neiltingley added a comment - can someone shout if the patch gets released ? Otherwise I could patch our hudson if I get some time.

          mtoader added a comment -

          I have patched my hudson instance right now and it works beautifully but it's a drag to have to rebuild the plugin every time hudson does a release. I also don't have any idea how to push this into the main build right now .

          mtoader added a comment - I have patched my hudson instance right now and it works beautifully but it's a drag to have to rebuild the plugin every time hudson does a release. I also don't have any idea how to push this into the main build right now .
          mtoader made changes -
          Component/s New: core [ 15593 ]

          neiltingley added a comment - - edited

          I patched the source, rebuilt maven-plugin and deployed the hpi. Do I need to do anything else ? Not seeing hudson recording the test results.

          neiltingley added a comment - - edited I patched the source, rebuilt maven-plugin and deployed the hpi. Do I need to do anything else ? Not seeing hudson recording the test results.

            mtoader mtoader
            mtoader mtoader
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: