I need to access an environment variable named ENV that is set in the xcconfig file for my main app target, but from inside my UI test target.
After doing a ton of googling this is what I've tried:
- set the main xcconfig as the configuration for the UITest target
- add an environment variable
ENV=$(ENV)
in the test plan configuration - print the environment dictionary like this
print(ProcessInfo.processInfo.environment)
But $(ENV)
is not expanding to the real value.
I also tried adding a custom entry in the Info.plist
for the UITest target
<key>ENV</key>
<string>$(ENV)</string>
And then accessing it via Bundle.main.infoDictionary
but again I just get the string $(ENV)
. Any idea what I am missing, or is this just impossible because of the way UI tests work in Xcode?