Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android测试协调器未找到任何测试_Android_Kotlin_Instrumented Test_Android Test Orchestrator - Fatal编程技术网

Android测试协调器未找到任何测试

Android测试协调器未找到任何测试,android,kotlin,instrumented-test,android-test-orchestrator,Android,Kotlin,Instrumented Test,Android Test Orchestrator,我正在使用Kotlin编程语言开发一个Android应用程序。我正在为我的应用程序编写仪器化测试。我还使用测试编排器来运行我的测试。但是在安装了修改Grandle文件的测试编排器之后,我无法在Android Studio中运行测试 我在app.grandle文件中添加了以下配置 android { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { applicationId "c

我正在使用Kotlin编程语言开发一个Android应用程序。我正在为我的应用程序编写仪器化测试。我还使用测试编排器来运行我的测试。但是在安装了修改Grandle文件的测试编排器之后,我无法在Android Studio中运行测试

我在app.grandle文件中添加了以下配置

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.memento"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
//        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        testInstrumentationRunner "com.example.memento.MockTestRunner"
        // Cleared between tests.
        testInstrumentationRunnerArguments clearPackageData: 'true'
        testOptions {
            execution 'ANDROID_TEST_ORCHESTRATOR'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}
用这个

androidTestImplementation 'com.android.support.test:runner:1.1.1'
    androidTestUtil 'com.android.support.test:orchestrator:1.1.1'
这是MockTestRunner类

导入android.app.Application 导入android.content.Context 导入androidx.test.runner.AndroidJUnitRunner 导入com.example.utils.MockApplicationController

class MockTestRunner: AndroidJUnitRunner()
{
    override fun newApplication(
        cl: ClassLoader?,
        className: String?,
        context: Context?
    ): Application {
        return super.newApplication(cl, MockApplicationController::class.java!!.getName(), context)
    }
}
然后,在Android Studio中,我尝试通过右键单击代码来运行测试,如下所示。

这是我运行测试时得到的结果

$ adb shell CLASSPATH=$(pm path android.support.test.services) app_process / android.support.test.services.shellexecutor.ShellMain am instrument -r -w -e targetInstrumentation com.example.memento.test/com.example.memento.MockTestRunner   -e debug false -e class 'com.example.memento.EventListTest#eventListIndexZeroTabRendersCurrentEvents' -e clearPackageData true android.support.test.orchestrator/android.support.test.orchestrator.AndroidTestOrchestrator
Waiting for process to come online...

Started running tests
Test running failed: No test results

实际上,没有运行测试。我的配置有什么问题,如何修复。如果我删除了test orchestrator安装,我可以运行测试,并且它可以按预期工作。

找到解决方案了吗?我也面临同样的问题。