Testing Clojure With Expectations
Blog post from Semaphore
Clojure's built-in testing library, clojure.test, is complemented by several alternatives, including Expectations by Jay Fields, which is promoted as a minimalist unit testing framework with the slogan "adding signal, removing noise." Expectations simplifies setup by integrating with tools like Emacs and IntelliJ and requires only a few configurations in project.clj. It enhances testing by offering a concise syntax and producing more informative, visually appealing output with features like default color coding and precise failure descriptions. The framework excels in testing collections, focusing on both equality and content, and aggressively minimizes noise by trimming unnecessary stack trace details. Additionally, Expectations provides advanced capabilities for testing side effects and controlling test execution time, making it a powerful tool for developers seeking more efficient and effective testing practices.