Android Studio Espresso Testing Error: Empty Test Suite -


i keep running following error when trying execute tests in android studio: test running failed: unable find instrumentation info for: componentinfo{.test/android.support.test.runner.androidjunitrunner}

my test class in androidtest/java directory , has constructor. build.gradle correct too. appreciated.

test class

@runwith(androidjunit4.class) @largetest public class androiduitests extends activityinstrumentationtestcase2<useractivity>{      private useractivity useractivity;      public androiduitests() {         super(useractivity.class);     }       @before     public void setup() throws exception {         super.setup();         injectinstrumentation(instrumentationregistry.getinstrumentation());         useractivity = getactivity();     }      @test     public void testphoneiconisdisplayed() {         // when phone_icon view available,         // check displayed.         onview(viewmatchers.withid(r.id.groupcreate)).perform(click())                 .check(matches(withtext("enter name")));     } } 

app/build.gradle:

apply plugin: 'com.android.application'  android {     compilesdkversion 21     buildtoolsversion "21.1.2"      defaultconfig {         testinstrumentationrunner         "android.support.test.runner.androidjunitrunner"     }      packagingoptions {         exclude 'license.txt'     } }  dependencies {     androidtestcompile 'com.android.support.test.espresso:espresso-core:2.0'     androidtestcompile 'com.android.support.test:testing-support-lib:0.1' } 

you have update test "edit configuration" , include androidjunitrunner instrumentation runner.

enter image description here

i found solution in video: https://youtu.be/tgu0b4qrlhy?t=9m36s

updated

adding @loeschg suggest: make sure check logcat logs ensure isn't causing issues (crash) before test run. bad code in @beforeclass block resulted in "empty test suite" message in android studio despite having set test runner.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -