jenkinsci / jenkinsci/junit-plugin

[JENKINS-15380] No history for test cases where name of suite is part of test case name

Open
#929 12 comments 0 reactions 0 assignees View on GitHub
component:junit-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
87
Forks
351
Avg merge
1d 19h
Merged PRs (30d)
2

Description

If the name of test suite (e.g. "aaaa") is part of the test case name (e.g. "tc_aaaa"), Jenkins is unable to display history of this test case and throws an exeption:

Oct 2, 2012 5:06:15 PM hudson.ExpressionFactory2$JexlExpression evaluate

WARNING: Caught exception evaluating: it.getResultInBuild(b). Reason: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

java.lang.StringIndexOutOfBoundsException: String index out of range: -1

at java.lang.String.substring(Unknown Source)

at java.lang.String.substring(Unknown Source)

at hudson.tasks.junit.ClassResult.findCorrespondingResult(ClassResult.java:86)

at hudson.tasks.junit.PackageResult.findCorrespondingResult(PackageResult.java:102)

at hudson.tasks.junit.TestResult.findCorrespondingResult(TestResult.java:295)

at hudson.tasks.test.AbstractTestResultAction.findCorrespondingResult(AbstractTestResultAction.java:183)

at hudson.tasks.test.TestResult.getResultInBuild(TestResult.java:162)

(full log can be found in attachment log.txt)

I´ve attached the test results file (junit.xml) with which this behavior can be reproduced.

---
Originally reported by hjhafner, imported from: No history for test cases where name of suite is part of test case name


  • assignee: thesam
  • status: Reopened
  • priority: Major
  • component(s): junit-plugin
  • label(s): 1.509.4-rejected
  • resolution: Unresolved
  • votes: 2
  • watchers: 8
  • imported: 2025-11-26

Raw content of original issue

If the name of test suite (e.g. "aaaa") is part of the test case name (e.g. "tc_aaaa"), Jenkins is unable to display history of this test case and throws an exeption:

Oct 2, 2012 5:06:15 PM hudson.ExpressionFactory2$JexlExpression evaluate
WARNING: Caught exception evaluating: it.getResultInBuild(b). Reason: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at java.lang.String.substring(Unknown Source)
at hudson.tasks.junit.ClassResult.findCorrespondingResult(ClassResult.java:86)
at hudson.tasks.junit.PackageResult.findCorrespondingResult(PackageResult.java:102)
at hudson.tasks.junit.TestResult.findCorrespondingResult(TestResult.java:295)
at hudson.tasks.test.AbstractTestResultAction.findCorrespondingResult(AbstractTestResultAction.java:183)
at hudson.tasks.test.TestResult.getResultInBuild(TestResult.java:162)

(full log can be found in attachment log.txt)

I´ve attached the test results file (junit.xml) with which this behavior can be reproduced.

  • environment: Jenkins 1.484

7 attachments

- [junit.xml](https://issues.jenkins.io/secure/attachment/22604/junit.xml)
- [junit2.xml](https://issues.jenkins.io/secure/attachment/24535/junit2.xml)
- [junit3.xml](https://issues.jenkins.io/secure/attachment/24536/junit3.xml)
- [log.txt](https://issues.jenkins.io/secure/attachment/22605/log.txt)
- [tc_aaaa.jpg](https://issues.jenkins.io/secure/attachment/22606/tc_aaaa.jpg)
> ![tc_aaaa.jpg](https://issues.jenkins.io/secure/attachment/22606/tc_aaaa.jpg)
- [tc_bbbb.jpg](https://issues.jenkins.io/secure/attachment/22608/tc_bbbb.jpg)
> ![tc_bbbb.jpg](https://issues.jenkins.io/secure/attachment/22608/tc_bbbb.jpg)
- [tc_xaaaax.jpg](https://issues.jenkins.io/secure/attachment/22607/tc_xaaaax.jpg)
> ![tc_xaaaax.jpg](https://issues.jenkins.io/secure/attachment/22607/tc_xaaaax.jpg)

Contributor guide

Open the contributing guide

Research direction

Start in hudson.tasks.junit.ClassResult.findCorrespondingResult, reported at ClassResult.java:86, and reproduce the failure with the attached junit.xml or junit2.xml inputs. Trace the corresponding-result lookup for a suite name embedded in a test-case name; done means the test history displays without StringIndexOutOfBoundsException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.