[英]Robolectric test not running for project having own Application class
I have followed steps as mentioned Robolectric http://robolectric.org/eclipse-quick-start/ I am able to successfully run the test as per steps provided. 我遵循了Robolectric所说的步骤http://robolectric.org/eclipse-quick-start/我能够按照提供的步骤成功运行测试。 For a fresh new Project and Test project.
对于一个新的新项目和测试项目。
But when I followed same steps for my existing project, then nothing happens only a warning is being shown and test gets terminated. 但是,当我对现有项目执行相同的步骤时,什么也没有发生,只显示警告并终止测试。
My existing app is for target android-15 and I am using robolectric-2.2-jar-with-dependencies.jar
我现有的应用是针对目标android-15的,并且我正在使用
robolectric-2.2-jar-with-dependencies.jar
PS I have created a new Java Project for my existing project. PS我为现有项目创建了一个新的Java项目。
UPDATE 更新
After hours of debugging I found that, if I remove android:name="com.myapp.bl.MyApplication
from AndroidManifest, then its starts executing tests. 经过数小时的调试,我发现,如果我从AndroidManifest中删除了
android:name="com.myapp.bl.MyApplication
,则它将开始执行测试。
<application
android:name="com.myapp.bl.MyApplication"
android:allowBackup="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
Is there any addition flag or setting, that I have to pass Robolectric, so that it understands MyApplication class. 是否有任何其他标志或设置,我必须通过Robolectric,以便它理解MyApplication类。
Regards, Yuvi 问候,尤维
I found the issue, there was an exception in MyApplication class. 我发现了问题,MyApplication类中有一个异常。 If that exception occurs then application was getting closed.
如果发生该异常,则说明应用程序已关闭。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.