Search⌘ K
AI Features

What Makes CRC Code Testable?

Explore how to make CRC code testable by writing unit tests for isolated functions and integration tests for LiveView components. Understand testing strategies that balance simplicity, maintainability, and coverage to ensure reliable real-time web applications.

Why testing is important

Think of a test as a scientific experiment. The experiment’s target is a bit of code, and the thesis is that the code is working. Logically, each test is an experiment that does three things:

  • Sets up preconditions
  • Provides a stimulus
  • Compares an actual response to expectations

That definition is pretty broad and covers a wide range of testing strategies and frameworks. We’re going to write three tests of two specific types. Both types of tests will follow this broad pattern. One of the tests will be a unit test. We’ll ...