Test Clojure functions with clojure.test and the REPL

10 steps · about 4 h 45 min · Beginner

  1. Clojure - Documentary (doc, clojure.org, 5 min)

    This page gives the official one-paragraph idea of the REPL and the setup pointers you need, such as Calva for VS Code, before you write any code.

  2. Clojure Tutorial (tutorial, Eric Normand, 1 h)

    You install an editor, jack in to a REPL and build a small game, so you practise sending forms to the REPL before you touch tests.

  3. Chicago Clojure - 2017-06-21 - Stuart Halloway on Repl Driven Development (video, Stuart Halloway / Chicago Clojure (Vimeo), 1 h 30 min)

    Halloway explains why small steps and fast feedback are the core of REPL work, and how to turn REPL experiments into example tests.

  4. talk-transcripts/Halloway_Stuart/REPLDrivenDevelopment.md (article, matthiasn/talk-transcripts (GitHub), 25 min)

    The transcript lets you skim the talk again and copy the techniques you want to try.

  5. Clojure Impressions Round Three (blog, Kari Marttila, 10 min)

    A learner's account of the scratch-file habit: keep your experiments in a file and send forms to the REPL, so your work is saved.

  6. Clojure Unit Testing: Easy Beginner's Guide (guide, Toni Väisänen, 25 min)

    Now you write real tests with is, deftest and testing, and see why Clojure tests are usually run from the REPL rather than in a watch loop.

  7. clojure.test - Clojure v1.12.4 API documentation (reference, clojure.github.io, 20 min)

    The official reference covers nested testing contexts, with-test and use-fixtures :each and :once, so you can write cleaner tests.

  8. deftest - clojure.test (reference, ClojureDocs, 5 min)

    A focused entry on how deftest defines tests, how tests compose and what test-ns-hook does, to avoid confusion when tests call each other.

  9. Clojure Unit Testing - Practicalli Clojure (guide, Practicalli, 20 min)

    Shows how to run tests in an editor-connected REPL with run-tests, and how command-line runners such as Kaocha give a clean state, which suits CI.

  10. Clojure REPL Driven Development - Promesante (tutorial, Promesante, 25 min)

    A worked example of writing, loading and running tests for a real piece of code from the editor, which ties the REPL and testing together.