Kotlin devs and fans, here’s your top reading list 🔥
Check trending Kotlin articles from our blog - packed with practical insights, patterns, and tools:

1️⃣ https://softwaremill.com/7-kotlin-libraries-and-frameworks-for-backend-development-you-should-know/
2️⃣ https://softwaremill.com/handling-errors-in-kotlin/
3️⃣ https://softwaremill.com/kotest-the-kotlin-testing-framework-you-will-love/
4️⃣ https://softwaremill.com/kotest-the-kotlin-testing-framework-you-will-love/
5️⃣ https://softwaremill.com/meet-kotlin-2-1-from-non-local-exits-to-multi-dollar-strings/

✨ Whether you're leveling up your stack or diving into Kotlin’s new features, these pieces are worth your time!

#Kotlin #BackendDevelopment #Kotest #Ktor #Programming #DevReads

Using #kotest to test your #kotlin code?

I wrote a small post about tweaking some Kotest settings related to classpath scanning in order to achieve faster test run times. Hope it's of use to someone 🙂

https://kantis.github.io/posts/Faster-Kotest-startup/

Faster Kotest

Add these properties to speed up your Kotest executions. 1 2 3 4 5 6 7 8 9 // in build.gradle.kts or a convention plugin tasks.withType<Test>().configureEach { useJUnitPlatform() // [... maybe other config] systemProperty("kotest.framework.discovery.jar.scan.disabled", "true") systemProperty("kotest.framework.classpath.scanning.config.disable", "true") systemProperty("kotest.framework.classpath.scanning.autoscan.disable", "true") } In my project, doing so dropped the test execution time from 2.2s to 600ms when running a single spec using Gradle. Note, this is assuming you’re running your tests with Gradle. We’ll walk through how to do this with the Kotest runner as well.

Emil Kantis
@jakub_zalas Have you looked at #kotest? You can make a list of scenarios, then define tests as you iterate over the list. Here are the relevant docs: https://kotest.io/docs/framework/datatesting/data-driven-testing.html
Introduction | Kotest

Before data-driven-testing can be used, you need to add the module kotest-framework-datatest to your build.

In #kotest tests are just functions. So they can be extracted into other extension functions like this:

fun FunSpec.someTests() {
test("1") {...}
test("2") {...}
}

Clever but the problem is that you can't run just one test from IDE 😒 Use abstract class instead? #UXfail

Back to #kotest rants. Because kotest has “built in coroutine support at every level” when an assertion fails, you can’t navigate to the matcher source code from the stack trace (Kotlin coroutines are stackless). So good luck if the error message is not very clear.
What about namespace "pollution" by extension functions in #Kotlin? E.g. a library with `fun Any?.print()` (yes, it's a #kotest #rant again) will add `print()` to code completion popup for all objects. Sure, IDE can deprioritise it, but maybe don't do it in the first place?
More #kotest #rants... shouldHaveSize() is helpful enough to print the whole (actual) list when sizes don't match. Good idea unless the list contains large data classes. Good luck scrolling around Gradle output for the failure message. OTOH it could be symptom of a bad test 🤔
Another #kotest #rant is that most of its matchers don’t show diff window in IntelliJ with JUnit5 runner. It tries but most matchers throw AssertionError (no diff) and some AssertionFailedError (has diff) 🤷‍♂️😒 Makes you wonder if kotest authors actually use it via IntelliJ.
Kotest has eventually() function which retries lambda until it succeeds or times out. Not the best idea to use it across all tests in the first place, but in addition kotest prints stack trace from the first and the last failure, so you end up scrolling down 🤦‍ #kotest #rant

Are you ready for #Hacktoberfest!?

I've prepared my #JetBrains #Ktor #ArrowKt
example with #SqlDelight
#testcontainers and #kotest in #Kotlin with 19 issues for hacktoberfest!

I'll be giving personal guidance to everyone wanting to learn, and contribute.

https://github.com/nomisRev/ktor-arrow-example

GitHub - nomisRev/ktor-arrow-example: Real World implementation - "The mother of all demo apps". Written in Kotlin, with Ktor, Arrow, SqlDelight, KotlinX Serialization, etc.

Real World implementation - "The mother of all demo apps". Written in Kotlin, with Ktor, Arrow, SqlDelight, KotlinX Serialization, etc. - GitHub - nomisRev/ktor-arrow-example: Real World ...

GitHub