I haven't been able to find any up to date info on using the OCUnit tests with Xcode 4, even though it is a redesigned feature.
Apples own documentation in the Organizer is from 2005 (OS X 10.3).
I thought I just go ahead and try set it up myself.
1: Made a new test target. (TestUnit)
2: Made sure all Base SDK settings in project and targets is set to iOS 4.3.
3: Added a test Class
4: Made sure the framework search path pointed to the framework folder
(4.1?) Manually added the SenTesting framework to my testTarget
When I set my scheme to the "TestUnit iOS 4.3 Simulator" and try and run it an error pop up says "The selected run destination is not valid for this action.".
I have no idea if the above is the correct way to add OCUnit testing to Xcode 4, so if someone has a resource or could point out the steps I would be grateful.
Thank you in advance.
In Xcode 4 'longpress' on the run button until a drop down comes out and select test.
The following steps worked for me to add unit testing to an iPhone project running in the simulator:
You do not need to add the SenTesting framework to your project. Also, make sure the Test Host build setting is blank if you're unit testing an iPhone app running in the simulator. The simulator does not support application-hosted unit tests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With