0

我是kotlin开发新手。在我的应用程序中,我想编写测试用例,但我无法使用它。src/test/kotlin 文件夹没有被创建

毕业典礼

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "in.getparking.getparkingattendant"
        minSdkVersion 23
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    sourceSets {
        test.java.srcDirs += 'src/test/kotlin'
        androidTest.java.srcDirs += 'src/androidTest/kotlin'
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.firebase:geofire-android:2.2.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-firestore:11.8.0'
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:support-media-compat:27.0.2'
    implementation 'com.android.support:support-v4:27.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.android.support:recyclerview-v7:27.0.2'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.21'
    implementation 'com.android.support:cardview-v7:27.0.2'



    /*for testing*/
    testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.0.0-M4'
    testCompile "org.junit.platform:junit-platform-runner:1.0.0-M4"
    testCompile "org.jetbrains.spek:spek-api:1.1.5"
    testCompile "org.jetbrains.spek:spek-junit-platform-engine:1.1.5"
    testCompile "io.kotlintest:kotlintest:2.0.4"


}

如果我运行 androidTest,我会得到"No class found error" 另外哪个是好的 kotlintest 或 spek?

4

0 回答 0