Parameterized tests with Kotest
Creating parameterized tests in Kotlin: data driven testing, collection inspections and generating test cases with FreeSpec.
Handling exceptions in tests: Junit & Kotest
Exceptions and throwables are essential part of many Java APIs. They are useful for modeling application domain layer and controlling program execution flow. We’ll be working on following piece of code: Annotated Junit4 method Not perfect – the whole test method listens for `CustomException` to be thrown anywhere in method – and with junit4 tools […]
Test execution basics: passed, failed, crashed
When the test passes, when it fails and why it crashes? In this short note we will try to find the answers for those questions.
Assert softly – when one assertion is not enough
It’s usually in our best interest to keep one assertion per test method. Yet, situation when more than one check in single test method is present may occur. Why this may be a problem?Generally, JVM testing frameworks, such as Junit makes use of AssertionExceptions. If such exception is thrown during test block execution, test stops and […]
Parametrized tests with Spek
Using Spek to generate test cases
Building Unit Tests for ViewModel in TDD style
In this example we will try to implement VenueDetailsViewModel in TDD style. TDD (Test Driven Development) is development technique, where developer relies on unit tests created before actual implementation.
Testing with Kotlin – Mobilization 2018 conference talk
KotlinUnitTesting – repository with examples
This repository contains examples of basic unit tests written in Kotlin. In specific directories you can find gradle buildscript with needed dependencies and configuration, simple unit test and parameterized test.