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

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

    Details

    • Type: Patch
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Component/s: core, maven-plugin
    • Labels:
      None
    • Environment:
      maven2 + flexmojos > 3.5.0 + flex unit testing libraries
    • Similar Issues:
      Show 5 results

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            mtoader mtoader added a comment -

            Put the patch as an attachment.

            Show
            mtoader mtoader added a comment - Put the patch as an attachment.
            Hide
            neiltingley 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.

            Show
            neiltingley 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.
            Hide
            mtoader 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 .

            Show
            mtoader 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 .
            Hide
            neiltingley neiltingley added a comment -

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

            Show
            neiltingley neiltingley added a comment - can someone shout if the patch gets released ? Otherwise I could patch our hudson if I get some time.
            Hide
            mtoader 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 .

            Show
            mtoader 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 .
            Hide
            neiltingley 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.

            Show
            neiltingley 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.
            Hide
            mtoader mtoader added a comment -

            Make sure the maven plugin that hudson is using is yours.
            Look in the manage hudson/plugins page that your version of the plugin is similar to this: "1.367-SNAPSHOT (private-07/20/2010 02:53-mtoader)". If not then hudson is not using your build. You should have pinned your version of the plugin. For example in the folder /var/lib/hudson/plugins that i am using for the installation i have a file name maven-plugin.hpi.pinned and the maven-plugin.hpi is the actual output of the build from the patched source.

            In order for it to work you have to have a maven + flexmojos enabled project and you have to run the tests using the flex mojos plugin (this should work by default if the project is swc/swf type and the flexmojos plugin is running the show). You can also check your flex module build page and look at the executed mojos link and see if it looks something like this:

            org.apache.maven.plugins:maven-clean-plugin 2.2 clean default-clean 12 ms
            org.apache.maven.plugins:maven-resources-plugin 2.3 resources default-resources 2 ms
            org.sonatype.flexmojos:flexmojos-maven-plugin 3.7.1 compile-swc default-compile-swc 7.9 sec
            org.apache.maven.plugins:maven-resources-plugin 2.3 testResources default-testResources 65 ms
            org.sonatype.flexmojos:flexmojos-maven-plugin 3.7.1 test-compile default-test-compile 5.8 sec
            org.sonatype.flexmojos:flexmojos-maven-plugin 3.7.1 test-run default-test-run 12 sec
            org.apache.maven.plugins:maven-install-plugin 2.2 install default-install 94 ms

            you want to have this line in there:

            org.sonatype.flexmojos:flexmojos-maven-plugin 3.7.1 test-run default-test-run 12 sec

            If all this is working it should work.

            Show
            mtoader mtoader added a comment - Make sure the maven plugin that hudson is using is yours. Look in the manage hudson/plugins page that your version of the plugin is similar to this: "1.367-SNAPSHOT (private-07/20/2010 02:53-mtoader)". If not then hudson is not using your build. You should have pinned your version of the plugin. For example in the folder /var/lib/hudson/plugins that i am using for the installation i have a file name maven-plugin.hpi.pinned and the maven-plugin.hpi is the actual output of the build from the patched source. In order for it to work you have to have a maven + flexmojos enabled project and you have to run the tests using the flex mojos plugin (this should work by default if the project is swc/swf type and the flexmojos plugin is running the show). You can also check your flex module build page and look at the executed mojos link and see if it looks something like this: org.apache.maven.plugins:maven-clean-plugin 2.2 clean default-clean 12 ms org.apache.maven.plugins:maven-resources-plugin 2.3 resources default-resources 2 ms org.sonatype.flexmojos:flexmojos-maven-plugin 3.7.1 compile-swc default-compile-swc 7.9 sec org.apache.maven.plugins:maven-resources-plugin 2.3 testResources default-testResources 65 ms org.sonatype.flexmojos:flexmojos-maven-plugin 3.7.1 test-compile default-test-compile 5.8 sec org.sonatype.flexmojos:flexmojos-maven-plugin 3.7.1 test-run default-test-run 12 sec org.apache.maven.plugins:maven-install-plugin 2.2 install default-install 94 ms you want to have this line in there: org.sonatype.flexmojos:flexmojos-maven-plugin 3.7.1 test-run default-test-run 12 sec If all this is working it should work.
            Hide
            neiltingley neiltingley added a comment -

            Thanks. pinning the plugin worked!

            This is new to me so I will read up on it. I'd just uploaded the plugin previously, getting something wrong somewhere in the process.

            Show
            neiltingley neiltingley added a comment - Thanks. pinning the plugin worked! This is new to me so I will read up on it. I'd just uploaded the plugin previously, getting something wrong somewhere in the process.
            Hide
            mtoader mtoader added a comment -

            I'm glad it works.

            pinning is the way hudson will allow you to override "core" plugins.

            Show
            mtoader mtoader added a comment - I'm glad it works. pinning is the way hudson will allow you to override "core" plugins.
            Hide
            neiltingley neiltingley added a comment -

            Is this fix being released anytime soon. It works for me.

            Show
            neiltingley neiltingley added a comment - Is this fix being released anytime soon. It works for me.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in hudson
            User: : kohsuke
            Path:
            trunk/hudson/main/maven-plugin/src/main/java/hudson/maven/reporters/SurefireArchiver.java
            trunk/www/changelog.html
            http://jenkins-ci.org/commit/34029
            Log:
            [FIXED JENKINS-6893] integrated toward 1.373.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : kohsuke Path: trunk/hudson/main/maven-plugin/src/main/java/hudson/maven/reporters/SurefireArchiver.java trunk/www/changelog.html http://jenkins-ci.org/commit/34029 Log: [FIXED JENKINS-6893] integrated toward 1.373.
            Hide
            dogfood dogfood added a comment -

            Integrated in hudson_main_trunk #203
            [FIXED JENKINS-6893] integrated toward 1.373.

            kohsuke :
            Files :

            • /trunk/hudson/main/maven-plugin/src/main/java/hudson/maven/reporters/SurefireArchiver.java
            • /trunk/www/changelog.html
            Show
            dogfood dogfood added a comment - Integrated in hudson_main_trunk #203 [FIXED JENKINS-6893] integrated toward 1.373. kohsuke : Files : /trunk/hudson/main/maven-plugin/src/main/java/hudson/maven/reporters/SurefireArchiver.java /trunk/www/changelog.html
            Hide
            neiltingley neiltingley added a comment -

            Thanks guys.

            Show
            neiltingley neiltingley added a comment - Thanks guys.
            Hide
            adrianp Adrian Price added a comment -

            See linked JENKINS-31258 for a generalised solution for any unknown test-capable Maven plug-in.

            Show
            adrianp Adrian Price added a comment - See linked JENKINS-31258 for a generalised solution for any unknown test-capable Maven plug-in.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: