# iOS Unit Tests failing only on Bitrise

**URL:** <https://discuss.bitrise.io/t/ios-unit-tests-failing-only-on-bitrise/760>\
**Category:** Builds\
**Created:** [February 13, 2017, 11:54am UTC](https://discuss.bitrise.io/t/ios-unit-tests-failing-only-on-bitrise/760 "2017-02-13T11:54:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamfabiomilano](https://avatars.discourse-cdn.com/v4/letter/i/50afbb/32.png) [@iamfabiomilano](https://discuss.bitrise.io/u/iamfabiomilano)\
**Post date:** [February 13, 2017, 11:54am UTC](https://discuss.bitrise.io/t/ios-unit-tests-failing-only-on-bitrise/760/1 "2017-02-13T11:54:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [February 13, 2017, 12:20pm UTC](https://discuss.bitrise.io/t/ios-unit-tests-failing-only-on-bitrise/760/2 "2017-02-13T12:20:17Z")

</div>

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](http://Bitrise.io) - make sure you use the same version both locally and on [Bitrise.io](http://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.

 ![](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/1X/2ccc758fa3a0aa3a3e94d509f228e7b99b58cfa6.png)

---

<div class="post-metadata">

**Author:** ![iamfabiomilano](https://avatars.discourse-cdn.com/v4/letter/i/50afbb/32.png) [@iamfabiomilano](https://discuss.bitrise.io/u/iamfabiomilano)\
**Post date:** [February 13, 2017, 11:16pm UTC](https://discuss.bitrise.io/t/ios-unit-tests-failing-only-on-bitrise/760/3 "2017-02-13T23:16:07Z")

</div>

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