Tutorial or examples for unit testing?


#1

Can anyone point me to a tutorial or easy-to-understand examples for how to create Kotlin unit tests?  Note that I'm using Maven.


#2

JUnit 3: Just create a class that extens TestCase, everything else is also exactly like Java

JUnit 4: example here: https://github.com/abreslav/introduction-to-kotlin/blob/master/kotlin-examples/src/_07_annotations/Tests.kt


#3

A Maven project with tests, written in Kotlin: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib


#4

Also there's a few testing helper methods in the kotlin.test.* package (which work with no other dependencies apart from kotlin stdlib or with JUnit if its on the classpath - we should be able to create a TestNG plugin too). e.g.

failsWith<SomeException> { ... } todo {   .... } expect(5) { ... }