Trouble with testing
I have the latest AppCode (downloaded the morning of April 26th), but I'm having some trouble running test cases.
I can run the example test case just fine, but if I allocate objects in my test cases, I get "Unable to attach test reporter to test framework":
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/Developer/usr/bin/otest -SenTest FooTests /Users/blah/Foo/build/Debug-iphonesimulator/FooTests.octest
Testing started at 5:14 PM ...
The test bundle at /Users/blah/Foo/build/Debug-iphonesimulator/FooTests.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, possibly because the framework or library had an incorrect install path at link time.
Process finished with exit code 1
What does this mean? For this file, the behavior only occurs when I alloc a new object.
I also tried creating a fresh test, had it inherit from SenTestCase and implemented a simple test method:
-(void)testInclusion
{
STAssertTrue(1 == 1, @"universe is broken");
}
I get the same error I got above when I try to run this file (and I haven't even created any objects).
Please sign in to leave a comment.
Please describe the structure of your testbundle dependencies and their paths (frameworks, etc.).
I'm not too familiar with the interface of AppCode - where would I find that information?
Could you just attach the sample project with this behaviour?
All the needed information is in <project>.xcodeproj/project.pbxproj file.
The fix is already pushed I just want to verify if it works for you.
Hi Greg,
Thanks for fixing. I'm actually just using a wizard-generated project created in AppCode.
Is the fix publicly available?
Sure, it will be available in the next EAP as always.
I'm still having this issue with the latest EAP - 108.293.
I have the same problem on 108.318. The default template tests worked fine until I added a library dependency (xml2) ie. not a framework. This dependency was added in xcode4 and the unittests runs from within xcode, but they fail with dylib not found in AppCode.
I can't find a way to see what libs are linked in AppCode .
I'm using
AppCode 108.318
xcode 4.0.2 build 4A2002a
iPhone SDK 4.3
I have issues running tests with the same versions as Thomas:
AppCode 108.318
Xcode 4.0.2
iOS SDK 4.3
I'm not sure whether I have the exact same issue - mine is below:
The test bundle at <my-path>/MyAppTests.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, possibly because the framework or library had an incorrect install path at link time.
The tests run fine in Xcode 4, and I think they even worked with a previous version of AppCode; however, I've made changes to my project, so it's possible something I introduced broke the tests in AppCode, rather than a change to AppCode breaking my tests.
After carefully trying to avoid this problem by reverting every time it appears, I did a reorg of the files in my project and now the octest fails again in AppCode. Not when run from Xcode, only in AppCode. This is using build 108564.
Just tried to launch the unittest from the command line and it shows that NSAutoreleasePool isn't linked in. Odd
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/Developer/usr/bin/otest -SenTest Self /Users/tchristensen/Library/Developer/AppCode/DerivedData/fokuson-6af0ce53/Build/Products/Debug-iphonesimulator/fokusonTests.octest
dyld: Symbol not found: _OBJC_CLASS_$_NSAutoreleasePool
Referenced from: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/Developer/usr/bin/otest
Expected in: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/Developer/usr/bin/otest
Trace/BPT trap: 5
That sounds a bit like it's using the Mac OS system framework library instead of the one in
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework
Well, sometimes when I'm using AppCode the project in XCode changes to only have Mac 64 bit in the scheme list. If I restart Xcode and appcode it comes back to iphone, ipad and ios as possible schemes. Not sure the NSAutoreleasePool object missing is of important. I tried to execute the unittest binary created by xcode and that fails on the commandline with the same error - but works from within xcode.
I have a suspicion that this has to do with adding classes. I added SBJson classes by copying them into xcode (drag and drop) and marked all .m files to be part of both my app binary and my unittest binary. But that is unnecessary because the unittest depends on the app target already. I'm not sure if that means the classes are compiled into both, but if I remove the .m files from the unittest target it still works in xcode.
No matter what I do, AppCode still can't handle it. Even if I delete the AppCode generated files and make it open the xcode project from scratch, it still cannot execute the tests. Appcode can build and run the other targets.
I'd guess that XCode overrides the standard search path for dynamic library linking when it executes the tests.
But that would imply that executing unittest never works in AppCode and they do initially. I have only added source files to my project since it last worked. SBJson and DTCustomColoredAccessory to be specific.
I've created a youtrack ticket for this problem
http://youtrack.jetbrains.net/issue/OC-1169