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
13
votes
4 answers

Accessing a UIImage inside a OCUnit test target

I'm currently writing an image manipulation test for an iPad app. I have a resources folder inside my unit test target with a photo inside, however when I try to access it using [UIImage imageNamed:@"photo1.jpg"] no image gets returned. If I change…
treeba
  • 469
  • 5
  • 10
12
votes
2 answers

how to write expected failures?

In Xcode, at the end of my unit tests I get a result like this: Test Suite 'All tests' finished at 2012-12-06 10:23:38 +0000 Executed 195 tests, with 0 failures (0 unexpected) in 4.314 (4.485) seconds I would love to find out how can I define…
SystematicFrank
  • 16,555
  • 7
  • 56
  • 102
11
votes
4 answers

OCUnit Application Test with Simulator in terminal

Is it possible to start an application test that runs in the simulator with a terminal command(s)? Thanks
Mats Stijlaart
  • 5,058
  • 7
  • 42
  • 58
11
votes
5 answers

SenTestingKit in Xcode 4: Asynchronous testing?

I have been searching for a way to use SenTestingKit to do some integration testing between my client-side code and our server. I haven't had any luck. It seems that once the code is run in a method, the object gets destroyed. This means that any…
hocker
  • 688
  • 6
  • 18
11
votes
4 answers

Unit Testing broken in iOS 4.1 SDK?

After upgrading to the 4.1 iOS SDK my unit test bundles always return with the following two errors and one warning: An internal error occurred when handling command output: -[XCBuildLogCommandInvocationSection setTestsPassedString:]: unrecognized…
Matt Baker
  • 3,394
  • 3
  • 25
  • 35
11
votes
2 answers

SenTestKit: cleaning up after ALL tests have run?

I am using SenTest in XCode for my unit tests. I must run a command-line task for my unit tests to test. I can do that in the +initialize method of my test class (subclass of SenTestCase, of course). I would like to terminate the command-line task…
Mel
  • 959
  • 11
  • 19
11
votes
4 answers

Timed out waiting 120 seconds for simulator to boot

It looks like Teamcity agent (TC version is 9.0 EAP) has issues with launching iOS Simulator via testing shell script. I use Build Step: Command Line, which runs Custom Script and passes params to it. Teamcity agent is launched on Mac OS X Yosemite…
sig
  • 6,024
  • 2
  • 26
  • 31
11
votes
4 answers

Prevent app from creating a viewcontroller when running unit tests

When I test my app using OCUnit, it sets up the AppDelegate, window and rootViewController as usual before running the tests. My rootViewController then adds itself as an observer for some NSNotifications. When I test these notifications with…
Dorian Roy
  • 3,094
  • 2
  • 31
  • 51
10
votes
2 answers

How do I unit test for EXC_BAD_ACCESS?

I know how to resolve EXC_BAD_ACCESS issues, but I'm not sure how to unit test for it. Is there a way to capture EXC_BAD_ACCESS in code instead of simply crashing? Here's why I ask: I have written a library that heavily uses blocks, like this: -…
greenisus
  • 1,707
  • 14
  • 17
10
votes
2 answers

How do I trap OCUnit test pass/failure messages/events

I'm trying to use xcodebuild and OCUnit with my Continuous Integration server (TeamCity). JetBrains offers test observer implementations for boost::test and CppUnit that format test output in a way that TeamCity can interpret. I need to do…
orj
  • 13,234
  • 14
  • 63
  • 73
10
votes
2 answers

Unit testing and TDD, OCUnit vs Google Tool Box

I'm trying to choose between OCUnit and Google Tool Box, do you have any preferences, would recommend one or the other, why ? I would be very interested to hear about your experiences with any of the 2. The main problem i have with both of them is…
user142764
  • 1,893
  • 1
  • 13
  • 15
10
votes
1 answer

Why do my OCUnit tests fail with "code 138"?

I'm currently trying to learn objective-c using XCode 3.1. I've been working on a small program and decided to add unit testing to it. I followed the steps on the Apple Developer page - Automated Unit Testing with Xcode 3 and Objective-C. When I…
Joe
  • 796
  • 1
  • 7
  • 15
9
votes
4 answers

Conditional unit testing based on iOS version

My unit test suite contains a few test cases that are only applicable for the latest iOS version. Expectedly, these tests fail when running the suite on an older iOS version. Is there a standard way to indicate that these test cases should run on a…
hpique
  • 119,096
  • 131
  • 338
  • 476
9
votes
5 answers

Can I integrate Jenkins and XCTest

Is it possible to use Jenkins with XCTest? There's a ruby script (OCUnit2JUnit -- https://github.com/ciryon/OCUnit2JUnit) that parses OCUnit output and creates XML files that Jenkins can parse. Is there something equivalent to handle the new XCTest…
8
votes
2 answers

Unit testing with UIWebView

When creating an UIWebView inside an unit test I get EXC_BAD_ACCESS: -(void)test1 { [[UIWebView alloc] initWithFrame:CGRectZero]; // EXC_BAD_ACCESS } Is there a special configuration to run units test that involve UIWebView? I'm using…
hpique
  • 119,096
  • 131
  • 338
  • 476
1 2
3
17 18