jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig <mdue...@apache.org>
Subject Re: [trivia] unit test class length
Date Fri, 04 Apr 2014 12:48:20 GMT

Hi Davide,

I wouldn't split just because you reached 3k (or any number of lines of 
code). Since a unit test is just a collection of tests there is (should 
be) no further dependency between the various tests beyond belonging to 
the same unit under test. Thus the number of lines it not a good measure 
for code complexity in this case. I'd even find in more confusing if I'd 
have to look through various classes because the tests have been 
arbitrarily split up.

OTHO the size of the test class might be an indicator that the class 
under test has to many responsibilities and should be split up by itself.

Michael


On 4.4.14 2:37 , Davide Giannella wrote:
> Good afternoon everyone,
>
> normally I tend to group all the unit testing per class of coverage. For
> example all the unit tests related to a class named FooBar will be in a
> class named FooBarTest. So far so good, it gives me a quick
> understanding of what I am looking at.
>
> Now I have some test classes that reaches the heights of 3k lines. IMO
> worth the effort of splitting those in multiple classes for better
> maintenance an reading.
>
> Do we have any (in)formal rules around this topic? Do anyone think I
> should not split the tests in separate classes?
>
> Cheers
> D.
>
>

Mime
View raw message