Simple play icon Course
Skills

Kotlin Unit Testing with JUnit

by Kevin Jones

This course will teach you how to use JUnit 5 to write unit tests for your Kotlin code.

What you'll learn

Junit 5 is the de-facto standard testing framework on the JVM. It is used to test application code in many areas including enterprise, desktop and mobile applications.

This class will show how to setup Junit to test Kotlin code, including the some of the issues you will encounter that are unique to Kotlin.

The class will also extend some of the features of Junit, for example by using an assertions library to extend the range and flexibility of the assertions that are available. Finally we will look at ‘mocking’, something that JUnit does not provide itself, for this we will use the MockK, a mocking framework written in and for Kotlin.

About the author

A long time ago in a university far, far away Kevin fell in love with programming. Initially on the university's DEC20 computer doing BASIC and Pascal and a little bit of Fortran. His first job had him writing batch PL/1 on an IBM mainframe where he also discovered the arcane delights of JCL. He soon realized the multiuser systems were not for him after discovering the delights of dBase IV on IBM PCs. From here it was all downhill as he became addicted to C and the Windows API. Just missing out ... more

Ready to upskill? Get started