-
Notifications
You must be signed in to change notification settings - Fork 345
Issue #237 parse flakyFailure and rerunFailure from surefire report files #765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
timja
merged 9 commits into
jenkinsci:master
from
olamy:gh-237-parse-flakyFailure-and-rerunFailure
Nov 23, 2025
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
710aafd
fix this test
olamy d0887a5
Issue #237 parse flakyFailure and rerunFailure
olamy 2705286
use List but returns null rather than empty list
olamy b3566a3
Collections.unmodifiableList only for getters
olamy a5c266c
do not return null
olamy 89dbd72
fix some missing parsing
olamy dca551b
remove commented code
olamy 0a33e5e
back to record as this was not the problem
olamy f58164a
simplify code
olamy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package hudson.tasks.junit; | ||
|
|
||
| import java.io.Serializable; | ||
|
|
||
| public record FlakyFailure(String message, String type, String stackTrace, String stdout, String stderr) | ||
| implements Serializable {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package hudson.tasks.junit; | ||
|
|
||
| import java.io.Serializable; | ||
|
|
||
| public record RerunFailure(String message, String type, String stackTrace, String stdout, String stderr) | ||
| implements Serializable {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
188 changes: 188 additions & 0 deletions
188
src/test/resources/hudson/tasks/junit/gh-237/TEST-io.olamy.AlwaysFailTest.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,188 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" version="3.0.2" name="io.olamy.AlwaysFailTest" time="0.002" tests="4" errors="0" skipped="0" failures="4"> | ||
| <properties> | ||
| <property name="java.specification.version" value="17"/> | ||
| <property name="sun.jnu.encoding" value="UTF-8"/> | ||
| <property name="java.class.path" value="/home/olamy/test/test-junit/target/test-classes:/home/olamy/test/test-junit/target/classes:/home/olamy/.m2/repository/junit/junit/4.12/junit-4.12.jar:/home/olamy/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:"/> | ||
| <property name="java.vm.vendor" value="Eclipse Adoptium"/> | ||
| <property name="sun.arch.data.model" value="64"/> | ||
| <property name="java.vendor.url" value="https://adoptium.net/"/> | ||
| <property name="os.name" value="Linux"/> | ||
| <property name="java.vm.specification.version" value="17"/> | ||
| <property name="sun.java.launcher" value="SUN_STANDARD"/> | ||
| <property name="user.country" value="AU"/> | ||
| <property name="sun.boot.library.path" value="/home/olamy/.sdkman/candidates/java/17.0.11-tem/lib"/> | ||
| <property name="sun.java.command" value="/home/olamy/test/test-junit/target/surefire/surefirebooter-20251117145123698_3.jar /home/olamy/test/test-junit/target/surefire 2025-11-17T14-51-23_625-jvmRun1 surefire-20251117145123698_1tmp surefire_0-20251117145123698_2tmp"/> | ||
| <property name="jdk.debug" value="release"/> | ||
| <property name="surefire.test.class.path" value="/home/olamy/test/test-junit/target/test-classes:/home/olamy/test/test-junit/target/classes:/home/olamy/.m2/repository/junit/junit/4.12/junit-4.12.jar:/home/olamy/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:"/> | ||
| <property name="sun.cpu.endian" value="little"/> | ||
| <property name="user.home" value="/home/olamy"/> | ||
| <property name="user.language" value="en"/> | ||
| <property name="java.specification.vendor" value="Oracle Corporation"/> | ||
| <property name="java.version.date" value="2024-04-16"/> | ||
| <property name="java.home" value="/home/olamy/.sdkman/candidates/java/17.0.11-tem"/> | ||
| <property name="file.separator" value="/"/> | ||
| <property name="basedir" value="/home/olamy/test/test-junit"/> | ||
| <property name="java.vm.compressedOopsMode" value="Zero based"/> | ||
| <property name="line.separator" value=" "/> | ||
| <property name="java.vm.specification.vendor" value="Oracle Corporation"/> | ||
| <property name="java.specification.name" value="Java Platform API Specification"/> | ||
| <property name="surefire.real.class.path" value="/home/olamy/test/test-junit/target/surefire/surefirebooter-20251117145123698_3.jar"/> | ||
| <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> | ||
| <property name="java.runtime.version" value="17.0.11+9"/> | ||
| <property name="user.name" value="olamy"/> | ||
| <property name="path.separator" value=":"/> | ||
| <property name="os.version" value="6.16.3-76061603-generic"/> | ||
| <property name="java.runtime.name" value="OpenJDK Runtime Environment"/> | ||
| <property name="file.encoding" value="UTF-8"/> | ||
| <property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/> | ||
| <property name="java.vendor.version" value="Temurin-17.0.11+9"/> | ||
| <property name="localRepository" value="/home/olamy/.m2/repository"/> | ||
| <property name="java.vendor.url.bug" value="https://github.com/adoptium/adoptium-support/issues"/> | ||
| <property name="java.io.tmpdir" value="/tmp"/> | ||
| <property name="java.version" value="17.0.11"/> | ||
| <property name="surefire.rerunFailingTestsCount" value="3"/> | ||
| <property name="user.dir" value="/home/olamy/test/test-junit"/> | ||
| <property name="os.arch" value="amd64"/> | ||
| <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> | ||
| <property name="native.encoding" value="UTF-8"/> | ||
| <property name="java.library.path" value="/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib"/> | ||
| <property name="java.vm.info" value="mixed mode, sharing"/> | ||
| <property name="java.vendor" value="Eclipse Adoptium"/> | ||
| <property name="java.vm.version" value="17.0.11+9"/> | ||
| <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> | ||
| <property name="java.class.version" value="61.0"/> | ||
| </properties> | ||
| <testcase name="testApp" classname="io.olamy.AlwaysFailTest" time="0.001"> | ||
| <failure message="built to fail" type="junit.framework.AssertionFailedError"><![CDATA[junit.framework.AssertionFailedError: built to fail | ||
| at junit.framework.Assert.fail(Assert.java:57) | ||
| at junit.framework.Assert.assertTrue(Assert.java:22) | ||
| at junit.framework.TestCase.assertTrue(TestCase.java:192) | ||
| at io.olamy.AlwaysFailTest.testApp(AlwaysFailTest.java:23) | ||
| at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | ||
| at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) | ||
| at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | ||
| at java.base/java.lang.reflect.Method.invoke(Method.java:568) | ||
| at junit.framework.TestCase.runTest(TestCase.java:176) | ||
| at junit.framework.TestCase.runBare(TestCase.java:141) | ||
| at junit.framework.TestResult$1.protect(TestResult.java:122) | ||
| at junit.framework.TestResult.runProtected(TestResult.java:142) | ||
| at junit.framework.TestResult.run(TestResult.java:125) | ||
| at junit.framework.TestCase.run(TestCase.java:129) | ||
| at junit.framework.TestSuite.runTest(TestSuite.java:252) | ||
| at junit.framework.TestSuite.run(TestSuite.java:247) | ||
| at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:316) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:240) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495) | ||
| ]]></failure> | ||
| <system-out><![CDATA[this will fail for real | ||
| ]]></system-out> | ||
| <system-err><![CDATA[this will really fail | ||
| ]]></system-err> | ||
| <rerunFailure message="built to fail" type="junit.framework.AssertionFailedError"> | ||
| <stackTrace><![CDATA[junit.framework.AssertionFailedError: built to fail | ||
| at junit.framework.Assert.fail(Assert.java:57) | ||
| at junit.framework.Assert.assertTrue(Assert.java:22) | ||
| at junit.framework.TestCase.assertTrue(TestCase.java:192) | ||
| at io.olamy.AlwaysFailTest.testApp(AlwaysFailTest.java:23) | ||
| at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | ||
| at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) | ||
| at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | ||
| at java.base/java.lang.reflect.Method.invoke(Method.java:568) | ||
| at junit.framework.TestCase.runTest(TestCase.java:176) | ||
| at junit.framework.TestCase.runBare(TestCase.java:141) | ||
| at junit.framework.TestResult$1.protect(TestResult.java:122) | ||
| at junit.framework.TestResult.runProtected(TestResult.java:142) | ||
| at junit.framework.TestResult.run(TestResult.java:125) | ||
| at junit.framework.TestCase.run(TestCase.java:129) | ||
| at junit.framework.TestSuite.runTest(TestSuite.java:252) | ||
| at junit.framework.TestSuite.run(TestSuite.java:247) | ||
| at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:316) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:257) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495) | ||
| ]]></stackTrace> | ||
| <system-out><![CDATA[this will fail for real | ||
| ]]></system-out> | ||
| <system-err><![CDATA[this will really fail | ||
| ]]></system-err> | ||
| </rerunFailure> | ||
| <rerunFailure message="built to fail" type="junit.framework.AssertionFailedError"> | ||
| <stackTrace><![CDATA[junit.framework.AssertionFailedError: built to fail | ||
| at junit.framework.Assert.fail(Assert.java:57) | ||
| at junit.framework.Assert.assertTrue(Assert.java:22) | ||
| at junit.framework.TestCase.assertTrue(TestCase.java:192) | ||
| at io.olamy.AlwaysFailTest.testApp(AlwaysFailTest.java:23) | ||
| at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | ||
| at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) | ||
| at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | ||
| at java.base/java.lang.reflect.Method.invoke(Method.java:568) | ||
| at junit.framework.TestCase.runTest(TestCase.java:176) | ||
| at junit.framework.TestCase.runBare(TestCase.java:141) | ||
| at junit.framework.TestResult$1.protect(TestResult.java:122) | ||
| at junit.framework.TestResult.runProtected(TestResult.java:142) | ||
| at junit.framework.TestResult.run(TestResult.java:125) | ||
| at junit.framework.TestCase.run(TestCase.java:129) | ||
| at junit.framework.TestSuite.runTest(TestSuite.java:252) | ||
| at junit.framework.TestSuite.run(TestSuite.java:247) | ||
| at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:316) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:257) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495) | ||
| ]]></stackTrace> | ||
| <system-out><![CDATA[this will fail for real | ||
| ]]></system-out> | ||
| <system-err><![CDATA[this will really fail | ||
| ]]></system-err> | ||
| </rerunFailure> | ||
| <rerunFailure message="built to fail" type="junit.framework.AssertionFailedError"> | ||
| <stackTrace><![CDATA[junit.framework.AssertionFailedError: built to fail | ||
| at junit.framework.Assert.fail(Assert.java:57) | ||
| at junit.framework.Assert.assertTrue(Assert.java:22) | ||
| at junit.framework.TestCase.assertTrue(TestCase.java:192) | ||
| at io.olamy.AlwaysFailTest.testApp(AlwaysFailTest.java:23) | ||
| at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | ||
| at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) | ||
| at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | ||
| at java.base/java.lang.reflect.Method.invoke(Method.java:568) | ||
| at junit.framework.TestCase.runTest(TestCase.java:176) | ||
| at junit.framework.TestCase.runBare(TestCase.java:141) | ||
| at junit.framework.TestResult$1.protect(TestResult.java:122) | ||
| at junit.framework.TestResult.runProtected(TestResult.java:142) | ||
| at junit.framework.TestResult.run(TestResult.java:125) | ||
| at junit.framework.TestCase.run(TestCase.java:129) | ||
| at junit.framework.TestSuite.runTest(TestSuite.java:252) | ||
| at junit.framework.TestSuite.run(TestSuite.java:247) | ||
| at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:316) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:257) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214) | ||
| at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507) | ||
| at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495) | ||
| ]]></stackTrace> | ||
| <system-out><![CDATA[this will fail for real | ||
| ]]></system-out> | ||
| <system-err><![CDATA[this will really fail | ||
| ]]></system-err> | ||
| </rerunFailure> | ||
| </testcase> | ||
| </testsuite> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
@CheckForNullis not required now.I wonder, why the field itself still is nullable? All those ugly
if (x != null)guards could be eliminated by working with an empty collection. You can add a readResolve method to ensure that the field is set in old serializations.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because this
so it looks parsing files needs to be done with
XMLStreamReaderas well,Hopefully I don't have to do with SAX.. (at least I hope :))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting test, it is totally unclear what the test is doing. Would be helpful when the variables would use meaningful names...
Without using XmlUnit it is hard too see what is wrong in the document.