How to run Android JUnit tests from multiple projects in eclipse?

为君一笑 提交于 2019-12-11 10:37:50

问题


I'm wondering how to run multiple projects containing Android JUnit Robotium test from eclipse at once... I hope someone could help.

Thanks a lot!


回答1:


I was caught up in the similar situation. I used command line to run my test. You can use the following commands

For a single Test

adb shell am instrument -e your class -w your package/android.test.InstrumentationTestRunner

For all your Tests

adb shell am instrument -w your package/android.test.InstrumentationTestRunner

Hope it helps.




回答2:


You can run JUnit tests across multiple projects using the open source Classpath Suite.

Create an Eclipse project which contains a dependency on all the projects you want to test. Write a suite:

@RunWith(ClasspathSuite.class)
public class MySuite

Take a look on this article: Roger Rabbit - JUnit Tests Runner Across Multiple Projects, it includes a step by step example and a code sample.



来源:https://stackoverflow.com/questions/7525757/how-to-run-android-junit-tests-from-multiple-projects-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!