Questions tagged [octest]
18 questions
208
votes
8 answers
Why can't code inside unit tests find bundle resources?
Some code I am unit testing needs to load a resource file. It contains the following line:
NSString *path = [[NSBundle mainBundle] pathForResource:@"foo" ofType:@"txt"];
In the app it runs just fine, but when run by the unit testing framework…

benzado
- 82,288
- 22
- 110
- 138
5
votes
1 answer
How to test code that depends on UIUserInterfaceIdiom (ios)
I have some Objective-C [i-os] code that I would like to run unit tests over using XCode. It accesses different metadata depending on the type of device, using:
[[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad
The problem I…

lindon fox
- 3,298
- 3
- 33
- 59
4
votes
3 answers
How does one unit test network-dependent operations?
Some of my apps grab data from the internet. I'm getting into the habit of writing unit tests, and I suspect that if I write a test for values returned from the internet, I will run into latency and/or reliability problems.
What's a valid way to…

Moshe
- 57,511
- 78
- 272
- 425
3
votes
1 answer
Unit tests no longer working after XCode upgrade from 3.2.3 to 3.2.4
I have just updated my XCode to 3.2.4 and it turns out my unit tests are no longer working. I have configured a target and executable following the instructions from Scott Densmore so that I'm able to debug my tests.
I did change the Base SDK to…

Georg Gruetter
- 31
- 1
2
votes
0 answers
Logic tests hang in -[MKTileCache init] () after linking AssetsLibrary.framework
My iOS app has a bunch of simple logic tests, which we run in a continuous integration using buildot.
Recently I started linking the AssetsLibrary framework to both the main app, and to the logic tests. The logic tests include classes from the main…

Johan Bilien
- 412
- 2
- 12
2
votes
1 answer
Bypass login/authentication in OCUnit application tests
I just setup application tests with OCUnit for my iOS project and am trying to figure out what to do with authentication. My app has a forced login screen where the user is required to authenticate with Facebook prior to entering the main app. When…

Rahul Jaswa
- 509
- 4
- 17
2
votes
1 answer
How can I launch OCUnit test on iPhone from Command line
I want to run unit test on iPhone without using Xcode. Is there any command line utility to run OCunit test on iPhone device.
I also tried fruit-strap but it only launches App not OCtests. "fruitstrap -d path_of_app" this command install app but I…

Ram Suthar
- 356
- 2
- 9
2
votes
0 answers
Unit Test C++ code in Xcode
I am using OCTest for Objective-C code. Does OCTest support C++? How do I go about writing tests for C++ classes?

Aldrich Co
- 587
- 6
- 21
1
vote
0 answers
XCode, Unit Tests and Implementation Files
I finally decided to add some unit tests to my simple iPhone application. There is one thing that is kind of annoying and that is to have to include all dependencies in the test bundle.
But, maybe I'm doing it wrong.. Do I really need to add all…

Sebastien Martin
- 1,341
- 11
- 25
1
vote
1 answer
pthread_mutex_lock lets OCTest crash when UIWebView alloc
just another question for Unit testing. In one of my iOS Projects doing Unit tests, it is necessary to use a UIWebView. When i create one in - (void)setUp; or any test method, the whole Test crashes without any further information. The Debug…

Tomte
- 1,331
- 12
- 19
1
vote
3 answers
Xcode missing inline test results
Everywhere there are pretty pictures of failing tests shown inline in the code editor, like in Peepcodes Objective-C for Rubyist screencast and in apples own technical documentation:
(source: apple.com)
When I build my test-target, all I get is a…

Vegar
- 12,828
- 16
- 85
- 151
1
vote
1 answer
What conditions enable the Xcode 4 "Product > Test" menu option?
It's not entirely clear what enables the "Test" option for a product in Xcode 4. It is enabled when you create a new project with an associated .octest target.
Is there a flag or an option to link a particular target as a test of another? The…

tadman
- 208,517
- 23
- 234
- 262
0
votes
1 answer
Unit Testing in Objective C -> how to copy sqlite database
I have a bit of trouble getting my test-suite up and running. Basically I added a new target to my application like so:
Unit Testing Applications
As I want to test against my DA-classes and sqlite-database I use the following snipped to copy the…

Tom
- 213
- 3
- 10
0
votes
1 answer
Nib files cannot be loaded by name from main bundle
It seems as though my nib files are included in my test target, they don't exist in the main bundle, so my app crashes on me when I am loding a nib by its name from the main bundle. I either need to find the correct bundle that includes my nib file,…

aryaxt
- 76,198
- 92
- 293
- 442
0
votes
2 answers
How can iPhone Nibs be Unit Tested using Logical Tests?
Unit Testing View Controllers seems to be very important part of iPhone Development (see this Article). This, however, requires initializing the Controllers from a Nib, which I found impossible to do properly in a logical test.
Loading Resources…
Holger