When creating the project

You should check “Include UI Tests” in the project creation dialog.

https://i.stack.imgur.com/WrHnW.png

After creating the project

If you missed checking UI target while creating project, you could always add test target later.

Setps:

https://i.stack.imgur.com/zDp7e.png