Skip to content
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

Junit & HTML reports - Incorrect count for failed tests when -retry-tests-on-failure flag is passed #217

Open
ssharma0312 opened this issue Sep 30, 2021 · 6 comments
Labels

Comments

@ssharma0312
Copy link

ssharma0312 commented Sep 30, 2021

With introduction of XCode 13, we can now re-run failed tests multiple times. This feature is very helpful for flaky tests.

Unlike .xcresult file, the test reports produced by XCTestHTMLReport counts re-tried tests x number of times (where x == no. of times a test is retried). This shows incorrect metrics.

In the following example I am passing flag -retry-tests-on-failure, so my failed test will re-run until they pass but for maxi 2 times (-test-iterations )
xcodebuild -workspace ABC.xcworkspace -scheme ABCTest -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11,OS=15.0' test -parallel-testing-enabled YES -parallel-testing-worker-count 5 -maximum-concurrent-test-simulator-destinations 5 -test-iterations 2 -retry-tests-on-failure -quiet -resultBundlePath TestResults

The .xcresult file produced, the "Failed" tab only shows 3 failed test because these 3 failed on both retries, the few tests that were failed on 1st attempt but succeed on 2nd retry are marked as Passed and counted only once, and showed under "Passed" tab. XCTestHTMLReport plugin should follow same pattern i.e. the tests that were passed on retry should not be counted as failed in HTML & Junit reports & should be counted only once.

.xcresult file
image

.HTML Report produced by XCTestHTMLReport
image

.HTML Report produced by XCTestHTMLReport
image

@nacho4d
Copy link
Member

nacho4d commented Oct 1, 2021

@ssharma0312 Thank you for reporting this.
I haven't reproduced this bug but since you provided all the screenshots and information I think this look like a valid bug (or a new feature in Xcode13 XCTestHTMLReport doesn't support yet and it looks like a bug).

@nacho4d nacho4d added the Bug label Oct 1, 2021
@erik-agens
Copy link

We are also seeing this. An awesome improvement in Xcode 13.
Maybe follow .xcresult's pattern and show Mixed (xx) for tests that have failed, but succeeded on retry?

@ssharma0312
Copy link
Author

Any update on this bug?

@Husseinovich
Copy link

I am also seeing this issue on Xcode 13.1. Tests that passed on successive iterations are reported as failure. Very critical bug.

@ssharma0312
Copy link
Author

ssharma0312 commented Nov 18, 2021

Working on this bug, I will create a MR coming shortly with the fix.

@tylervick
Copy link
Member

Please feel free to test by pulling from #247

Or using mint: mint run tylervick/XCTestHTMLReport@tvick/mixed-test-status, though I don't encourage the practice of executing arbitrary git repos (even from myself 😬)..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants