Prueba Android corriendo fallidos: Sin resultados de prueba

Jonathan:

Hola estoy tratando de ejecutar el ejemplo instrumentado clase de prueba en mi proyecto, pero cada vez que lo ejecuto me sale este error:

Test running failed: no test results
Empty test suit

Aquí está mi ejemplo instrumentadas clase de prueba

import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

/**
 * Instrumented test, which will execute on an Android device.
 *
 * See [testing documentation](http://d.android.com/tools/testing).
 */
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
    @Test
    fun useAppContext() {
        // Context of the app under test.
        val appContext = androidx.test.platform.app.InstrumentationRegistry.getInstrumentation().context
        assertEquals("com.app", appContext.packageName)
    }
}

Aquí está mi construcción Gradle filefor pruebas:

android {
  compileSdkVersion 28
    defaultConfig {
        applicationId "com.app"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        testInstrumentationRunnerArguments clearPackageData: 'true'

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    testOptions {
        execution 'ANDROID_TEST_ORCHESTRATOR'
    }
}

dependencies {

    def mockito = "2.18.3"
//android instrumental test
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.ext:truth:1.1.0'
    androidTestImplementation 'androidx.test:core:1.1.0'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.arch.core:core-testing:2.0.0'
    androidTestUtil 'androidx.test:orchestrator:1.1.1'

    androidTestImplementation 'com.jraska.livedata:testing-ktx:0.6.0'
    androidTestImplementation 'com.jraska.livedata:testing:0.6.0'

    androidTestImplementation "org.mockito:mockito-core:$mockito"
    androidTestImplementation "org.mockito:mockito-android:$mockito"
    androidTestImplementation "org.mockito:mockito-inline:$mockito"

    androidTestImplementation 'org.koin:koin-test:1.0.2'

    //unit test
    testImplementation 'junit:junit:4.12'
    testImplementation "org.mockito:mockito-core:$mockito"
    testImplementation "org.mockito:mockito-android:$mockito"
    testImplementation "org.mockito:mockito-inline:$mockito"
    testImplementation 'org.koin:koin-test:1.0.2'
    testImplementation 'androidx.test.ext:junit:1.1.0'
    testImplementation 'androidx.arch.core:core-testing:2.0.0'
    testImplementation 'com.jraska.livedata:testing-ktx:0.6.0'
    testImplementation 'com.jraska.livedata:testing:0.6.0'
    testImplementation 'androidx.test.ext:truth:1.1.0'
  }
}
Jonathan:

Actualización de mi estudio Android a la versión 3.3 y la eliminación

testOptions {
    execution 'ANDROID_TEST_ORCHESTRATOR'
}

trabajó

Supongo que te gusta

Origin http://43.154.161.224:23101/article/api/json?id=171483&siteId=1
Recomendado
Clasificación