客户端性能自动化-亲自实践遇到的问题

basic是内存 CPU FPS

RT是runtime

 

测试webhook

iOS性能测试竞品包下载

使用文档

脚本地址

各业务性能指标基线

iOS竞品打包地址

项目地址

1.参考文档用工具根据自己的业务场景写自动化脚本,这是关键能力

2.自动化脚本本地测试通过后,按如下方法迁移脚本即可

参考性能用例例子

3.运行命令

mvn test -Dtest=xxHome

 

鉴于目前性能测试属于试用阶段,为了提高效率,避免反复重跑。如果要跑性能测试,请自己建好性能测试任务然后运行次数选1次,如果脚本和结果都没问题,任务链接发给xx 会安排正式执行

算法配置

 

性能测试方案对外发布计划

4月份第一周对外发布1.0版本,

支持功能:

1.android 响应时间,fps,内存,CPU

2.iOS 响应时间,内存,CPU

 

发布形式:

1.jar包

perftool

1.0.0-SNAPSHOT

 

打包系统存在bug 无法正常下载竞品包的时候,下载.ipa包到PC端电脑,再在PC端安装pp助手,选择从本地安装ipa包

 

注:xx 腾讯 爱奇艺的签名一致,所以每次只能安装一个包进行脚本验证

pom文件与git master一致就可以

如遇代码报错,bizlib错误,引用的包找不到,记得在appearance-maven 将默认的.m2下的pom文件改为性能脚本项目pom文件路径

客户端性能自动化-亲自实践遇到的问题_第1张图片

 

 

 

和之前UI自动化的xcode一致

  1. Xcode -> Preferences -> Accounts 添加一个Apple ID(如果已经添加过,则忽略)
  2. 需要为以下地方配置证书。如下图

 

客户端性能自动化-亲自实践遇到的问题_第2张图片

升级完macOS和xcode ,安装idevice 参考博客如下:https://www.cnblogs.com/csj2018/p/9680224.html

如果在应用程序打不开xcode(因为下载完可以点击查看下xcode版本)点击xcode没反应,不弹出界面,只有图标在属性栏跳一跳,则用如下方式打开

open ~/xx/WDA/WebDriverAgent/WebDriverAgent.xcodeproj/

如上是最后一次打开的工程,如果最后一个打开了其他工程 就不能打开wda了,以后也建议如上方式打开

以上搞定后,真的可以安装idevice for iOS了

 

如遇

This iPhone XR is running iOS 13.1.2 (17A860), which may not be supported by this version of Xcode.

说明xcode版本不支持

Version 10.2.1 (10E1001)

 

如遇

Verify the Developer App certificate for your account is trusted on your device. Open Settings on iPhoneSoku and navigate to General -> Device Management, then select your Developer App certificate to trust it.

Internal launch error: process launch failed: Security

到手机-通用-描述文件与设备管理-开发者应用-信任应用

 

 

如遇

iPhoneSoku has denied the launch request.

Internal launch error: process launch failed: Unspecified

则修改钥匙串-种类-我的证书-iPhone Developer: [email protected] (J7DVJWC96G) -信任-使用此证书时:使用系统默认

解决了4小时,死都没想到的原因,参考https://www.jianshu.com/p/57bea4d581de 方案三,应该参考https://blog.csdn.net/u010953692/article/details/89519350

原因:证书设置成了全部信任 结果反而会出问题。

一般遇到的 launch不起来,都是证书的原因。比如手机上的app证书和 当前证书不一致,它就验证不通过,然后launch不起来,或者是企业证书没有信任 也爱这样。

感谢我阳哥提供的可能解决的方案 删除 cd /Users/xx/Library/MobileDevice/Provisioning\ Profiles 下的所有文件,重新test,也学习到了

客户端性能自动化-亲自实践遇到的问题_第3张图片

 

感谢我阳哥提供的可能解决的方案 删除 cd /Users/xx/Library/MobileDevice/Provisioning\ Profiles 下的所有文件,重新test,也学习到了
 

脚本设计部分:参考博客xx-2通用性能测试接入文档 https://blog.csdn.net/weixin_42498050/article/details/102590676

自己设计case过程:

// 获取屏幕尺寸
Dimension destination=driver.getScreenSize();
int width1=destination.getWidth();
float x= width1/2;
// 浮类型,首页搜索输入框高度从顶部0,0算为y=60,取一半命中输入框
float y=30.0f;
customLog.log("点击输入按钮");
driver.click(x,y);
sleep(10000);
driver.sendKeys("火王之破晓");
sleep(10000);
driver.findElementByName("火王之破晓之战").click();

 

如遇xx多个进程,原因:手动运行xcode里的test的同时,运行脚本或者反复停止运行脚本

2019-10-20 20:19:45.699 [main][INFO ] [LocalCommandLine.java:199] ps -ax | grep 807e947b0dee370cb10e484cb06c7aff5c8bb66e
2019-10-20 20:19:45.757 [main][INFO ] [IOSxxServer.java:97] line: 不可执行,因为任务刚刚创建
2019-10-20 20:19:45.758 [main][INFO ] [IOSxxServer.java:97] line: null
2019-10-20 20:19:45.758 [main][INFO ] [IOSxxServer.java:107] ******* break *******
startWDA exitCode: -2
2019-10-20 20:19:47.763 [main][INFO ] [LocalCommandLine.java:199] ps -ax | grep 807e947b0dee370cb10e484cb06c7aff5c8bb66e
2019-10-20 20:19:47.821 [main][INFO ] [IOSxxServer.java:97] line: 不可执行,因为任务刚刚创建
2019-10-20 20:19:47.823 [main][INFO ] [IOSxxServer.java:97] line: null
2019-10-20 20:19:47.823 [main][INFO ] [IOSxxServer.java:107] ******* break *******
startWDA exitCode: -2
2019-10-20 20:19:49.826 [main][INFO ] [LocalCommandLine.java:199] ps -ax | grep 807e947b0dee370cb10e484cb06c7aff5c8bb66e
2019-10-20 20:19:49.974 [main][INFO ] [IOSxxServer.java:97] line: xx进程数=2
2019-10-20 20:19:49.975 [main][INFO ] [IOSxxServer.java:97] line: xx进行中,任务结束
2019-10-20 20:19:49.976 [main][INFO ] [IOSxxServer.java:97] line: null
2019-10-20 20:19:49.976 [main][INFO ] [IOSxxServer.java:107] ******* break *******
startWDA exitCode: -2
2019-10-20 20:19:51.981 [main][INFO ] [LocalCommandLine.java:199] ps -ax | grep 807e947b0dee370cb10e484cb06c7aff5c8bb66e
2019-10-20 20:19:52.047 [main][INFO ] [IOSxxServer.java:97] line: 不可执行,因为任务刚刚创建
2019-10-20 20:19:52.049 [main][INFO ] [IOSxxServer.java:97] line: null
2019-10-20 20:19:52.049 [main][INFO ] [IOSxxServer.java:107] ******* break *******
startWDA exitCode: -2
2019-10-20 20:19:54.049 [main][INFO ] [LocalCommandLine.java:199] ps -ax | grep 807e947b0dee370cb10e484cb06c7aff5c8bb66e
2019-10-20 20:19:54.139 [main][INFO ] [IOSxxServer.java:97] line: 不可执行,因为任务刚刚创建
2019-10-20 20:19:54.140 [main][INFO ] [IOSxxServer.java:97] line: null
2019-10-20 20:19:54.141 [main][INFO ] [IOSxxServer.java:107] ******* break *******
startWDA exitCode: -2
2019-10-20 20:19:56.144 [main][INFO ] [LocalCommandLine.java:199] ps -ax | grep 807e947b0dee370cb10e484cb06c7aff5c8bb66e

Process finished with exit code 130 (interrupted by signal 2: SIGINT)
 

客户端性能自动化-亲自实践遇到的问题_第4张图片

解决办法:

批量杀自动化进程   ps -ef |grep -i 自动化|grep -v grep|awk '{print $2}'|xargs sudo kill -9

则在xcode进行test,注意这里需要WebDriverAgent  和WDAMonitor都分别test,桌面会出现3个图标,才可以运行脚本

客户端性能自动化-亲自实践遇到的问题_第5张图片

 

 

 

脚本运行时间:5-16min+

感想:弹框处理的太慢,一定要多等!!!太着急往往看不到运行成功的结果

 

 

1. 爱奇艺搜索

1> 爱奇艺搜索FPS分帧脚本运行结果

客户端性能自动化-亲自实践遇到的问题_第6张图片

脚本分帧截图在   /Users/xx/Desktop/code/perftest/screenshot

脚本分帧日志在   /Users/xx/Desktop/code/perftest/custom.log

2019-10-21 15:07:31    init
2019-10-21 15:07:31    loop start,mirror config init
2019-10-21 15:07:31    0 starts testQiyiFPS
2019-10-21 15:07:31    testQiyiFPS%230
2019-10-21 15:07:55    处理弹窗
2019-10-21 15:07:56    启动app处理弹窗
2019-10-21 15:08:37    处理弹框:
2019-10-21 15:12:10    setup
2019-10-21 15:12:10    等待8s启动app
2019-10-21 15:12:18    关掉app进程
2019-10-21 15:12:24    MEASURE:等待10s,启动app
2019-10-21 15:13:04    处理弹框:
2019-10-21 15:13:21    点击输入按钮
2019-10-21 15:17:17    tearDown
2019-10-21 15:17:17    test succeeded
2019-10-21 15:17:17    null
2019-10-21 15:17:17    0 finished
2019-10-21 15:17:17    [{result=pass, cpuUsageMax=-1, sf=0, videoUrl=null, heapMax=-1, fpsDetails={1571642108000=55.0, 1571642028000=60.0, 1571642137000=1.0, 1571642020000=1.0, 1571642057000=1.0, 1571642114000=57.0, 1571642072000=59.0, 1571642095000=1.0, 1571642123000=1.0, 1571642037000=25.0, 1571642146000=22.0, 1571642081000=12.0, 1571642043000=39.0, 1571642089000=24.0, 1571642100000=26.0, 1571642066000=56.0, 1571642025000=6.0, 1571642098000=57.0, 1571642134000=56.0, 1571642052000=21.0, 1571642031000=47.0, 1571642128000=58.0, 1571642019000=60.0, 1571642077000=58.0, 1571642090000=57.0, 1571642120000=60.0, 1571642063000=25.0, 1571642117000=11.0, 1571642103000=17.0, 1571642141000=56.0, 1571642046000=20.0, 1571642084000=36.0, 1571642049000=60.0, 1571642106000=55.0, 1571642135000=56.0, 1571642022000=60.0, 1571642129000=58.0, 1571642055000=54.0, 1571642070000=23.0, 1571642112000=30.0, 1571642097000=30.0, 1571642078000=49.0, 1571642064000=20.0, 1571642121000=57.0, 1571642035000=60.0, 1571642041000=16.0, 1571642148000=58.0, 1571642140000=58.0, 1571642083000=15.0, 1571642050000=60.0, 1571642075000=23.0, 1571642109000=55.0, 1571642027000=58.0, 1571642132000=19.0, 1571642115000=57.0, 1571642033000=60.0, 1571642058000=1.0, 1571642061000=57.0, 1571642038000=36.0, 1571642143000=56.0, 1571642126000=59.0, 1571642044000=59.0, 1571642101000=26.0, 1571642069000=21.0, 1571642086000=59.0, 1571642099000=58.0, 1571642110000=0.0, 1571642133000=60.0, 1571642053000=60.0, 1571642024000=60.0, 1571642030000=60.0, 1571642018000=60.0, 1571642091000=58.0, 1571642076000=30.0, 1571642062000=60.0, 1571642118000=14.0, 1571642142000=56.0, 1571642127000=58.0, 1571642104000=59.0, 1571642047000=24.0, 1571642085000=55.0, 1571642073000=60.0, 1571642107000=55.0, 1571642138000=15.0, 1571642021000=30.0, 1571642056000=54.0, 1571642113000=57.0, 1571642130000=1.0, 1571642094000=58.0, 1571642036000=18.0, 1571642124000=19.0, 1571642042000=29.0, 1571642145000=19.0, 1571642080000=49.0, 1571642067000=59.0, 1571642088000=21.0, 1571642026000=22.0, 1571642051000=47.0, 1571642074000=23.0, 1571642131000=18.0, 1571642032000=40.0, 1571642093000=58.0, 1571642116000=11.0, 1571642059000=15.0, 1571642039000=60.0, 1571642060000=41.0, 1571642125000=19.0, 1571642144000=1.0, 1571642068000=59.0, 1571642139000=19.0, 1571642102000=18.0, 1571642045000=60.0, 1571642087000=27.0, 1571642048000=55.0, 1571642111000=17.0, 1571642023000=60.0, 1571642136000=56.0, 1571642054000=54.0, 1571642071000=39.0, 1571642096000=19.0, 1571642079000=49.0, 1571642122000=57.0, 1571642034000=60.0, 1571642040000=60.0, 1571642119000=22.0, 1571642147000=58.0, 1571642082000=12.0, 1571642105000=55.0, 1571642065000=27.0}, name=testQiyiFPS, sfDetails={1571642237298=0}, index=0, sm=39.00}]
2019-10-21 15:17:17    loop finished
2019-10-21 15:17:17    com.xx.auto.base.HcTestSuite@1b75c2e3
2019-10-21 15:17:17    fps统计个数:129
2019-10-21 15:17:17    [com.xx.auto.base.HcTestClass@6af9fcb2]
2019-10-21 15:17:17    end

2019-10-21 15:07:31    init

2019-10-21 15:07:31    loop start,mirror config init

2019-10-21 15:07:31    0 starts testQiyiFPS

2019-10-21 15:07:31    testQiyiFPS%230

2019-10-21 15:07:55    处理弹窗

2019-10-21 15:07:56    启动app处理弹窗

2019-10-21 15:08:37    处理弹框:

2019-10-21 15:12:10    setup

2019-10-21 15:12:10    等待8s启动app

2019-10-21 15:12:18    关掉app进程

2019-10-21 15:12:24    MEASURE:等待10s,启动app

2019-10-21 15:13:04    处理弹框:

2019-10-21 15:13:21    点击输入按钮

2019-10-21 15:17:17    tearDown

2019-10-21 15:17:17    test succeeded

2019-10-21 15:17:17    null

2019-10-21 15:17:17    0 finished

2019-10-21 15:17:17    [{result=pass, cpuUsageMax=-1, sf=0, videoUrl=null, heapMax=-1, fpsDetails={1571642108000=55.0, 1571642028000=60.0, 1571642137000=1.0, 1571642020000=1.0, 1571642057000=1.0, 1571642114000=57.0, 1571642072000=59.0, 1571642095000=1.0, 1571642123000=1.0, 1571642037000=25.0, 1571642146000=22.0, 1571642081000=12.0, 1571642043000=39.0, 1571642089000=24.0, 1571642100000=26.0, 1571642066000=56.0, 1571642025000=6.0, 1571642098000=57.0, 1571642134000=56.0, 1571642052000=21.0, 1571642031000=47.0, 1571642128000=58.0, 1571642019000=60.0, 1571642077000=58.0, 1571642090000=57.0, 1571642120000=60.0, 1571642063000=25.0, 1571642117000=11.0, 1571642103000=17.0, 1571642141000=56.0, 1571642046000=20.0, 1571642084000=36.0, 1571642049000=60.0, 1571642106000=55.0, 1571642135000=56.0, 1571642022000=60.0, 1571642129000=58.0, 1571642055000=54.0, 1571642070000=23.0, 1571642112000=30.0, 1571642097000=30.0, 1571642078000=49.0, 1571642064000=20.0, 1571642121000=57.0, 1571642035000=60.0, 1571642041000=16.0, 1571642148000=58.0, 1571642140000=58.0, 1571642083000=15.0, 1571642050000=60.0, 1571642075000=23.0, 1571642109000=55.0, 1571642027000=58.0, 1571642132000=19.0, 1571642115000=57.0, 1571642033000=60.0, 1571642058000=1.0, 1571642061000=57.0, 1571642038000=36.0, 1571642143000=56.0, 1571642126000=59.0, 1571642044000=59.0, 1571642101000=26.0, 1571642069000=21.0, 1571642086000=59.0, 1571642099000=58.0, 1571642110000=0.0, 1571642133000=60.0, 1571642053000=60.0, 1571642024000=60.0, 1571642030000=60.0, 1571642018000=60.0, 1571642091000=58.0, 1571642076000=30.0, 1571642062000=60.0, 1571642118000=14.0, 1571642142000=56.0, 1571642127000=58.0, 1571642104000=59.0, 1571642047000=24.0, 1571642085000=55.0, 1571642073000=60.0, 1571642107000=55.0, 1571642138000=15.0, 1571642021000=30.0, 1571642056000=54.0, 1571642113000=57.0, 1571642130000=1.0, 1571642094000=58.0, 1571642036000=18.0, 1571642124000=19.0, 1571642042000=29.0, 1571642145000=19.0, 1571642080000=49.0, 1571642067000=59.0, 1571642088000=21.0, 1571642026000=22.0, 1571642051000=47.0, 1571642074000=23.0, 1571642131000=18.0, 1571642032000=40.0, 1571642093000=58.0, 1571642116000=11.0, 1571642059000=15.0, 1571642039000=60.0, 1571642060000=41.0, 1571642125000=19.0, 1571642144000=1.0, 1571642068000=59.0, 1571642139000=19.0, 1571642102000=18.0, 1571642045000=60.0, 1571642087000=27.0, 1571642048000=55.0, 1571642111000=17.0, 1571642023000=60.0, 1571642136000=56.0, 1571642054000=54.0, 1571642071000=39.0, 1571642096000=19.0, 1571642079000=49.0, 1571642122000=57.0, 1571642034000=60.0, 1571642040000=60.0, 1571642119000=22.0, 1571642147000=58.0, 1571642082000=12.0, 1571642105000=55.0, 1571642065000=27.0}, name=testQiyiFPS, sfDetails={1571642237298=0}, index=0, sm=39.00}]

2019-10-21 15:17:17    loop finished

2019-10-21 15:17:17    com.xx.auto.base.HcTestSuite@1b75c2e3

2019-10-21 15:17:17    fps统计个数:129

2019-10-21 15:17:17    [com.xx.auto.base.HcTestClass@6af9fcb2]

2019-10-21 15:17:17    end

 

2> 爱奇艺搜索CPU

客户端性能自动化-亲自实践遇到的问题_第7张图片

/Users/xx/Desktop/code/perftest/custom.log   搜索CPU日志

/Users/xx/Desktop/code/perftest/custom.log

 

2019-10-21 15:49:58    init

2019-10-21 15:49:58    loop start,mirror config init

2019-10-21 15:49:58    0 starts testQiyiCPU

2019-10-21 15:49:58    testQiyiCPU%230

2019-10-21 15:50:29    处理弹窗

2019-10-21 15:50:31    启动app处理弹窗

2019-10-21 15:51:12    处理弹框:

2019-10-21 15:54:47    setup

2019-10-21 15:54:47    等待8s启动app

2019-10-21 15:54:55    关掉app进程

2019-10-21 15:55:01    MEASURE:等待10s,启动app

2019-10-21 15:55:39    处理弹框:

2019-10-21 15:55:56    点击输入按钮

2019-10-21 15:59:51    tearDown

2019-10-21 15:59:51    test succeeded

2019-10-21 15:59:51    null

2019-10-21 15:59:51    0 finished

2019-10-21 15:59:51    [{result=pass, cpuUsageMax=100.0, sf=-1, heapMax=117.667969, name=testQiyiCPU, cpuDetails={1571644639000=99.299995, 1571644580000=96.400002, 1571644616000=24.699999, 1571644668000=16.600002, 1571644622000=21.0, 1571644645000=47.599995, 1571644660000=27.000002, 1571644697000=12.900001, 1571644588000=26.499998, 1571644568000=76.799995, 1571644677000=14.7, 1571644654000=28.499994, 1571644683000=17.9, 1571644574000=100.0, 1571644631000=96.099991, 1571644702000=24.4, 1571644597000=77.299995, 1571644640000=60.099995, 1571644583000=15.2, 1571644692000=29.900002, 1571644686000=95.700005, 1571644659000=79.0, 1571644665000=80.699989, 1571644607000=57.499992, 1571644602000=80.900002, 1571644627000=25.5, 1571644594000=18.599998, 1571644651000=97.499992, 1571644672000=83.5, 1571644648000=16.200001, 1571644634000=20.199999, 1571644577000=19.200001, 1571644613000=100.0, 1571644700000=93.599991, 1571644618000=16.0, 1571644643000=54.400002, 1571644637000=100.0, 1571644685000=64.300003, 1571644666000=21.9, 1571644691000=92.800003, 1571644586000=82.000008, 1571644624000=88.0, 1571644601000=73.800003, 1571644566000=3.5, 1571644572000=46.199997, 1571644679000=58.200001, 1571644610000=61.699993, 1571644671000=100.0, 1571644595000=14.5, 1571644581000=46.699997, 1571644615000=49.499996, 1571644688000=18.900003, 1571644663000=99.300003, 1571644609000=23.6, 1571644646000=28.5, 1571644621000=34.900002, 1571644694000=92.699997, 1571644589000=13.400001, 1571644569000=79.399994, 1571644604000=24.699999, 1571644592000=92.799995, 1571644699000=66.099998, 1571644680000=37.5, 1571644629000=16.999998, 1571644657000=39.399998, 1571644674000=38.700001, 1571644575000=100.0, 1571644632000=64.300003, 1571644703000=18.700001, 1571644664000=90.900002, 1571644687000=75.899994, 1571644641000=24.1, 1571644693000=99.099998, 1571644658000=71.0, 1571644584000=15.400002, 1571644606000=85.099998, 1571644593000=42.699997, 1571644603000=42.999996, 1571644570000=71.5, 1571644626000=45.0, 1571644650000=68.499992, 1571644649000=81.900009, 1571644673000=96.899994, 1571644635000=68.300003, 1571644578000=11.700001, 1571644612000=96.699997, 1571644617000=18.0, 1571644701000=79.799995, 1571644644000=41.999996, 1571644661000=20.700001, 1571644638000=39.200001, 1571644587000=50.5, 1571644623000=17.300001, 1571644696000=19.200001, 1571644676000=22.400002, 1571644567000=50.900002, 1571644655000=19.400002, 1571644682000=22.000002, 1571644669000=97.0, 1571644573000=76.299995, 1571644590000=11.400001, 1571644630000=95.300003, 1571644598000=48.399998, 1571644614000=85.199997, 1571644582000=22.999998, 1571644689000=25.800001, 1571644662000=44.199993, 1571644695000=24.799999, 1571644608000=54.299992, 1571644620000=65.099998, 1571644628000=16.5, 1571644591000=95.800003, 1571644698000=96.200005, 1571644647000=26.700003, 1571644675000=18.900002, 1571644656000=47.999996, 1571644681000=54.900002, 1571644599000=20.700001, 1571644704000=24.400002, 1571644576000=60.099995, 1571644633000=22.5, 1571644642000=17.9, 1571644667000=34.999992, 1571644619000=82.899994, 1571644636000=100.0, 1571644684000=71.300003, 1571644690000=17.800001, 1571644605000=12.6, 1571644600000=18.099998, 1571644653000=66.899994, 1571644625000=48.099995, 1571644571000=47.700001, 1571644678000=86.599998, 1571644670000=100.0, 1571644596000=86.099998, 1571644579000=61.400009, 1571644611000=15.700001}, index=0, sm=-1, memDetails={1571644639000=114.101562, 1571644580000=97.945312, 1571644616000=112.867188, 1571644668000=114.648438, 1571644622000=113.585938, 1571644645000=115.308594, 1571644660000=117.015625, 1571644697000=110.527344, 1571644588000=102.695312, 1571644568000=80.851562, 1571644677000=111.234375, 1571644683000=110.535156, 1571644574000=91.648438, 1571644631000=114.679688, 1571644702000=105.03125, 1571644597000=105.175781, 1571644640000=113.9375, 1571644583000=98.550781, 1571644692000=109.84375, 1571644686000=110.835938, 1571644659000=116.488281, 1571644665000=117.472656, 1571644607000=106.535156, 1571644602000=105.898438, 1571644627000=114.105469, 1571644594000=104.226562, 1571644651000=115.628906, 1571644672000=110.347656, 1571644648000=115.433594, 1571644634000=115.390625, 1571644577000=96.988281, 1571644613000=111.085938, 1571644700000=104.859375, 1571644618000=113.183594, 1571644643000=115.3125, 1571644637000=114.621094, 1571644685000=110.757812, 1571644666000=117.570312, 1571644691000=111.054688, 1571644624000=113.710938, 1571644601000=105.980469, 1571644652000=115.382812, 1571644566000=78.929688, 1571644572000=82.210938, 1571644679000=111.519531, 1571644610000=110.011719, 1571644671000=113.253906, 1571644595000=104.648438, 1571644581000=98.042969, 1571644615000=112.316406, 1571644688000=108.65625, 1571644663000=117.367188, 1571644609000=106.46875, 1571644646000=115.351562, 1571644621000=113.320312, 1571644694000=109.546875, 1571644589000=102.898438, 1571644569000=80.902344, 1571644604000=106.152344, 1571644592000=103.335938, 1571644699000=110.65625, 1571644680000=111.59375, 1571644629000=115.539062, 1571644657000=116.476562, 1571644674000=110.621094, 1571644575000=96.605469, 1571644632000=114.753906, 1571644703000=104.953125, 1571644664000=117.667969, 1571644687000=110.59375, 1571644641000=114.320312, 1571644693000=110.417969, 1571644658000=116.480469, 1571644584000=98.882812, 1571644606000=106.375, 1571644593000=103.382812, 1571644603000=105.867188, 1571644570000=80.96875, 1571644626000=113.597656, 1571644650000=115.621094, 1571644649000=115.859375, 1571644673000=110.804688, 1571644635000=112.042969, 1571644578000=97.445312, 1571644612000=110.203125, 1571644617000=113.175781, 1571644701000=104.761719, 1571644644000=115.304688, 1571644661000=116.996094, 1571644638000=113.894531, 1571644587000=102.53125, 1571644623000=113.734375, 1571644696000=110.277344, 1571644676000=111.441406, 1571644567000=83.953125, 1571644655000=116.226562, 1571644682000=111.511719, 1571644669000=115.050781, 1571644573000=88.246094, 1571644590000=102.9375, 1571644630000=114.898438, 1571644598000=104.886719, 1571644614000=112.496094, 1571644582000=98.378906, 1571644689000=109.675781, 1571644662000=117.226562, 1571644695000=109.867188, 1571644608000=106.523438, 1571644620000=113.3125, 1571644628000=115.339844, 1571644591000=103.121094, 1571644698000=111.898438, 1571644647000=116.136719, 1571644675000=110.714844, 1571644656000=116.371094, 1571644681000=111.128906, 1571644599000=105.75, 1571644704000=104.992188, 1571644576000=96.851562, 1571644633000=115.113281, 1571644642000=115.144531, 1571644667000=114.5625, 1571644619000=113.234375, 1571644636000=112.398438, 1571644684000=110.933594, 1571644690000=110.078125, 1571644585000=99.652344, 1571644605000=106.113281, 1571644600000=105.761719, 1571644653000=116.105469, 1571644625000=113.589844, 1571644571000=81.09375, 1571644678000=111.328125, 1571644670000=113.128906, 1571644596000=104.929688, 1571644579000=97.671875, 1571644611000=109.914062}}]

2019-10-21 15:59:51    loop finished

2019-10-21 15:59:51    com.xx.auto.base.HcTestSuite@1f53a5dc

2019-10-21 15:59:51    [com.xx.auto.base.HcTestClass@1b75c2e3]

2019-10-21 15:59:51    end

 

2019-10-21 15:49:58    init
2019-10-21 15:49:58    loop start,mirror config init
2019-10-21 15:49:58    0 starts testQiyiCPU
2019-10-21 15:49:58    testQiyiCPU%230
2019-10-21 15:50:29    处理弹窗
2019-10-21 15:50:31    启动app处理弹窗
2019-10-21 15:51:12    处理弹框:
2019-10-21 15:54:47    setup
2019-10-21 15:54:47    等待8s启动app
2019-10-21 15:54:55    关掉app进程
2019-10-21 15:55:01    MEASURE:等待10s,启动app
2019-10-21 15:55:39    处理弹框:
2019-10-21 15:55:56    点击输入按钮
2019-10-21 15:59:51    tearDown
2019-10-21 15:59:51    test succeeded
2019-10-21 15:59:51    null
2019-10-21 15:59:51    0 finished
2019-10-21 15:59:51    [{result=pass, cpuUsageMax=100.0, sf=-1, heapMax=117.667969, name=testQiyiCPU, cpuDetails={1571644639000=99.299995, 1571644580000=96.400002, 1571644616000=24.699999, 1571644668000=16.600002, 1571644622000=21.0, 1571644645000=47.599995, 1571644660000=27.000002, 1571644697000=12.900001, 1571644588000=26.499998, 1571644568000=76.799995, 1571644677000=14.7, 1571644654000=28.499994, 1571644683000=17.9, 1571644574000=100.0, 1571644631000=96.099991, 1571644702000=24.4, 1571644597000=77.299995, 1571644640000=60.099995, 1571644583000=15.2, 1571644692000=29.900002, 1571644686000=95.700005, 1571644659000=79.0, 1571644665000=80.699989, 1571644607000=57.499992, 1571644602000=80.900002, 1571644627000=25.5, 1571644594000=18.599998, 1571644651000=97.499992, 1571644672000=83.5, 1571644648000=16.200001, 1571644634000=20.199999, 1571644577000=19.200001, 1571644613000=100.0, 1571644700000=93.599991, 1571644618000=16.0, 1571644643000=54.400002, 1571644637000=100.0, 1571644685000=64.300003, 1571644666000=21.9, 1571644691000=92.800003, 1571644586000=82.000008, 1571644624000=88.0, 1571644601000=73.800003, 1571644566000=3.5, 1571644572000=46.199997, 1571644679000=58.200001, 1571644610000=61.699993, 1571644671000=100.0, 1571644595000=14.5, 1571644581000=46.699997, 1571644615000=49.499996, 1571644688000=18.900003, 1571644663000=99.300003, 1571644609000=23.6, 1571644646000=28.5, 1571644621000=34.900002, 1571644694000=92.699997, 1571644589000=13.400001, 1571644569000=79.399994, 1571644604000=24.699999, 1571644592000=92.799995, 1571644699000=66.099998, 1571644680000=37.5, 1571644629000=16.999998, 1571644657000=39.399998, 1571644674000=38.700001, 1571644575000=100.0, 1571644632000=64.300003, 1571644703000=18.700001, 1571644664000=90.900002, 1571644687000=75.899994, 1571644641000=24.1, 1571644693000=99.099998, 1571644658000=71.0, 1571644584000=15.400002, 1571644606000=85.099998, 1571644593000=42.699997, 1571644603000=42.999996, 1571644570000=71.5, 1571644626000=45.0, 1571644650000=68.499992, 1571644649000=81.900009, 1571644673000=96.899994, 1571644635000=68.300003, 1571644578000=11.700001, 1571644612000=96.699997, 1571644617000=18.0, 1571644701000=79.799995, 1571644644000=41.999996, 1571644661000=20.700001, 1571644638000=39.200001, 1571644587000=50.5, 1571644623000=17.300001, 1571644696000=19.200001, 1571644676000=22.400002, 1571644567000=50.900002, 1571644655000=19.400002, 1571644682000=22.000002, 1571644669000=97.0, 1571644573000=76.299995, 1571644590000=11.400001, 1571644630000=95.300003, 1571644598000=48.399998, 1571644614000=85.199997, 1571644582000=22.999998, 1571644689000=25.800001, 1571644662000=44.199993, 1571644695000=24.799999, 1571644608000=54.299992, 1571644620000=65.099998, 1571644628000=16.5, 1571644591000=95.800003, 1571644698000=96.200005, 1571644647000=26.700003, 1571644675000=18.900002, 1571644656000=47.999996, 1571644681000=54.900002, 1571644599000=20.700001, 1571644704000=24.400002, 1571644576000=60.099995, 1571644633000=22.5, 1571644642000=17.9, 1571644667000=34.999992, 1571644619000=82.899994, 1571644636000=100.0, 1571644684000=71.300003, 1571644690000=17.800001, 1571644605000=12.6, 1571644600000=18.099998, 1571644653000=66.899994, 1571644625000=48.099995, 1571644571000=47.700001, 1571644678000=86.599998, 1571644670000=100.0, 1571644596000=86.099998, 1571644579000=61.400009, 1571644611000=15.700001}, index=0, sm=-1, memDetails={1571644639000=114.101562, 1571644580000=97.945312, 1571644616000=112.867188, 1571644668000=114.648438, 1571644622000=113.585938, 1571644645000=115.308594, 1571644660000=117.015625, 1571644697000=110.527344, 1571644588000=102.695312, 1571644568000=80.851562, 1571644677000=111.234375, 1571644683000=110.535156, 1571644574000=91.648438, 1571644631000=114.679688, 1571644702000=105.03125, 1571644597000=105.175781, 1571644640000=113.9375, 1571644583000=98.550781, 1571644692000=109.84375, 1571644686000=110.835938, 1571644659000=116.488281, 1571644665000=117.472656, 1571644607000=106.535156, 1571644602000=105.898438, 1571644627000=114.105469, 1571644594000=104.226562, 1571644651000=115.628906, 1571644672000=110.347656, 1571644648000=115.433594, 1571644634000=115.390625, 1571644577000=96.988281, 1571644613000=111.085938, 1571644700000=104.859375, 1571644618000=113.183594, 1571644643000=115.3125, 1571644637000=114.621094, 1571644685000=110.757812, 1571644666000=117.570312, 1571644691000=111.054688, 1571644624000=113.710938, 1571644601000=105.980469, 1571644652000=115.382812, 1571644566000=78.929688, 1571644572000=82.210938, 1571644679000=111.519531, 1571644610000=110.011719, 1571644671000=113.253906, 1571644595000=104.648438, 1571644581000=98.042969, 1571644615000=112.316406, 1571644688000=108.65625, 1571644663000=117.367188, 1571644609000=106.46875, 1571644646000=115.351562, 1571644621000=113.320312, 1571644694000=109.546875, 1571644589000=102.898438, 1571644569000=80.902344, 1571644604000=106.152344, 1571644592000=103.335938, 1571644699000=110.65625, 1571644680000=111.59375, 1571644629000=115.539062, 1571644657000=116.476562, 1571644674000=110.621094, 1571644575000=96.605469, 1571644632000=114.753906, 1571644703000=104.953125, 1571644664000=117.667969, 1571644687000=110.59375, 1571644641000=114.320312, 1571644693000=110.417969, 1571644658000=116.480469, 1571644584000=98.882812, 1571644606000=106.375, 1571644593000=103.382812, 1571644603000=105.867188, 1571644570000=80.96875, 1571644626000=113.597656, 1571644650000=115.621094, 1571644649000=115.859375, 1571644673000=110.804688, 1571644635000=112.042969, 1571644578000=97.445312, 1571644612000=110.203125, 1571644617000=113.175781, 1571644701000=104.761719, 1571644644000=115.304688, 1571644661000=116.996094, 1571644638000=113.894531, 1571644587000=102.53125, 1571644623000=113.734375, 1571644696000=110.277344, 1571644676000=111.441406, 1571644567000=83.953125, 1571644655000=116.226562, 1571644682000=111.511719, 1571644669000=115.050781, 1571644573000=88.246094, 1571644590000=102.9375, 1571644630000=114.898438, 1571644598000=104.886719, 1571644614000=112.496094, 1571644582000=98.378906, 1571644689000=109.675781, 1571644662000=117.226562, 1571644695000=109.867188, 1571644608000=106.523438, 1571644620000=113.3125, 1571644628000=115.339844, 1571644591000=103.121094, 1571644698000=111.898438, 1571644647000=116.136719, 1571644675000=110.714844, 1571644656000=116.371094, 1571644681000=111.128906, 1571644599000=105.75, 1571644704000=104.992188, 1571644576000=96.851562, 1571644633000=115.113281, 1571644642000=115.144531, 1571644667000=114.5625, 1571644619000=113.234375, 1571644636000=112.398438, 1571644684000=110.933594, 1571644690000=110.078125, 1571644585000=99.652344, 1571644605000=106.113281, 1571644600000=105.761719, 1571644653000=116.105469, 1571644625000=113.589844, 1571644571000=81.09375, 1571644678000=111.328125, 1571644670000=113.128906, 1571644596000=104.929688, 1571644579000=97.671875, 1571644611000=109.914062}}]
2019-10-21 15:59:51    loop finished
2019-10-21 15:59:51    com.xx.auto.base.HcTestSuite@1f53a5dc
2019-10-21 15:59:51    [com.xx.auto.base.HcTestClass@1b75c2e3]
2019-10-21 15:59:51    end

 

遇到的问题分析:

遇到的问题:

  1. 日志显示是有还在进行中的自动化进程 所以新任务起不来。可能是有bug有残留的进程
  2. 执行响应时间脚本 电脑重启,无crash日志,custom.log看起来正常

10.21运行调整脚本1PD,发现1020的运行成功的脚本都fail了

报错日志

2019-10-22 16:30:49.444 [main][INFO ] [HttpCommandExecutor.java:188] POST <-- /session/6EB0F5B5-5918-4FC7-B049-3DBE7094AA20/element 200 22533ms

{

"sessionId":"6EB0F5B5-5918-4FC7-B049-3DBE7094AA20",

"value":{

 "using":"xpath",

 "description":"unable to find an element",

 "value":"//*[@name='允许' or @name='我知道了' or @name='以后' or @name='取消' or @name='同意']"

},

"status":7

}

 

分析日志:一直找不到元素,从脚本在客户端页面展示来看,发现到了“登录iTunes Store”弹框,关闭后总是再弹出来,代码handleAlert无法关闭弹框未生效,导致查找首页输入框的时候,定位到了iTunes Store的输入框,在此输入框sendKeys时,搜索词被错误录入到这里了。。。


原因:本地安装包的签名和手机登录的苹果账号不一致。即使输入了账号密码,“登录iTunes Store”弹框还是会再次弹出来的。。。感谢我徐阳大佬找出原因--签名不一致的问题,这个验证是iOS操作系统触发的。

 

解决办法:设置-用户-iTunes Store与APP Store-Apple ID点击-退出登录另外:脚本昨天可以运行成功今天不行,可能跟xx脚本有关系:因为Xcode11中对XCTest进行了升级,而且升级改动很大。所以WDA我阳哥就直接分成了Xcode10和Xcode11两个分支 使用不同的代码,所以如果换了Xcode的版本,需要切换下WDA的代码分支。iOS每次大版本系统升级,就需要升级xcode,xcode10和xcode11之间变动很大,xx依赖于xcode里的一些库

 

晚21:33分更新,经过反复的多次运行脚本发现,还是处理不了弹框,这个弹框权限特别高 而且出现的时机不确定 随时会出来。没办法在脚本里处理掉的,只能让它不弹出

 

客户端性能自动化-亲自实践遇到的问题_第8张图片

客户端性能自动化-亲自实践遇到的问题_第9张图片

4. 自动化运行日志分析:

客户端性能自动化-亲自实践遇到的问题_第10张图片


2019-10-22 20:34:52.156 [main][INFO ] [LocalCommandLine.java:37] /Users/xx/Desktop/code/perftest/bin/xxEnvCheck [807e947b0dee370cb10e484cb06c7aff5c8bb66e]
2019-10-22 20:34:52.187 xxEnvCheck[21198:581023] 环境变量xx_WDA_BRANCH = (null)
2019-10-22 20:34:52.188 xxEnvCheck[21198:581023] 环境变量xx_TOOLS_BRANCH = (null)
2019-10-22 20:34:52.188 xxEnvCheck[21198:581023] 环境变量CHECK_UPDATING = (null)
HEAD is now at 076b3c1 xxtools签名时增加了验证pp文件和p12的匹配
rm: config.plist: No such file or directory
2019-10-22 20:34:52.930 xxEnvCheck[21198:581023] git pull
Already up to date.
2019-10-22 20:34:53.131 xxEnvCheck[21198:581023] git reset --hard
HEAD is now at 076b3c1 xxtools签名时增加了验证pp文件和p12的匹配
Saved working directory and index state WIP on Xcode10: aa1e0b2 update
Already up to date.
On branch Xcode10
Your branch is up to date with 'origin/Xcode10'.

Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)

    modified:   WDAMonitor/Info.plist
    modified:   WDAMonitorUITests/WDAMonitorUITests.m
    modified:   WebDriverAgent.xcodeproj/project.pbxproj
    modified:   WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WDAMonitor.xcscheme
    modified:   WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgent.xcscheme

no changes added to commit (use "git add" and/or "git commit -a")
/bin/sh: /usr/local/bin/xxtools: No such file or directory
/bin/sh: /usr/local/bin/xxtools: No such file or directory
/bin/sh: /usr/local/bin/xxtools: No such file or directory
xxEnvCheck进程数=1
不是SLM Agent
未指定wdaBranch分支,拉取主分支
未指定serverBranch分支,拉取主分支
xx目录存在
开始更新xx Service
Service 存在,走升级逻辑
不切分支,pull代码
开始更新WDA
更新Origin WDA
WebDriverAgent.xcodeproj 存在走升级逻辑
不切分支,pull代码
对比Copy Image和 Local Source WDA版本
git stash
git pull
git stash apply
对比WDA版本号。 oldVersion=1.1.13,newVersion=1.1.13
Copy Image 对应文件夹数量不为1。 count=0
WDA代码有更新需要升级
+[TTRCommonUtil cleanWDAImageFolderDeviceSN:]
xx进程数=0
+[TTRCommonUtil cleanDeviceWDADeviceSN:]
xx进程数=0
/usr/local/bin/xxxtools uninstall_app -u 807e947b0dee370cb10e484cb06c7aff5c8bb66e com.pay.wda.WDAMonitor  出错
/usr/local/bin/xxtools uninstall_app -u 807e947b0dee370cb10e484cb06c7aff5c8bb66e com.apple.test.WDAMonitorUITests-Runner  出错
/usr/local/bin/xxtools uninstall_app -u 807e947b0dee370cb10e484cb06c7aff5c8bb66e com.apple.test.WebDriverAgent-Runner  出错
2019-10-22 20:34:54.548 [main][INFO ] [IOSxxServer.java:229] ***** check env code: 0
2019-10-22 20:34:54.614 [main][INFO ] [IOSxxServer.java:97] line: 不可执行,因为任务刚刚创建
2019-10-22 20:34:54.616 [main][INFO ] [IOSxxServer.java:97] line: null
2019-10-22 20:34:54.618 [main][INFO ] [IOSxxServer.java:107] ******* break *******
startWDA exitCode: -2
2019-10-22 20:34:54.624 [main][INFO ] [LocalCommandLine.java:199] ps -ax | grep 807e947b0dee370cb10e484cb06c7aff5c8bb66e
2019-10-22 20:34:54.701 [main][INFO ] [IOSxxServer.java:97] line: 不可执行,因为任务刚刚创建
2019-10-22 20:34:54.702 [main][INFO ] [IOSxxServer.java:97] line: null
2019-10-22 20:34:54.702 [main][INFO ] [IOSxxServer.java:107] ******* break *******
startWDA exitCode: -2
2019-10-22 20:34:56.707 [main][INFO ] [LocalCommandLine.java:199] ps -ax | grep 807e947b0dee370cb10e484cb06c7aff5c8bb66e
2019-10-22 20:34:56.777 [main][INFO ] [IOSxxServer.java:97] line: 不可执行,因为任务刚刚创建
2019-10-22 20:34:56.778 [main][INFO ] [IOSxxServer.java:97] line: null
2019-10-22 20:34:56.778 [main][INFO ] [IOSxxServer.java:107] ******* break *******
startWDA exitCode: -2
2019-10-22 20:34:58.784 [main][INFO ] [LocalCommandLine.java:199] ps -ax | grep 807e947b0dee370cb10e484cb06c7aff5c8bb66e
2019-10-22 20:34:59.732 [main][INFO ] [IOSxxServer.java:97] line: xx进程数=1
2019-10-22 20:34:59.734 [main][INFO ] [IOSxxServer.java:97] line: 手机:807e947b0dee370cb10e484cb06c7aff5c8bb66e中的wda存活。返回状态0
2019-10-22 20:34:59.736 [main][INFO ] [IOSxxServer.java:107] ******* break *******
startWDA exitCode: 0
2019-10-22 20:34:59.737 [main][INFO ] [IOSxxServer.java:56] exitStatus: 0
2019-10-22 20:34:59.739 [main][INFO ] [IOSxxServer.java:59] port: 49606
2019-10-22 20:35:00.220 [main][INFO ] [RemoteWebDriver.java:1295] Executing: newSession [null, newSession {desiredCapabilities=Capabilities [{appPackage=com.xx.xx.InHouse, isRunLongTime=false, shouldUseCompactResponses=true, deviceId=807e947b0dee370cb10e484cb06c7aff5c8bb66e, platform=IOS, isLocal=true}]}]
2019-10-22 20:35:00.461 [main][INFO ] [HttpCommandExecutor.java:156] POST --> /session 
{
    "desiredCapabilities":{
        "appPackage":"com.xx.xx.InHouse",
        "isRunLongTime":false,
        "shouldUseCompactResponses":true,
        "deviceId":"807e947b0dee370cb10e484cb06c7aff5c8bb66e",
        "platform":"IOS",
        "isLocal":true
    }
}

 

5. 如遇RT

2019-10-23 19:20:17.119 [main][INFO ] [VideoCapHelper.java:86] remote device server can't find, so restart~
2019-10-23 19:20:17.120 [minicap][INFO ] [LocalCommandLine.java:199] /Users/xx/xxHome/remote_device/remote_device

原因:本地FPS CPU脚本正常运行,但Runtime脚本一直报错,原因:macOS系统版本不兼容导致。解决办法:脚本在海川运行==pass

 

如遇:

腾讯运行脚本时,总会遇到输入框输入的query=西游记,自动化录入时可能为游记

运行中的日志为

 

{

"value":"西游记"

}

2019-10-28 15:48:11.411 [main][INFO ] [HttpCommandExecutor.java:188] POST <-- /rpc_input 200 2100ms

{

"sessionId":"C6792C95-175B-43FA-88B5-5762169F6ED0",

"value":"Error Domain=XCTDaemonErrorDomain Code=14 \"Timed out after waiting 1.0s for KeyEventCompleted after sending event for '西'.\" UserInfo={NSLocalizedDescription=Timed out after waiting 1.0s for KeyEventCompleted after sending event for '西'.}",

"status":13

}

2019-10-28 15:48:11.412 [main][INFO ] [RemoteWebDriver.java:1298] Executed: [C6792C95-175B-43FA-88B5-5762169F6ED0, rpc_input {value=西游记}]

2019-10-28 15:48:21.430 [main][INFO ] [RemoteWebDriver.java:1106] *********** Execption message : Error Domain=XCTDaemonErrorDomain Code=14 "Timed out after waiting 1.0s for KeyEventCompleted after sending event for '西'." UserInfo={NSLocalizedDescription=Timed out after waiting 1.0s for KeyEventCompleted after sending event for '西'.}

Command duration or timeout: 2.10 seconds

 

运行结束日志为:

org.openqa.selenium.WebDriverException: Error Domain=XCTDaemonErrorDomain Code=14 "Timed out after waiting 1.0s for KeyEventCompleted after sending event for '西'." UserInfo={NSLocalizedDescription=Timed out after waiting 1.0s for KeyEventCompleted after sending event for '西'.}

Command duration or timeout: 2.10 seconds

到搜索默认页,键盘弹出来了。比如录入的query=西游记,在运行自动化case时有会为“游记”,有时为“西”

经RD确认,XCTDaemonErrorDomain Code=14 "Timed out after waiting 1.0s for KeyEventCompleted after sending event为苹果系统的XCTest(苹果负责自动化测试的服务)的bug。解决办法:反复输入几次或者重启,蚂蚁金服那边的解决办法:重启手机,然后换个设备执行这个任务,那个出问题的设备有几率重启之后恢复。因为是苹果系统的bug 所以没办法彻底解决

客户端性能自动化-亲自实践遇到的问题_第11张图片

 

6. 搜索性能自动化接入海川平台

在接入海川平台之前,需要在本地以maven脚本方式运行通过

➜  perftest git:(sokuiOS) mvn test -Dtest=QiyiRespTimels  
 

内存 CPU FPS,配置如下,包名填写com.xx.xx.InHouse

 客户端性能自动化-亲自实践遇到的问题_第12张图片

 

ipa包链接获取:

 

7. 搜索性能自动化接入海川平台 RT响应时间,配置如下,包名填写com.qiyi.iphone

需要注意的是安装应用关闭即可,脚本会自动安装下载对应的线上包

客户端性能自动化-亲自实践遇到的问题_第13张图片

8. 在海川运行脚本,运行结果分析

日志:我的构建-查看结果-结果分析-结果列表-点击下载

算法信息-统计图:我的构建-查看结果-结果分析-结果列表-点击查看详细结果

iOS爱奇艺-搜索性能自动化-Basic-CPU内存FPS:   https://xx.xx-inc.com/hch#/task/result/detail?resultId=191603&configId=10888

iOS爱奇艺-搜索性能自动化-RT:https://xx-inc.com/hch#/task/result/detail?resultId=191643&configId=10898

iOSxx-搜索FPS:   https://xx.xx-inc.com/hch#/task/result/detail?resultId=191664&configId=10915

 

 

 

 

爱奇艺    

1> 爱奇艺 - FPS - 企业签名伪包-com.xx.xx.InHouse

客户端性能自动化-亲自实践遇到的问题_第14张图片

 

2>爱奇艺 - CUP 内存 企业签名伪包-com.xx.xx.InHouse

客户端性能自动化-亲自实践遇到的问题_第15张图片

3> 爱奇艺 - RT响应时间 - App Store线上包-com.qiyi.iphone

客户端性能自动化-亲自实践遇到的问题_第16张图片

起始帧

客户端性能自动化-亲自实践遇到的问题_第17张图片

结束帧

客户端性能自动化-亲自实践遇到的问题_第18张图片

 

 

 


客户端性能自动化-亲自实践遇到的问题_第19张图片

 

xx

1> xx - FPS - 企业签名-com.xx.xx.InHouse

客户端性能自动化-亲自实践遇到的问题_第20张图片

2>xx - CUP 内存 企业签名-com.xx.xx.InHouse

客户端性能自动化-亲自实践遇到的问题_第21张图片

3> xx- RT响应时间 - 企业签名-com.xx.xx.InHouse

客户端性能自动化-亲自实践遇到的问题_第22张图片

 

 

特殊处理:

// 获取屏幕尺寸
Dimension destination = driver.getScreenSize();
// 搜索入口:首页输入框点击坐标
// 浮类型,首页搜索输入框高度从顶部0,0算为y=83,上移一点点获取搜索输入框
int width1 = destination.getWidth();
float x = width1 / 2;
float y = 80.0f;
customLog.log("点击输入按钮");
driver.click(x, y);
sleep(1000);

// 由于腾讯从首页到默认页,输入框鼠标未在1s内聚焦,同时聚焦调起输入框,爱奇艺是进入默认页瞬间输入框获得焦点
// 因此需要对腾讯这块的逻辑单独处理,查找输入框,再次点击搜索输入框
WebElement inputArea = driver.findElementByClassName("XCUIElementTypeTextField");
inputArea.click();
sleep(1000);

driver.sendKeys("长安十二时辰");
WebElement enterButton = driver.findElementByAccessibilityId("Search");
enterButton.click();

sleep(1000);

 

 

关于代码-FPS:

package test.ios.xx;

import com.xx.auto.base.Fps;
import com.xx.auto.base.PerfiOSTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;

public class QQFPSTest extends PerfiOSTestCase {

//    private String bundleId = "com.xx.xx.InHouse";
    private String bundleId = "com.tencent.live4iphone";


    public void beforeSetupInit() {

    }
    // 定义全局变量,开始时间
    private long processStartTime;

    @Test
    @Fps(description = "腾讯iOS搜索FPS")
    public void testQQFPS() {
        processStartTime = System.currentTimeMillis();
        System.out.println("===================startTime为:【"+startTime+"】程序开始跑啦===================");

        customLog.log("等待8s启动app");

        driver.sleep(8000);


        customLog.log("关掉app进程");
        driver.closeApp(bundleId);
        driver.sleep(5000);


        customLog.log("MEASURE:等待10s,启动app");
        driver.launchApp(bundleId);

        sleep(10000);
        driver.dumpDLPageSource();
        System.out.println("页面资源为"+driver.dumpDLPageSource());


//        WebElement InputArea = driver.findElementByClassName("XCUIElementTypeStaticText");
//        InputArea.click();
//
//        sleep(2000);
//        driver.sendKeys("长安十二时辰");
//        WebElement enterButton1 = driver.findElementByAccessibilityId("Search");
//        enterButton1.click();

        // 获取屏幕尺寸
        Dimension destination = driver.getScreenSize();
        // 搜索入口:首页输入框点击坐标
        // 浮类型,首页搜索输入框高度从顶部0,0算为y=83,上移一点点获取搜索输入框
        int width1 = destination.getWidth();
        float x = width1 / 2;
        float y = 80.0f;
        customLog.log("点击输入按钮");
        driver.click(x, y);
        sleep(1000);

        // 由于腾讯从首页到默认页,输入框鼠标未在1s内聚焦,同时聚焦调起输入框,爱奇艺是进入默认页瞬间输入框获得焦点
        // 因此需要对腾讯这块的逻辑单独处理,查找输入框,再次点击搜索输入框
        WebElement inputArea = driver.findElementByClassName("XCUIElementTypeTextField");
        inputArea.click();
        sleep(1000);

        driver.sendKeys("长安十二时辰");
        WebElement enterButton = driver.findElementByAccessibilityId("Search");
        enterButton.click();

        sleep(1000);

        // 翻页-20页,分帧开始
        startFpsSampling(true);
        for (Integer i = 0; i <= 20; i++) {

            //driver.swipe(width / 2,height / 5 * 4,width / 2,height / 5,500);
            driver.scrollUp();
            sleep(1300);
        }

        // 分帧结束
        stopFpsSampling(true);

        long endTime = System.currentTimeMillis();
        long runTime = (endTime - processStartTime)/1000/60;
        System.out.println("===================runTime为:【"+runTime+"】分钟,搜索分帧测试结束啦===================");

    }

    @Before
    public void setUp() {
        super.setUp();
        customLog.log("setup");
        System.out.println("setup");
    }

//     本地调试重载方法,不走关闭弹框的验证,提交git时,需要注释掉
    @Override
    protected void loopPrecondition() {
        customLog.log("ignore precondition");
    }

    @After
    public void tearDown() {
        super.tearDown();
        customLog.log("tearDown");
        System.out.println("tearDown");
        long processEndTime = System.currentTimeMillis();
        long processRuntime = (processEndTime - processStartTime)/1000/60;
        System.out.println("===================processRuntime为:【"+processRuntime+"】分钟,程序运行结束啦===================");

    }

    public WebElement findElementInLauncher(String appName) {

        Integer retry = 10;
        WebElement element = null;
        Dimension d = driver.getScreenSize();
        int height = d.getHeight();
        int width = d.getWidth();
        for (Integer i = 0; i < retry; i++) {
            //开始点元素
            element = driver.findElementByNameWithoutExp(appName);

            if (element != null && element.isDisplayed()) {
                break;
            } else {
                driver.swipe((double) (width / 5 * 4), (double) (height / 2), (double) (width / 5), (double) (height / 2), 500);
                sleep(5000);
            }

        }

        return element;

    }

}

 

关于代码-CPU:

package test.ios.xx;
import com.xx.auto.base.Basic;
import com.xx.auto.base.PerfiOSTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;


public class QQCPUTest extends PerfiOSTestCase {

    private String bundleId = "com.xx.xx.InHouse";

    public void beforeSetupInit() {

    }
    // 定义全局变量,开始时间
    private long processStartTime;

    @Test
    @Basic(description = "腾讯iOS搜索内存和CPU-翻多页测试")
    public void testQQCPU() {
        processStartTime = System.currentTimeMillis();
        System.out.println("===================startTime为:【"+startTime+"】程序开始跑啦===================");

        customLog.log("等待8s启动app");

        driver.sleep(8000);

        customLog.log("关掉app进程");
        driver.closeApp(bundleId);
        driver.sleep(5000);


        customLog.log("MEASURE:等待10s,启动app");
        driver.launchApp(bundleId);

        sleep(10000);

        // 获取屏幕尺寸
        Dimension destination = driver.getScreenSize();
        // 搜索入口:首页输入框点击坐标
        // 浮类型,首页搜索输入框高度从顶部0,0算为y=83,上移一点点获取搜索输入框
        int width1 = destination.getWidth();
        float x = width1 / 2;
        float y = 80.0f;
        customLog.log("点击输入按钮");
        driver.click(x, y);
        sleep(1000);

        // 由于腾讯从首页到默认页,输入框鼠标未在1s内聚焦,同时聚焦调起输入框,爱奇艺是进入默认页瞬间输入框获得焦点
        // 因此需要对腾讯这块的逻辑单独处理,查找输入框,再次点击搜索输入框
        WebElement inputArea = driver.findElementByClassName("XCUIElementTypeTextField");
        inputArea.click();
        sleep(1000);

        driver.sendKeys("长安十二时辰");

        // 搜索CPU测试开始
        startMetricsProfiling();

        WebElement enterButton = driver.findElementByAccessibilityId("Search");
        enterButton.click();

        sleep(1000);

        // 翻页-20页
        for (Integer i = 0; i <= 20; i++) {

            driver.scrollUp();
            sleep(1300);
        }

        // 搜索CPU测试结束
        stopMetricsProfiling();

        long endTime = System.currentTimeMillis();
        long runTime = (endTime - processStartTime)/1000/60;
        System.out.println("===================runTime为:【"+runTime+"】分钟,搜索CPU测试结束啦===================");

    }

    @Before
    public void setUp() {
        super.setUp();
        customLog.log("setup");
        System.out.println("setup");
    }

    @After
    public void tearDown() {
        super.tearDown();
        customLog.log("tearDown");
        System.out.println("tearDown");
        long processEndTime = System.currentTimeMillis();
        long processRuntime = (processEndTime - processStartTime)/1000/60;
        System.out.println("===================processRuntime为:【"+processRuntime+"】分钟,程序运行结束啦===================");

    }

    public WebElement findElementInLauncher(String appName) {

        Integer retry = 10;
        WebElement element = null;
        Dimension d = driver.getScreenSize();
        int height = d.getHeight();
        int width = d.getWidth();
        for (Integer i = 0; i < retry; i++) {
            //开始点元素
            element = driver.findElementByNameWithoutExp(appName);

            if (element != null && element.isDisplayed()) {
                break;
            } else {
                driver.swipe((double) (width / 5 * 4), (double) (height / 2), (double) (width / 5), (double) (height / 2), 500);
                sleep(5000);
            }

        }

        return element;

    }


}

 

关于代码-RT:

package test.ios.yksearch;

import com.xx.auto.base.Config;
import com.xx.auto.base.PerfiOSTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;


public class QQRespTimeTest extends PerfiOSTestCase {

    private String bundleId = "com.tencent.live4iphone";

    public void beforeSetupInit() {

    }

    // 定义全局变量,开始时间
    private long processStartTime;

    @Test
    // config为算法配置,找xx,搜索为SearchPage
    @Config(algorithmName = "SearchPage", description = "腾讯iOS搜索响应时间RT-测试")
    public void testQQRespTime() {
        processStartTime = System.currentTimeMillis();
        System.out.println("===================startTime为:【" + startTime + "】程序开始跑啦===================");

        customLog.log("等待8s启动app");

        driver.sleep(8000);

        customLog.log("关掉app进程");
        driver.closeApp(bundleId);
        driver.sleep(5000);


        customLog.log("MEASURE:等待10s,启动app");
        driver.launchApp(bundleId);

        sleep(10000);

        // 获取屏幕尺寸
        Dimension destination = driver.getScreenSize();
        // 搜索入口:首页输入框点击坐标
        // 浮类型,首页搜索输入框高度从顶部0,0算为y=83,上移一点点获取搜索输入框
        int width1 = destination.getWidth();
        float x = width1 / 2;
        float y = 80.0f;
        customLog.log("点击输入按钮");
        driver.click(x, y);
        sleep(1000);

        // 由于腾讯从首页到默认页,输入框鼠标未在1s内聚焦,同时聚焦调起输入框,爱奇艺是进入默认页瞬间输入框获得焦点
        // 因此需要对腾讯这块的逻辑单独处理,查找输入框,再次点击搜索输入框
        WebElement inputArea = driver.findElementByClassName("XCUIElementTypeTextField");
        inputArea.click();
        sleep(1000);

        driver.sendKeys("西游记");
        WebElement enterButton = driver.findElementByAccessibilityId("Search");

        // 搜索RT测试开始
        setVideoCut(false);
        sampleByElement(enterButton);

        long endTime = System.currentTimeMillis();
        long runTime = (endTime - processStartTime) / 1000 / 60;
        System.out.println("===================runTime为:【" + runTime + "】分钟,搜索RT响应时间测试结束啦===================");

    }

    @Before
    public void setUp() {
        super.setUp();
        customLog.log("setup");
        System.out.println("setup");
    }

    // 本地调试重载方法,不走关闭弹框的验证,提交git时,需要注释掉
//    @Override
//    protected void loopPrecondition() {
//        customLog.log("ignore precondition");
//    }

    @After
    public void tearDown() {
        super.tearDown();
        customLog.log("tearDown");
        System.out.println("tearDown");
        long processEndTime = System.currentTimeMillis();
        long processRuntime = (processEndTime - processStartTime) / 1000 / 60;
        System.out.println("===================processRuntime为:【" + processRuntime + "】分钟,程序运行结束啦===================");

    }


    protected void setCapabilities() {
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("platform", platform);
        if ("ANDROID".equalsIgnoreCase(platform)) {
            capabilities.setCapability("deviceId", "");
            capabilities.setCapability("appActivity", ".ActivityWelcome");
            capabilities.setCapability("appPackage", "com.tencent.live4iphone");
        } else if ("IOS".equalsIgnoreCase(platform)) {
            capabilities.setCapability("deviceId", iOSDeviceId != null ? iOSDeviceId : "");
            capabilities.setCapability("appPackage", System.getenv("CI_PKG_NAME") != null ? System.getenv("CI_PKG_NAME") : "com.tencent.live4iphone");
        }

        setCustomCapabilities(capabilities);
    }

    public WebElement findElementInLauncher(String appName) {

        Integer retry = 10;
        WebElement element = null;
        Dimension d = driver.getScreenSize();
        int height = d.getHeight();
        int width = d.getWidth();
        for (Integer i = 0; i < retry; i++) {
            //开始点元素
            element = driver.findElementByNameWithoutExp(appName);

            if (element != null && element.isDisplayed()) {
                break;
            } else {
                driver.swipe((double) (width / 5 * 4), (double) (height / 2), (double) (width / 5), (double) (height / 2), 500);
                sleep(5000);
            }

        }

        return element;

    }

}

 

 

待续

你可能感兴趣的:(客户端自动化)