Technical requirements

To run the code from this chapter, we just need IntelliJ IDEA and Git installed. We also need to add dependencies on the JUnit test engine, the Spek framework, and the Kotlin test library. You should add the following line to the dependencies section of the buildscript block in your build.gradle file:

buildscript {
dependencies {
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0'
}
}

We should also apply the junit.gradle plugin by using the following lines:

apply plugin: 'org.junit.platform.gradle.plugin'

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

To make the Gradle build system able to find the Spek repository, we should add this line:

 repositories {
maven { url "http://dl.bintray.com/jetbrains/spek" }
}

The following lines should be added to the dependencies section:

 dependencies {
testCompile 'org.jetbrains.spek:spek-api:1.1.5'
testRuntime 'org.jetbrains.spek:spek-junit-platform-engine:1.1.5'
testCompile 'org.junit.platform:junit-platform-runner:1.0.0'
testCompile 'io.kotlintest:kotlintest-runner-junit5:3.1.7'
}

The entire code can be found at https://github.com/PacktPublishing/Hands-On-Object-Oriented-Programming-with-Kotlin/blob/master/build.gradle.

You can find examples from this chapter on GitHub at https://github.com/PacktPublishing/Hands-On-Object-Oriented-Programming-with-Kotlin/tree/master/src/test/kotlin/Chapter11.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.151.220