# What is your favorite assertion library for Kotlin?

**URL:** <https://discuss.kotlinlang.org/t/what-is-your-favorite-assertion-library-for-kotlin/24006>\
**Category:** Uncategorized\
**Created:** [January 21, 2022, 9:13pm UTC](https://discuss.kotlinlang.org/t/what-is-your-favorite-assertion-library-for-kotlin/24006 "2022-01-21T21:13:10Z")\
**Posts on this page:** 4\
**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:** [January 21, 2022, 9:13pm UTC](https://discuss.kotlinlang.org/t/what-is-your-favorite-assertion-library-for-kotlin/24006/1 "2022-01-21T21:13:10Z")

</div>

4.5 years ago I [asked](https://discuss.kotlinlang.org/t/what-assertions-library-do-you-use/1809) what your favorite assertion library is. Things have changed in the meantime and such a library is an important tool for daily usage.

So, **what is your favorite assertion library** for Kotlin now? Maybe you could also share, why do you prefer the library you picked (bonus points for that answer! 😉 )

---

<div class="post-metadata">

**Author:** ![frozenice](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/frozenice/32/7436_2.png) [@frozenice](https://discuss.kotlinlang.org/u/frozenice)\
**Post date:** [January 23, 2022, 12:29pm UTC](https://discuss.kotlinlang.org/t/what-is-your-favorite-assertion-library-for-kotlin/24006/2 "2022-01-23T12:29:20Z")

</div>

I have used [strikt](https://strikt.io/) in the past, because of its nice syntax and plenty assertions.

Nowadays [kotest](https://kotest.io/) (formerly kotlintest, not te be confused with [kotlin-test](https://kotlinlang.org/api/latest/kotlin.test/)) seems to have caught up on the assertions part, so I’m giving this a try in some projects. It also has its own (optional) test runner with plenty of writing-styles and features - one thing I found, though, is that I can’t run specific tests via the IntelliJ gutter (there is an kotest IntelliJ plugin which brings back the icons, but the tests aren’t run via Gradle).

---

<div class="post-metadata">

**Author:** ![ov7a](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@ov7a](https://discuss.kotlinlang.org/u/ov7a)\
**Post date:** [January 27, 2022, 10:56am UTC](https://discuss.kotlinlang.org/t/what-is-your-favorite-assertion-library-for-kotlin/24006/3 "2022-01-27T10:56:08Z")

</div>

Kotest hands down. A while ago I made a comparison of assertion libs features, hope that would be useful for someone.

> **[GitHub - ov7a/kotlin-asserts-comparison](https://github.com/ov7a/kotlin-asserts-comparison)**
>
> Contribute to ov7a/kotlin-asserts-comparison development by creating an account on GitHub.

---

<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:** [January 25, 2023, 2:46pm UTC](https://discuss.kotlinlang.org/t/what-is-your-favorite-assertion-library-for-kotlin/24006/4 "2023-01-25T14:46:25Z")

</div>

Let me share some recent experiences with Strikt. While the Kotlin friendly syntax looks very nice, this library struggles with the basis. AssertJ, what is the source of inspiration for Strikt, supports a very handy method `usingRecursiveFieldByFieldElementComparatorIgnoringFields` to compare complete objects except certain fields (e.g. IDs). Strikt doesn’t seem to have such a function. `containsExcactly` to compare lists should be there, according to the documentation, but isn’t.
