Testing a Proxy Provider?

I'm mostly thinking of a Transparent Proxy Provider, as usual, but... how does one test it? I can't see how one would do it with unit tests (although you could break out code and test some of that code). Since it requires MDM or user approval, that makes automated tests a bit difficult. I have this monstrous vision of writing a program that loads the extension and invokes the appropriate methods on it but that just leads to other questions about subclasses.

I'm sure other people have thought about this and am curious what the thoughts are. 😄

Yes, testing today with any of the providers is a bit of a manual process without the use of MDM to bypass the System Extension prompt. But this is really to test the provider machinery really. If you have other logic that you could break out into isolated pieces to test then that would be another option. For example, your flow copying logic relies on NEAppProxyFlow objects, but you could mock up a test object that represents the infrastructure in this class to just pipe network traffic into it to exercise your flow copying logic. Likewise for other pieces of logic such as identifying who the owner of the flow is etc..

Matt Eaton - Networking

Well, we'd also want to be able to test the XPC parts, since they're such a large part of the, ahem, process.

Well, we'd also want to be able to test the XPC parts, since they're such a large part of the, ahem, process.

I'm not exactly sure of the workflow you have here but if you are sending XPC messages to a daemon then you could possibly mock up a set of files that represent testing messages and then have a set of classes in your tests that do the XPC connection and send a predefined set of messages over the connection to your daemon and validate that you are receiving the right response. Then you could use this set of classes each time you run your unit tests.

Matt Eaton - Networking

At an extreme end, I was thinking of having the wrapping process (the one that would load & instantiate the class) setting up its own Mach listening for the correct name, so it'd be able to test those parts.

As part of the other stuff I've bee doing recently, I've been factoring out some of the code (for example, all of the flow reads & writes are done in a different class now, resulting in reduced complexity in the TPP subclass.)

Testing a Proxy Provider?
 
 
Q