YES!! THANK YOU!
I lost several hours to debugging this today. After updating our iOS app to Swift 3 and Xcode 8.0b6, all Keychain accesses in our application were failing during unit testing, on a real device or in the simulator. I nuked all codesigning stuff from orbit, rebuilt it all manually, nuked it again and let Xcode try its "automagic" mode, and repeated this with various build settings tweaks... nothing worked and the app couldn't be tested.
And, because of the insane multi-year legacy of the "Keychain error -34018", there are tons of red herrings and unrelated threads on the interweb tubes, and rabbit holes to go down.
But, eventually I got to the end of this thread, and saw your tip to enable the "Keychain Sharing" entitlement for the main application being tested.
Et voilà. Xcode can run all the automated tests that involve the Keychain (SecItemAdd(), SecItemDelete() and friends...) and they all now work, rather than returning errSecMissingEntitlement (-34018).
So, thanks to your comment, my problems are totally solved. Sorry I can't help you with your remaining issues, but I just wanted to note for the record that your tip, at least in the case of my vanilla iOS-app-plus-test-bundle case, totally fixed things.