JUNIT parser breaks everything and does not find tests

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major
    • Component/s: coverage-plugin
    • None
    • Environment:
      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

       

       

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

              Created:
              Updated:
              Resolved: