You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some unit tests that use Analytics to carryout some testing. Some of these create the Analytics objects in static members. i.e., so the Analytics object is effectively global, scoped to those test cases. This has worked well so far, but I'm running into an issue.
In a new test, I wanted to get a new instance of Analytics and I assumed the userId would be nil. That's part of what I'm testing. Since, in that XCTestCase class hadn't initialized it. i.e., I hadn't done an identify call. However, the other XCTestCases test do those identify calls, and happen to get initialized first across all the test targets of my Swift package.
It looks like Analytics shares a global value for userId across Analytics instances. This is making my testing a bit tricker than I would have expected. Not sure if this is operating as expected or not.
The text was updated successfully, but these errors were encountered:
I have some unit tests that use
Analytics
to carryout some testing. Some of these create theAnalytics
objects in static members. i.e., so theAnalytics
object is effectively global, scoped to those test cases. This has worked well so far, but I'm running into an issue.In a new test, I wanted to get a new instance of
Analytics
and I assumed theuserId
would be nil. That's part of what I'm testing. Since, in that XCTestCase class hadn't initialized it. i.e., I hadn't done anidentify
call. However, the other XCTestCases test do those identify calls, and happen to get initialized first across all the test targets of my Swift package.It looks like
Analytics
shares a global value foruserId
acrossAnalytics
instances. This is making my testing a bit tricker than I would have expected. Not sure if this is operating as expected or not.The text was updated successfully, but these errors were encountered: