我在做Android应用程序相当丰富的经验。对于我的新项目,我们决定做测试驱动开发(TDD)。我已经让我的手在Robotium湿的用户场景测试,并能正常工作,看起来很容易。
I have considerable experience in making Android applications. For my new project, we have decided to do Test Driven Development (TDD). I have been getting my hands wet on Robotium for User Scenario Testing, and it works fine and looks easy too.
有关单元测试,我试着用嘲笑上下文(MockContext安卓类),但我不能这样做。我通过这个博客sites.google/site/androiddevtesting/并通过这种sdudzin.blogspot/2011/01/easy-unit-testing-for-android.html ,这表明在嘲讽Android应用程序仍然是非常有限的,硬,并建议使用PowerMock,jMockit,JeasyTest,或Roboelectric(与的Mockito和Maven的组合),甚至RoboGuice。
For unit testing, I tried to mock Context using (MockContext Android Class) but I am unable to do so. I went through this blog sites.google/site/androiddevtesting/ and through this sdudzin.blogspot/2011/01/easy-unit-testing-for-android.html , which suggests that mocking in Android apps is still very limited and hard, and have suggested to use PowerMock, jMockit, JeasyTest, or Roboelectric (in combination with Mockito and Maven) and even RoboGuice.
我希望得到你们哪个在您看来,单元测试框架是最好的测试Android应用程序的任何建议。 (特别是测试机器人类,可能给模拟上下文和其他嘲讽功能,这样我可以让我的测试案例尽可能独立)。任何建议或指针会很有帮助。谢谢
I would like to get any suggestions from you guys on which unit testing framework in your opinion is the best for testing Android applications. (particularly testing Android classes, possibly giving mock Contexts and other mocking features so that I can make my test cases as independent as possible). Any suggestions or pointers would be helpful . Thanks
推荐答案有关关闭设备的测试,看看 Robolectric
For off-device testing, look at Robolectric
有关设备的测试,看看Borachio
底线:它仍然是非常非常困难的事很好。情况正在好转(显着提高今天比10个月前的情况),但Android是舒服,我曾经编写的程序在大多数测试恶劣的环境。
Bottom line: it's still very, very difficult to do well. Things are improving (the situation is dramatically better today than it was 6 months ago) but Android is comfortably the most test-hostile environment I've ever written programs for.
更多推荐
Android的测试驱动开发
发布评论