How to do weak network testing, this is the most detailed article I have read

The current APP network environment is relatively complicated. The network standards include 2G, 3G, and 4G networks, and there are more and more public Wi-Fi. Different network environments and differences in network standards will have a certain impact on users’ use of apps. In addition, the current app usage scenarios are changeable, such as entering the subway, taking the bus, entering the elevator, etc., making the weak network test particularly important.

If the app does not handle various network exceptions in a compatible manner, users may encounter problems such as app crashes, ANR, and data loss in their daily lives. Therefore, app network testing, especially weak network testing is particularly important. This article sorts out the key points of app network testing and common simulation methods for weak network testing, so that everyone can have a comprehensive understanding of network testing.

01. Main points of APP network test

1. Functional test under each network

  • Under different networks, check the basic function points

  • Carrier mobile, China Unicom, China Telecom access point test (need to use the actual SIM card)

  • If there is a smart DNS function, it is also necessary to pay attention to operator judgment/classification

  • High latency, high packet loss, no network, and false hotspots can also be included in the weak network test category

2. Network switching test
Some APPs have smart DNS functions, and network switching involves DNS switching.
Network switching detection mechanism: Android can listen to system broadcasts

3. Weak network test
User experience and exception handling need to be paid attention to in all network scenarios, but in weak network scenarios, it needs to be focused on.

02. Weak network test simulation

1. What kind of network is a weak network

When the rate is lower than 2G, it belongs to weak network, and 3G can also be classified as weak network. Generally, Wi-Fi is not included in the weak network test category.

2. How to conduct a weak network test

  • SIM card network switching
    Phone-Settings-Mobile Network Settings-Network Type Selection
    Both 3G and 4G cards can be set to turn off 3G/4G, and only use 2G network.

  • Specific weak network scenario test, common scenarios include: subway/bus, elevator, stairwell, parking lot

  • Use a virtual machine to simulate network speed, such as a weak network tester built with a Raspberry Pi

  • Use software as a network agent to simulate different network bandwidth, delay rate, and packet loss rate

3. Common tools for weak network simulation

Method 1:charles weak network simulation

Configuration parameter parsing:

  • bandwidth–bandwidth, that is, the speed of uplink and downlink data transmission

  • utilization — Bandwidth availability, most modern is 100%

  • round-trip latency – the delay of the first request, in ms

  • MTU – the maximum transmission unit, that is, the maximum size of a TCP packet, which can more realistically simulate the TCP layer and the packetization of each transmission

  • Releability – refers to the reliability of the connection. This refers to the reliability rate of 10kb. Used to simulate network instability

  • Stability – Connection stability, also affects bandwidth availability. Used to simulate mobile networks, where mobile network connections are generally unreliable

Reference for specific network settings:

Fiddler can also perform weak network environment simulation

Method 2: chrome’s webview debugging tool weak network simulation

The disadvantage of using chrome’s webview debugging tool is that it is only suitable for weak network simulation of web pages.

Concrete steps:

  • The application enables the webview debugging function, as follows:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {undefined
WebView.setWebContentsDebuggingEnabled(true);
}

  • Connect the mobile phone to the computer, run the APP, and enter the specific H5 page;

  • Open Webview in DevTools of chrome: Enter chrome://inspect/#devices, it will display the connected device, select the inspect network page of webview to be debugged, No throttling drop-down box, you can perform network simulation.

Method Three:

iOS mobile phone comes with Network Link Conditioner weak network simulation

Open the developer options on the iPhone:
Settings – Developer Options > Network Link Conditioner entry.
The system has built-in common network configurations, and custom configurations can also be added.

Specific configuration parameters:

  • in Bandwidth Downlink bandwidth, that is, downlink network speed

  • In packet loss downlink packet loss rate

  • in delay Downlink delay, unit ms

  • out bandwidth upstream bandwidth

  • out packet loss Uplink packet loss rate

  • out delay uplink delay

  • DNS delay DNS resolution delay

  • protocol supports Any, IPV4, IPV6

  • interface supports Any, WI-Fi, cellular (cellular network)

Reference for specific steps:
?

Internet test classic question sharing

  • Scenario 1: Under a weak network, the page loads, and the program crashes
    Reason: webview timeout processing is not in the UI thread. Toast, close the page and other operations need to be in the UI thread

  • Scenario 2: 302 jumps to the page, and when the built-in timeout threshold is reached, the webview is automatically closed
    Reason: The business has the logic of automatically closing when the page load times out, and the timeout mechanism does not consider the 302 scenario

END’s humble strength

Finally, I would like to thank everyone who has read my article carefully. Seeing the fans’ growth and attention all the way, there is always a need for reciprocity. Although it is not a very valuable thing, if you need it, you can take it away: strong>

These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey. I hope it can help you too!

Join my software testing exchange group: 110685036 to get it for free~ (Academic exchanges with fellow leaders, and there will be live broadcasts to share technical knowledge points every night)

Software testing interview applet

The software test question bank maxed out by millions of people! ! ! Who is who knows! ! ! The most comprehensive quiz mini program on the whole network, you can use your mobile phone to do the quizzes, on the subway or on the bus, roll it up!

The following interview question sections are covered:

1. Basic theory of software testing, 2. web, app, interface function testing, 3. network, 4. database, 5. linux

6. web, app, interface automation, 7. performance testing, 8. programming basics, 9. hr interview questions, 10. open test questions, 11. security testing, 12. computer basics

How to get it: