• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

evant/android-studio-unit-test-plugin: [Deprecated] Android Studio IDE support f ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

evant/android-studio-unit-test-plugin

开源软件地址(OpenSource Url):

https://github.com/evant/android-studio-unit-test-plugin

开源编程语言(OpenSource Language):

Java 100.0%

开源软件介绍(OpenSource Introduction):

#[Deprecated] Google has finally released a proper solution for unit testing. Therefore this plugin will no longer be activlty maintained.

android-studio-unit-test-plugin

Android Studio (and Intellij 14) IDE support for Android gradle unit tests.

This plugin will mark test directories and resolve testCompile dependencies. It also sets up the correct system properties so that Robolectric will work if you are using it.

alt tag

Requirements

  • Android Studio 0.6.0+
  • Android Gradle Plugin 0.11.0+
  • JCAndKSolutions' android-unit-test gradle plugin 1.5.0+

Install IDE the plugin

In Android Studio go to Settings -> Plugins -> Browse Repositories... and search for 'Android Studio Unit Test'.

If you feel like living on the edge, can download the zip then go to Settings -> Plugins -> Install plugin from disk.. to install.

Install the gradle plugin

To add unit testing support to your gradle project, you need JCAndKSolutions' android-unit-test gradle plugin. You need to set it up as described in the README. Make sure you have at least version 1.5.0.

Troubleshooting

  • Running tests from the IDE gives a ClassNotFoundException or something similar.

If you are running Android Stuido 0.8.9+. The latest version of this plugin will compile your test classes before running the test. However, the very first time you run them after they have been cleaned, you will still get this error. Simply attempting to run again will fix it and any subsiquent runs will work correctly.

If you are running intellij or and older version of Android Studio. If your app includes a library project compile project(":myLib") then the JUnit test runner will attempt to run testClasses on that project. Since it doesn't have that task it will fail and your test classes will not be generated. To fix, add the needed task to your library project.

task testClasses {}
  • The relative path for Robolectric's @Config(manifest = "path") is different between gradle and Android Studio.

    This is because when creating a run configuration, the path is by default relative to your project root, whereas when running it from gradle it's correctly relative to your apps root. To fix, edit the JUnit run configuration and change Working Directory to point to your app root.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap