Re: Unit Testing in XCode 3.2.3
Re: Unit Testing in XCode 3.2.3
- Subject: Re: Unit Testing in XCode 3.2.3
- From: Eeyore <email@hidden>
- Date: Sun, 21 Nov 2010 10:03:25 -0800
You may also want to check out the Developer Forums, there are a few threads associated with unit testing.
Here's my set up (and some reasons for doing it this way). I gave up on the Simulator, I like to use gcov and could never get the simulator to produce data files under iOS 4.1 (possibly due to multitasking not actually exiting the app and so gcov's hook to dump the files doesn't get called) and the iOS 3.2 output was garbled (but I think that might have been an code-optimization issue). I also never got to the point where debugging Unit Tests in the Simulator was comfortable. So, I do all my testing on my device (2nd Gen iPod Touch running iOS 4.1) placing all the gcov data files in the Documents directory (so I can access them via iTunes File Sharing) and I have found it relatively painless to debug the unit tests in this set up as well (while debugging I override the some settings in the target inspector to reduce the optimization level). Looking at my xcconfig files (the ones online might be a little out of date, but did work under the most recent version of Xcode) may help you get started on the configuration part and the bit of code used to get gcov to put the data in Documents directory is also below. Note that my Tests target depends on my iSplit target and my iSplitTesting target depends on my Tests target so building iSplitTesting with the Testing configuration builds and runs the tests. The one thing I really miss is making failed tests stand out in the Console output. To help with this, I write my own testing macros that format the error message so that it stands out and then call the STAssert macros rather than using the STAssert macros directly. Sorry I can't help you with the UIAutomation testing, that is still on my to-do list.
xcconfig files at http://www.monsterworks.com/isplit/build/
The code I use in main() (just after setting up an autorelease pool) to place the gcov files into the Documents directory is below.
#if CONFIG == Testing
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* gcovDirectory = [[paths objectAtIndex: 0] stringByAppendingPathComponent: @"gcov"];
setenv("GCOV_PREFIX", [gcovDirectory UTF8String], 0);
setenv("GCOV_PREFIX_STRIP", "10", 0);
#endif
Hope that helps,
Aaron
On Nov 21, 2010, at 2:40 AM, David Jackman wrote:
> Aaron,
>
> Thank you,
>
> I would like to do automated testing in the iphone simulator using iOS SDK 4 and Xcode 3.2.3.
> I would like to do both inspection of the views (application testing i think) and unit testing.
>
> David
>
> On Nov 20, 2010, at 8:44 PM, Eeyore wrote:
>
>> Answers to the following questions may help you get better answers to your question.
>>
>> What SDK are you using (Mac or iOS)?
>> Are you attempting to do Logic Tests or Application Tests?
>> If iOS, are you trying to run them in the Simulator or on the device?
>>
>>
>> Aaron
>>
>>
>> On Nov 20, 2010, at 7:55 PM, David Jackman wrote:
>>
>>> Is anyone out there using the testing that is available in Xcode version 3.2.3?
>>>
>>> I have tried to follow some tutorials but find it difficult to follow, they are usually lengthy vague, and in the end seem to be talking about yesterdays technology. Is there an up to date guide of some sort out there, or a place to discuss any problems i have?
>>>
>>> I was under the impression that the unit testing was built in to XCode and would be somewhat easy to adopt at least enough to get a fail to fail. So far it has just been a time sink.
>>>
>>> David Jackman
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Xcode-users mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>>
>>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden