-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add flakes to the failsafe-summary.xml. Fix a bug in the equals metho… #1
base: master
Are you sure you want to change the base?
Conversation
…d for RunResult where it did not account for the flakes field.
} | ||
|
||
@Test | ||
public void testLegacyDeserialization() throws Exception { |
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.
I added this test to check for backwards compatibility. It ensures that failsafe-summary.xml files produced by older versions of the plugin (i.e without the flakes field) can still be read into memory. In these cases, we simply set flakes to 0.
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.
Love your work.
s/include a/add an optional/ Please note that both |
@@ -84,12 +85,14 @@ public static RunResult toRunResult(File failsafeSummaryXml) throws Exception { | |||
String skipped = xpath.evaluate("/failsafe-summary/skipped", root); | |||
String failureMessage = xpath.evaluate("/failsafe-summary/failureMessage", root); | |||
String timeout = xpath.evaluate("/failsafe-summary/@timeout", root); | |||
String flakes = xpath.evaluate("/failsafe-summary/flakes", root); |
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.
Probably not a problem:
What happens when you don't put flakes in the xml string? Does this fail well?
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.
Yeah; this function doesn't throw when the field isn't present. It will just return a blank string (and I'm handling that case in the linked line of code). We'll set flakes = 0 when the flakes XML element isn't present.
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.
Looks good
: 1 ; udiff /tmp/old.xml /tmp/new.xml
--- /tmp/old.xml 2024-10-10 14:04:00
+++ /tmp/new.xml 2024-10-10 14:04:02
@@ -8,6 +8,7 @@
<xsd:element name="errors" type="xsd:int"/>
<xsd:element name="failures" type="xsd:int"/>
<xsd:element name="skipped" type="xsd:int"/>
+<xsd:element name="flakes" type="xsd:int" nillable="true"/>
<xsd:element name="failureMessage" type="xsd:string" nillable="true"/>
</xsd:sequence>
<xsd:attribute name="result" type="errorType" use="optional"/>
assertThat(actual.getSkipped()).isEqualTo(expected.getSkipped()); | ||
|
||
assertThat(actual.getFlakes()).isEqualTo(expected.getFlakes()); | ||
|
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.
nit: unnecessary empty lines
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.
I only did this to be consistent with the person who wrote the other test in this file 😆
Looks good to me! |
Let's do it. |
4cb82fe
to
d24adb4
Compare
Summary of these changes:
failsafe-summary.xml
has been updated to include aflakes
elementflakes
was already being recorded by theRunResult
class, but this was not exposed in the .xml previouslytestAppendSerialization
test, but was not due to a bug in theRunResult.toEquals
method where it did not take theflakes
field into account for equality comparison betweenRunResult
objects.