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
1 answer

OCUnit on private properties

I am new to test driven development and have a basic question. How do I access private properties for unit testing? There are plenty of answers on how you access methods but I couldn't find much on properties. Here is what I've got now for my class…
BlueVoodoo
  • 3,626
  • 5
  • 29
  • 37
0
votes
1 answer

Unit testing keyWindow using OCUnit throws an error

I want to test my app delegate make window as key window after launch. So I write the following tests. - (void)setUp { window = [[UIWindow alloc] init]; appDelegate = [[FGAppDelegate alloc] init]; appDelegate.window = window; …
newguy
  • 5,668
  • 12
  • 55
  • 95
0
votes
0 answers

Extending an objc unit test class runs the superclass's tests again

I am writing Objective-C unit tests in Xcode. I would like to extend my base class so I can reuse my setUp/tearDown methods. I created a header and put the imports there, since Xcode defaults to making just an implementation file. Extending the base…
owenfi
  • 2,471
  • 1
  • 24
  • 37
0
votes
0 answers

iOS OCMock: Text Files

I have a .txt file that I'd like to unit test. Is there a way with OCMock to make a "fake" test files for testing purposes? The behavior of my application depends on whats in the text file and ideally I'd like to write a unit test with different…
user1802143
  • 14,662
  • 17
  • 46
  • 55
0
votes
1 answer

Adding a root view controller OCMockObject[UIViewController] as a child view controller error

I've been working on my unit tests for iOS programming, and I've run into a little problem when trying to validate my main class by mocking it's child classes using OCMock and then seeing if the main class adds the child controllers…
iRunner
  • 58
  • 8
0
votes
4 answers

Should you still do memory management in a unit test? (OCUnit)

Should I still bother with releasing objects in a unit test? I noticed in Apple's "iPhoneUnitTests" sample project objects are [[object alloc] init] in the setup method but never released anywhere in the unit test? Thanks!
Hua-Ying
  • 3,166
  • 4
  • 23
  • 25
0
votes
1 answer

Failing OCUnit tests don't take me to the failing line when I click the error in XCode

I've got a large iOS project set up with OCUnit tests, some of which are imported from a dependent project, and some of which are local. When I have a failing test in the dependent project, I can click the error, and be transported to the line…
joseph.hainline
  • 24,829
  • 18
  • 53
  • 70
0
votes
1 answer

Tests retaining reference count

It seems octest doesn't decrement reference count for instances created within a test - (void)test_That_TaskFetcher_is_Invoked_from_tasksDownloaded { InboxViewController *vc = [[InboxViewController alloc] init]; id fetcher = [OCMockObject…
Zayin Krige
  • 3,229
  • 1
  • 35
  • 34
0
votes
1 answer

Trouble Adding OCUnit Testing Framework to Existing Xcode Project

I am trying to integrate Unit Tests in my current Xcode project using the OCUnit Testing Framework. I have been following Apple's…
andrewRC
  • 61
  • 4
0
votes
1 answer

OCUnit test cases not running

If I create a new project which includes unit tests, the test cases get called. But when I'm adding tests to an existing project I'm getting the following in the log: 2013-05-21 19:41:08.814 otest[51593:7e03] Unknown Device Type. Using…
StudentX
  • 2,506
  • 5
  • 19
  • 28
0
votes
1 answer

Can we add dependency in between unit test class1 to unit test class2 iOS

I have started writing Unit Test cases for my existing application for testing functional flow. I am using OCUnit (SentestingKit.framework). App is client-server based app. There are five tabs in my app after login screen. My problem is I want to…
Ameer
  • 705
  • 8
  • 18
0
votes
1 answer

OCUnit testing problems in UINavigationController

I create single view application with 1) Story board 2) ARC and 3) Unit Testing. In view controller i drag on UIButton. and ViewContrller embedded with Navigation Controller (Using Interface). It run fine in when i simply run the application, But…
RahulSalvikar
  • 658
  • 1
  • 10
  • 31
0
votes
1 answer

What is the difference between STAssertEqualObjects and STAssertEquals?

I have the following class: #import "Period.h" @implementation Period ... - (BOOL)isEqualTo:(id)object { return [self isEqual:object]; } - (BOOL)isEqual:(id)object { if (object == self) { return YES; } if ([[object…
Glauco Vinicius
  • 2,527
  • 3
  • 24
  • 37
0
votes
1 answer

GHUnit as test bundle instead of separate target

Is it possible to create Test Bundle with OCUnit for unit tests, but instead OCUnit use GHUnit?
Piotr Wach
  • 913
  • 2
  • 9
  • 22
0
votes
1 answer

Unit test in didselectrowatindexpath in UItableview

I used the below code to call UITableView -(void)testJumpSection { NSIndexPath *indexPath1= [NSIndexPath indexPathForRow:0 inSection:0]; [viewControllerObject tableView:viewControllerObject.masterTableView…