[Baypiggies] How to determine what unit tests cover a code change?
c1 at caseyc.net
Thu Feb 3 05:00:13 CET 2011
I don't know of an existing tool, but I bet you can pretty simply
approximate what you want with the 'parser' python library.
Specifically, you can detect all 'import' statements and create a
dependency digraph without a lot of effort. The granularity of this
isn't perfect (it overshoots) but it will probably help a lot given the
time it takes your tests to run.
If you keep it at that level of granularity,
On 2/2/11 11:18 AM, Lincoln Peters wrote:
> I work on a project with thousands of unit tests, implemented using
> the built-in "unittest" module, and it takes about five hours to run
> the full suite. If I know which source files changed since I last ran
> the unit tests, does anyone know of a good way to determine which unit
> tests cover those source files and only run those?
> The individual test cases are spread across about 150 subclasses of
> TestCase, some of which define dozens of test methods, and for the
> most part each class is in its own module (there are a few cases where
> two subclasses of TestCase are in the same module, e.g. if one derives
> from the other and changes something about how the tests run). My
> best idea thus far is to use the "inspect" module to look at what each
> test module imports and figure out if a changed file gets imported at
> any point. But I wouldn't be at all surprised if there's an existing
> tool that does that, or if there's a better way that I haven't thought
More information about the Baypiggies