Finding Missing Test Coverage in Rails
Here’s a little testing trick I use while working in Rails. When I’m trying to find areas of code that are missing test coverage, I like to individually run the different types of tests, then check the coverage for that type. So instead of simply running
rspec, I’ll first run each of the following:
I find that if I mix feature tests with any of the other test types, that many lines of code are incidentally run that I don’t have adequate coverage for. By running the different tests in isolation, it’s much easier to identify gaps in real coverage.