Let’s say you don’t use coverage tools, and you’re looking at a function that you want to change and you wonder if it’s tested.
No problem—just change something random in the function.
Change a less-than to a greater-than, an &&
to an ||
, or slightly alter an arithmetic expression. Change something small that keeps the code syntactically correct, but slightly wrong otherwise. Now, run your tests.
If tests fail, undo that change and try something different.
If the tests pass, you know this line is untested. Add a failing tests to force you to undo your change.
Keep perturbing lines until you feel comfortable that you’ve covered enough of the function to make it less risky to change.