I continuously see this pop up "Error Generating Code Coverage " when I try to run my UI Tests and this is followed by another error bundle identifier missing. I have enable code coverage in test scheme. I am really looking forward to run my UI Tests without this blocking error.
4 Answers
Apple had an issue which was filed under open radar for Xcode 9 and this got resolved with XCode 10
One potential solution would be :
Move to Xcode 10 and enable code coverage in Build Settings.
Also, in your test scheme by going into the Test action and check the "Enable the Code Coverage checkbox" to gather coverage data ( As you see in the image in the question )

- 718
- 8
- 13
I Resolved this temporarrily though not sure if it is proper solution.
Every time I need to clean project
Xcode -> Preferences -> Derived data(Delete this folder)
Build the project and then run the tests.

- 1,334
- 3
- 16
- 49
I am getting this error when using simulator with iOS < 10. So using later iOS version simulators solved the issue for me

- 74
- 4
I used to have a similar issue with the next error log:
14:35:45.129 Xcode[83419:1712361] _finishWithError:Error Domain=IDETestOperationsObserverErrorDomain Code=5 "Launch session expired before checking in." UserInfo={NSLocalizedDescription=Launch session expired before checking in.}
Resolved it by adding missed frameworks to the unit tests target:
- drag the built frameworks to the Link Binaries build phase of the tests target.
- in the Test target under the Build Settings tab, add @loader_path/Frameworks to the Runpath Search Paths if it isn't already present.
- make sure dependencies are present in a test bundle. Create a new Copy Files build phase with the Frameworks destination, then add the framework reference there as well.

- 1,357
- 11
- 13