BDD unit test framework for kotlin

We earlier used junit in our product for testing and using BDD syntax with give-when-then structured tests, unfortunately junit doesn’t enforce any structure of the test and the developers does not follow our standards very well and produce spagetti test code that is hard to maintain.

So we switched to Spock framework instead which enforce the BDD structure of the tests and the syntax og the code with groovy make the test code extremely easy to read and this is my favorite so far.

Unfortunately with coroutines Spock and groovy doesn’t work very well, so we migrated to kotest which has both BDD structured tests and good support for coroutines by being a native kotlin framework. The syntax is not as nice as Spock but close enough.

But not I’m thinking of migrating back to junit again because of its the standard and widespread use and with kotlin coroutines support it seems to work pretty well. Maybe it’s better to just the most popular framework and work on the developers to write the test code better?

What are you others using as kotlin test framework?

submitted by /u/ellensen
[link] [comments]