Couldn't unit test NetworkExtension Target

I tried to unit test the method "FilterDataProvider.handleNewFlow" from the sample project

https://developer.apple.com/documentation/networkextension/filtering_network_traffic

I always get this below issue,

Undefined symbols: Linker command failed with exit code 1 (use -v to see invocation)

Could someone help with it?

I tried to unit test the method FilterDataProvider.handleNewFlow from the sample project

You won’t be able to do this. The NE provider infrastructure only works within an NE provider, and an XCTest unit test is unable to target that.

Having said that, I don’t think you’re missing out on much. A unit test is meant to test a unit in isolation. If your unit test has to rely on NE provider infrastructure then it’s not a unit test; it’s an integration test. IMO you should factor your core logic out of your provider and then have you unit tests focus on that.

I talk about this in more detail, albeit for a very different API, in this post.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks @eskimo for the quick reply ❤️. I got it, we'll do the integration test.

Couldn't unit test NetworkExtension Target
 
 
Q