‘NSInternalInconsistencyException’ when running UITesting with Xcode 7 ‘NSInternalInconsistencyException’ when running UITesting with Xcode 7 xcode xcode

‘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"


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.

enter image description here


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.