app专项测试
过滤:
过滤表达式:
domain. 展示 domain 中的资源, *.com
has-response-header. 包含指定 HTTP 响应 header
is. 表达式
larger-than. 展示大于某个尺寸的资源,1000 等于 1k
method. 指定http请求方法,比如 get 或者 post
mime-type. 资源 mime 类型,比如 application/json
scheme. HTTP (scheme:http) 或者 HTTPS (scheme:https).
status-code. 状态码
例子:
大于 10k 的图片资源
mime-type:image/png larger-than:1K
所有状态码为 304 的 http 请求
scheme:https status-code:304
域名以 .com 结尾,使用 http 协议
domain:*.com scheme:https
资源的调用关系:performance
前端加载情况:w3c提供的标准
https://www.w3.org/TR/navigation-timing/
卸载前期页面、重定向、缓存、DNS ip转域名、tcp建立连接、请求服务器、响应、dom加载完成时间、所有资源加载完成时间
以卸载举例
处于同源时,进行时间计算
protocol、port 和 host 相同
js :
window.performance.timing.unloadEventEnd - window.performance.timing.unloadEventStart
使用 appium 获取性能数据
from appium import webdriver from selenium.webdriver.common.by import By def test_xueqiu(): caps = {} caps["platformName"] = "Android" caps["deviceName"] = "127.0.0.1:62001" caps["appPackage"] = "com.xueqiu.android" caps["appActivity"] = ".view.WelcomeActivityAlias" caps['noReset'] = "true" caps['chromedriverExecutable']="D:/develop/chromedriver/2.20.exe" driver = webdriver.Remote("http://localhost:4723/wd/hub", caps) driver.implicitly_wait(15) driver.find_element(By.XPATH, "//*[@text='交易']").click() webview = driver.contexts[-1] driver.switch_to.context(webview) performance = driver.execute_script("return window.performance.timing") print(performance['domComplete'] - performance['responseStart'])
bash性能获取
while true ;do adb shell top -n 1 | grep xueqiu | awk '{print $9}';done
adb shell monkey -p com.xueqiu.android -v 200 2000