Rightpoint / ios-template

A `cookiecutter` template for iOS projects
MIT License
94 stars 26 forks source link

Unit test target TEST_HOST values use `debug` for all configurations #149

Open armcknight opened 4 years ago

armcknight commented 4 years ago

I'm hitting a bug with fastlane where it can't build/run a test target because of the TEST_HOST setting value:

Reason: Could not find test host for ServicesIntegration: TEST_HOST evaluates to "~/Library/Developer/Xcode/DerivedData/<redacted app name>-gmyfcakdlvzgwyfrmtlureaezdpc/Build/Products/Develop-iphoneos/debug-<redacted app name>.app/debug-<redacted app name>"

Notice the Develop and debug there... there's a configuration mismatch.

I looked in the build settings and noticed that for all configurations, TEST_HOST has paths that contain debug. Is this correct or should they be changed to contain the values of PRODUCT_NAME in the app target? This would involve us requiring to abstract that into a user-defined setting like {{ cookiecutter.project_name | replace(' ', '') }}_PRODUCT_NAME which we'd reference from PRODUCT_NAME and use to construct the TEST_HOST paths.

Changing it to the actual PRODUCT_NAME of our app target fixes it on my end.

It could be that since someone had changed the values of PRODUCT_NAME at some point in my project, not updating the TEST_HOST values caused this drift that ultimately wound up as a build error.

The four lines in the template:

https://github.com/Rightpoint/ios-template/blob/master/PRODUCTNAME/app/PRODUCTNAME.xcodeproj/project.pbxproj#L1258:

TEST_HOST = "$(BUILT_PRODUCTS_DIR)/debug-PRODUCTNAME.app/debug-PRODUCTNAME";

https://github.com/Rightpoint/ios-template/blob/master/PRODUCTNAME/app/PRODUCTNAME.xcodeproj/project.pbxproj#L1639:

TEST_HOST = "$(BUILT_PRODUCTS_DIR)/debug-PRODUCTNAME.app/debug-PRODUCTNAME";

https://github.com/Rightpoint/ios-template/blob/master/PRODUCTNAME/app/PRODUCTNAME.xcodeproj/project.pbxproj#L1654:

TEST_HOST = "$(BUILT_PRODUCTS_DIR)/debug-PRODUCTNAME.app/debug-PRODUCTNAME";

https://github.com/Rightpoint/ios-template/blob/master/PRODUCTNAME/app/PRODUCTNAME.xcodeproj/project.pbxproj#L1737:

TEST_HOST = "$(BUILT_PRODUCTS_DIR)/debug-PRODUCTNAME.app/debug-PRODUCTNAME";