Questions tagged [ocunit]

OCUnit is a unit testing framework for the Objective-C language and included with Apple's Xcode IDE since Xcode 2.1.

OCUnit is a unit testing framework for the Objective-C language and included with Apple's Xcode IDE since Xcode 2.1.

It was created by Sen:te and modeled after the original Smalltalk unit testing framework. In design and use it is similar to classical JUnit, but taking advantage of Objective-C's runtime features to automatically locate tests to run.

263 questions
0
votes
4 answers

Does OCUnit allow application tests to be run on the iPhone Simulator?

Apple's "iPhone Development Guide" suggests on page 62 that "Because application tests run only on a device, you can also use these tests to perform hardware testing...". I'd like to run my OCUnit test cases in the simulator as well -- but haven't…
Vik
  • 1,301
  • 4
  • 16
  • 29
0
votes
2 answers

Do you need to define test methods in the public interface in OCUnit's test case class

When writing unit test with OCUnit it's possible to omit the test method definition in the public interface (.h). But what is the best practice for OCUnit regarding test methods definitions in public interface? ModelTest.h (no test methods…
Vladimir
  • 4,782
  • 7
  • 35
  • 56
0
votes
1 answer

STAssertTrue not returning as I expect

I'm just starting OCUnitTesting. I don't think that my code is wrong, but the problem is probably is a tiny mistake I made somewhere along the way.. I have a function - (BOOL)tooManyCouplesForER:(NSMutableArray *)startfield { NSLog(@"Size %i",…
Nareille
  • 811
  • 2
  • 11
  • 30
0
votes
1 answer

NSBundle while unit testing with OCUnit returns (null)

Problem : Retrieving from NSBundle returns (null) while running Unit Test, returns valid object on run time. What have I done ? I have searched SO with similar problems, apple's developer and other online resources for this problem but with no…
Kishor Kundan
  • 3,135
  • 1
  • 23
  • 30
0
votes
1 answer

Issue OCUnit Test Case for Notification

- (id)init { if (self = [super init]) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onDidFinishLaunchingNotification:) …
Kiran
  • 345
  • 1
  • 4
  • 16
0
votes
2 answers

Passing NSTimer has parameter

I have method which take NSTimer has parameter which is in Class A -(void)demoMethod:(NSTimer *)timer{ //Do something! } Now I have covering test case for the method: -(void)testDemoMethodPassNilTimer{ //Created class Instance for the…
Kiran
  • 345
  • 1
  • 4
  • 16
0
votes
1 answer

STAssertEqualObjects compare class

i trying to cover the test case a method which return class object. -(ClassName *)returnClass{ return _class; } -(void)test_ReturnClass{ id returnObj; returnObj = [aClassNameObj returnClass]; STAssertNotNil(returnObj, @"return Not NULL…
kiran
  • 4,285
  • 7
  • 53
  • 98
0
votes
1 answer

How do I exclude a code path when running a unit test on iOS?

I have some code that throws an exception when run from a logic test in ocunit. I would like to ignore this code and test the rest of the functionality without having to setup an application test nor having to decompose the method. For…
louoso
  • 795
  • 7
  • 9
0
votes
2 answers

Assert that message is sent to self OCUnit

I am fairly new to OCUnit and I am trying to add a Test Case to a method that looks like this: - (void) processMessageBody:(XMPPMessage *)message fromNick:(NSString *)nick; { BOOL isEcho; SBEventMessage *eventMessage =…
Pierluigi Cifani
  • 224
  • 2
  • 14
0
votes
1 answer

Issue implementing OCUnit in existing ARC project

I'm looking into adding unit tests into my existing app, mainly to teach myself how it all works. I've got to the stage where everything is wired up with dependencies, I can run some little checks like: STAssertEquals(1, 2, @"This is a fail!"); And…
jowie
  • 8,028
  • 8
  • 55
  • 94
0
votes
1 answer

How to write OCUnit Test Case

I want to write unit tests using Apple's default SenTestingKit for the below method: - (NSDictionary*)getValueTags { return _tags; } - (NSString*)getFlag { NSString* jo = @""; for (NSString* key in _tags) { jo = [jo…
kiran
  • 4,285
  • 7
  • 53
  • 98
0
votes
1 answer

How do I add a target to a test scheme?

I have configured unit testing for a project, and I need to use the classes that are in the run scheme also in the test scheme. This because if I try to use a class that I use in the run scheme, I get a linker error, the linker does not recognize…
Ramy Al Zuhouri
  • 21,580
  • 26
  • 105
  • 187
0
votes
1 answer

how to use presentedViewController when testing for modal launch

I'm unit testing one of my view controllers and wanted to confirm that when a logic branch is hit, the modal view controller that I pop up with present: viewDidLoad MWLoginViewController *loginController = [[MWLoginViewController alloc]…
Mark W
  • 3,879
  • 2
  • 37
  • 53
0
votes
1 answer

EXC_BREAKPOINT using UITableViewCell's textLabel's text in a test target

I have a test target where I am testing a table view data source.I want to test that the cell's textLabel returned by tableView:cellForRowAtIndexPath: contains the text I expect, but when I set the textLabel's text I get a EXC_BREAKPOINT…
e1985
  • 6,239
  • 1
  • 24
  • 39
0
votes
1 answer

STFail in block

When running tests using SenTestingKit, they don't fail correctly inside a block, e.g. operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest…
Snowcrash
  • 80,579
  • 89
  • 266
  • 376
1 2 3
17
18