0

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?

roperklacks
  • 1,081
  • 11
  • 13

1 Answers1

0

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.

roperklacks
  • 1,081
  • 11
  • 13
  • Are you sure it's Kiwi? Seems that your code is the problematic once. – Cristik May 21 '15 at 21:05
  • Yes, I agree. It was my own code. Please read my answer - I was using invalid data types in my `RLMObject` subclasses that were causing an exception that propagated through all the tests. – roperklacks May 21 '15 at 21:10
  • Please then give some examples so that further readers can understand what not to do. Also you are kinda blaming Kiwi for masking an exception. – Cristik May 21 '15 at 21:11
  • Sorry, I didn't mean to imply that Kiwi was at fault here. It was my oversight that I didn't notice the exception. I don't know why it caused all matcher creation to fail for every subsequent test, though, so all I can say is to set an exception breakpoint when running your tests to be sure that you don't overlook the exception that gets thrown. – roperklacks May 22 '15 at 20:48
  • Also I edited my answer to hopefully be clearer and not direct blame at Kiwi. Thanks for pointing that out! – roperklacks May 22 '15 at 20:52