为什么要举行测试,在一个单独的项目而不是文件夹? [英] Why to hold tests in a separate project rather then folder?
问题描述
只是出于兴趣? - 为什么它被决定将测试一个单独的项目,而不只是一个单独的源文件夹
Just out of interest - why has it been decided to move tests to a separate project, not just to a separate source folder?
推荐答案
测试应用程序乐器的目标和主要应用。
The test application "instruments" the target or main application.
在测试项目的AndroidManifest.xml该仪器部分允许测试中相同的处理的应用程序运行。该仪器功能允许测试应用程序来逐步的Android组件的生命周期以可控的方式。
The instrumentation section in the test project's AndroidManifest.xml allows the tests to run in the same process as the application. This instrumentation feature allows the test application to step through android component lifecycles in a controlled way.
有了这个控件允许你(例如)创建可重复的测试为活动周期的情况下(创建,恢复,暂停,销毁)。
Having this control allows you to (for example) create repeatable tests for cases for the activity lifecycle (create,resume,pause,destroy).
看的http://developer.android.com/guide/topics/testing/testing_android.html#Instrumentation
因此,在总结,额外的应用程序已超过测试目标的特殊权力。 由于这些被封装在测试应用程序,您的实际应用只需要拥有它要求履行职责的权限。
So in summary, the extra application has special powers over the test target. Since these are encapsulated in the test application, your real application need only have the permissions it requires to perform its duty.
这篇关于为什么要举行测试,在一个单独的项目而不是文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!