Host Application for SPM Tests

Couldn't find anything on this, but is there anyway to run swift test inside of a host application? Attempting to test a package that has keychain interactions.

Not sure exactly what the restrictions are you need to get around, but if calling through Process is allowed, this package has a method which would make the experiment a one‐liner. If it works, you can reverse‐engineer from there. (On the other hand, if using Process is a no‐go, then even statically linking the package manager itself probably would not work, since it uses Process internally to communicate with swiftc and xctest.)

Or do you mean applying the tests to a running application like Xcode does when you tell it to unit test an application target?

My previous answer assumed you only meant you needed to trigger the tests from an application of your own. describes the problem a bit more succinctly. This solves the issue in Xcode (looks like this goes back to Xcode 8, but I'm not sure of a way to fix the issue when running tests at the CLI with the Swift Package Manager.

Then you mean you want to unit test an application, not a framework.

That cannot be done from the package manager because there is no such thing as an application target.

For now, doing that requires Xcode.

Maybe mocking the keychain would be an alternate solution to the underlying problem?

It's a bit of both; like square/Valet, it's a framework to wrap functionality in the Keychain, but it must run within an application. Figured this would be the case with the package manager.