What to do when the error “Could not find test host for ~” appears in UnitTest on iOS
When I was working today, I got an error in the title for the first time in a while, so I’ll make a note of how to deal with it for a memorandum!
This error is probably caused by changing the Scheme and Configuration settings in the Xcode project, creating an application for each server connection destination, creating a Configuration for Test, and naming each application I think it happens when you run UnitTest after making changes.
To fix this error, you need to change the UnitTest Target Test Host setting.
The picture below is a sample of the screen of the Xcode project, but open the corresponding setting by the following procedure
- Select Target -> Build Settings for UnitTest
- Search for Test Host
And here you have to change the
ProductName for each
Configuration as in the above picture.
In the sample app above, the suffix of each
Configuration is added after the
ProductName as follows.
I use the abbreviation for
Configuration as the
suffix, so I add
-DD and so on.
By the way, you can edit the value for each
Configuration directly, but since it is also used in other setting items of the application, if you change one place, you have to change the other places as well.
So, in my case, I set a variable for
suffix in each
Configuration file as shown below so that it can be set collectively in the form of
PRODUCT_NAME_SUFFIX = -DD