That's probably a bad title, let's try with specifics: we have a network extension, it has some classes / functions of its own, and they, when push comes to build, depend on (for example) NEAppProxyFlow
and its subclasses. The code is written in Swift, since it is the language of the future.
If I want to do a unit test for my code, I need to provide something that at least looks like NEAppProxyFlow
, since I can't otherwise create one. I thought I could provide my own NetworkExtension
module for test case, but that... did not work well, and I still don't understand why.
On the other hand, I'm really bad at making unit tests, so the odds that I'm missing something fairly obvious to most other people are pretty high.
Matt Easton … said otherwise
Well, that kinda depends on your definition of “mock up a test object”. The thread that my colleagued linked to has itself a link to a more more detailed explanation of my advice on this topic.
If it were in ObjC, I could do #if and/or #define tricks to include different headers
Right. Some folks thing of this as a limitation of Swift, but personally I think it’s a good thing, because the structure it requires will server you well in the long term.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"