Simulating cellular data network over Wifi
In the course of the last few years we’ve developed and tested quite significant number of mobile applications. To no surprise we quickly discovered that our test environment doesn’t fully reflect reality as we were using our in-house wifi and broadband for testing data connection on mobile. As we all know wifi is way more reliable than the service delivered by our mobile operators. Using EDGE, HSDPA (or even LTE) we’re facing issues with low bandwidth, high latency, lost packets, unstable connection and even random network failures. These aspects of mobile apps testing forced us to look for solutions that could help to simulate “real life” conditions.
We found a set of tools to limit network bandwidth on developer’s workstations and test devices but none of these were good enough. Some of the disadvantages we discovered:
- hard to setup
- some of them worked only on emulators (not real devices)
- often quite expensive
- not easy to set up on multiple workstations
- not possible to monitor network traffic
- platform specific (purely Android or iOS)
This led us to a conclusion that we would have to build our own solution using wifi protocol (as it supports multiple SSIDs and makes it easy to create separate wireless networks within one radio).
We set our goals high:
- platform agnostic (could be used across all mobile platforms as well as PC and Mac)
- support environment with multiple devices and multiple testers
- should be accessible and configurable from developer’s machine
- simulate different networks: LTE, HSDPA, EDGE
- simulate delays, packet loss and data corruption
- easily change test scenario (using PC or Mac)
- monitor and capture network traffic
- make it easy to set up on different routers
That’s how the Cellular Data Network Simulator was born. It’s innovative approach to mobile apps testing. You can set it up as a dedicated wireless network to simulate different network conditions and to monitor traffic.
Cellular Data Network Simulator can be deployed on any wireless router capable of running OpenWrt. The solution uses: bash (as CGI script interpreter), netem (to emulate packet loss and delays), HTB (to apply per-device bandwidth limits) and iptables (to gather statistics). It also supports CloudShark (web version of Wireshark network protocol analyzer) to visualize network traffic and inspect packets. So, to sum it up, using Cellular Data Network Simulator user can:
- simulate: low bandwidth, delay, packet loss, packet corruption, occasional loss of signal
- capture the traffic and send it to CloudShark
- apply limits per device
After installing and configuring the package (please refer to README for details) the whole functionality is available through web based control panel (see the screenshot below).
This website gives an overview of all active devices, list of available events (packet captures for example) and list of available profiles. Every device connected to the wireless network can be “paired” with Cellular Data Network Simulator by scanning the QR code displayed on the screen. It’s all that simple! So go on and grab Mobile Bandwidth Simulator from Github and enjoy your perfect mobile apps testing environment.
Lead Software Engineer