Testing your code

In the earlier section, we learned how to write test cases, but did we test our code? No. We did the tests with some oblivious values. And we know that is not the purpose of tests. Tests are there to make sure that our functions, classes, and code blocks are working as expected.

We should write the tests on top of our existing code (unless we are following Test-driven development (TDD)).

Test-driven development is a development methodology where tests are written first, and then the actual source code is written that would pass the test cases. Test-driven development is hugely popular among developers and architects and many companies follow TDD as their development process.

The following is a small Kotlin file that contains ...

Get Reactive Programming in Kotlin now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.