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

RUMM-1394 Add more verbosity to flaky test errors #620

Merged

Conversation

ncreated
Copy link
Member

@ncreated ncreated commented Oct 1, 2021

What and why?

📦 This PR adds a bit more verbosity to errors which we capture in flaky tests.

Looking at last 7d, we got 11 failures in nightly tests:
Screenshot 2021-10-01 at 17 42 37

Unfortunately, the error messages are not handy in troubleshooting:

Screenshot 2021-10-01 at 17 44 45

As I couldn't reproduce these failures locally (in exactly the same OS + simulator setup and with dd-swift-testing instrumentation enabled), I propose to first add more verbosity in this PR, and collect more data in CI App.

How?

I improved the way we compare two task instances. Instead of:

XCTAssertTrue(actualTask === expectedTask)

now it uses a helper method:

AssertURLSessionTasksIdentical(actualTask, expectedTask)

which dumps additional information about the lhs and rhs tasks if they are not identical, e.g:

Screenshot 2021-10-01 at 17 48 41

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference

in `URLSessionSwizzlerTests` and `DDURLSessionDelegateTests`
@ncreated ncreated self-assigned this Oct 1, 2021
@ncreated ncreated requested a review from a team as a code owner October 1, 2021 15:50
@@ -94,26 +94,28 @@ class DDURLSessionDelegateTests: XCTestCase {

// When
let taskWithURL = session.dataTask(with: URL.mockAny())
taskWithURL.taskDescription = "taskWithURL"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As (in flaky scenario) we receive some other task than we expect, here I tag each task with a custom description, so we can see it in the error (expected vs actual taskDescription).

@ncreated ncreated merged commit f362f01 into master Oct 4, 2021
@ncreated ncreated deleted the ncreated/RUMM-1394-add-more-information-to-flaky-test-errors branch October 4, 2021 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants