# Kotlin projects tests and structure

**URL:** <https://discuss.kotlinlang.org/t/kotlin-projects-tests-and-structure/348>\
**Category:** Uncategorized\
**Created:** [January 18, 2015, 7:42pm UTC](https://discuss.kotlinlang.org/t/kotlin-projects-tests-and-structure/348 "2015-01-18T19:42:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Russel](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/russel/32/1442_2.png) [@Russel](https://discuss.kotlinlang.org/u/Russel)\
**Post date:** [January 18, 2015, 7:42pm UTC](https://discuss.kotlinlang.org/t/kotlin-projects-tests-and-structure/348/1 "2015-01-18T19:42:22Z")

</div>

Starting as if a person new to Kotlin, who is very much TDD oriented, I was looking for information about how to structure Kotlin projects, source code, unit tests, integration tests and such like. As far as I can tell there is no definite ionformation anywhere on how to approach writing Kotlin code from a TDD perspective. Well at least not as indexed by Google or more recent than 2012. Am I just moissing obvious material or is testing and Kotlin a bit of a hole re documentation and instruction to folk new to Kotlin?

---

<div class="post-metadata">

**Author:** ![udalov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/udalov/32/5679_2.png) [@udalov](https://discuss.kotlinlang.org/u/udalov)\
**Post date:** [January 19, 2015, 8:22am UTC](https://discuss.kotlinlang.org/t/kotlin-projects-tests-and-structure/348/2 "2015-01-19T08:22:53Z")

</div>

There's Spek ([https://jetbrains.github.io/spek/](https://jetbrains.github.io/spek/)). Also you can still use the same set of tools as when working with Java code (JUnit, TestNG, etc.)

---

<div class="post-metadata">

**Author:** ![hhariri](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/hhariri/32/1454_2.png) [@hhariri](https://discuss.kotlinlang.org/u/hhariri)\
**Post date:** [January 19, 2015, 9:08am UTC](https://discuss.kotlinlang.org/t/kotlin-projects-tests-and-structure/348/3 "2015-01-19T09:08:38Z")

</div>

I've been mostly using the same convention that people use for Java.

---

<div class="post-metadata">

**Author:** ![Russel](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/russel/32/1442_2.png) [@Russel](https://discuss.kotlinlang.org/u/Russel)\
**Post date:** [January 19, 2015, 4:06pm UTC](https://discuss.kotlinlang.org/t/kotlin-projects-tests-and-structure/348/4 "2015-01-19T16:06:43Z")

</div>

I possibly haven't tried Spek enough, but to date it doesn't really work for me compared to Spock.

@Unroll with where clause in spock for data-driven testing is a superb tool. Far better than DataProvider in TestNG and Parameterized and Theories in JUnit4.

---

<div class="post-metadata">

**Author:** ![Russel](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/russel/32/1442_2.png) [@Russel](https://discuss.kotlinlang.org/u/Russel)\
**Post date:** [January 19, 2015, 4:09pm UTC](https://discuss.kotlinlang.org/t/kotlin-projects-tests-and-structure/348/5 "2015-01-19T16:09:51Z")

</div>

I find JUnit4 substandard compared to TestNG, and both substandard compared to Spock. Maybe I just have to stick to Spock.

IntelliJ IDEA appears not to have ready made dependencies for JUnit, TestNG or Spock; it is a pain having to manually create these dependencies in newly created projects. Maybe I have to stop using IntelliJ IDEA to create projects and always use a Gradle file so it can so all the dependency handling.
