在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):rozkminiacz/KotlinUnitTesting开源软件地址(OpenSource Url):https://github.com/rozkminiacz/KotlinUnitTesting开源编程语言(OpenSource Language):Kotlin 80.8%开源软件介绍(OpenSource Introduction):Kotlin Unit Testing ExamplesTable of Contents
This repository contains examples of basic unit tests written in Kotlin. In specific directories you can find gradle buildscript with needed dependencies and configuration, simple unit test and parameterized test.
Application
Gradle, Kotlin & GroovyThis Gradle project is by default configured with Gradle’s Kotlin DSL The equivalent Groovy build are still available for you copy&pasting
pleasures, they have been renamed as You can switch between Groovy and Kotlin by running the script
Junit4Attach to project dependencies{
testCompile group: 'junit', name: 'junit', version: '4.12'
} Junit5Attach to project dependencies {
testCompile('org.junit.jupiter:junit-jupiter-api:5.3.1')
testCompile('org.junit.jupiter:junit-jupiter-params:5.3.1')
testRuntime('org.junit.jupiter:junit-jupiter-engine:5.3.1')
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
} KotlinTestAttach to project dependencies{
testCompile 'io.kotlintest:kotlintest-runner-junit5:3.1.10'
} Spekhttps://spekframework.org version 2.x Attach to project repositories {
mavenCentral()
maven { url "https://dl.bintray.com/spekframework/spek-dev" }
}
test {
useJUnitPlatform {
includeEngines 'spek2'
}
}
dependencies {
testImplementation ('org.spekframework.spek2:spek-dsl-jvm:2.0.0-rc.1') {
exclude group: 'org.jetbrains.kotlin'
}
testRuntimeOnly ('org.spekframework.spek2:spek-runner-junit5:2.0.0-rc.1') {
exclude group: 'org.junit.platform'
exclude group: 'org.jetbrains.kotlin'
}
testCompile('org.junit.jupiter:junit-jupiter-api:5.3.1')
// spek requires kotlin-reflect, can be omitted if already in the classpath
testRuntimeOnly "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
}
MockitoAdd to project repositories {
mavenCentral()
jcenter()
}
dependencies {
testCompile "org.mockito:mockito-core:2.23.0"
testCompile group: 'junit', name: 'junit', version: '4.12'
} Mockito-KotlinAdd to project repositories {
mavenCentral()
jcenter()
}
dependencies {
testCompile "org.mockito:mockito-core:2.23.0"
testCompile "com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0-RC1"
testCompile group: 'junit', name: 'junit', version: '4.12'
} MockkAdd to project dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testImplementation "io.mockk:mockk:1.8.12"
} StriktAdd to project dependencies {
testImplementation("io.strikt:strikt-core:0.17.0")
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论