简体   繁体   English

Robolectric样本和Gradle插件

[英]Robolectric Samples and Gradle Plugin

In Robolectric sample project , there is no gradle plugin set up in build.gradle. Robolectric示例项目中 ,build.gradle中没有设置gradle插件。 For instance for AppCompat-v7 例如对于AppCompat-v7

On the other hand we have Robolectric gradle plugin which as documentation says: 另一方面,我们有Robolectric gradle插件 ,如文档所述:

A Gradle plugin which enables Robolectric tests. 一个Gradle插件,可以进行Robolectric测试。

This plugin piggy-backs on the unit testing support added in version 1.1.0 of the Android Gradle plugin and configures the test tasks to work correctly with Robolectric. 此插件附带了Android Gradle插件1.1.0版中添加的单元测试支持,并配置了测试任务以与Robolectric一起正常工作。

I wonder why in Robolectric sample project there is no sign of Robolectric Gradle Plugin. 我想知道为什么在Robolectric示例项目中没有Robolectric Gradle插件的迹象。

If we can run robolectric tests without the plugin in Android Studio using gradle wrapper, then what is the exact usages of Plugin? 如果我们可以使用gradle wrapper在Android Studio中在没有插件的情况下运行robolectric测试,那么Plugin的确切用法是什么?

Main reason is that this plugin isn't necessary and will be marked as deprecated if robolectric 3.0 get final. 主要原因是该插件不是必需的,并且如果robolectric 3.0最终版将被标记为已弃用。 This is a statement from robolectric maintainer erd. 这是robolectric维护者erd的声明。 See first answer at https://github.com/robolectric/robolectric-gradle-plugin/issues/148 参见https://github.com/robolectric/robolectric-gradle-plugin/issues/148的第一个答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM