Cost and Value
Learn about the cost and value of tests, shoulda gem, end-to-end system test, tests goals, and steps to make less costly and valuable tests.
We'll cover the following...
Tests have costs, and tests have value. The goal of testing is to minimize the cost and maximize its value.
Test cost
The cost of a test includes the following:
- The time it takes to write the test
- The time it takes to run the test every time the suite runs
- The time it takes to understand the test
- The time it takes to fix the test if it breaks and the root code is okay
- The time it takes to change the code to make it testable.
The currency we’re using here is time. Tests cost time. Eventually, every programming decision costs time. When people talk about code quality and the difficulty or ease of changes, they’re talking about the amount of time it takes to change the code.
Here are a few ways writing a test can save time:
-
The act of writing the test makes it easier ...