# iOS UnitTest fails on Bitrise when checking applicationState

**URL:** <https://discuss.bitrise.io/t/ios-unittest-fails-on-bitrise-when-checking-applicationstate/4633>\
**Category:** Issues\
**Created:** [March 27, 2018, 8:26pm UTC](https://discuss.bitrise.io/t/ios-unittest-fails-on-bitrise-when-checking-applicationstate/4633 "2018-03-27T20:26:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![valleyman86](https://avatars.discourse-cdn.com/v4/letter/v/51bf81/32.png) [@valleyman86](https://discuss.bitrise.io/u/valleyman86)\
**Post date:** [March 27, 2018, 8:26pm UTC](https://discuss.bitrise.io/t/ios-unittest-fails-on-bitrise-when-checking-applicationstate/4633/1 "2018-03-27T20:26:12Z")

</div>

I have a unit test that is failing only in Bitrise. It works if I use xcodebuild or if I run directly from Xcode.

I placed a bunch of logs and it seems that UIApplication.shared.applicationState == .active is false when running in bitrise causing the test to fail.

What could be the cause of this?

---

<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:** [March 28, 2018, 3:53pm UTC](https://discuss.bitrise.io/t/ios-unittest-fails-on-bitrise-when-checking-applicationstate/4633/2 "2018-03-28T15:53:30Z")

</div>

Hi @valleyman86,

I’d suggest you to Remote Desktop / VNC into the build machine and run the tests there: [https://gist.github.com/viktorbenei/c6d4fe1e68de739dbb5f4f15de76b9db](https://gist.github.com/viktorbenei/c6d4fe1e68de739dbb5f4f15de76b9db)

Let us know how it goes or if you’d need additional assistance! 😉
