You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def start_record(video_path, run_path):
while not os.path.exists(run_path):
time.sleep(1)
while confrun.PerfConfig.threadLock:
if confrun.PerfConfig.record: # 这里的判断是我需要在用例的指定步骤后穿插开始录屏的标识,这边监听状态
try:
if confrun.Config.device == confrun.Scene.iOS.value: # 这里也是双端用了不同的录屏方式
with make_screenrecord(output_video_path=video_path): # iOS是上下文管理器的方式来控制录屏的启停
while confrun.PerfConfig.record:
time.sleep(1)
elif confrun.Config.device == confrun.Scene.Android.value:
my_u2.start_recording(video_path)
except Exception as e:
common.update_cache('record_error', f"Error in recording: {e}")
break
time.sleep(1.5)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
现状:
1.我很喜欢seldom框架,让我更多的时间集中于如何实现用例上,不必再去造轮子;
2.公司方面希望能够进行APP的性能测试,主要在于某些功能的耗时。
想法:
1.seldom框架能够支持完成自动化的测试工作,但目前缺乏对性能的采集和录屏分帧计算耗时;
2.让每条用例更丰富的方式考虑利用装饰器来实现;
3.UI自动化主要是耗时密集型场景,所以我选择了协程实现并发;
实现:
1.首先设计一个装饰器架子然后在里面套一个协程即可
2.其中的三个方法设计如下:
大致的设计思路是这样,协程是这样设计,但也有后续的数据处理操作,比如:性能数据绘制图表,录屏进行分帧和图像识别计算耗时,完整的装饰器设计如下:
下面再贴一下装饰器后置处理的相关代码:
最后还有一个最重要的,在seldom框架执行的最开始处需要处理一下:
代码还是不全,但主要的都在这里,有需要或者也是一起做APP性能的同学可以一起交流一起学习~
Beta Was this translation helpful? Give feedback.
All reactions