Is there a way I can use Swift's Active Compilation Conditions to customize the behavior of test targets?
My login view controller includes the following convenience code to avoid having to type credentials for every test:
#if DEBUG_LOGIN_CREDENTIALS
emailInput.value = DebugConfig.userEmail
passwordInput.value = DebugConfig.userPassword
#endif
I was hoping that omitting the DEBUG_LOGIN_CREDENTIALS condition in my test target would be enough to ignore that code in runtime during my tests but my screenshots keep featuring login values đ€Š♂️.
The only option I could find to alter the behavior of (a) debug code and (b) running in a test target was to add an extra environment variable at the scheme level that is only present for the test stage of that scheme ie:
Is there a more elegant way to do this?

Aucun commentaire:
Enregistrer un commentaire