[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] RFC: Move tests into same directory as the sources



On 21.01.2014 12:26, Daniel P. Berrange wrote:
> Currently we have a split with all the "source" code under various
> subdirectories of src/, while the test cases are (mostly) all under
> the tests/ directory. I think there could be some benefits to moving
> the test files to be alongside the source files being tested.
> eg instead of tests/virhashtest.c  have src/util/virhashtest.c
> 
> The tests/ directory is getting reasonably large, and is likely to
> grow even more as we push for greater unit tests. We could split it
> up into various sub-directories mirroring the split of dirs under
> src/, but it seems easier to put have them directory under src/ and
> remove the arbitrary split of source and tests.
> 
> Having the test files alongside the source files makes it obvious
> to anyone looking in a directory that tests exist for a file. This
> might encourage people to think about adding tests when changing
> a source file. It also makes it more slightly obvious which files
> lack proper tests.

I don't think that people don't write tests because they forget. In
fact, I think it's this laziness and resistance that each developer has
in him/her. Having said that, I'm not against structure you're proposing
but I'd be cautious with promising ourselves that it will bring more
tests. I think it was us, requiring tests in patch reviews which
extended our test suite the most. Looking at other projects, it's 50-50:
some has tests/ separated some don't.

Michal


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]