# Kotlin Unit Test Framework: KotlinTest

**URL:** <https://discuss.kotlinlang.org/t/kotlin-unit-test-framework-kotlintest/1599>\
**Category:** Uncategorized\
**Created:** [April 14, 2016, 2:57pm UTC](https://discuss.kotlinlang.org/t/kotlin-unit-test-framework-kotlintest/1599 "2016-04-14T14:57:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![medium](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/medium/32/10404_2.png) [@medium](https://discuss.kotlinlang.org/u/medium)\
**Post date:** [April 14, 2016, 2:57pm UTC](https://discuss.kotlinlang.org/t/kotlin-unit-test-framework-kotlintest/1599/1 "2016-04-14T14:57:03Z")

</div>

I thought recently that Kotlin would need a powerful testing framework like [ScalaTest](http://www.scalatest.org/). Now I’m happy someone actually ported it to Kotlin and named it … **[KotlinTest](https://github.com/kotlintest/kotlintest)**! It doesn’t support all features of ScalaTest yet, but it looks promising.

I’m a fan of flatspec, since it is pretty readable without introducing too much nested blocks and documentation nobody cares about. Confusing unit tests with “executable specs”, like other testing styles do, is not very helpful, since such tests are not read by business users. In my opinion it is much better to keep unit tests clean, simple and flat and use a BDD framework like Cucumber for high-level acceptance tests. So for me, it’s great news to hear about KotlinTest!

---

<div class="post-metadata">

**Author:** ![sksamuel](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sksamuel/32/1904_2.png) [@sksamuel](https://discuss.kotlinlang.org/u/sksamuel)\
**Post date:** [April 15, 2016, 6:56am UTC](https://discuss.kotlinlang.org/t/kotlin-unit-test-framework-kotlintest/1599/2 "2016-04-15T06:56:03Z")

</div>

As the author, I’m pleased you like it. Please create any tickets on github if you need extra features. Did you find it via the kotlin blog I put up yesterday?

---

<div class="post-metadata">

**Author:** ![medium](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/medium/32/10404_2.png) [@medium](https://discuss.kotlinlang.org/u/medium)\
**Post date:** [April 15, 2016, 7:11am UTC](https://discuss.kotlinlang.org/t/kotlin-unit-test-framework-kotlintest/1599/3 "2016-04-15T07:11:31Z")

</div>

Yes, I’ve found it via [Kotlin for Scala Developers](http://www.51zero.com/blog/2016/4/14/kotlin-for-scala-developers). Maybe KotlinTest is worth a separate blog post …

---

<div class="post-metadata">

**Author:** ![sksamuel](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sksamuel/32/1904_2.png) [@sksamuel](https://discuss.kotlinlang.org/u/sksamuel)\
**Post date:** [April 15, 2016, 3:06pm UTC](https://discuss.kotlinlang.org/t/kotlin-unit-test-framework-kotlintest/1599/4 "2016-04-15T15:06:02Z")

</div>

I have written a KotlinTest blog. The boss will post it next week.

---

<div class="post-metadata">

**Author:** ![svd](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/svd/32/1756_2.png) [@svd](https://discuss.kotlinlang.org/u/svd)\
**Post date:** [April 15, 2016, 3:16pm UTC](https://discuss.kotlinlang.org/t/kotlin-unit-test-framework-kotlintest/1599/5 "2016-04-15T15:16:29Z")

</div>

im just trying it out in a gradle project.  
in intellij everything is fine, but when running gradle test it does not work.  
eg this test passes in gradle but fails in IJ

``  
class AnotherTest() : FunSpec(), Logging {  
override val log: Logger by lazyLogger()

```
init {
    test("fails") {
        log.debug("log sth")
        false shouldBe true
    }
}

override fun afterAll() {
    super.afterAll()
}

```

}  
``

test result output is  
``

\<?xml version="1.0" encoding="UTF-8"?\> ``

---

<div class="post-metadata">

**Author:** ![sksamuel](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sksamuel/32/1904_2.png) [@sksamuel](https://discuss.kotlinlang.org/u/sksamuel)\
**Post date:** [April 15, 2016, 7:07pm UTC](https://discuss.kotlinlang.org/t/kotlin-unit-test-framework-kotlintest/1599/6 "2016-04-15T19:07:42Z")

</div>

I’ve created ticket here [Gradle issue · Issue #8 · kotest/kotest · GitHub](https://github.com/kotlintest/kotlintest/issues/8)  
I’ll work it asap

---

<div class="post-metadata">

**Author:** ![sksamuel](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sksamuel/32/1904_2.png) [@sksamuel](https://discuss.kotlinlang.org/u/sksamuel)\
**Post date:** [April 16, 2016, 11:24am UTC](https://discuss.kotlinlang.org/t/kotlin-unit-test-framework-kotlintest/1599/7 "2016-04-16T11:24:31Z")

</div>

That’s fixed in 1.0.5 which I just pushed to maven central. Thanks for bug report.
