android studio下编写robotium,运行,配置
1、robotium的测试代码应该放在android studi工程下的androidTest目录下。
2、编写好测试代码后,配置Runner, 以
com.zutubi.android.junitreport.JUnitReportTestRunner为例 ,需要在build.gradle文件中的defaultConfig{ }下添加,testInstrumentationRunner "com.zutubi.android.junitreport.JUnitReportTestRunner",
3、点击菜单 run->editor configruations... 在弹出的对话框中,在 Specfic instrumentation runner选择使用的。
4、另外android studio 和 eclipse中运行,instrumentation有所不同,不需要再manifest.xml中 配置<instrumentation 这个标签。只要保证2、3中一致就行。
5、都配置好以后就可以运行了,
6、再第3中,大家看到了除了junit,还有testng。 只要在你的testcase函数中, 如果你用的@Test 是junit下的那么就显示在junit标签下,如果是testng包下的那就就显示在testng下。