android-instrumentation

“java.lang.RuntimeException: Could not launch intent” for UI with indeterminate ProgressBar

半世苍凉 提交于 2020-01-14 10:33:16
问题 Are there any known issues with displaying indeterminate ProgressBar s with the AndroidJUnitRunner? I'm hitting this error during tests: 05-26 15:22:48.504 1003-1016/? I/TestRunner﹕ java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=com.cookbrite.dev/com.cookbrite.ui.HomeListActivity } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly

Error when generating code coverage report for androidTest instrumented testcases with dagger

狂风中的少年 提交于 2020-01-06 17:58:25
问题 I want to run createDebugCoverageReport gradle task.But after run task is failing and giving below error. java.lang.NoClassDefFoundError: dagger.shaded.auto.common.BasicAnnotationProcessor 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

Error when generating code coverage report for androidTest instrumented testcases with dagger

假装没事ソ 提交于 2020-01-06 17:58:04
问题 I want to run createDebugCoverageReport gradle task.But after run task is failing and giving below error. java.lang.NoClassDefFoundError: dagger.shaded.auto.common.BasicAnnotationProcessor 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

Mockito not Mocking in Instrumented Android Test [duplicate]

▼魔方 西西 提交于 2020-01-05 04:01:30
问题 This question already has answers here : Mockito AbstractMethodError on initMocks (5 answers) Closed 3 years ago . EDIT: Solution: Changed Mockito Version to 1.+. In my androidTest folder I have something like this: @Before public void setUp() throws Exception { LoginPresenter context = Mockito.mock(LoginPresenter.class); } I got the following dependencies: androidTestCompile "org.mockito:mockito-core:2.2.9" androidTestCompile "com.android.support.test:runner:0.5" androidTestCompile "com

How to debug or resolve “Error: The current project can not be run” for Run Configuration for Android Instrumented Tests?

可紊 提交于 2020-01-04 07:35:50
问题 I have a project (created via this StackOverflow question) that has a module with an Android Instrumented Test . It can be run via a normal Configuration where the module is selected. This works for Android Gradle plugin <=2.2.3 and >=3.0.0-beta1. But as soon as I change the project to Android Gradle project 2.3.x (2.3.0 -> 2.3.3) I get this error message for my run configuration: I found no way to get more information or debug this error message in any way. There is nothing highlighted in

How not to run a particular test when executing connectedAndroidTest?

风流意气都作罢 提交于 2020-01-03 15:34:30
问题 It takes long to execute some of our instrumented tests. So I'd like not to run them when I run all the other instrumented tests with gradle connectedAndroidTest . Why don't I annotate those tests with @Ignore? Because I'd like to run them later using adb shell as described here. Like this: Running all tests except those in a particular class: adb shell am instrument -w -e notClass com.android.foo.FooTest com.android.foo/android.support.test.runner.AndroidJUnitRunner If I marked those tests

Android instrumentation tests for library module coverage

落爺英雄遲暮 提交于 2020-01-01 03:09:16
问题 I inherited an android project to setup code coverage for. Not having done much for android and almost as little in gradle, I embarked on a quest to find a helpful tutorial. As surprises go, the first few tutorials were very helpful and I was able to include the jacoco gradle plugin and enable the code coverage. Using jenkins I even generated a coverage report. So far everything looks fine. However, upon setting my eyes on the report, I smelled something fishy. The test vs coverage ratio

Android Studio — clear application data for Instrumentation Test

点点圈 提交于 2019-12-28 04:18:28
问题 How can I get Android Studio (AndroidJunitRunner) to clear application data preceding an instrumentation test without manually running adb command? I discovered that android.support.test.runner.AndroidJUnitRunner kind of cheats -- it never actually invokes connectedCheck or connectedAndroidTest . When run from command line $ gradle connectedCheck :MyMainApp:assembleDebug UP-TO-DATE :MyMainApp:assembleDebugTest UP-TO-DATE :MyMainApp:clearMainAppData :MyMainApp:connectedCheck When run from

Getting error while accessing the room database in test cases - Android

梦想的初衷 提交于 2019-12-24 21:11:24
问题 I am using room database in my app. I have Login feature in my app, where after taking userId & password, on click of Login button I am calling API and storing the response data in room database table after getting a successful callback response from API. Now I want to write integration test cases for database data, where I am using mockWebServer to mock the API response and storing that in the room database table. And later I am fetching the DB values & testing whether those are stored

Testing RxJava2 using Espresso and getting a null pointer exception when suscribeOn

☆樱花仙子☆ 提交于 2019-12-23 07:26:02
问题 Android Studio 3.0 Beta2 I am testing getting a list for an endpoint using RxJava2. The app works fine when running normally. However, when I test using espresso I get a null pointer exception when I try and subscribeOn(scheduler) . For the schedulers I use the trampoline() for both subscribeOn and observeOn which are injected. Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'io.reactivex.Observable io.reactivex.Observable.subscribeOn(io.reactivex.Scheduler)' on a