Building Testable sample tests failed with "XCTest/XCTest.h" not found

2,141 views
Skip to first unread message

Apple C

unread,
Mar 9, 2015, 9:24:05 PM3/9/15
to kif-fr...@googlegroups.com
I downloaded KIF from https://github.com/kif-framework/KIF using git clone, then opened the  Documentation ▸ Examples ▸ Testable  Testable.xcworkspace from Xcode 6.2.  I tried using Command + U to run the tests but I am seeing the following build error:
"XCTest/XCTest.h" not found 

It's strange because I thought XCTest.framework should be included by default.  Anyone else ran into this?   Any pointers on how to fix this will be greatly appreciated.

Thanks!

Apple

Tony Mann

unread,
Mar 10, 2015, 6:39:22 PM3/10/15
to kif-fr...@googlegroups.com
Take a look at this pull request and see if it helps.

Tony

-- 
You received this message because you are subscribed to the Google Groups "KIF iOS Automated Testing Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kif-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Abbey Jackson

unread,
Sep 10, 2015, 2:53:11 PM9/10/15
to KIF iOS Automated Testing Framework
Hi Tony, I am having the same XCtest.h not found error. I looked at the link but I am not sure how it helps. I installed KIF yesterday so this is the newest version. 

I am also having a different error which may be related. I get this error:

ld: -bundle_loader can only be used with -bundle

clang: error: linker command failed with exit code 1 (use -v to see invocation)


​When I look on google it says that I need to add the target to Target memberships so I did that on the test files and then after I do that I get:

Lexical or Preprocessor error 'XCTest/XCTest.h' file not found


This happens in KIFTestCase.h


Do you know what could be going on ?

-Abbey

mike...@aol.com

unread,
Sep 10, 2015, 3:52:28 PM9/10/15
to kif-fr...@googlegroups.com
Abbey,
I am curious how you implemented KIF into your project. It should not be this difficult. Most people's issue is how they set up their Schemes and Targets in Xcode. 
Via Cocoapods or via Sources?

For my product, I am required to implement KFI via sources ...so if your installation is via cocapods, my experience may not apply.

But..., please explain how you set up your test target. Just to be clear, It's your test target that should integrate KIF and not your application under test.

Here are the basics to set up the test target.

For your test target: Build Phases > Target Dependencies
...you should have 2 targets appearing.
1) KIF
2) Your Application Target.

In the Test Target's Link List: Build Phases > Link Binary With Libraries.
...you should link in 2 libraries:
1) libKif.a
2) IOKit.Framework

IOKit.Framework is a private api library. In order to add it to your target link list you will have to browse to it.
For me, it's located at:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/IOKit.Framework

Hope this helps.
Mike

mike...@aol.com

unread,
Sep 10, 2015, 4:02:19 PM9/10/15
to kif-fr...@googlegroups.com
A bad edit broke the train of thought in the first paragraph. 
What I meant to say concisely was this...
I am curious how you implemented KIF into your project.
Via Cocoapods or via Sources?


Abbey Jackson

unread,
Sep 10, 2015, 4:53:59 PM9/10/15
to kif-fr...@googlegroups.com
Mike, 

I implemented it via cocoapods but this isn’t a KIF problem specifically. This project is rife with issues. I was just hoping someone would have seen this come up before and know what to do since the error is being triggered in KIF.

It turns out in the test target that Mach-O was set to “executable” and needed to be set to “bundle”. That fixed all the errors.

Interestingly my test target does not have these settings you have said. In Target Dependencies it has only the application target and in Linked Libraries it has only one also and it is libPods-AppNameTests.a

The tests are running now and I don’t want to risk causing problems so I am not going to add the others unless I have additional problems later. But hopefully this helps anyone else googling this problem :)

Now to get some KIFFING DONE! :)

--
You received this message because you are subscribed to a topic in the Google Groups "KIF iOS Automated Testing Framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kif-framework/rTIStSZA6q8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kif-framewor...@googlegroups.com.

mike...@aol.com

unread,
Sep 10, 2015, 5:33:45 PM9/10/15
to kif-fr...@googlegroups.com
Abbey,
Great news! Sounds like your persistence is helping you to work through the issues.

Seems like my test target setup does not mirror yours due to the cocoapods installation.

Like you, I also test on the actual hardware. So if you're having concerns, my experience may be able to assist.

Regards,

Abbey Jackson

unread,
Sep 11, 2015, 7:25:10 PM9/11/15
to KIF iOS Automated Testing Framework
Hey Everyone! I wanted to let you know about another possible fix for this error.

So the first one was I had to change the Mach-O setting from executable to bundle for the test target.

Today I encountered this error again in the middle of tests that were working fine. I discovered I somehow checked off one of the project targets (NOT the test target) in Target Memberships for a KIFTestCase file. 

If you get this " 'XCTest/XCTest.h' file not found " error hopefully one of these solutions will fix it for you!
Reply all
Reply to author
Forward
0 new messages