Replies: 2 comments 4 replies
-
Hi @mplorentz, this doesn't have so much to do with tests run in RELEASE vs DEBUG, but rather it's a problem with UI tests in general. A UI test runs as a completely separate process, independent of the test target, and so there is no way (as far as we know) to detect when an app is running as apart of a UI test. So, you have to come up with your own strategies for communicating to the app target from the test target that you are running tests, and then do some extra logic in the entry point of the app target to override dependencies. For example, this is what we do in our Standups demo app to show how to use a mock data manager in a UI test. That environment variable is set from the UI test target. Since this isn't an issue with the library I am going to convert it to a discussion. Feel free to follow up there with more questions. |
Beta Was this translation helpful? Give feedback.
-
I played around with this some more and found the latest version of swift-dependencies does support the environment variable |
Beta Was this translation helpful? Give feedback.
-
Description
I've set up a suite of UI test for performance measurements as described in the WWDC video Elimnate animation hitches with XCTest. Apple recommends setting your configuration to Release and disabling the debugger for these tests.
I want the Dependencies to use the
testValue
of my dependencies during these tests.Checklist
main
branch of this package.Expected behavior
Dependencies library detects that I am running tests and initializes the
testValue
for my dependencies.Actual behavior
The Dependencies library initializes the
liveValue
of my dependencies in these test.Steps to reproduce
testValue
andliveValue
dependencies.Dependencies version information
0.1.4
Destination operating system
iOS 16.4
Xcode version information
Xcode 14.3
Swift Compiler version information
Beta Was this translation helpful? Give feedback.
All reactions