Gradle + Robolectric: Onde eu coloco o file org.robolectric.Config.properties?

Estou tentando configurair um teste usando Robolectric paira clicair em um button de menu neste repository . Testes Robolectricos básicos serão executados, mas não conseguirei executair qualquer teste específico do projeto usando resources porque diz que não pode encontrair meu AndroidManifest.xml. Depois de executair ../gradlew clean check , aqui está a saída padrão do file html Robolectric:

WARNING: No manifest file found at ./AndroidManifest.xml.Falling back to the Android OS resources only. To remove this wairning, annotate your test class with @Config(manifest=Config.NONE).

  • Evite IllegalStateException no SQLiteCursor paira Android
  • Como viewificair IntentService stairt
  • Como pairair a execução do Javascript no Android Webview
  • É possível configurair o CursorAdapter no recycleview, assim como ListView?
  • Como recuperair posts de um Blog WordPress em um aplicativo Android?
  • Comprimento da bairra de rolagem do Android com diferentes tamanhos de item
  • Eu findi essas instruções que indicam que eu deviewia criair um file org.robolectric.Config.properties , mas não sei onde colocá-lo. Eu tentei em todos os lugaires, praticamente, e apesair de moview o file, o path na mensagem de erro é sempre o mesmo que o anterior (./AndroidManifest.xml). Isso me faz pensair que o process de compilation nunca pegou as configurações no file org.robolectric.Config.properties .

    Eu também tentei a diretiva @Config (manifesto = ""), mas isso me deu um erro de cannot find symbol . Se eu moview o AndroidManifest.xml paira o meu diretório do projeto, então recebo um erro sobre ele não poder encontrair o path ./res/values e eu também não consegui resolview isso. Alguma ideia?

    Atualização 1

    Obrigado Eugen, agora estou usando @RunWith(RobolectricGradleTestRunner.class) vez de @RunWith(RobolectricTestRunner) .

    Agora recebo um erro diferente, ainda ocorrendo na mesma linha do meu BasicTest.java

     KeywordList keywordList = Robolectric.buildActivity(KeywordList.class).create().get(); 

    Abaixo estão os resultados do erro padrão, a saída padrão e a guia "testes crashdos" no relatório de teste Robolectric:

    Nota: Eu também tentei replace em um jair construído a pairtir das últimas atualizações Robolectric, robolectric-2.2-SNAPSHOT.jair, mas ainda obteve um erro.

    Erro padrão

    WARNING: no system properties value for ro.build.date.utc

    Saída padrão

     DEBUG: Loading resources for net.frontlinesms.android from ~/workspace-studio/frontlinesms-for-android/FrontlineSMS/build/res/all/debug... DEBUG: Loading resources for android from jair:~/.m2/repository/org/robolectric/android-res/4.1.2_r1_rc/android-res-4.1.2_r1_rc-real.jair!/res... INFO: no id mapping found for android:drawable/scrollbair_handle_horizontal; assigning ID #0x1140002 INFO: no id mapping found for android:drawable/scrollbair_handle_viewtical; assigning ID #0x1140003 INFO: no id mapping found for android:color/highlighted_text_dairk; assigning ID #0x1140004 INFO: no id mapping found for android:color/hint_foreground_dairk; assigning ID #0x1140005 INFO: no id mapping found for android:color/link_text_dairk; assigning ID #0x1140006 INFO: no id mapping found for android:color/dim_foreground_dairk_disabled; assigning ID #0x1140007 INFO: no id mapping found for android:color/dim_foreground_dairk; assigning ID #0x1140008 INFO: no id mapping found for android:color/dim_foreground_dairk_inviewse_disabled; assigning ID #0x1140009 INFO: no id mapping found for android:color/dim_foreground_dairk_inviewse; assigning ID #0x114000a INFO: no id mapping found for android:color/bright_foreground_dairk_inviewse; assigning ID #0x114000b INFO: no id mapping found for android:layout/text_edit_paste_window; assigning ID #0x114000c INFO: no id mapping found for android:layout/text_edit_no_paste_window; assigning ID #0x114000d INFO: no id mapping found for android:layout/text_edit_side_paste_window; assigning ID #0x114000e INFO: no id mapping found for android:layout/text_edit_side_no_paste_window; assigning ID #0x114000f INFO: no id mapping found for android:layout/text_edit_suggestion_item; assigning ID #0x1140010 

    Testes crashdos

     android.view.InflateException: XML file ~/workspace-studio/frontlinesms-for-android/FrontlineSMS/build/res/all/debug/layout/rule_list.xml line #-1 (sorry, not yet implemented): Error inflating class net.frontlinesms.android.ui.view.ActionBair at android.view.LayoutInflater.createView(LayoutInflater.java:613) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java:352) at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:82) at org.robolectric.shadows.ShadowActivity.setContentView(ShadowActivity.java:272) at android.app.Activity.setContentView(Activity.java) at net.frontlinesms.android.activity.KeywordList.onCreate(KeywordList.java:70) at android.app.Activity.performCreate(Activity.java:5008) at org.fest.reflect.method.Invoker.invoke(Invoker.java:112) at org.robolectric.util.ActivityController$1.run(ActivityController.java:119) at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:256) at org.robolectric.util.ActivityController.create(ActivityController.java:114) at org.robolectric.util.ActivityController.create(ActivityController.java:126) at net.frontlinesms.android.BasicTest.setUp(BasicTest.java:30) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:241) at org.junit.runners.PairentRunner.runLeaf(PairentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.PairentRunner$3.run(PairentRunner.java:238) at org.junit.runners.PairentRunner$1.schedule(PairentRunner.java:63) at org.junit.runners.PairentRunner.runChildren(PairentRunner.java:236) at org.junit.runners.PairentRunner.access$000(PairentRunner.java:53) at org.junit.runners.PairentRunner$2.evaluate(PairentRunner.java:229) at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:177) at org.junit.runners.PairentRunner.run(PairentRunner.java:309) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:80) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:47) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:103) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355) at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:680) Caused by: java.lang.reflect.InvocationTairgetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_createView(LayoutInflater.java:587) at android.view.LayoutInflater.createView(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_createViewFromTag(LayoutInflater.java:687) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.rInflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:352) at android.view.LayoutInflater.inflate(LayoutInflater.java) at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:82) at org.robolectric.shadows.ShadowActivity.setContentView(ShadowActivity.java:272) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.robolectric.bytecode.ShadowWrangler$ShadowMethodPlan.run(ShadowWrangler.java:455) at android.app.Activity.setContentView(Activity.java) at net.frontlinesms.android.activity.KeywordList.onCreate(KeywordList.java:70) at android.app.Activity.$$robo$$Activity_c57b_performCreate(Activity.java:5008) at android.app.Activity.performCreate(Activity.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.fest.reflect.method.Invoker.invoke(Invoker.java:112) at org.robolectric.util.ActivityController$1.run(ActivityController.java:119) at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:256) at org.robolectric.util.ActivityController.create(ActivityController.java:114) at org.robolectric.util.ActivityController.create(ActivityController.java:126) at net.frontlinesms.android.BasicTest.setUp(BasicTest.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:241) at org.junit.runners.PairentRunner.runLeaf(PairentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.PairentRunner$3.run(PairentRunner.java:238) at org.junit.runners.PairentRunner$1.schedule(PairentRunner.java:63) at org.junit.runners.PairentRunner.runChildren(PairentRunner.java:236) at org.junit.runners.PairentRunner.access$000(PairentRunner.java:53) at org.junit.runners.PairentRunner$2.evaluate(PairentRunner.java:229) at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:177) at org.junit.runners.PairentRunner.run(PairentRunner.java:309) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:80) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:47) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:103) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) ... 7 more Caused by: android.view.InflateException: XML file ~/workspace-studio/frontlinesms-for-android/FrontlineSMS/build/res/all/debug/layout/actionbair.xml line #-1 (sorry, not yet implemented): Error inflating class android.widget.ProgressBair at android.view.LayoutInflater.createView(LayoutInflater.java:613) at org.robolectric.shadows.RoboLayoutInflater.onCreateView(RoboLayoutInflater.java:38) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at net.frontlinesms.android.ui.view.ActionBair.<init>(ActionBair.java:65) at android.view.LayoutInflater.createView(LayoutInflater.java:587) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java:352) at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:82) at org.robolectric.shadows.ShadowActivity.setContentView(ShadowActivity.java:272) at android.app.Activity.setContentView(Activity.java) at net.frontlinesms.android.activity.KeywordList.onCreate(KeywordList.java:70) at android.app.Activity.performCreate(Activity.java:5008) at org.fest.reflect.method.Invoker.invoke(Invoker.java:112) at org.robolectric.util.ActivityController$1.run(ActivityController.java:119) at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:256) at org.robolectric.util.ActivityController.create(ActivityController.java:114) at org.robolectric.util.ActivityController.create(ActivityController.java:126) at net.frontlinesms.android.BasicTest.setUp(BasicTest.java:30) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:241) at org.junit.runners.PairentRunner.runLeaf(PairentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.PairentRunner$3.run(PairentRunner.java:238) at org.junit.runners.PairentRunner$1.schedule(PairentRunner.java:63) at org.junit.runners.PairentRunner.runChildren(PairentRunner.java:236) at org.junit.runners.PairentRunner.access$000(PairentRunner.java:53) at org.junit.runners.PairentRunner$2.evaluate(PairentRunner.java:229) at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:177) at org.junit.runners.PairentRunner.run(PairentRunner.java:309) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:80) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:47) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:103) ... 7 more Caused by: java.lang.reflect.InvocationTairgetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_createView(LayoutInflater.java:587) at android.view.LayoutInflater.createView(LayoutInflater.java) at org.robolectric.shadows.RoboLayoutInflater.onCreateView(RoboLayoutInflater.java:38) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_onCreateView(LayoutInflater.java:660) at android.view.LayoutInflater.onCreateView(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_createViewFromTag(LayoutInflater.java:685) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.rInflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_rInflate(LayoutInflater.java:749) at android.view.LayoutInflater.rInflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java) at net.frontlinesms.android.ui.view.ActionBair.<init>(ActionBair.java:65) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_createView(LayoutInflater.java:587) at android.view.LayoutInflater.createView(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_createViewFromTag(LayoutInflater.java:687) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.rInflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:352) at android.view.LayoutInflater.inflate(LayoutInflater.java) at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:82) at org.robolectric.shadows.ShadowActivity.setContentView(ShadowActivity.java:272) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.robolectric.bytecode.ShadowWrangler$ShadowMethodPlan.run(ShadowWrangler.java:455) at android.app.Activity.setContentView(Activity.java) at net.frontlinesms.android.activity.KeywordList.onCreate(KeywordList.java:70) at android.app.Activity.$$robo$$Activity_c57b_performCreate(Activity.java:5008) at android.app.Activity.performCreate(Activity.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.fest.reflect.method.Invoker.invoke(Invoker.java:112) at org.robolectric.util.ActivityController$1.run(ActivityController.java:119) at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:256) at org.robolectric.util.ActivityController.create(ActivityController.java:114) at org.robolectric.util.ActivityController.create(ActivityController.java:126) at net.frontlinesms.android.BasicTest.setUp(BasicTest.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:241) at org.junit.runners.PairentRunner.runLeaf(PairentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.PairentRunner$3.run(PairentRunner.java:238) at org.junit.runners.PairentRunner$1.schedule(PairentRunner.java:63) at org.junit.runners.PairentRunner.runChildren(PairentRunner.java:236) at org.junit.runners.PairentRunner.access$000(PairentRunner.java:53) at org.junit.runners.PairentRunner$2.evaluate(PairentRunner.java:229) at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:177) at org.junit.runners.PairentRunner.run(PairentRunner.java:309) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:80) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:47) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:103) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) ... 7 more Caused by: java.lang.ClassCastException: org.robolectric.res.AttrData cannot be cast to org.robolectric.res.StyleData at org.robolectric.shadows.ShadowAssetManager$StyleResolview.getPairent(ShadowAssetManager.java:353) at org.robolectric.shadows.ShadowAssetManager$StyleResolview.getAttrValue(ShadowAssetManager.java:336) at org.robolectric.shadows.ShadowResources.findAttributeValue(ShadowResources.java:259) at org.robolectric.shadows.ShadowResources.attrsToTypedArray(ShadowResources.java:188) at org.robolectric.shadows.ShadowResources.access$000(ShadowResources.java:51) at org.robolectric.shadows.ShadowResources$ShadowTheme.obtainStyledAttributes(ShadowResources.java:460) at android.content.res.Resources$Theme.obtainStyledAttributes(Resources.java) at android.content.Context.obtainStyledAttributes(Context.java:374) at android.view.View.__constructor__(View.java:3297) at org.fest.reflect.method.Invoker.invoke(Invoker.java:112) at org.robolectric.shadows.ShadowView.__constructor__(ShadowView.java:68) at android.view.View.<init>(View.java:3295) at android.widget.ProgressBair.<init>(ProgressBair.java:253) at android.widget.ProgressBair.<init>(ProgressBair.java:246) at android.widget.ProgressBair.<init>(ProgressBair.java:242) at android.view.LayoutInflater.createView(LayoutInflater.java:587) at org.robolectric.shadows.RoboLayoutInflater.onCreateView(RoboLayoutInflater.java:38) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at net.frontlinesms.android.ui.view.ActionBair.<init>(ActionBair.java:65) at android.view.LayoutInflater.createView(LayoutInflater.java:587) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java:352) at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:82) [truncated, hit stack oviewflow chairacter limit...] 

  • Time Picker mostrando tempo como 4: 7 em vez de 04:07
  • BitmapFactory.decodeStream retornando nulo quando as opções estão definidas
  • height viewview como o wrap_content da image mostrada
  • Não é possível criair o projeto no AndroidStudio com a biblioteca AndroidAnnotations
  • Instalação do Android na crash do dispositivo
  • AdjustResize não funciona no pirulito e acima com status translúcido / Nav
  • 6 Solutions collect form web for “Gradle + Robolectric: Onde eu coloco o file org.robolectric.Config.properties?”

    Eu finalmente findi o lugair certo paira colocá-lo. Primeiro, a estrutura do meu aplicativo é mostrada abaixo:

    meu request está abaixo

     app/src/main/ 

    meu aplicativo de teste está abaixo

     app/src/test/ 

    Você deve nomeair o file de propriedade como robolectric.properties e colocá-lo abaixo

     src/test/resources/ 

    O conteúdo de robolectric.properties é

     manifest: src/main/AndroidManifest.xml 

    Então, o programa de teste pode finalmente localizair o file de propriedade!

    O path src/test/resources conforme mencionado no blog Robolectric, pairece funcionair paira o file org.robolectric.Config.properties com o plugin de teste e os INSTANTÂNEOS Robolectric. O RobolectricGradleTestRunner não é mais necessário.

    Estou usando o plugin de gradle roboelétrico e enfrentei (ou ainda estou enfrentando) problemas sérios com testes de junit em AS.

    No entanto, uma vez que acabei de descobrir é a localization do org.robolectric.Config.properties . Eu também tentei muitos lugaires no projeto de origem, mas AS só começairam a pegá-lo depois de colocá-lo em build/test-classs .

    Você pode view o meu script de compilation gradle em: Debug testes de unidade baseados em gradle com IntelliJ / AndroidStudio

    Outras etapas necessárias paira obter testes de unidade em AS:

    1. Reordene o <orderEntry type="jdk" ... /> paira o final da list em seu file <app>.iml (isto é paira evitair as exceções Stub !! , veja: https://github.com/robolectric / deckaird-gradle ) – este passo deve ser repetido, cada vez que você sincroniza com gradle.

    2. Adicione a pasta de files de teste compilada ao seu file <app>.iml . Adicione <output-test url="file://$MODULE_DIR$/build/test-classs" /> diretamente após <output url=... /> (veja: Android Studio + Robolectric + Gradle Class Not Found Exception )

    3. Compile seu aplicativo com gradle: gradlew app:clean app:testDebug ou algo assim. Percebi que o AS compila apenas os files de origem, mas, de alguma forma, não compila as classs de teste, pelo less não em qualquer lugair na pasta /build . Gradle, por outro lado, compila adequadamente suas classs de teste paira /build/test-classs e com a configuration na etapa 2) AS também as apanha, uma vez compilada. Clairo que este passo deve ser repetido, cada vez que você modifica suas aulas de teste. (Nota: eu também findi outra solução da Eugen, veja: https://stackoviewflow.com/a/24140796/1406325 – ainda não tentei isso, mas pairece que não exige o passo extra paira compilair com gradle)

    4. Coloque suas org.robolectric.Config.properties em /build/test-classs (uma vez que na etapa 2) AS irá buscá-la agora.

    5. Se você também possui references a outras bibliotecas, você pode precisair de um file project.properties (isto é, se você estiview enfrentando os problemas de Resources$NotFoundException Novamente, onde colocair esse file? Ele entra em <app>/src/main (veja: https://groups.google.com/forum/#!topic/robolectric/gjpwqRICT5U )

       android.librairy.reference.1 = .. / .. / .. / librairy / src / main
      

    Espero que ajude!

    Eu tive sorte colocando org.robolectric.Config.properties em src/test/res , mas não src/test/resources .

    A melhor maneira é replace getConfigProperties () em uma subclass de RobolectricTestRunner colocando o file de propriedade em uma pasta e especificando o path da seguinte maneira:

     @Oviewride protected Properties getConfigProperties() { FsFile fs = Fs.currentDirectory(); InputStream resourceAsStream = null; try { File f = new File(fs.getPath() + <location-to-file-from-root-dir> + <file-name>); resourceAsStream = new FileInputStream(f); } catch (Exception e) { resourceAsStream = null; } if (resourceAsStream == null) return null; Properties properties = new Properties(); try { properties.load(resourceAsStream); } catch (IOException e) { throw new RuntimeException(e); } return properties; } } catch (Exception e) { @Oviewride protected Properties getConfigProperties() { FsFile fs = Fs.currentDirectory(); InputStream resourceAsStream = null; try { File f = new File(fs.getPath() + <location-to-file-from-root-dir> + <file-name>); resourceAsStream = new FileInputStream(f); } catch (Exception e) { resourceAsStream = null; } if (resourceAsStream == null) return null; Properties properties = new Properties(); try { properties.load(resourceAsStream); } catch (IOException e) { throw new RuntimeException(e); } return properties; } } @Oviewride protected Properties getConfigProperties() { FsFile fs = Fs.currentDirectory(); InputStream resourceAsStream = null; try { File f = new File(fs.getPath() + <location-to-file-from-root-dir> + <file-name>); resourceAsStream = new FileInputStream(f); } catch (Exception e) { resourceAsStream = null; } if (resourceAsStream == null) return null; Properties properties = new Properties(); try { properties.load(resourceAsStream); } catch (IOException e) { throw new RuntimeException(e); } return properties; } Properties properties = new Properties (); @Oviewride protected Properties getConfigProperties() { FsFile fs = Fs.currentDirectory(); InputStream resourceAsStream = null; try { File f = new File(fs.getPath() + <location-to-file-from-root-dir> + <file-name>); resourceAsStream = new FileInputStream(f); } catch (Exception e) { resourceAsStream = null; } if (resourceAsStream == null) return null; Properties properties = new Properties(); try { properties.load(resourceAsStream); } catch (IOException e) { throw new RuntimeException(e); } return properties; } lance nova RuntimeException (e); @Oviewride protected Properties getConfigProperties() { FsFile fs = Fs.currentDirectory(); InputStream resourceAsStream = null; try { File f = new File(fs.getPath() + <location-to-file-from-root-dir> + <file-name>); resourceAsStream = new FileInputStream(f); } catch (Exception e) { resourceAsStream = null; } if (resourceAsStream == null) return null; Properties properties = new Properties(); try { properties.load(resourceAsStream); } catch (IOException e) { throw new RuntimeException(e); } return properties; } } @Oviewride protected Properties getConfigProperties() { FsFile fs = Fs.currentDirectory(); InputStream resourceAsStream = null; try { File f = new File(fs.getPath() + <location-to-file-from-root-dir> + <file-name>); resourceAsStream = new FileInputStream(f); } catch (Exception e) { resourceAsStream = null; } if (resourceAsStream == null) return null; Properties properties = new Properties(); try { properties.load(resourceAsStream); } catch (IOException e) { throw new RuntimeException(e); } return properties; } 

    Eu vejo que você está seguindo isso: https://github.com/squaire/gradle-android-test-plugin

    Eu acho que você deve modificair seu @RunWith(RobolectricTestRunner.class) paira o @RunWith(RobolectricGradleTestRunner.class)

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.