Why do the testing and how weak network

Why do weak network testing?

Weak network testing, belong to the contents of robustness testing, why do it? Especially now that people are more accustomed to in the subway, on the bus, or even an elevator, garage, etc. scene going concern some news, look at the novel, live, play games and so on. At this time, we need to address these scenes, to look at the state of running applications, as well as a weak network environment, the emergence of processing mechanism loss, delay software to avoid the loss of customers.

 

Recently made a move APP weak network and interrupt the test, then share some of the problems encountered at:

1, phenomenon: when the user logs download the application initialization data, download speed is too slow process due to click Cancel and log in again, duplicate data after initialization is complete, resulting in inconsistent data.
  The reason: data download, the download fails, the data is not rolled back, re-download after suspension, duplicate data appear
  Solution: After the download fails, use a local database for data rollback transaction data downloaded by logic.

2, phenomenon: the user click data upload, data upload process is weak and unstable network, based on network status automatically triggered data upload, resulting in duplication of data written to appear, forming dirty
  Cause: The data upload process, due to the failure retransmission mechanism, appears twice the write operation, and without making a unique identification processing
  solutions: the characteristic data, the local data may cause dirty by key fields, such as creation time, key-value generating hash key value, etc., the only mark recording resistance, i.e., data write, check hash key is present, if it already exists, this duplicate data discarded.

3, phenomenon: in the weak network environment, the user enters a user name and password and click login, use the link timeout returns user name and password error.
  Cause: After the connection timeout weak network environment, the network service logic processing according to the intensity, causing the return timeout exception.
  Solution: After a weak network connection timeout, the application checks whether there is a local database user login information, if there is immediate access local user information to log on.

4, phenomenon: in the weak network environment, users enter a user name and password click login, the login process application crashes and flash back.
  The reason: weak network environment data download times out, load data rely heavily loaded later asynchronous. Data have not had time to return the application to jump to the next activity, leading to a crash.
  Solution: robust data loading process, the download status interface to load data by marking backstage, after-dependent data download to finish before making the jump page.

5, the phenomenon: weak network environment, the user requests a page in response to a long time, waiting for the process, part of the controls on the page can still operate, when the user clicks the control, the application flash back phenomenon occurs;
  Cause: loading the data flow the determination, controls the controllable directly exposed, occurs when the control data dependent operations, do not return data before processing compatibility.
  Solution: In the data loading process, the external exposure controls settings page is "inoperable" when the data is loaded and then release.

6, phenomenon: in the weak network environment, users first enter the search keywords do not get a response, enter new keywords again and send the request and wait for the search results are returned, before the current results of keyword search results page is refreshed coverage
  Cause: after the request to return the intermediate slow display the final results, the data to be returned before the request is not processed.
  Solution: asynchronous request unfinished task cancel.

In summary therefore, a test for the mobile APP, functionality, performance, stability, exception handling characteristics of the scene to summarize several dimensions, weak network testing focused on the following scenario: 2G / 3G / 4G wifi- mobile network switching.

 

1, the analog network environment weak

Open Fiddler, Rules-> Performance-> Check Simulate Modem Speeds, then check the network access the site will find a lot slower

2, the principle Fiddler weak network

Rules-> Cutomize Rules document open CustomRules.js

Search keywords in the file, m_SimulateModem

 

Let us analyze these lines of code:

  • First, to determine whether m_SimulateModem is true, that is, whether a weak network mode.

  • If weak network mode. The analysis code

  • oSession [ "request-trickle-delay"] = "300"; comments also understand, Delay sends by 300ms per KB uploaded upload 1KB need 300ms, transforming what upload speed: 1Kb / 0.3s = 10/3 (KB /. s)

  • 如果你想设置上传的速度为50KB/s,你则需要设置Delay 时间为 20ms

  • 同样的方法,也可以限制上传的速度,调整oSession[“response-trickle-delay”]即可。

 

设置完成后,清空原有的log,并使用你的app进行弱网条件下的操作,

选择第一个请求和最后一个请求,可获得整个页面加载所消耗的总体时间。从条形图表中还可以分别出哪些请求耗时最多,从而对页面的访问进行访问速度优化

如下图:

 

 

 

不同请求耗时多少的图形表,获取那种资源耗时最大,进而进行优化:

如下图

Guess you like

Origin www.cnblogs.com/ht22ht22/p/12434230.html