ocunit

How to configure a OCUnit test bundle for a framework?

I've been developing a Mac OS X framework and I want to use OCUnit in my XCode 3.2.1 project. I've followed several tutorials on how to configure a OCUnit test bundle. The problem is that when I create a test case that uses a function that is defined in one of the framework's sources, I get a building error telling me that the symbol is ...

How to implement or emulate an "abstract" OCUnit test class?

I have a number of Objective-C classes organized in an inheritance hierarchy. They all share a common parent which implements all the behaviors shared among the children. Each child class defines a few methods that make it work, and the parent class raises an exception for the methods designed to be implemented/overridden by its children...

Xcode Objective-c warnings "creating selector for nonexistent method" with OCUnit (SenTestingKit)

I started getting getting warnings like the following in XCode when trying to write some unit tests with OCUnit (SenTestingKit). warning: creating selector for nonexistent method 'myMethodName1:' warning: creating selector for nonexistent method 'myMethodName2:' ... warning: creating selector for nonexistent method 'release' warning: c...

Unit tests only run automatically when active SDK is "simulator"?

I have followed the instructions Apple publishes for unit testing applications on iPhone and things work great when I set the active SDK to "iPhone Simulator". I have it configured to always build and run my tests as part of building the application itself. Apple implies (by omission) that this should work all of the time, but the tests...

What is the best approach for writing unit tests for iPhone / iPad ?

I am developing an iPad application. I'm not sure if I should write unit tests for this application, and if so, how I should go about writing them. What would you suggest as the best approach to writing unit tests for iPhone / iPad? ...

How to write test cases for drawing text / string in a box ?

Hi, I am drawing strings in a rectangular frame. The string is drawing perfectly. Now I need to write test cases using sentesting kit. I have no ideas from where I should start. For help I have also seen the iPhone sample calculator application But still out of sorts. Any body having ideas please help. Thanks, Madhup ...

OCUnit testing an embedded framework

UPDATE: I ended up giving up and added GHUnit to my project instead. I got up and running with GHUnit in a matter of minutes. UPDATE: You can download the Xcode project here: http://github.com/d11wtq/Cioccolata I've added a Unit Test target to my Xcode project but it fails to find my framework when it builds, saying: Test.octest could...

XCode - Run Focussed Test

In XCode - Is there a way of running just one test(one test case or preferably one test method). What I do today is to run the 'Test' task which runs all tests and takes up a lot of time. Thanks ...

Prevent OCUnit tests from running when compilation fails

I'm using Xcode 3.2.2 and the built in OCUnit test stuff. One problem I'm running into is that every time I do a build my unit tests are run, even if the build failed. Let's say I make a syntax error in one of my tests. The test fails to compile and the last successful compilation of the unit tests are run. The same thing happens if ...

ocunit testing on iPhone

Hi I am trying to get ocunit working in my project from XCode. Since I also need to debug in the unit tests I am using a script that automates the setup (see below). I just include it in the project under resources and change the name to the .ocunit file I want it to run. The problem I get is that it cant find the bundle file and there...

OCUnit & NSBundle

I created OCUnit test in concordance with "iPhone Development Guide". Here is the class I want to test: // myClass.h #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface myClass : NSObject { UIImage *image; } @property (readonly) UIImage *image; - (id)initWithIndex:(NSUInteger)aIndex; @end // myClass.m #import "my...

Trouble with OCUnit - Instantiating custom data type

Hi, I have successfully set up unit testing for an XCode version 3.2.2 project with the iPhone SDK version 3.1.2. I have created a class, "Callout" which I am attempting to instantiate within the context of a unit test. The class has a method, -(id) initWithDictionary:(NSDictionary*)calloutDict includesSong:(BOOL)hasSong lastUpdate:(N...

OCUnit will not allow me to use my own data types

Hi, I am using XCode 3.2.2 to unit test some custom data types. The tests run properly without those data types, but when I use said data types, I get this error: "_OBJC_CLASS_$_classname", referenced from: (where "classname" is the, well, class name...) I have seen hints online that it could be linker related. The strange thing is, ...

Imported files not recognized in OCUnit

Hi, I am doing unit testing on my iPhone app using OCUnit on XCode 3.2.3, and iOS 4.0. I have successfully set up my testing environment to pass and fail basic tests appropriately, but when I import my own files (in this case, "UserAccount.h", it fails to compile and tells me: "_OBJC_CLASS_$_UserAccount", referenced from: It then says...

OCMock for iPhone (iOS4, XCode 3.2.3)

I have the last version of OCMock (1.55) and XCode 3.2.3. I have created a test bundle target in my project. What is the best way to use OCMock in my tests? When I add OCMock.framework to the test bundle, this build error appears: "_OBJC_CLASS_$_OCMockObject", referenced from: objc-class-ref-to-OCMockObject in NotificationTests.o ...

OCUnit problem: DevToolsBundleInjection error loading octest bundle

Hi, this is a cross-post of this question @ the ADC forum. Here's the messages I'm getting: /Developer/Tools/RunPlatformUnitTests.include:273: note: Running tests for architecture 'x86_64' (GC OFF) objc9727: GC: forcing GC OFF because OBJC_DISABLE_GC is set 2010-07-14 16:07:42.893 TestXMLDataApp9727:903 Cannot find executable for CFBu...

OCUnit for iPhone App - Set all .m files as part of UnitTest Target.

Hy everybody, I have two targets: MyApp and UnitTests MyApp contains two classes: ClassA and ClassB. ClassA has a method "getSomeNumber" that uses a ClassB method. UnitTest is a "Unit Test Bundle" and in "Groups & Files" section i have a folder named "UnitTests" where i create a "MyAppTest" Class. MyAppTest Class has the following me...

OCUnit Error Codes

Does anyone know how to find a list of all the possible error codes thrown by the ostest utility, and their meanings? I noticed this to be a common problem for people, where they ask about an OCUnit failure with some code 138 or 139 that is completely opaque to them, and somebody who has encountered that particular error number points ou...

OCUnit wants me to install Rosetta

I followed the instructions on Unit Testing objective C from Apple: http://developer.apple.com/tools/unittest.html I installed the latest version of OCUnit, but when I compile, software update starts and tells me I need to install Resetta. What's going on? ...

OCUnit tests not running / not being found

I'm trying to get to grips with OCTest, but can't seem to get it to actually run my tests (at least, I believe it's not running my tests). I've set up a project as described in the developer documentation, and added a class called UnitTests which contains the following function: -(void)testFailures { STFail(@"A message"); } When I...