1

so - I'm new to swift, but done lots of other languages - and I'm big into testing - I rely heavily on my tests to catch stuff - especially structurally.

I keep getting tripped up in Xcode - I hit "run" and it runs.. and I think I'm fine - then down the track I go to add another test, and find my test project doesn't even compile.

How do I make Xcode compile all the projects in the solution when I run any one of them, regardless of what I run. I don't want to be able to run my app, if there's a compile error in my tests... and I don't want to ever explicitly compile the test project. In the perfect world, it would also run all the tests before running the app, so I can't even run the app if I have a test failure.

Darren Oakey
  • 2,894
  • 3
  • 29
  • 55
  • https://stackoverflow.com/questions/6980025/how-to-run-ocunit-logic-tests-automatically-before-each-build-run-of-ios-app-i – matt Jun 19 '21 at 02:53
  • tried those suggestions - they seem to only be valid with older versions of Xcode - can't find any evidence of "test after build" existing anymore :( – Darren Oakey Jun 20 '21 at 00:20
  • Yes I was afraid of that. You might want to try AppCode instead... Also you will be a lot happier if you keep your testable code in a framework with its own unit tests, as this can be tested without leading the blasted Test Runner into the simulator. – matt Jun 20 '21 at 01:26
  • Another suggestion is to use CI. It doesn't solve exactly the problem you're describing but it makes sure the tests are always passing. – matt Jun 28 '21 at 23:49

0 Answers0