Kotest v2.0.0 Release Notes
Release Date: 2017-03-26 // about 7 years ago-
๐ Closed Issues
โ Added
- โ You can write tests alternatively into a lambda parameter in the class constructor, eg:
class StringSpecExample : StringSpec({ "strings.size should return size of string" { "hello".length shouldBe 5 "hello" should haveLength(5) } })
- โ Added
forNone
for table tests, eg
val table = table( headers("a", "b"), row(0L, 2L), row(2L, 2L), row(4L, 5L), row(4L, 6L) ) forNone(table) { a, b -> 3 shouldBe between(a, b) }
๐ Interceptors have been added. Interceptors allow code to be executed before and after a test. See the main readme for more info.
๐ Simplified ability to add custom matchers. Simple implement
Matcher<T>
interface. See readme for more information.โ Added
shouldNot
to invert matchers. Eg,"hello" shouldNot include("hallo")
๐ Deprecated matchers which do not implement Matcher. Eg,
should have substring(x)
has been deprecated in favour of"hello" should include("l")
. This is because instances of Matcher can be combined withor
andand
and can be negated withshouldNot
.โ Added
between
matcher for int and long, eg
3 shouldBe between(2, 5)
- Added
singleElement
matcher for collections, eg
x shouldBe singleElement(y)
- โ Added
sorted
matcher for collections, eg
listOf(1,2,3) shouldBe sorted<Int>()
Now supports comparsion of arrays #116
Added Gen.oneOf to create a generator that returns one of the values for the given Enum class.
Changed
- Tags are objects derived from
Tag
class now. - Tags can now be included and/or exluded. It is no longer the case that all untagged tests are always executed.
- Fixed bugs with parenthesis breaking layout in Intellij #112
Removed
- FlatSpec was removed because it has an irregular syntax with
config
and is essentially the same as StringSpec, but more complicated. - Deprecated method overloads with
duration: Long, unit: TimeUnit
expecting
for testing exceptions (use shouldThrow now)