Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Unit Testing (Part 1)

Unit testing is a critical part of software development, and we will expect you to write good unit tests in all of your assessments for this module.

In this section, we will position unit testing in the context of all testing approaches, then consider some of the key concepts involved in writing unit tests. After that, we will introduce you to a unit testing framework for Kotlin, Kotest.

After completing this section, you will understand the basic principles of unit testing and you will be able to write simple unit tests for functions using Kotest. Testing of classes, and the use of test fixtures and rich assertions, will be covered in Part 2.