Mihai Damian
Mihai Damian

Reputation: 11432

Can't run unit tests in Xcode 8 with earlier unit test configuration

I ran into this issue after upgrading to Xcode 8. When running the tests I get this error at run time:

/Users/<me>/work/<appname>/Build/Intermediates/<appname>.build/Debug-iphonesimulator/<appname>UnitTests.build/Script-231C35D610AC1F5000D830C2.sh: line 3: /Applications/Xcode.app/Contents/Developer/Tools/RunUnitTests: No such file or directory

The sh script in the error message is trying to access the RunUnitTests tool and fails. I assume this tool has been removed in Xcode 8. It seems that for my project Xcode tries to run tests in a way that is no longer supported. If I create a brand new project no such script is created and I can run tests.

Any idea what settings I need to update in my project to get the tests running again? I tried the 'Update to recommended settings' checklist but it doesn't solve this issue.

Upvotes: 12

Views: 2254

Answers (2)

Sagar Mody
Sagar Mody

Reputation: 531

Removing Run Script from the Build Phases didn't help me.

I simply copied /Applications/Xcode.app/Contents/Developer/Tools/RunUnitTests from my older Xcode into my XCode 8 package content. Give it right permissions: RWXR-XR-X

And it worked for me.

Upvotes: 0

Mihai Damian
Mihai Damian

Reputation: 11432

It seems I only needed to remove the Run Script phase that invoked that script.

Upvotes: 22

Related Questions