NullPointerException on reflection during Robolectric startup - any hints?

后端 未结 3 801
醉梦人生
醉梦人生 2021-01-05 18:28

I am developing an Android project on Eclipse, and I\'m trying to switch from running tests on the emulator/device (which is very slow) to Robolectric.

I re

3条回答
  •  醉酒成梦
    2021-01-05 18:46

    No need to create a custom RoboelectricTestRunner, just play a bit with your 'Run Configurations' on Eclipse. On the configuration for running your tests, go to the classpath tab and ensure that the libraries required for your test, e.g. robolectric-2.2-jar-with-dependencies.jar and android.jar and the project itself are in the User Entries and ONLY the Java SDK is in the Bootstrap Entries.

    Then add this file:

    [project_path]/test/org.robolectric.Config.properties

     manifest=../AndroidManifest.xml
    

提交回复
热议问题