我目前正在使用Kotlin测试框架https://github.com/kotlintest/kotlintest。
我想知道是否有一种预期的方式来构建这个项目,我的意思是,就像一个基础项目,我可以在那里开始。
发布于 2018-03-29 13:27:25
在主要回购项目中有一些KotlinTest示例项目:https://github.com/kotlintest/kotlintest/tree/master/kotlintest-samples
它们使用KotlinTest 3.0.x,对于gradle用户,构建文件如下所示:
apply plugin: 'org.junit.platform.gradle.plugin'
buildscript {
ext.kotlin_version = '1.2.31'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.junit.platform:junit-platform-gradle-plugin:1.1.0"
}
}
dependencies {
testCompile 'io.kotlintest:kotlintest-runner-junit5:3.0.3'
}我将不包括Maven示例,因为pom.xml是冗长的,因为它是XML,但是您可以在上面的链接中找到它。
发布于 2017-12-28 16:01:25
没有专门的方法来为这个测试框架构建项目。您应该将其构造为任何其他Kotlin项目,因此您的测试应该转到your-project/src/test/kotlin/com/jimmy/。
重要的是从kotlintest扩展一个可用的基类。WordSpec您可以看到kotlintest本身的所有内容(结构和测试)是什么样子的- https://github.com/kotlintest/kotlintest/tree/master/src/test/kotlin/io/kotlintest。
发布于 2017-12-28 17:05:32
您可以使用spek测试代码,下面是示例,这可能有助于在项目上实现。
https://stackoverflow.com/questions/47983510
复制相似问题