在机器人工作室0.8单元测试 [英] Unit tests in Android Studio 0.8

查看:144
本文介绍了在机器人工作室0.8单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  

最新消息: Android的工作室1.1.0现在已经内置了对单元测试的支持。查看更多在这里: https://sites.google .COM / A / android.com /工具/高科技文档/单元测试支持

  

起初,我知道有非常,非常,非常的很多类似的问题(即使在这里SO)。他们大多是非常过时的,所以我要问一个全新的问题,这应该是最新的Andr​​oid的工作室0.8.4。

我知道有一些库,工作不知何故,但是几乎在每一种情况下我没有证据证明该信息是最新的。我知道有例如 roboelectric 的,也有一些去precated杰克·沃顿一样的摇篮 - Android的测试插件或的双ES preSSO ,我还发现库的 RoboSpock 戴克。但他们都不似乎有任何的Andr​​oid Studio的集成。

长研制后,我发现这两个错误在所有实现:

  • 在类路径被破坏,需要被黑客入侵获得的JUnit运行
  • JUnit测试不能被调试

我正在寻找的:

  • 我要自动测试的算法(这是普通的Java)
  • 我要检查的融合在我的Andr​​oid应用程序的工作原理
  • 我想在Android的Studio中的集成,这样我可以跳进code OUT堆栈跟踪的
  • 我想一步thrue测试code

我也发现某处一个很好的破解这在摇篮作为外部任务运行的测试,推动了成果转化为AS,这样的结果可能被显示出来,但不幸的是我无法找到该链接再次(如果我没记错的话它确实也不会为我工作)。

你们是否有一些新的参考?它是否适合你?

解决方案

您要编辑的Andr​​oid Studio生成指向您的测试类目录,也从Junit的修复存根错误.iml文件。目前还没有变通这一点。

Gradlectric 是使用的 Robolectric摇篮的插件运行在Android的Studio中的单元测试。

BREAKING NEWS: Android Studio 1.1.0 now has built-in support for unit testing. See more here: https://sites.google.com/a/android.com/tools/tech-docs/unit-testing-support

At first I know that there are very, very, very much similar questions (even here on SO). Most of them are terribly outdated so I'm asking a fresh new question which should be up to date for Android Studio 0.8.x.

I know there are some libraries which work somehow, but in almost each case I had no evidence that the information were up to date. I know there is e.g. roboelectric, there are also some deprecated Jake Wharton like gradle-android-test-plugin or double-espresso, I also found the library RoboSpock and Deckard. But none of them seems to have any Android Studio integration.

After long reseach I found this two bugs in all implementations:

  • The classpath is broken and needs to been hacked to get junit running
  • The junit tests cannot been debugged

What I'm looking for:

  • I want to automatically test an algorithm (which is plain java)
  • I want to check the integration in my Android app works
  • I want an integration in Android Studio so that I can jump into the code out of a stacktrace
  • I want to step thrue the test code

I found also somewhere a nice hack which run the tests in gradle as an external task and pushed the results into AS so that the results could been displayed, but unfortunately I cannot find that link again (and if I remember correctly it did also not work for me).

Do you guys have some fresh references? Does it work for you?

解决方案

You have to edit the .iml file that Android Studio generates to point to your test-classes directory and also to fix the Stub error from Junit. There is currently no work around for this.

Gradlectric is a sample that uses the Robolectric Gradle Plugin to run unit tests in Android Studio.

这篇关于在机器人工作室0.8单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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