‘NSInternalInconsistencyException’ when running UITesting with Xcode 7
I had a similar issue and my mistake was trying to use UI testing code in a regular test target. Once I made a new target, starting with "iOS UI Testing Bundle" and copied the code there the error went away. Here's the thread that pointed me in the right direction: https://twitter.com/punksomething/status/609505357132500993 "Yeah, I was trying to use a UI test in a regular test target. Had to create a newly added UI Test target"
I had this exact problem. I think the issue stemmed from renaming a target along the way. None of the fixes here helped me with my issue. Since I was just getting started and hadn't written any tests yet I deleted the entire target for the UI tests and re-added it. Same name and everything started working just fine.
If you run into this issue, its possible it is due to the naming. You can track it down that way or save your tests and re-add a UI target.
I got this after renaming my target. The solution was to set the 'Target Application' to 'None' in my UITest target and hit build. After this I set 'None' back my app and the error resolved. I think it's highly possible that the renaming messed up the ui test target's 'Target Application' settings.
This happened to me when I was trying to add a new class to my unit test target but I've selected UI Test Case Class template instead of Unit Test Case Class template.
Make sure that you always select proper one. Eventhough they are both XCTestCase subclass and you assign them to proper target, it will throw this error when selecting wrong template.