简体   繁体   中英

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. 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

PS I have created a new Java Project for my existing project.

UPDATE

After hours of debugging I found that, if I remove android:name="com.myapp.bl.MyApplication from AndroidManifest, then its starts executing tests.

<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.

Regards, Yuvi

I found the issue, there was an exception in MyApplication class. If that exception occurs then application was getting closed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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