Questions tagged [sentestingkit]

SenTestingKit is Apple's install of OCUnit on Mac OS X 10.4.

It is installed as SenTestingKit.framework.

It is used by making a new target - a "Unit Test Bundle" - in an XCode project.

96 questions
45
votes
5 answers

dispatch_sync on main queue hangs in unit test

I was having some trouble unit testing some grand central dispatch code with the built in Xcode unit testing framework, SenTestingKit. I managed to boil my problem done to this. I have a unit test that builds a block and tries to execute it on the…
Drewsmits
  • 1,374
  • 2
  • 14
  • 23
42
votes
5 answers

Testing the Keychain - OSStatus error -34018

I'm trying to test code that reads and alters the keychain using the basic SenTest framework on Xcode. The code works fine on device, but when I start the test I get these errors every time I want to touch the keychain with…
Andrew
  • 2,058
  • 1
  • 19
  • 42
32
votes
6 answers

Pattern for unit testing async queue that calls main queue on completion

This is related to my previous question, but different enough that I figured I'd throw it into a new one. I have some code that runs async on a custom queue, then executes a completion block on the main thread when complete. I'd like to write unit…
Drewsmits
  • 1,374
  • 2
  • 14
  • 23
31
votes
11 answers

XCTest build errors for test target Xcode 5:

I have set up an XCode 5 iOS 7 project for unit tests. Of course, setting up the unit tests are taking me so long that I'm trying to keep the faith that it's worth it. Struggling for hours over this error: ld: building for iOS Simulator, but…
user798719
  • 8,591
  • 21
  • 77
  • 114
24
votes
3 answers

What are the advantages of XCTest over SenTestingKit?

I want to do unit testing in iOS. By default test classes are created using XCTest framework classes in Xcode 5. I have used SenTestingKit in earlier versions of iOS. What are the differences between these two frameworks? What are the advantages of…
sridevi
  • 617
  • 1
  • 6
  • 15
18
votes
6 answers

OCUnit tests to existing iOS project. "ld: file not found"

I've been following this blog post: Adding unit tests to existing project. I'm getting this error however: ld: file not found: Build/Products/Debug-iphoneos/MyApp.app/MyApp Command …
Sam
  • 1,002
  • 1
  • 8
  • 19
18
votes
2 answers

How do you load a prototype cell from a storyboard?

Is there a way to load a prototype cell, along with any IBOutlet connections as defined within a storyboard? Update I want to unit test the cell (a UICollectionViewCell for that mater), hence would like to load it outside of a UIViewController…
qnoid
  • 2,246
  • 2
  • 26
  • 40
16
votes
2 answers

How to read in a local JSON file for testing

I'm trying to write unit tests for json validation (since the app heavily relies on json from a rest API). I have a local file that contains simple json: "goodFeaturedJson.txt" The contents: { "test": "TEST" } The test case: -…
Jordan Johns
  • 655
  • 2
  • 9
  • 20
12
votes
4 answers

Logic Testing on iOS devices is not supported?

I am using the SenTestingKit to Unit Test, but I get the following message Logic Testing on iOS devices is not supported. You can run logic tests on the Simulator. How can I do this?
mark
  • 141
  • 1
  • 5
10
votes
2 answers

Running SenTestingKit unit tests in Instruments

I'm developing a database-access library and I'm trying to check for memory leaks using already-written unit tests. These are logic tests based on SenTestingKit, set up the normal way in Xcode 4.2. I can run them fine using Cmd-U but don't see a way…
paulmelnikow
  • 16,036
  • 6
  • 56
  • 110
9
votes
4 answers

Conditional unit testing based on iOS version

My unit test suite contains a few test cases that are only applicable for the latest iOS version. Expectedly, these tests fail when running the suite on an older iOS version. Is there a standard way to indicate that these test cases should run on a…
hpique
  • 112,774
  • 126
  • 328
  • 461
9
votes
6 answers

Xcode 5 -- Test target did not finish

Since earlier today, I cannot get my tests to pass when running them from Xcode 5. I know all the tests are passing, because I can run them from command line (well, a CI Job) and they're all passing there. Have I accidentally changed some project…
shortstuffsushi
  • 2,135
  • 16
  • 32
9
votes
4 answers

Xcode 5 says "Simulator in Use" when running 64-bit Unit tests

I just downloaded and installed Xcode 5 GM seed. I removed the previous Xcode (DP5). When I open my project, select "iPhone Retina (4-inch 64 bit)" and type Command-U to run my SenTeskingKit unit tests, Xcode invariably complains: "Simulator in…
Rayfleck
  • 12,116
  • 7
  • 44
  • 72
7
votes
3 answers

XCode 4 Unit test: Is it possible to ignore certain test cases?

Is there a way of ignoring a specific test case without commenting it out? Some tests are written before the implementation exists, so before commiting any code I'd like to first flag these tests to be ignored so it doesn't appal any of my…
Schoob
  • 1,658
  • 1
  • 14
  • 18
6
votes
1 answer

Testing Exceptions using SenTestingKit/OCUnit

The only solution I seem to be able to find for testing for exceptions is using SenTestingKit's STAssertThrows and STAssertThrowsSpecific, however in both cases when the exception is thrown the application under test hangs until I manually ask it to…
Undistraction
  • 38,727
  • 46
  • 165
  • 296
1
2 3 4 5 6 7