Skip to content

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

Closed

Description

@jenkins-infra-bot

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

 

 


Originally reported by reitzmichnicht, imported from: JUNIT parser breaks everything and does not find tests
  • assignee: drulli
  • status: Resolved
  • priority: Major
  • component(s): coverage-plugin
  • resolution: Fixed
  • resolved: 2024-01-12T13:10:37+00:00
  • votes: 0
  • watchers: 1
  • imported: 20260107-220949
Raw content of original issue

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

 

 

  • environment: Coverage Plugin 1.6.0

Activity

  1. jenkins-infra-bot commented on Dec 21, 2023

    @jenkins-infra-bot
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions