This workshop teaches how to test backend applications using modern testing frameworks like Kotest and MockK (alternatively, JUnit and Mockito). It shows how to use Kotlin functionalities to improve readability and design our code for proper testing.

On the workshop you will

Learn from lecture supported by slides

Solve coding challenges

Complete practical exercises

During the workshop we cover:

Day 1:

  • Basics of Kotest
  • Different testing styles
  • Setup in Gradle and Mavenie
  • Infix operators in Kotlin
  • Basic assertions in Kotest (numbers, texts, nullability, collections, ...)
  • Configuration
  • Tests isolation a) single test b) interface c) global object
  • Advanced assertions - shouldThrow, shouldBeInstanceOf, shouldBeAfter/Before, ...
  • Data-driven tests
  • Mocking in MockK
  • Mocking classes, relaxed mock, return values, functions
  • Mocking by annotations
  • Partial arguments matching - any()
  • Call verification
  • Object mocking
  • Spy
  • answer
  • Arguments capturing and validation

Day 2:

  • Kotest + MockK + Spring Boot
  • Best practices for Spring Boot testing
  • Test setup, autowiring
  • SpringMockk
  • ContextConfiguration
  • Beans overriding
  • Testing in-memory database
  • Testing real database - Spring profiles
  • Before / after test
  • Testing web layer
  • Mocking HTTP server
  • Testing async code
  • Testing Futures
  • Introduction to Coroutines
  • Testing suspending functions
  • Testing Channel and Flow functions
  • Other testing frameworks
  • JUnit
  • SpeK
  • Comparing Kotest, SpeK and JUnit

How long does it take?

The workshop lasts 2 days.

Requirements

  • At least basic Kotlin understanding.

Professional training materials

All attendees of the workshop will receive a printed book plus a code to download the Effective Kotlin ebook for free.

Kt. Academy materials

Register

Choose this option if you need a workshop for your team or company. The basic price is 3000 EUR for the group for 2 days.

Private workshop

Choose this option if you need a workshop for yourself or for a small group of people. The basic price is 280 EUR per person for the whole workshop.

Open online workshop

Our experts offer consultations for both companies and individuals. The price is set individually.

Contact us