Ever time a start a Xcode project without UI Test.... I regret that decision. Because, I will - at some later momement want to write a XCUI test... and the Bundle is not in the project. So then I'm frailing about in the menu system and cannot find the starting point. So this time - I'm writing it down.
1) File > New > Target... (that's the secret starting point a new target)
2) ... Filter for "test"
3) Select UI Testing Bundle - click Next
4) You can change the name of the Product Name (I like to shove an underscore in there).
When you are adding the Unit Test Bundle - Target.
So the testing icon appears to be a diamond - OK... but the UI Testing icon is a square.
I wish there was better consistance in this look & feel. And I wish the test failures would NOT be in red - as they appear at a glance to be a compiler error. I've asked Apple to consider orange... for testing but it has fallen on deaf ear (eyes).
I like to rename the Product Name to just "Unit Tests" it makes finding them in the sidebar much easier.
I see many people complain and delete the verbose testing example code... I wish they would stop for just a minute and express gratitude for the people that pioneered this awesome practice and consider the people pushing the boundaries... mob (ensemble) programming.
You may want to create your own template: View Unit Test Case.
You could start your template testExample with a Failure. Imagine that red X in orange!
I also always forget the syntax for importing the App project into the TestCase...
This would be a great thing for Apple Xcode engineers to ... one more thing!
@testable import MyApp // <== your App Target Here