I expand on Jeffrey Fulton's comment in the previous answer. I banged my head on this issue for three days. In the FunctionsTests.swift file, I would try to import my module using @testable import myModule but when I try to run the tests, I always get the error Undefined character: enter metadata for function Y, and the test build will fail (while the normal build will fail work like a charm).
Jeffrey's comment fixed it for me. Here is a step by step from the very beginning.
To add tests for the command line tool, I needed to go to File >> New >> Target .... In the search area or find the MacOS testing package .
Then click "Change Scheme" when the application target is active. edit diagram
In the next panel on the left, go to "Testing" and add the test target here. go to Test, click on the plus and add the goal of the test
Finally, in the membership target panel, add each file to the test target. add test target membership
Only after that the test assembly was completed.
source share