Unit Test

How can i call a function that is private in my unit test

AFAIR you can't call private functions from your tests. You can import and call things that are internal when you do @testable import MyModule.

I think it's somewhat controversial, but I think the general consensus is you shouldn't Unit Test private methods, even if you could. One article: https://enterprisecraftsmanship.com/2017/10/23/unit-testing-private-methods/

1 Like