One common requirement for testing apps that are supposed to run in a variety of contexts is related to the device-under-test’s network speed. An app that runs just fine on an LTE connection will not necessarily run with the same quality on a GPRS or EDGE connection. So how do you make sure that your app works well across all types of connections?
There are of course services out there that will give you the ability to test on actual devices connected to actual networks in different locations and at different speeds. Sometimes, though, all you need is to throttle the network connection to your test device to see how your app will behave under different network conditions. Appium provides a way to do this for Android devices. Well, not all devices–it only works for emulators. Luckily, TestProject supports automation of Android Emulators, so if network speed modulation is an attractive feature for you, you can make it work with TestProject and Appium.
If you were using Appium directly, it’s fairly easy to adjust the network speed of an Android Emulator in code. For example, in Java, you could run a command like the following:
This code uses a Java enum class that holds values for all the different speeds available. They are:
(Here, “FULL” means no network throttling. And if you were using Appium directly, you could also set this with a desired capability.)
With the new Android Emulator Network Speed Modulator Addon, you can add a global action that prompts for one of these speeds. All you have to do is type in the speed you want (in exactly the format as shown above, using all caps), and when the action is run, the network speed will be adjusted. This actually changes it for the emulator as a whole (not just for the course of a test), so if you want to reset the speed to FULL, make sure you do that at some subsequent point (I chose to do it both before and after the rest of the test, to make sure that if the state is messed up from a previous test, I still start out each test at full speed).
That’s really all there is to it! 😉 Of course, the emulator is still using the host’s network, so these “synthetic” speeds will all be dependent on the host’s network. If the host’s network is slower than LTE speeds, for example, you won’t get an accurate rendition of the app’s performance at LTE (or FULL) speeds. Still, it’s a very useful tool for seeing how long it takes for your app to load a webpage or make calls to a backend API, especially for users that have devices operating at much slower network speeds than you as an early adopter of technology and developer or tester of your app!
The following diagram illustrates how you can make sure your Mobile app works well across all connection types using the TestProject Speed Modulator Addon:
Which kind of Addon would you like to see next? Share your ideas in the comments below!
In the meantime, check out some previous Addons I’ve already created and shared with the community 👉