Chapter 18Unit Testing and Mocking
Unit testing is essential for metaprogramming. However weak the checks performed by a compiler might be in a statically typed language, we don’t have even that level of support in a dynamic language. That’s why unit testing is necessary in dynamic languages. (See Test Driven Development: By Example [Bec02], Pragmatic Unit Testing in Java with JUnit [TH03], and JUnit Recipes: Practical Methods for Programmer Testing [Rai04].) Although we can easily take advantage of dynamic capabilities and metaprogramming in these languages, we have to take the time to make sure our program is doing what we expect and not just what we typed.
There has been greater awareness of unit testing among developers in the past few ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access