roperklacks
roperklacks

Reputation: 1179

Spontaneous failures running Kiwi-based tests on an iOS app when using Realm

I'm working on an app that has a Kiwi test suite with 300+ tests. The tests are being run as application tests, where the main app target is the host for the test bundle.

I am trying to add Realm to the app, but when I have Realm objects compiled into the app target, my tests spontaneously fail due to Kiwi matchers failing to be created. I notice that this only happens if my RLMObject subclasses have RLMArray properties. Removing them fixes the issue.

The failure reasons in the console log vary, but the common ones are:

[FAILED], could not create matcher for -receiveMessagePattern:countType:count:
[FAILED], could not create matcher for -receive:withCountAtLeast

and my favorite:

[FAILED], (null)

Anyone else run into this issue?

Upvotes: 0

Views: 171

Answers (1)

roperklacks
roperklacks

Reputation: 1179

It turns out that unsigned integer types and NSNumber properties are not allowed in RLMObject subclasses – I had both of these, and it was throwing an exception at the start of the unit test suite. Exceptions are swallowed during unit tests (at least when using Kiwi) so I didn't notice this at first. Fixing the property types fixed my issue, though I'm still not sure why it caused the all the rest of the tests to fail. Perhaps the runtime was in a bad state following the exception.

Upvotes: 0

Related Questions