3 ms·
You can safely do this as long as your tests are fully deterministic. If they use inputs which change over time, like a system clock, or a database, or share m
by codex 16y ago
You can safely do this as long as your tests are fully deterministic. If they use inputs which change over time, like a system clock, or a database, or share mutable state between threads, then you can't be sure that the code coverage does not change from run to run.
There's more to it than simply checking each line with a coverage tool--you also need to rerun tests when any implicitly referenced global data, strings, input files, command line parameters, etc. change, including calls to third party libraries for which the source is not available. Usually a build system and compiler can track some of these dependencies already, so you may be able to leverage those.
As long as you occasionally run the full test suite, though, you may not care to cover these cases for your incremental tests.