-
Notifications
You must be signed in to change notification settings - Fork 12
Remove state from EventQueueTests and other test refinements
#78
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
Conversation
| func makePareslyTracker() -> Parsely { | ||
| let tracker = Parsely.getInstance() | ||
|
|
||
| // Note that because we call addTeardownBlock, this method needs to be defined within an | ||
| // XCTestCase | ||
| addTeardownBlock { | ||
| tracker.hardShutdown() | ||
| } | ||
|
|
||
| return tracker | ||
| } |
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.
Using addTeardownBlock in the context of makeParselyTracker() makes sure that any test calling this method will call hardShutdown() on completion. This gives us the ability to call the method and assign its return value to an instance scoped at the test method without the risk of it remaining in memory after the test finishes.
EventQueueTests and other test refinements
crazytonyli
left a comment
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 first GitHub Action run failed at a flaky test which should be fixed in #79 |
It did not need access to the `ParselyTestCase` APIs
It did not need access to the `ParselyTestCase` APIs
It did not need access to the `ParselyTestCase` APIs.
It did not need access to the `ParselyTestCase` APIs.
The next step will be to remove the setup method and let subclasses call `makeParselyTracker()`.
4c09a85 to
ec6b4bd
Compare
XCTestCasesubclasses instead ofParselyTestCase. They didn't need access to the tracker test instanceEventQueueTestsandEngagedTimeTests. Now each test methods create objects whose lifecycle ends together with the test. They will not survive in memory after the test finished.ParselyTestCaseto offer a single API to generate aParselyinstance for tests configured to callhardShutdown()when the test finishes.My editor removed whitespaces from the files. I recommend hiding them when reviewing to reduce the noise. Also, commit by commit review might be clearer.
CI runs only on PRs against
master. I obviously run the tests locally and verified everything still works but feel free to doublecheck 😄