1

I'm trying out XCode UI Tests for the first time (XCUITest Framework) and getting stuck almost at the beginning. I'm following these instructions.

I created a new UI Testing Bundle target. It created the default boilerplate classes. When I try to run the HerdBossUITests.testExample() test the project fails to build with the error:

/path/to/code/BaseSyncableEntity.h:13:9: 'NYTPhotoViewerDataSource.h' file not found

The main target builds just fine and doesn't complain about this import. It's just when I try to run the XCUITest target that the build fails.

That line is:

#import <Foundation/Foundation.h>
#import "BaseClonableEntity.h"

#import <NYTPhotoViewerDataSource.h> // <-- this line
#import <QuickLook/QuickLook.h>

The NYTPhotoViewer is included in my project with CocoaPods, and as I said above, works just fine when I run the app via the main target.

# Uncomment this line to define a global platform for your project
platform :ios, '11.0'

source 'https://github.com/CocoaPods/Specs.git'

target 'HerdBoss' do
    use_modular_headers!
    pod 'AFNetworking', '~> 4.0'
    pod 'Firebase/Analytics'
    pod 'Firebase/Crashlytics'
    pod 'NYTPhotoViewer'
end

Why can't my XCUITest target properly build when my main target can?

Here is the full output from the build log. I tried to break up the lines to make it readable here and I searched and replaced the really long path names to try to make it easier to visually parse.

ProcessPCH /path/to/builddir/Build/Intermediates.noindex/PrecompiledHeaders/
SharedPrecompiledHeaders/2970504634487531785/HerdBoss-Prefix.pch.gch 

/path/to/code/HerdBoss/HerdBoss-Prefix.pch 
normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler 
(in target 'HerdBossTests' from project 'HerdBoss')
cd /Users/kenny/inaday/svn-herdboss/trunk/apps/iOS/HerdBoss
    
Precompile of '/path/to/code/HerdBoss/HerdBoss-Prefix.pch'
required by '/path/to/code/HerdBossTests/HerdBossTests.m'
    
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang 
-x objective-c-header -target arm64-apple-ios12.0-simulator -fmessage-length\=0 
-fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fobjc-arc 
-gmodules -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers 
-Wno-missing-prototypes -Wunreachable-code -Wquoted-include-in-framework-header 
-Wno-implicit-atomic-properties -Wno-objc-interface-ivars -Wno-arc-repeated-use-of-weak 
-Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch 
-Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value 
-Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants 
-Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion 
-Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion 
-Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match 
-Wundeclared-selector -Wdeprecated-implementations -Wno-implicit-fallthrough -DDEBUG\=1 
-DOBJC_OLD_DISPATCH_PROTOTYPES\=0 -isysroot 

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/
SDKs/iPhoneSimulator16.4.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations 
-g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing 
-Wstrict-prototypes -Wno-semicolon-before-method-body -fobjc-abi-version\=2 
-fobjc-legacy-dispatch -index-store-path /path/to/builddir/Index.noindex/DataStore 
-iquote /path/to/builddir/intermediates/HerdBossTests-generated-files.hmap 
-I/path/to/builddir/intermediates/HerdBossTests-own-target-headers.hmap 
-I/path/to/builddir/intermediates/HerdBossTests-all-target-headers.hmap 
-iquote /path/to/builddir/intermediates/HerdBossTests-project-headers.hmap 
-I/path/to/builddir/Build/Products/Debug-iphonesimulator/include 
-I/path/to/builddir/intermediates/DerivedSources-normal/arm64 
-I/path/to/builddir/intermediates/DerivedSources/arm64 
-I/path/to/builddir/intermediates/DerivedSources 
-F/path/to/builddir/Build/Products/Debug-iphonesimulator 
-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/
SDKs/iPhoneSimulator16.4.sdk/Developer/Library/Frameworks 
-F/Applications/Xcode.app/Contents/Developer/Library/Frameworks 
-iframework /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/
Developer/Library/Frameworks 
-c /path/to/code/HerdBoss/HerdBoss-Prefix.pch -MD -MT dependencies 
-MF /path/to/builddir/Build/Intermediates.noindex/PrecompiledHeaders/
SharedPrecompiledHeaders/2970504634487531785/HerdBoss-Prefix.pch.d 
-iquote /path/to/builddir/intermediates/HerdBossTests-generated-files.hmap 
-I/path/to/builddir/intermediates/HerdBossTests-own-target-headers.hmap 
-I/path/to/builddir/intermediates/HerdBossTests-all-target-headers.hmap 
-iquote /path/to/builddir/intermediates/HerdBossTests-project-headers.hmap 
-I/path/to/builddir/Build/Products/Debug-iphonesimulator/include 
-I/path/to/builddir/intermediates/DerivedSources-normal/arm64 
-I/path/to/builddir/intermediates/DerivedSources/arm64 
-I/path/to/builddir/intermediates/DerivedSources 
-o /path/to/builddir/Build/Intermediates.noindex/PrecompiledHeaders/
SharedPrecompiledHeaders/2970504634487531785/HerdBoss-Prefix.pch.gch 
--serialize-diagnostics /path/to/builddir/Build/Intermediates.noindex/PrecompiledHeaders/
SharedPrecompiledHeaders/2970504634487531785/HerdBoss-Prefix.pch.dia

In file included from /path/to/code/HerdBoss/HerdBoss-Prefix.pch:18:
In file included from /path/to/code/HerdBoss/Classes/BaseTableViewController.h:12:
In file included from /path/to/code/HerdBoss/Classes/AppController.h:14:
In file included from /path/to/code/HerdBoss/Classes/Settings.h:11:
/path/to/code/HerdBoss/Classes/BaseSyncableEntity.h:12:9: fatal error: 'NYTPhotoViewerDataSource.h' file not found
#import <NYTPhotoViewerDataSource.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229

0 Answers0