2017-06-19 51 views
1

每次我嘗試運行我的測試控制檯這樣說:試運行失敗:無法找到儀器儀表信息爲:ComponentInfo

Started running tests 
Test running failed: Unable to find instrumentation info for: ComponentInfo{com.rit.andrey.service.test/android.test.InstrumentationTestRunner} 
Empty test suite. 

My project structure looks like

的build.gradle文件

apply plugin: 'com.android.application' 

android { 
    signingConfigs { 
     release { 
      <config> 
     } 
     debug { 
      <config> 
     } 
    } 
    compileSdkVersion 25 
    buildToolsVersion '25.0.1' 
    defaultConfig { 
     applicationId "com.rit.andrey.service" 
     minSdkVersion 16 
     versionCode 1 
     versionName "1.3.0" 
     multiDexEnabled true 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
     debug { 
     } 
    } 
    packagingOptions { 
     /----/ 
    } 
    dexOptions { 
     preDexLibraries = false 
     javaMaxHeapSize "5g" 
    } 
} 

dependencies { 
    /---/ 
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    } 
    testCompile 'junit:junit:4.12' 
} 

測試類看起來像這樣

@LargeTest 
@RunWith(AndroidJUnit4.class) 
public class LoginActivityTest { 
    @Rule 
    public ActivityTestRule<LoginActivity> mActivityTestRule = new ActivityTestRule<>(LoginActivity.class); 

    @Test 
    public void testLoginActivityTest() { 
     onView(withId(R.id.synch_button)).check(matches(isDisplayed())); 
} 

所有建立的變異體 「調試」

我試圖測試該設備上的另一個應用程序,一切都OK

參賽者:

[email protected]:/ $ pm list instrumentation 
     instrumentation:com.mu.rit.mmlib.test/android.test.InstrumentationTestRunner (target=com.mu.rit.mmlib.test) 
     instrumentation:com.rit.andrey.service/android.test.InstrumentationTestRunner (target=com.rit.andrey.service) 
     instrumentation:com.rit.andrey.service.test/android.support.test.runner.AndroidJUnitRunner (target=com.rit.andrey.service) 
     instrumentation:com.rit.unittestingapp.test/android.support.test.runner.AndroidJUnitRunner (target=com.rit.unittestingapp) 

附: Android Studio 2.3.3

回答

0

發生在我身上。卸載該設備上的應用程序,重新安裝新版本,然後運行測試似乎有所幫助。

相關問題