5

Uygulamamda REST servis çağrıları yapmak için android yayın RestTemplate kullanıyorum. REST servis çağrılarının alay edilmesini içeren android Instrumentation testini ekledim. android stüdyodan çalışırken Tüm benim test iyi çalışıyor, ancak build.gradle üzerindeAndroidTest Komut satırından çalışırken başarısız oldu: app: connectedDebugAndroidTest

./gradlew clean :app:connectedDebugAndroidTest 

bahar testi bağımlılığını kullanarak terminalden çalışırken Test yayı sahte sınıfını yüklenemedi

androidTestCompile("org.springframework:spring-test:3.2.8.RELEASE") 

ise androidTestCompile yerine compile olarak değiştirdim, android testi terminalden düzgün çalışıyor. Bu bağımlılığı istemediğimden eminim APK, herhangi bir yardım, takdir. Eksik test için karşılaşılmasına olan sınıfları alay gibi

Bu günlük

testi

08-05 00:04:12.585 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.asm.commons.JSRInlinerAdapter 08-05 00:04:12.587 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.asm.commons.TryCatchBlockSorter 08-05 00:04:12.593 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.cglib.transform.AbstractProcessTask 08-05 00:04:12.593 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.cglib.transform.AbstractTransformTask 08-05 00:04:12.603 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.core.convert.support.ConvertingPropertyEditorAdapter 08-05 00:04:12.610 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.core.io.ResourceEditor 08-05 00:04:12.611 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.core.io.support.ResourceArrayPropertyEditor 08-05 00:04:12.617 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.http.MockHttpInputMessage 08-05 00:04:12.618 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.http.MockHttpOutputMessage 08-05 00:04:12.618 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.http.client.MockClientHttpRequest 08-05 00:04:12.618 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.http.client.MockClientHttpResponse 08-05 00:04:12.618 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.jndi.ExpectedLookupTemplate 08-05 00:04:12.619 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.jndi.SimpleNamingContext 08-05 00:04:12.619 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.jndi.SimpleNamingContextBuilder 08-05 00:04:12.619 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.DelegatingServletInputStream 08-05 00:04:12.619 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.DelegatingServletOutputStream 08-05 00:04:12.620 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockBodyContent 08-05 00:04:12.620 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockExpressionEvaluator 08-05 00:04:12.620 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockFilterChain 08-05 00:04:12.620 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockFilterConfig 08-05 00:04:12.620 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockHttpServletRequest 08-05 00:04:12.621 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockHttpServletResponse 08-05 00:04:12.621 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockHttpSession 08-05 00:04:12.621 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockJspWriter 08-05 00:04:12.621 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockMultipartFile 08-05 00:04:12.621 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockMultipartHttpServletRequest 08-05 00:04:12.622 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockPageContext 08-05 00:04:12.622 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockRequestDispatcher 08-05 00:04:12.623 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockServletConfig 08-05 00:04:12.623 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.MockServletContext 08-05 00:04:12.628 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.PassThroughFilterChain 08-05 00:04:12.628 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.portlet.MockActionRequest 08-05 00:04:12.629 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.portlet.MockActionResponse 08-05 00:04:12.629 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.portlet.MockBaseURL 08-05 00:04:12.629 22274-22302/com.libin.androiduitesting E/TestLoader: Could not find class: org.springframework.mock.web.portlet.MockCacheControl 08-05 00:04:12.630 22274-22302/com.libin.androiduitesting E/AndroidRuntime: FATAL EXCEPTION: Instr: android.support.test.runner.AndroidJUnitRunner Process: com.libin.androiduitesting, PID: 22274 java.lang.NoClassDefFoundError: org.springframework.mock.web.portlet.MockClientDataRequest at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:324) at android.support.test.internal.runner.TestLoader.doLoadClass(TestLoader.java:92) at android.support.test.internal.runner.TestLoader.loadIfTest(TestLoader.java:113) at android.support.test.internal.runner.TestRequestBuilder.loadClassesFromClassPath(TestRequestBuilder.java:801) at android.support.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:747) at android.support.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:354) at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:260) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1879)

+0

'TestCompile' nedir? –

+0

, 'androidTestCompile' işlevini 'testCompile' olarak değiştirerek @ cricket_007 yazdı. Çalışıyormu? – piotrek1543

+0

Hayır. Bu nasıl çalışır ?, testCompile'a eklenen bağımlılıklar yalnızca birim testi için dahil edilir. Ben androidTest koşuyorum. Yapacağınız build.gradle dosyasını ekleyebilmeniz için androidTest – Libin

cevap

1

başlatılırken görünüyor. Bahar testi kavanozunu boşaltmayı deneyin ve tüm alay sınıflarının içinde olup olmadığını kontrol edin - örneğin, sınıfını org.springframework.mock.web.portlet paketinden dışa aktarmalıdır. this issue'da alay sınıfları için eksikliklerin kaybolduğu bazı talihsiz kavanoz yapılarını kullanıyor olabilirsiniz.

Ayrıca, bahar çerçevesini güncelleştirmeyi deneyebilirsiniz, en sonda 4.3.2.

+0

Hayır Sınıfları kaçırmıyorum. Çalışmaya başladığında, tüm modül için testi loda ederek çıkarıldığını görür. Test bireysel sınıf veya paket için çalışıyorsa her şey yolunda – Libin

İlgili konular