I have been searching for a way to use SenTestingKit to do some integration testing between my client-side code and our server. I haven't had any luck. It seems that once the code is run in a method, the object gets destroyed. This means that any asynchronous responses never call the selectors.
Questions:
- Is there a way to keep the object instantiated until such time as I see fit to destroy it - ie. after the tests have completed?
- If not, how could I create a class that blocks (ie. acts synchronously) until the tests are completed?
FYI, I'm running a test server where I know the expected results.
I've done a fair bit of Googling but haven't seen proof one way or another about this. I'm sure others would be interested as well.
Two options:
This project https://github.com/hfossli/AGAsyncTestHelper has a very convenient macro
Which ables you to write the test like so
Checkout the SenTestingKitAsync project - https://github.com/nxtbgthng/SenTestingKitAsync. The related blog is here - http://www.objc.io/issue-2/async-testing.html
You can use a semaphore to wait until the asynchronous method finishes.
}
http://samwize.com/2012/10/03/sentestingkit-does-not-support-wait-for-blocks/
Kiwi supports asynchronous testing. Kiwi is a Behavior Driven Development (BDD) library for iOS that extends SentTestingKit (OCUnit), so it's easy to set up & use.
Also, check out: