-
Notifications
You must be signed in to change notification settings - Fork 40
Flaky failure #226
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
base: master
Are you sure you want to change the base?
Flaky failure #226
Conversation
Export test results to Test Reports add-on (multi_level_UI_tests) Test Results🛑 3 out of 17 tests have failed!testFailMe
testFailMe()
testFailMe2()
|
# Conflicts: # test/converters/converters_test.go # test/converters/junitxml/junitxml.go # test/converters/junitxml/junitxml_test.go # test/converters/junitxml/models.go # test/converters/xcresult3/action_invocation_record.go # test/junit/xml.go # test/test.go # test/testreport/test_report.go
Export test results to Test Reports add-on (multi_level_UI_tests) Test Results🛑 3 out of 17 tests have failed!testFailMe
testFailMe()
testFailMe2()
|
Export test results to Test Reports add-on (multi_level_UI_tests) Test Results🛑 3 out of 17 tests have failed!testFailMe
testFailMe()
testFailMe2()
|
|
||
for _, rerunError := range testCase.RerunErrors { | ||
flattenedTestCase.Failure = convertRerunErrorToFailure(rerunError) | ||
flattenedTestCases = append(flattenedTestCases, flattenedTestCase) |
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.
convertXXXToFailure
is the same code 4x (insert rant about Go "interfaces").
Could we maybe replace them/delegate to something like convertToFailure(type, message, systemErr string)
?
Failure: nil, | ||
Skipped: nil, | ||
Error: nil, | ||
FlakyFailures: nil, |
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.
If you want to be explicit about leaving these empty, also add FlakyErrors and RetryErrors.
Or just leave them all out.
Time: 0, | ||
Failure: nil, | ||
Skipped: nil, | ||
Error: nil, | ||
FlakyFailures: nil, | ||
RerunFailures: nil, |
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 think you do not need to explicitly set these and omit them because they will be initialised to their default value which are what you just described here.
message += ": " | ||
} | ||
message += flakyFailure.Message | ||
} | ||
|
||
if len(strings.TrimSpace(flakyFailure.SystemErr)) > 0 { | ||
if len(message) > 0 { | ||
message += "\n\n" | ||
} | ||
message += "System error:\n" + flakyFailure.SystemErr | ||
} | ||
|
||
if len(message) > 0 { | ||
return &Failure{ | ||
Value: message, | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func convertFlakyErrorToFailure(flakyError FlakyError) *Failure { | ||
var message string | ||
if len(strings.TrimSpace(flakyError.Type)) > 0 { | ||
message = flakyError.Type | ||
} | ||
if len(strings.TrimSpace(flakyError.Message)) > 0 { | ||
if len(message) > 0 { | ||
message += ": " | ||
} | ||
message += flakyError.Message | ||
} | ||
|
||
if len(strings.TrimSpace(flakyError.SystemErr)) > 0 { | ||
if len(message) > 0 { | ||
message += "\n\n" | ||
} | ||
message += "System error:\n" + flakyError.SystemErr | ||
} | ||
|
||
if len(message) > 0 { | ||
return &Failure{ | ||
Value: message, | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func convertRerunFailureToFailure(rerunFailure RerunFailure) *Failure { | ||
var message string | ||
if len(strings.TrimSpace(rerunFailure.Type)) > 0 { | ||
message = rerunFailure.Type | ||
} | ||
if len(strings.TrimSpace(rerunFailure.Message)) > 0 { | ||
if len(message) > 0 { | ||
message += ": " | ||
} | ||
message += rerunFailure.Message | ||
} | ||
|
||
if len(strings.TrimSpace(rerunFailure.SystemErr)) > 0 { | ||
if len(message) > 0 { | ||
message += "\n\n" | ||
} | ||
message += "System error:\n" + rerunFailure.SystemErr | ||
} | ||
|
||
if len(message) > 0 { | ||
return &Failure{ | ||
Value: message, | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func convertRerunErrorToFailure(rerunError RerunError) *Failure { | ||
var message string | ||
if len(strings.TrimSpace(rerunError.Type)) > 0 { | ||
message = rerunError.Type | ||
} | ||
if len(strings.TrimSpace(rerunError.Message)) > 0 { | ||
if len(message) > 0 { | ||
message += ": " | ||
} | ||
message += rerunError.Message | ||
} | ||
|
||
if len(strings.TrimSpace(rerunError.SystemErr)) > 0 { | ||
if len(message) > 0 { | ||
message += "\n\n" | ||
} | ||
message += "System error:\n" + rerunError.SystemErr | ||
} | ||
|
||
if len(message) > 0 { | ||
return &Failure{ | ||
Value: message, | ||
} | ||
} | ||
return nil | ||
} |
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.
These are identical functions with different parameter type but the used variables are the same on that given type.
We could simplify this by receiving the actual variables as parameters:
func convertToFailure(itemType, failureMessage, systemErr string) *Failure {
var message string
if len(strings.TrimSpace(itemType)) > 0 {
message = itemType
}
if len(strings.TrimSpace(failureMessage)) > 0 {
if len(message) > 0 {
message += ": "
}
message += failureMessage
}
if len(strings.TrimSpace(systemErr)) > 0 {
if len(message) > 0 {
message += "\n\n"
}
message += "System error:\n" + systemErr
}
if len(message) > 0 {
return &Failure{
Value: message,
}
}
return nil
}
Checklist
step.yml
andREADME.md
is updated with the changes (if needed)Version
Requires a MINOR version update
Context
This PR adds support for the JUnit report format described for Maven Surefire. The
flakyFailure
,flakyError
,rerunFailure
andrerunError
elements are converted into a test case with failure preserving the order of test case runs.