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

JUNIT parser breaks everything and does not find tests

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • coverage-plugin
    • None
    • Coverage Plugin 1.6.0

      I have the following configuration:

            recordCoverage(
                failOnError: false,
                ignoreParsingErrors: true,
                sourceCodeRetention: 'LAST_BUILD',
                sourceCodeEncoding: 'UTF-8',
                sourceDirectories: [[path: 'glob:**/src/main/java'],
                                    [path: 'glob:**/target/generated-sources/*']],
                tools: [
                    [parser: 'JACOCO', pattern: '**/target/site/jacoco-ut/jacoco.xml,**/target/site/jacoco-it/jacoco.xml'],
                    [parser: 'COBERTURA', pattern: '**/target/coverage-reports/cobertura-coverage.xml'],
                    [parser: 'JUNIT', pattern: '**/target/surefire-reports/TEST-*.xml,**/target/failsafe-reports/TEST-*.xml,**/target/karma-reports/TEST-*.xml']])

       In most cases this works will, but I have one project where at least surefire reports are available, but I get the following error:

      *11:47:06*  java.util.NoSuchElementException: No test cases found*11:47:06*  	at edu.hm.hafner.coverage.parser.JunitParser.parseReport(JunitParser.java:51)*11:47:06*  	at edu.hm.hafner.coverage.CoverageParser.parse(CoverageParser.java:75)*11:47:06*  	at io.jenkins.plugins.coverage.metrics.steps.CoverageReportScanner.processFile(CoverageReportScanner.java:60)*11:47:06*  	at io.jenkins.plugins.util.AgentFileVisitor.scanFiles(AgentFileVisitor.java:114)*11:47:06*  	at io.jenkins.plugins.util.AgentFileVisitor.invoke(AgentFileVisitor.java:93)*11:47:06*  	at io.jenkins.plugins.util.AgentFileVisitor.invoke(AgentFileVisitor.java:39)*11:47:06*  	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3578)*11:47:06*  	at hudson.remoting.UserRequest.perform(UserRequest.java:211)*11:47:06*  	at hudson.remoting.UserRequest.perform(UserRequest.java:54)*11:47:06*  	at hudson.remoting.Request$2.run(Request.java:377)*11:47:06*  	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)*11:47:06*  	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)*11:47:06*  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)*11:47:06*  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)*11:47:06*  	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:137)*11:47:06*  	at java.base/java.lang.Thread.run(Unknown Source)
      

       

      1. Its really bad that it breaks the whole build, especially as failOnError is false
      2. I have no clue why no tests are found, the files are available in the workspace and its working for other repositories
      3. The logging is not really helpful on doing further investigations

       

       

          [JENKINS-72449] JUNIT parser breaks everything and does not find tests

          Michael Düsterhus created issue -
          Ulli Hafner made changes -
          Remote Link New: This issue links to "duplicates #723 (Web Link)" [ 29211 ]
          Ulli Hafner made changes -
          Remote Link New: This issue links to "coverage-model#66 (Web Link)" [ 29429 ]
          Ulli Hafner made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Ulli Hafner made changes -
          Released As New: https://github.com/jenkinsci/coverage-plugin/releases/tag/v1.8.0
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]

            drulli Ulli Hafner
            reitzmichnicht Michael Düsterhus
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: