Android 测试框架 [英] Android Test Frameworks

查看:28
本文介绍了Android 测试框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Android 测试框架的新手,想知道现有测试框架之间的区别:Monkey、CTS、Instrumentation Framework &机器人?

I am new to Android test frameworks ,Would like to know the differences between existing test frameworks : Monkey , CTS ,Instrumentation Framework & Robotium ?

推荐答案

Instrumentation 是一种测试,与 Unit-testing 相反.

Instrumentation is a category of testing, opposite to Unit-testing.

该框架为仪器测试提供了钩子,但您将需要一个额外的第三方框架才能真正开始.

The framework provides hooks for instrumentation testing, but you are going to need an additional third-party framework to really get going.

Robotium 就是这样一个框架.它允许你编写通过用户界面运行的脚本",比如点击这个"、输入那个"等等.写得好的它可以带你完成你的用例,从而让你感觉你的应用程序不是破碎的.它还允许您测试多个活动和活动的交互.

Robotium is such a framework. It allows you to write "scripts" that run through the user interface, saying "click this", "type that", etc. Well-written it can take you through your usecases and thus provide a good feeling that your app isn't broken. It also allows you to test multiple activities and activities interacting.

根据我的经验,单元测试对于 Android 来说非常困难,尤其是对于处理 UI、数据库、活动状态等的常规"代码,除非您编写代码以实现可测试性.

Unit-testing in my experience is very hard for Android, especially for the "regular" code dealing with UI, databases, activity state, etc., unless you write your code for testability.

Android Monkey 也使用检测来运行您的用户界面,但它不遵循脚本.它随机执行此操作,其想法是无论做什么都不会使您的应用程序崩溃.根据统计数据,通过生成 100000 个事件,它试图获得尽可能高的覆盖率.除了 Robotium,猴子永远不会离开你的应用程序(那会很危险).不过,这是一个完美的补充,而且几乎免费提供(设置非常便宜,而且无需维护).

The Android Monkey also uses instrumentation to run through your user interface but it does not follow a script. It does this randomly, with the idea that whatever it does it should not crash your app. By generating 100000's of events it tries to get coverage as high as possible, based on statistics. Other than Robotium, the monkey never leaves your app (that would be dangerous). It's a perfect complement though and it comes nearly for free (the setup is really cheap and there is no maintenance).

CTS 只与操作系统和框架本身相关.

CTS is only relevant to the operating system and framework itself.

您可能还想了解模拟?

这篇关于Android 测试框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆