Adding unit tests to plugins?

Skip to first unread message

Nathan Henrie

Aug 24, 2022, 4:58:08 PM8/24/22
to Quicksilver


I’ve been banging my head on the wall trying to add unit tests to the plugin template.

Starting with a freshly cookiecutter-ed plugin, File -> New -> Target... -> Unit Testing Bundle, see that Target to be Tested is None and can’t be changed to the plugin.

I think the problem might be that the resulting binary is of Mach-O type bundle instead of executable, whereas the XCode unit testing stuff seems to want an executable as the TEST_HOST. I tried changing TEST_HOST (and Bundle Loader) manually to to the binary as well as to the Quicksilver executable with no success.

Tried using the GitHub search to see if any of the plugins on the QS org have existing unit tests but didn’t find any, but I’m not sure how well that search worked.

Do any of you know of an existing QS plugin that has unit tests?


Nathan Henrie

Aug 25, 2022, 4:12:12 PM8/25/22
to Quicksilver

Well, some progress —

By setting Bundle Loader, linking to QSCore, and changing the mach-O type from Bundle to Framework or Static Library, everything compiles, links, and the tests run.

Any ideas why I would need to change to a static library?

All of the build settings regarding stripping debug and swift symbols are set to off.

Xcode gives me errors about missing symbols:

  Assertions: System: Failed to load the test bundle. If you believe this error represents a bug, please attach the result bundle at /Users/n8henrie/Library/Developer/Xcode/DerivedData/QSasdf-dtdzxwslxbegikancingpnsvllhj/Logs/Test/Test-QSasdf-2022.08.25_14-08-54--0600.xcresult. (Underlying Error: The bundle “QSasdf Unit Tests” couldn’t be loaded. The bundle couldn’t be loaded. Try reinstalling the bundle. dlopen(/tmp/QS/build/Debug/QSasdf Unit Tests.xctest/Contents/MacOS/QSasdf Unit Tests, 0x0109): Symbol not found: (_$s6QSasdf0A11SwiftActionCACycfC)
  Referenced from: '/private/tmp/QS/build/Debug/QSasdf Unit Tests.xctest/Contents/MacOS/QSasdf Unit Tests'
  Expected in: '/Applications/')

But those symbols seem to be present in the binary:

$ nm QSasdf | grep 11SwiftActionCACycfC
0000000000009034 T _$s6QSasdf0A11SwiftActionCACycfC

Is there some reason this would need to be set as a static lib instead of a “bundle”? It looks like the (somewhat dated) Apple dev documentation on plugins recommends a bundle.

Thanks for any ideas.


Nathan Henrie

Sep 11, 2022, 5:21:50 PM9/11/22
to Quicksilver

I worked around by:

  • Adding the unit tests target to the .swift file
  • Adding the core Quicksilver frameworks to linked libraries in the unit tests’ build phases
  • Leaving everything as a bundle

If anyone wants to check it out, you should be able to run:

$ cookiecutter '' --checkout swift

and afterwards should be able to run the tests and see several actions for text objects that come up when searching for “swift”.

Please let me know if anyone can give it a shot! Will also start an issue.


Patrick Robertson

Sep 26, 2022, 7:22:38 AM9/26/22
Cool, this is great to have! So we can start creating plugins in Swift! 🎉

You received this message because you are subscribed to the Google Groups "Quicksilver - Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Reply all
Reply to author
0 new messages