The current application network environment is more complex, network format has 2G, 3G, 4G network, there are more and more public Wi-Fi. Different network environment and network format difference, will affect the user to use the app. In addition, the current application of changing scene, such as into the subway, bus, into the elevator and so on, making weak network testing is particularly important. If the app doesn't handle a variety of network exceptions, users may experience app flashback, ANR, and data loss in their daily lives. Therefore, app network testing, especially weak network testing, is particularly important. This paper combs the application Network Test Essentials and weak network test common simulation methods, so that we have a comprehensive understanding of network testing.
App Network Test Essentials
?
1. Functional testing under each network
- Check basic function points under different networks
- Operator Mobile, Unicom, telecom access point testing (need to use the actual SIM card)
- If you have intelligent DNS capabilities, you also need to focus on operator judgment/collation
- Gaoyen, high loss packet, no net, false hotspot can also be classified into weak network testing category
2. Network Switching test
Some apps have smart DNS capabilities, and network switching involves DNS switching.
Network switching detection mechanism: Android can listen to system broadcast
3. Weak net Test
User experience and exception handling is a concern for each network scene, but in a weak network scenario, it needs to focus on.
Weak net test simulates what kind of network belongs to weak net
Below the 2G rate of time are weak nets, 3G can also be divided into weak network, general Wi-Fi is not zoned weak network testing category.
How to test for weak nets
1. Network switch of SIM card
Mobile-Settings-Mobile network Settings-Network type selection
3G, 4G cards can be set off 3g/4g, only go 2G network.
2, the specific weak network scene test, common scenarios include: Subway/bus, elevator, staircase, parking
3, using virtual machines to simulate network speed, such as the use of Raspberry Pi built weak network tester
4, the use of Software Network agent, simulation of different network bandwidth, delay rate, packet loss rate
A common tool method for weak network simulation: Charles Weak network simulation
?
Configuration parameter Resolution:
bandwidth--bandwidth, i.e. uplink, downlink data transfer speed
utilisation--bandwidth availability, most modern is 100%
Round-trip latency--the delay of the first request, in Ms.
mtu--the largest transmission unit, the maximum size of the TCP packet, can simulate the TCP layer more realistically, each transmission of the subcontracting situation.
releability--refers to the reliability of the connection. This refers to the reliability rate of 10kb. Used to simulate network instability.
stability--connectivity stability can also affect bandwidth availability. For simulating mobile networks, mobile network connections are generally unreliable.
Specific Network Settings Reference:
?
Fiddler can also be used for weak network environment simulation, specific reference: Fiddler weak network simulation
Method Two: Chrome's WebView debugging tool Weak network simulation
Using Chrome's WebView debugging tool, the disadvantage is that it is only available for weak-network simulations of web pages.
Specific steps:
(1) The application opens the WebView debugging function, the specific following:
if (Build.VERSION.SDK_INT >= build.version_codes. KITKAT) {
Webview.setwebcontentsdebuggingenabled (TRUE);
}
(2) Mobile phone link computer, run the app, enter the specific H5 page;
(3) Chrome Devtools Open WebView: Enter the chrome://inspect/#devices, will show that the device is connected, select the inspect to debug WebView
Network page, No throttling drop-down box, you can perform a web simulation.
Method Three: iOS phone comes with network Link conditioner Weak network simulation
iphone opens developer options, specific reference: reference
Settings-Developer Options > Network Link Conditioner Portal.
The system already has a common network configuration built in, or you can add custom configurations.
Specific configuration parameters:
In Bandwidth downlink bandwidth, which is the downstream network speed
In packet loss packet drop rate
In delay downlink delay, Unit ms
Out bandwidth Upstream bandwidth
Out packet loss uplink packet loss rate
Out delay Uplink latency
DNS Delay DNS resolution latency
protocol supports ANY,IPV4, IPV6
Interface support Any,wi-fi,cellular (cellular network)
For specific steps, refer to:
?
?
App Network test Essentials and Weak network simulation