I'm testing MacOS app and it relies a lot on the network condition, because it is uploading a lot of files.

I would like to simulate a network condition on my macbook, that automatically changes to simulate network condition in the wild, train, forest etc.

How could I do that?

I was thinking of pf, but not sure if a script can be set up to automatically change speed, packet loss every X seconds for let's say 15 minutes (depending on how many files are being uploaded by that app).


1 Answer 1


You can simply create a stubbed version of your clients objects that simulate some behavior. Then in the tests you inject this stubbed client.

interface Client {



class RealClient {

   callTheNetwork() { return http.call(); }


class SlowClient {

   callTheNetwork() {
     return stubbedResponse; 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.