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
5
votes
3 answers

do I need to manually add each *.m file to my unit test target when it's needed?

I'm using Unit Testing in XCode 4. I've been adding my application *.m files to the unit test target "compile sources" as I refer to them so the unit test will build/run. Is there a better way here? Note - I've just tried adding the application…
Greg
  • 34,042
  • 79
  • 253
  • 454
5
votes
2 answers

Imported files not recognized in OCUnit

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…
mag725
  • 695
  • 2
  • 9
  • 22
5
votes
1 answer

Running a single test method

Using OCUnit & Xcode, is there a way of running just one test? Ideally, I'd be able to run just one test method, but if there's a way to just run a single test case, that would be OK too. What I'm currently doing is running the 'Test' task which…
Akshay Rawat
  • 4,714
  • 5
  • 40
  • 65
5
votes
6 answers

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…
d11wtq
  • 34,788
  • 19
  • 120
  • 195
5
votes
1 answer

iOS Application Unit Testing with Core Data, and Magical Record

I have an iOS app that uses Core Data along with the excellent Magical Record to manage persistence. Here is my problem: Our existing Unit Testing structure uses the standard iOS application tests. I want to run my unit tests with a clean in-memory…
Mark Struzinski
  • 32,945
  • 35
  • 107
  • 137
5
votes
2 answers

Jenkins iOS job broken because "FATAL: Log statements out of sync: current test case was null"

I setup a jenkins job for my iOS project. The host target runs smoothly while the unit test target failed on a very strange reason given by "jenkins console output" as below: [DEBUG] Test Case '-[WhereYouAreTests testShowMainTopbar]' started. Test…
5
votes
3 answers

Apple Mach-O Linker Error using Core Data classes in OCUnit

OK, here's my code in my test class: - (NSManagedObjectContext*)managedObjectContextWithConcurrencyType:(NSManagedObjectContextConcurrencyType)concurrencyType { NSManagedObjectModel *mom = [NSManagedObjectModel mergedModelFromBundles:nil]; …
CGee
  • 1,650
  • 5
  • 20
  • 31
5
votes
1 answer

Issue running iOS unit tests on command line (OCUnit + OCMock)

I'm trying to get unit tests to run in CI (Jenkins). I came across this a article online with some hacks to get tests running in command line. I tried it on an empty project with the default setup for unit tests and the instructions there work just…
4
votes
1 answer

Controlling order of unit test methods in OCUnit

I have been using OCUnit for unit testing in a project. I've managed to do all the setup required for OCUnit in Xcode 4.2 & successfully build my test cases. How can I control the order (priority) for a test case? I see that test cases are built in…
Ritika
  • 593
  • 1
  • 8
  • 21
4
votes
1 answer

Why is my UIWebView empty in my unit test?

I'm putting app-generated content into a UIWebView, and trying to test that I'm doing it correctly. Here's the HTML string I'm putting into the web view: @"

Come, let me clutch thee. I have thee not, and yet I see thee…

user23743
4
votes
4 answers

OCUnit: How to run tests without launching iPhone simulator?

I'm following iOS Development Guide: Unit Testing Applications. However, when I attempt to build (Command+B) the LogicTests target (step 8 of "Setting Up Logic Testing"), I get the error: "The selected run destination is not valid for this…
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
4
votes
2 answers

How to setup iOS UI tests as build dependency, like OCUnit?

I'd like to add UI tests to an iOS project, in the same manner as OCUnit tests. I know there is the Instruments + UIAutomation JavaScript approach, but I don't see how that fits into an automated build workflow. Can you setup Instruments +…
Martijn Thé
  • 4,674
  • 3
  • 29
  • 42
4
votes
2 answers

Is there a way to "Test" current file in Xcode4?

Is there a way to "Test" current file in Xcode4? That is if you are writting your 10th unit test, but rather than going TEST and having all unit tests run, you want to only trigger running those testing in the unit test file you are current in?
Greg
  • 34,042
  • 79
  • 253
  • 454
4
votes
2 answers

running test Case using OCUnit not working?

when run the target for test cases nothing is happening instead it is showing warning message warning: Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set). i am using xcode 3.2.5 and…
iOSPawan
  • 2,884
  • 2
  • 25
  • 50
4
votes
2 answers

What is a good tutorial for getting started with iPhone unit testing using OCUnit?

I am trying to get OCUnit to do anything on my project, but I am failing :-( Is there any good tutorial out there to get it work? Everything I find tells something different and they are all pretty complicated ... What I tried is e.g. set up a…
RRZ Europe
  • 954
  • 3
  • 14
  • 31