简体   繁体   English

从IDEA运行Robolectric测试

[英]Run Robolectric tests from IDEA

I'm trying to run RobolectricSample RobolectricDemoProject project with IDEA and i got error 我正在尝试使用IDEA运行RobolectricSample RobolectricDemoProject项目,但出现错误

Class not found: "de.peterfriese.robolectricdemo.MainActivityTest" Process finished with exit code 1 找不到类:“ de.peterfriese.robolectricdemo.MainActivityTest”进程结束,退出代码为1

but when i use gradle test command all is ok. 但是当我使用gradle test命令时一切正常。 this is my Junit config 这是我的Junit配置

now, in IDEA you have using non gradle project. 现在,在IDEA中,您正在使用非gradle项目。 That mean you can look on project structure (Ctrl+Shift+Alt+S) and look on Library visibility. 这意味着您可以查看项目结构(Ctrl + Shift + Alt + S)并查看库可见性。 (Runtime, Provided,etc) also export property are exist. (运行时,提供的等)还存在导出属性。 When library are provided or no exported, it will be absent in target apk. 提供库或不导出库时,目标apk中将不存在该库。

Also you can build project as gradle test project. 您也可以将项目构建为Gradle测试项目。 so IDEA will use your gradle test target. 因此IDEA将使用gradle测试目标。 Build will take litle more time. 构建将花费更多时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM