Test tool ideas inspired by Monkey

What is Monkey

  
Everyone is no stranger to Monkey, and I believe that many subsequent control traversal-based testing tools are more or less inspired by it. To put it simply, Monkey test is a means of automated testing on the Android platform. The Monkey program simulates the user's operations such as touching the screen, sliding the Trackball, and pressing buttons to perform stress tests on the programs on the device.

Why there is Monkey

  
Monkey mainly uses Android stress test, which is fast and effective for testing the stability and robustness of the software. The main purpose is to test whether the app will crash.
  
When we need to stress test a software to check its performance, if we test it manually If so, it will be very inefficient and boring. And Monkey can alleviate this part of the repetitive and tedious work for us, just observe how long the detected program will be abnormal, and collect the abnormal information at the end.

Disadvantages of Monkey

  • Unable to know exactly how to reproduce the bug
  • The validity of the user event stream sent is questionable, many of which are invalid operations

What improvements can be made against the drawbacks of Monkey

1. How to solve the problem of not knowing the steps to reproduce the bug

  
The help of Monkey for application robustness is self-evident, but its disadvantages cannot be ignored.
  
When Monkey runs out of a bunch of problems, if you can know the reproduction steps in time and accurately, it will greatly shorten the time for locating the problem and help you develop timely debugging programs to optimize performance. And combined with Monkey's testing ideas, we can also collect performance data synchronously, analyze possible problematic scenarios, and give early warnings.
  
Take the FPS test as an example to provide some ideas. The following figure is the workflow of using Monkey as the driver to measure the FPS performance of the entire application, conceived 3 years ago. (Note: The Monkey written in the picture is not an android native monkey, but a simple pseudo-Monkey tool based on its principle, which is characterized by the ability to record the operation type and operation track during the test process, which can be used to directly record the error screenshot in the future. Mark the operation path.)

image
  
通过上图这样的改造后,无法得知bug复现步骤的问题便在一定程度上得到了解决。于是,应用开发前期我们就可以对整个程序进行全面测试,在繁多的操作流程中找到可能存在问题的场景,这部分场景在测试中会以类似下图的方式展示,明确标记操作路径,并将当时操作产生的FPS等具体信息记录在案。进而测试可以根据这些信息有针对性地对这部分问题场景进行复测,同时开发也能同步进行调试定位,优化性能。

image

2.如何减少无效操作,提高测试覆盖面

  
为了解决Moneky无效操作过多的问题,研发基于控件的自动化遍历工具几乎是业界的共识,也由此涌现出了不少优秀的团队优秀的工具,而MQC旗下的Ripper亦是其中的佼佼者。目前MQC中的Android兼容性测试便是以Ripper驱动的。
  
相比Monkey,以及大多数遍历工具,Ripper有如下优势

  • 更多的动作:多点触控、缩放、连击、中文输入……
  • 精准控制,高并发,测试效率高
  • 根据规则遍历控件,减少重复操作次数,提高测试覆盖面
  • 记录测试场景,方便问题追踪
  • 识别输入框语义,根据语义输入内容
  • 识别并处理各类弹框 …… 更多的优点,试用过后,方能体会Ripper的美妙之处!   
    下图为Ripper测试后产生的部分操作场景拓扑图。

image  
  
MQC测试平台是为广大企业客户和移动开发者提供真机测试服务的云平台,拥有大量热门机型,提供7x24全天候服务。
    
我们致力于提供专业、稳定、全面、高价值的自动化测试能力,以及简单易用的使用流程、贴心的技术服务,并且帮助客户以最低的成本、最高的效率发现APP中的各类隐患(APP崩溃、各类兼容性问题、功能性问题、性能问题等),减少用户流失,提高APP质量和市场竞争力。

原文链接:https://yq.aliyun.com/articles/151878?spm=5176.8091938.0.0.ugigHu

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326375596&siteId=291194637