2017-01-31 12 views
6

मेरे पास कुछ Spek परीक्षणों के साथ एक ग्रैडल आधारित कोटलिन प्रोजेक्ट है, जो जुनीट पर आधारित है और आइडिया के साथ संगत होना चाहिए।इंटेलिजे आइडिया मेरे स्पेक परीक्षणों को क्यों पहचानता है?

लेकिन मुझे संदर्भ मेनू में "रन" मेनू आइटम नहीं दिखाई देता है।

Context menu

क्यों? अन्य जुनीट परीक्षणों जैसे आइडिया में स्पीक टेस्ट चलाने में सक्षम होने के लिए मुझे क्या करने की ज़रूरत है?

यहाँ मेरी build.gradle:

buildscript { 
    ext.kotlin_version = '1.0.4' 
    repositories { 
    mavenCentral() 
    maven { 
     url "https://dl.bintray.com/jetbrains/spek" 
    } 
    } 
    dependencies { 
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 
    classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-M3' 
    } 

} 

apply plugin: "kotlin" 
apply plugin: "application" 
apply plugin: 'org.junit.platform.gradle.plugin' 

junitPlatform { 
    filters { 
     engines { 
      include 'spek' 
     } 
    } 
} 

mainClassName = "com.mycompany.myproduct.AppKt" 

sourceSets { 
    deploy 
} 

repositories { 
    mavenCentral() 
    maven { 
    url "https://dl.bintray.com/jetbrains/spek" 
    } 

} 

dependencies { 
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 
    compile 'org.telegram:telegrambots:2.4.2' 
    compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0' 
    compile group: 'ch.qos.logback', name: 'logback-core', version: '1.1.3' 
    compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.3' 
    compile group: 'org.slf4j', name: 'slf4j-api', version: '1.6.1' 
    testCompile 'junit:junit:4.11' 
    testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" 
    testCompile group: 'org.mockito', name: 'mockito-all', version: '2.0.2-beta' 
    testCompile 'org.jetbrains.spek:spek-api:1.1.19' 
    testRuntime 'org.jetbrains.spek:spek-junit-platform-engine:1.1.19' 
} 

test.testClassesDir = project.tasks.compileTestKotlin.destinationDir 

task wrapper(type: Wrapper) { 
    gradleVersion="3.1" 
} 

run { 
    jvmArgs = ["-Xmx100m", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=/[...]/log/memdump.log"] 
} 

jar { 
    manifest { 
     attributes 'Main-Class': mainClassName, 
        'Class-Path': configurations.runtime.files.collect {"$it.name"}.join(' ') 
    } 
} 

उत्तर

5

आप Spek plugin for IntelliJ स्थापित है?

इंटेलिजे प्लगइन सेटिंग्स में बस spek के लिए खोजें।

0

आप JUnit 4.11 उपयोग कर रहे हैं, इसलिए आप अपनी build.gradle से निकाल सकते हैं:

@RunWith(JUnitPlatform::class) 

स्रोत:: http://spekframework.org/docs/latest/#setting-up-legacy

junitPlatform { 
    filters { 
     engines { 
      include 'spek' 
     } 
    } 
} 

फिर अपने परीक्षण वर्ग घोषणा से ऊपर इस ऐड

संबंधित मुद्दे