• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • maven-plugin
    • Platform: All, OS: All

      Using the Maven job type, if the surefire results are run twice (eg clean
      package site) the test results are counted twice.

      If we use the same pom for a freestyle project, the results are shown correctly.

          [JENKINS-2068] Junit test showing twice

          John McNair added a comment -

          Here is an example with the workaround. In Hudson, this correctly reports two total tests. To expose the issue, comment out the two reportsDirectory lines. This will cause Hudson to report three total tests.

          John McNair added a comment - Here is an example with the workaround. In Hudson, this correctly reports two total tests. To expose the issue, comment out the two reportsDirectory lines. This will cause Hudson to report three total tests.

          John McNair added a comment -

          Reopening because there are really two separate issues.

          I posted a workaround, but it still seems less than ideal for this not to just work, especially given the level of integration between Hudson and Maven. Is there any way Hudson could be changed to handle this automatically?

          John McNair added a comment - Reopening because there are really two separate issues. I posted a workaround, but it still seems less than ideal for this not to just work, especially given the level of integration between Hudson and Maven. Is there any way Hudson could be changed to handle this automatically?

          jieryn added a comment -

          You're invoking Maven in an improper way. It is unreasonable and unnecessary to expect Hudson to compensate for your bad judgement. Please correct your build and close the defect.

          jieryn added a comment - You're invoking Maven in an improper way. It is unreasonable and unnecessary to expect Hudson to compensate for your bad judgement. Please correct your build and close the defect.

          rogerdpack added a comment -

          Unfortunately it seems hard to (currently) avoid running unit tests twice.
          If you have to have the following goals:

          deploy cobertura:cobertura

          then each will run the unit tests twice, and you can only configure it to run tests 0 times (-Dmaven.test.skip) or twice (the default) so I'm thinking something's gotta give. Is there a way to set this up properly? (I for one, would love to not have to run those unit tests twice, but am at a loss as to how to setup maven propertly).

          rogerdpack added a comment - Unfortunately it seems hard to (currently) avoid running unit tests twice. If you have to have the following goals: deploy cobertura:cobertura then each will run the unit tests twice, and you can only configure it to run tests 0 times (-Dmaven.test.skip) or twice (the default) so I'm thinking something's gotta give. Is there a way to set this up properly? (I for one, would love to not have to run those unit tests twice, but am at a loss as to how to setup maven propertly).

          Junit test are not run twice, it is when you give Jenkins or Hudson the path where find tests reports! And in this directory you have the rapport of each test and the summary raport test. And if example you give Myproject/tests-reports/*.xml, jenkins retrieve all files and thus you have informations twice. Therefore, give the summary file or others files!

          Moustapha

          Moustapha SENE added a comment - Junit test are not run twice, it is when you give Jenkins or Hudson the path where find tests reports! And in this directory you have the rapport of each test and the summary raport test. And if example you give Myproject/tests-reports/*.xml, jenkins retrieve all files and thus you have informations twice. Therefore, give the summary file or others files! Moustapha

          David Corbin added a comment -

          I ran into this one too. The workaround described by John McNair (30/Jan/10 11:36 PM) worked great. While I think this problem is reflective of bad design in Maven, I think Jenkins maven support should work around the bad design.

          David Corbin added a comment - I ran into this one too. The workaround described by John McNair (30/Jan/10 11:36 PM) worked great. While I think this problem is reflective of bad design in Maven, I think Jenkins maven support should work around the bad design.

          Chris Graham added a comment -

          The point of this issue, was that calling the same job, the same way (eg: mvn clean package site) produced DIFFERENT results displayed in Hudson.
          The differences were observed then the same project, called the same way, was called either via a 'Free Style' or 'Maven2' job type.
          So, @jieryn, is it not a bad or improper usage of maven, as the same goals are being executed for both job types.

          So it is either a bug in the way that the reports are processed, or the way in that the Maven2 jobs are executed within hudson, given the same execution criteria.

          I would hope that calling 'mvn clean package site' would be executed the same way, irrespective of the job type.

          Chris Graham added a comment - The point of this issue, was that calling the same job, the same way (eg: mvn clean package site) produced DIFFERENT results displayed in Hudson. The differences were observed then the same project, called the same way, was called either via a 'Free Style' or 'Maven2' job type. So, @jieryn, is it not a bad or improper usage of maven, as the same goals are being executed for both job types. So it is either a bug in the way that the reports are processed, or the way in that the Maven2 jobs are executed within hudson, given the same execution criteria. I would hope that calling 'mvn clean package site' would be executed the same way, irrespective of the job type.

          Magesh Sankar added a comment -

          I am experiencing the double count of junit tests after upgrading the plugin from 2.12.1 to 2.13. Any thoughts?

          It works well after I downgraded the plugin to 2.12.1.

          Current Jenkins version: 1.658

          Magesh Sankar added a comment - I am experiencing the double count of junit tests after upgrading the plugin from 2.12.1 to 2.13. Any thoughts? It works well after I downgraded the plugin to 2.12.1. Current Jenkins version: 1.658

          liyatikal added a comment - - edited

          Still have this issue - Jenkins 2.162.1, JUnit plugin 1.27

          Any updates?

          The pattern for tests are defined output/**/test_results.xml

          I've created the separated bug for it since these are not maven tests and it is definitely problem in JUnit plugin https://issues.jenkins-ci.org/browse/JENKINS-56623

          liyatikal added a comment - - edited Still have this issue - Jenkins 2.162.1, JUnit plugin 1.27 Any updates? The pattern for tests are defined output/**/test_results.xml I've created the separated bug for it since these are not maven tests and it is definitely problem in JUnit plugin  https://issues.jenkins-ci.org/browse/JENKINS-56623

          Stanislav Bashkyrtsev added a comment - - edited

          People keep blaming either Maven or say that there's a misconfiguration, which is not true. So let me sum up.

          Steps to reproduce

          • Create 2 executions in Maven, you can skip the 2nd one so that only 1 is run.
          • Create a Pipeline that runs mvn test
          • Notice that Maven runs tests once and reports them once.

          Actual Result: Jenkins JUnit plugin reports tests running twice.

          If you do the same in Freestyle job - it reports tests once.

          Stanislav Bashkyrtsev added a comment - - edited People keep blaming either Maven or say that there's a misconfiguration, which is not true. So let me sum up. Steps to reproduce Create 2 executions in Maven, you can skip the 2nd one so that only 1 is run. Create a Pipeline that runs mvn test Notice that Maven runs tests once and reports them once . Actual Result : Jenkins JUnit plugin reports tests running twice. If you do the same in Freestyle job - it reports tests once.

            Unassigned Unassigned
            chrisgwarp Chris Graham
            Votes:
            28 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated: