Unable to run Android Instrumented Tests

Unable to run Android Instrumented Tests

Questions : Unable to run Android Instrumented Tests

439

I am trying to run some UI tests using in4codes_android-testing espresso on AS Arctic Fox 2020.3.1 Patch 3 in4codes_android-testing ARM preview. Following Google instructions in4codes_android-testing for setting up these are my dependencies:

// Core library androidTestImplementation 'androidx.test:core:1.4.0' // AndroidJUnitRunner and JUnit Rules androidTestImplementation 'androidx.test:runner:1.4.0' androidTestImplementation 'androidx.test:rules:1.4.0' androidTestUtil 'androidx.test:orchestrator:1.4.0' // Assertions androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:truth:1.4.0' androidTestImplementation 'com.google.truth:truth:1.0.1' // Espresso dependencies androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-intents:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-web:3.4.0' androidTestImplementation 'androidx.test.espresso.idling:idling-concurrent:3.4.0' 

I have also added the in4codes_android-testing testInstrumentationRunner in my Gradle to in4codes_android-testing testInstrumentationRunner in4codes_android-testing “androidx.test.runner.AndroidJUnitRunner”

I am trying to run the simplest possible in4codes_android-testing test below:

import androidx.test.ext.junit.runners.AndroidJUnit4 import org.junit.Test import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class DummyTest { @Test fun test() { assert(false) } } 

but when I click the Run of my test it looks in4codes_android-testing like I have 0 tests. Is there something I am in4codes_android-testing missing? Thanks

Total Answers 2
24

Answers 1 : of Unable to run Android Instrumented Tests

If AS shows TestResult 0/0 , delete that in4codes_android-espresso dependency

androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0' 

0

3

Answers 2 : of Unable to run Android Instrumented Tests

Found a way to fix this one after in4codes_android-espresso spending many hours. I noticed that the in4codes_android-espresso issue had to do with the

androidx.test.espresso:espresso-contrib:3.4.0 

check this answer for more insight link

Thought I was not getting any errors or in4codes_android-espresso issues. I had to disable the Test Matrix in4codes_android-espresso of the AS. After disabling I was getting in4codes_android-espresso more clear framework crash errors in the in4codes_android-espresso logical which helped me identify the in4codes_android-espresso issue.

0