Re: Error running unit test of framework
Re: Error running unit test of framework
- Subject: Re: Error running unit test of framework
- From: Rakesh Vidyadharan <email@hidden>
- Date: Sat, 3 May 2008 17:33:50 -0500
On 03-May-08, at 2:16 PM, Chris Hanson wrote:
On May 3, 2008, at 7:08 AM, Rakesh Vidyadharan wrote:
I am a beginner with Objective-C and XCode (3.0). To get started I
created a simple framework that represents the data model and logic
engine for a simple game I am writing. I am now writing some
simple unit tests for the core framework. I went through the unit
test documentation provided by Apple to set up my test.
I have instructions for Cocoa unit testing Xcode 2.1 through 3.0 here:
http://chanson.livejournal.com/182472.html
And more posts on unit testing, including how to do unit testing of
Cocoa user interfaces, here:
http://chanson.livejournal.com/tag/unit+testing
Try setting the "Architectures" build setting for your project's
Debug configuration to i386 on an Intel-based Mac, or to ppc on a
PowerPC-based Mac, and then running your tests. You should be able
to do that by copying one of these lines and just pasting it into
the inspector window:
ARCHS = i386
ARCHS = ppc
Hope this helps.
-- Chris
Thanks Chris and Jason for your suggestions. I had read your
instructions along with the instructions from Apple through a google
search. Still no luck however. Just to document exactly the steps I
performed (I did this a few times to see if I was missing some step):
1) Create a new Target "Unit Tests" for the project that is of type
"Cocoa->Unit Test Bundle"
2) For the new target, added my main framework as a direct dependency
in the info window General tab.
3) In the Build tab selected the native architecture only for the
"Architectures" configuration.
4) Set the active target to the Unit Test target
5) Selected Products group and checked off my framework for target
membership.
6) Created a new "Unit Tests" group to the project and added a new
Cocoa->Objective-C test case class with header file to the group.
7) Checked the Target membership for my new test case .m file
8) Cleaned and built the project. Result was the same error as
earlier. I tried putting a NSLog call into my setUp method, but did
not see anything in the Console. Just for reference my test files are
as follows:
-- CellTest.h --
#import <SenTestingKit/SenTestingKit.h>
#import "Cell.h"
@interface CellTest : SenTestCase
{
Cell *cell;
}
#define VALUE 8
#define ROW 2
#define COLUMN 3
@end
-- CellTest.m --
#import "CellTest.h"
@implementation CellTest
- (void) setUp
{
[super setUp];
cell = [[Cell alloc] init];
NSLog(@"setUp ran");
}
- (void) testValue
{
cell.value = VALUE;
STAssertEquals(VALUE, cell.value, @"Testing value");
}
- (void) testLocked
{
cell.locked = YES;
STAssertEquals(YES, cell.locked, @"Testing locked");
}
- (void) tearDown
{
[cell release];
[super tearDown];
}
@end
Rakesh
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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