The More Detailed Five: SWIFT Tests
I like to use five criteria to evaluate test quality. I’ve even managed to turn them into an acronym that is only slightly contrived: SWIFT.
Let’s explore those in more detail.
A test is straightforward if its purpose is immediately understandable.
Straightforwardness in testing goes beyond just having clear code. A straightforward test is also clear about how it fits into the larger test suite. Every test should have a point: it should test something different from the other tests, and that purpose should be easy to discern from reading the test.
Here is a test that is not straightforward:
## Don't do this
it "should add to 37" ...