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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.