Peter Boné
Peter Boné

Reputation: 131

Having separate schemes for test targets in Xcode?

We have the following project structure:

Workspace:
- app project
- cocoapods project


App scheme:
- app target (run)
- ui test target (test)
- unit test target (test)

After upgrading to Xcode 10, Xcode insists on building the entire project, including pods and ui tests, every time I run a single unit test, which is a quite heavy and slow process.

If i create a seperate scheme which only include the unit and/or ui tests, it only rebuilds the tests when I run them. Just as I want.

However, as they are no longer member of the main app scheme, I can no longer press Test on the main scheme, as it no longer contains test targets.

My question is then: Is it normal or recommended to have seperate schemes for tests, or can I prevent the entire project from being rebuild in another way, when running a single unit test?

(note: I have set the Host Application setting to None on the unit tests, so I don't get why it always builds the entire project anyway?)

Upvotes: 0

Views: 1382

Answers (1)

Jon Reid
Jon Reid

Reputation: 20980

Why not both? In your "Test All the Things" scheme, add each test target. This scheme should be shared.

But when I'm working in one target, I make a scheme for it alone. (More accurately, AppCode creates one for me.) Such schemes are not shared.

Upvotes: 1

Related Questions