iOS Unit Tests failing only on Bitrise

In my project I have a test for a small object responsible to save and retrieve data from the standard NSUserDefaults.
One of my tests is checking that a store function is properly saving values by retrieving them directly and check if they are what I expect them to be.
I don’t know why but even if the test is passing locally (tried to clean project and all derived data to take any “cache” out of the equation), it keeps failing on Bitrise.
More in detail a value that should be Optional with Some it is just retrieved as nil which makes the equality failing.

Hi @iamfabiomilano,

For what you described, in general, the most likely causes:

  1. You use a different Xcode version locally than the one you did set on Bitrise.io - make sure you use the same version both locally and on Bitrise.io!
  2. You might want to reset the Simulator locally, simply cleaning the build caches (tried to clean project and all derived data to take any “cache” out of the equation) does not affect the state of the iOS Simulator, you have to clear that too, with the Reset Content and Settings… menu option of the simulator.

Resetting the content and settings made the unit tests finally fail also locally.
Thank you!

1 Like