Akash Kundu
Akash Kundu

Reputation: 1358

Using XCUI tests and XC tests together

I am trying to use XCUI and XC tests together. I found this twitter post saying it was possible. However, which section in the build settings do I put those new attributes?

I ask because I tried the method and put those settings in the user defined section of the project target and it would not let me run my tests because those settings were defined.

Upvotes: 0

Views: 116

Answers (1)

Jon Reid
Jon Reid

Reputation: 20980

UI tests operate like this:

  • The app is launched.
  • Tests control another process external to the app, telling the app what to do.

Unit tests operate like this:

  • The app is launched.
  • The test code is injected into the running app.
  • The tests are executed.

These are radically different. UI tests operate strictly from the outside. They have no access to the internals of the program. In the end, UI tests boil down to simulating user actions.

Unit tests, on the other hand, operate from the inside. They can reach anything that is non-private.

The only way for UI tests to perform something like a unit test would be to build the test functionality into the production code, accessible through gestures. There are better ways to unit test than that, namely using unit testing frameworks.

So… no. They shouldn't live together.

Upvotes: 2

Related Questions