-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Refactor FXIOS-13740 [Unit Tests] Microsurvey Telemetry Tests #29814
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
Refactor FXIOS-13740 [Unit Tests] Microsurvey Telemetry Tests #29814
Conversation
|
Are those guidelines from the screenshot in a wikipage somewhere? I think they should be on this page right? |
firefox-ios/firefox-ios-tests/Tests/ClientTests/Microsurvey/Mock/MockMicrosurveyTelemetry.swift
Show resolved
Hide resolved
62283de to
b001d59
Compare
It's from Slack currently, but I'll probably write one after we finalize this PR so we have some proper examples along with the guidelines! |
|
|
||
| XCTAssertEqual(mockGleanWrapper.recordEventCalled, 1) | ||
| XCTAssertEqual(savedExtras.surveyId, expectedSurveyId) | ||
| XCTAssert(savedMetric === event, "Received \(savedMetric) instead of \(event)") |
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 change here from testing other telemetry structs with the mock is I removed the type comparison as well as the previous debug message.
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 this PR is a great example of following the new telemetry testing practices we've discussed! 🥇
(I was just about to mention about the telemetry test type check, but then I saw you commit update to check on actual object vs types so all good there!)
Just one suggestion for the mock implementation to improve the tests further. 😁
firefox-ios/firefox-ios-tests/Tests/ClientTests/Microsurvey/MicrosurveyMiddlewareTests.swift
Show resolved
Hide resolved
firefox-ios/firefox-ios-tests/Tests/ClientTests/Microsurvey/Mock/MockMicrosurveyTelemetry.swift
Show resolved
Hide resolved
💪 Quality guardian3 tests files modified. You're a champion of test coverage! 🚀 🥇 Perfect PR sizeSmaller PRs are easier to review. Thanks for making life easy for reviewers! ✨ 💬 Description craftsmanGreat PR description! Reviewers salute you 🫡 Client.app: Coverage: 37.34
Generated by 🚫 Danger Swift against 16226bb |
|
@ih-codes thanks for reviewing and always being so detailed oriented ❤️ , I updated the PR. Let me know if you have any other nits / comments. Thanks! :) |
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.
Great work 🚀
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.
Thanks for your work on this!! 🔥
Updated wiki here - https://github.com/mozilla-mobile/firefox-ios/wiki/Glean-testing#general-testing-telemetry-guidelines |
📜 Tickets
Jira ticket
Github issue
💡 Description
Fix tests failing frequently in pipeline:
testSurveyDidAppearAction()reported by IsabelPipeline: https://app.bitrise.io/app/6c06d3a40422d10f/pipelines/a4d07818-1e61-40b3-8a58-0098e53faa4b?tests_filter_status=failed&tab=tests
Following the guidelines listed here:

cc: @lmarceau @ih-codes @dataports since we discussed this in our previous unit test meeting.
📝 Checklist