Home

Unit Tests

A test suite:

  • give the ability to ensure that changes to the code base work as expected
  • give the ability to ensure that changes to one part of the system does not break the other part of the system
  • Removes the fear of making changes.
  1. Keep your test code clean.

It is unit tests that keep our code flexible, maintainable, and reusable.

What makes a clean test? Three things. Readability, readability, and readability. Readability is perhaps even more important in unit tests than it is in production code. What makes tests readable? The same thing that makes all code readable: clarity, simplicity, and density of expression. In a test you want to say a lot with as few expressions as possible.

When writing unit test, design them to be read.
Abstract the details that will need to be understood before the test makes any sense.

Naming convention

RSpec: given-when-then convention

Date:

Screen Dimensions