ocunit

OCUnit testing an embedded framework

一曲冷凌霜 提交于 2019-12-01 03:03:11
问题 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 not be loaded because a link error occurred. It is likely that dyld cannot locate a framework framework or library that the the test bundle was linked against,

Unit Tests fail, then don't

末鹿安然 提交于 2019-11-30 23:15:18
After some serious frustration and headaches, I've managed to add unit tests to an existing project. The problem is, the tests only get executed 50% of the time. I have a test method with an STFail macro inside, when I run the tests, it fails as I'd expect. Then, I run the tests again without touching any code/settings and it will pass without hitting breakpoints in the test fixture. The console prints out this output when this happens: The executable for the test bundle at ... octest could not be found. I've had a Google but there doesn't seem to be many/any people with this exact issue and

Unit Tests fail, then don't

╄→гoц情女王★ 提交于 2019-11-30 18:18:53
问题 After some serious frustration and headaches, I've managed to add unit tests to an existing project. The problem is, the tests only get executed 50% of the time. I have a test method with an STFail macro inside, when I run the tests, it fails as I'd expect. Then, I run the tests again without touching any code/settings and it will pass without hitting breakpoints in the test fixture. The console prints out this output when this happens: The executable for the test bundle at ... octest could

Is it possible to unit test a static library project using XCode's SenTestingKit?

眉间皱痕 提交于 2019-11-30 17:36:33
I've created an iOS unit test target for doing logic tests following the steps provided in Apple's documentation. However my build fails and i get the following error: Undefined symbols: "_OBJC_CLASS_$_MyClass", referenced from: objc-class-ref-to-MyClass in LogicTests.o ld: symbol(s) not found collect2: ld returned 1 exit status Ordinarily, if I wanted to use my static library within an application I would include the library.a file, and the headers(including the MyClass.h file...). Is something additional required to run logic tests on a static library WITHIN that same project if my test

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

戏子无情 提交于 2019-11-30 16:24:57
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? Ok, there are two questions being raised here: Is unit testing worth it? Answer: Definitely. I cannot count the times it has saved me hours of pain and suffering. What's the best way to unit test in the iPhone/iPad environment? Answer: for myself I skipped sen and moved onto GHUnit and OCMock. GHUnit allows in simulator testing and debugging where as sen doesn't.

iPhone - Retrieving Resources for logical unit tests

天大地大妈咪最大 提交于 2019-11-30 10:47:13
问题 I've been following Apple's documentation on writing unit tests for the iPhone, and out of the box, the routine doesn't seem to work. I'm not sure I understand where the unit test is going to get the reference to the application delegate. My Dependencies are like the following: My_Program_target -> UnitTesting_target -> UnitTests_bundle The following code snippet is where the assert fails. I'm very familiar with CPPUNIT, but I'm having trouble understanding how this crosses over. - (void)

Some of my unit tests tests are not finishing in XCode 4.4

时间秒杀一切 提交于 2019-11-30 07:58:57
I have seen people posting about this here and elsewhere, but I haven't found any solution that works. I am using XCode 4.4 and have a bunch of unit tests set up. I have ran them all before on this project, so I know that they do pass/fail when they are supposed to if they are actually ran. I have about 15 test suites, and each one contains 1-7 tests. On most attempts, all of the test suites finished (and passed) except for 1 (FooTests). It gives the warning: FooTests did not finish testFoo did not finish XCode will report that testing was successful, regardless of what happens in unfinished

XCTAssertEqual error: (“3”) is not equal to (“3”)

半城伤御伤魂 提交于 2019-11-30 07:51:38
NSMutableArray *arr = [NSMutableArray array]; [arr addObject:@"1"]; [arr addObject:@"2"]; [arr addObject:@"3"]; // This statement is fine. XCTAssertTrue(arr.count == 3, @"Wrong array size."); // This assertion fails with an error: ((arr.count) equal to (3)) failed: ("3") is not equal to ("3") XCTAssertEqual(arr.count, 3, @"Wrong array size."); What don't I understand about XCTAssertEqual? Why does the last assertion fail? I have also had quite a bit of trouble with Xcode 5's tests. It still seems quite buggy with some odd behaviour - however I have found the definitive reason your particular

Occasional errors when running OCUnit application test suite on device

一曲冷凌霜 提交于 2019-11-30 06:44:07
I'm having some problems with my OCUnit test suite, when running application tests (i.e. on the device). Occasionally, I get a tricky error that seems to be thrown from the OCUnit classes. I've been trying to look through the files added to the test suites, but can't get my head around it. I've followed the Apple documentation and looked at other tutorials when setting up my test targets, resulting in the following targets (and indented dependencies): LogicTests MyApp LogicTests ApplicationTests MyApp MyAppTesting ApplicationTests The last (MyAppTesting) is the one I run on the device to start

Is it possible to test IBAction?

空扰寡人 提交于 2019-11-30 05:07:38
问题 It is kinda easy to unit test IBOutlets, but how about IBActions? I was trying to find a way how to do it, but without any luck. Is there any way to unit test connection between IBAction in a View Controller and a button in the nib file? 回答1: For full unit testing, each outlet/action needs three tests: Is the outlet hooked up to a view? Is the outlet connected to the action we want? Invoke the action directly, as if it had been triggered by the outlet. I do this all the time to TDD my view