1

I am 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).

Thank you for any recommendation

1
0

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 {

   callTheNetwork();

}

class RealClient {

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

}

class SlowClient {

   callTheNetwork() {
     waitSeconds(3); 
     return stubbedResponse; 
   }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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